@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.
- package/.turbo/turbo-build.log +16 -16
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs +39 -159
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -9
- package/dist/index.d.ts +0 -9
- package/dist/index.js +66 -191
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +23 -60
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +4 -16
- package/dist/shared/index.d.ts +4 -16
- package/dist/shared/index.js +35 -72
- package/dist/shared/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/asset-card.ts +2 -22
- package/src/components/contract-card.ts +2 -67
- package/src/components/info-panel.ts +1 -21
- package/src/components/transaction-playback.ts +4 -4
- package/src/index.ts +1 -1
- package/src/shared/address-display.ts +3 -6
- package/src/shared/address-view.ts +2 -18
- package/src/shared/custom-select.ts +1 -1
- package/src/shared/function-name-view.ts +1 -1
- package/src/shared/gas-provider-view.ts +4 -7
- package/src/shared/icon-view.ts +7 -9
- package/src/shared/image-list.ts +3 -3
- package/src/shared/load-web-components.ts +3 -2
- package/src/shared/notification-view.ts +1 -1
- package/src/shared/progress-view.ts +1 -10
- package/src/shared/scroll-to-bottom-button.ts +1 -1
- package/src/shared/signal-controller.ts +3 -1
- package/src/shared/transaction-view-controller.ts +1 -1
- package/src/shared/url-view.ts +3 -3
- package/src/shared/value-view.ts +6 -12
- package/src/styles/styles.css +1 -1
- package/src/vue-entry.ts +0 -1
- package/tsup.config.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukso/transaction-view-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-dev.5ea12c5",
|
|
4
4
|
"description": "Core components and hooks for LUKSO transaction display",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@preact/signals-core": "^1.12.1",
|
|
36
36
|
"ethereum-blockies-base64": "^1.0.2",
|
|
37
37
|
"lit": "^3.3.1",
|
|
38
|
-
"@lukso/transaction-decoder": "1.
|
|
39
|
-
"@lukso/transaction-view-headless": "0.
|
|
38
|
+
"@lukso/transaction-decoder": "1.3.0-dev.5ea12c5",
|
|
39
|
+
"@lukso/transaction-view-headless": "0.4.0-dev.5ea12c5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@tailwindcss/typography": "^0.5.19",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"build": "tsup",
|
|
53
53
|
"dev": "tsup --watch",
|
|
54
54
|
"dev-alt": "tsup --watch",
|
|
55
|
-
"clean": "rm -rf dist"
|
|
55
|
+
"clean": "rm -rf dist",
|
|
56
|
+
"typecheck": "tsc --noEmit"
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -11,7 +11,7 @@ import '../shared/image-list.js'
|
|
|
11
11
|
import '@lukso/web-components'
|
|
12
12
|
import { Task } from '@lit/task'
|
|
13
13
|
import {
|
|
14
|
-
ResolvedAddress,
|
|
14
|
+
type ResolvedAddress,
|
|
15
15
|
useAddressResolver,
|
|
16
16
|
} from '@lukso/transaction-view-headless'
|
|
17
17
|
import { safeCustomElement } from '../shared/safe-custom-element.js'
|
|
@@ -73,13 +73,6 @@ export class AssetCard extends CoreLitElement {
|
|
|
73
73
|
@state()
|
|
74
74
|
private _resolvedData?: ResolvedAddress
|
|
75
75
|
|
|
76
|
-
@state()
|
|
77
|
-
private _imageError = false
|
|
78
|
-
|
|
79
|
-
private _handleImageError() {
|
|
80
|
-
this._imageError = true
|
|
81
|
-
}
|
|
82
|
-
|
|
83
76
|
private _handleInfoClick() {
|
|
84
77
|
this.displayDetails = !this.displayDetails
|
|
85
78
|
}
|
|
@@ -103,19 +96,6 @@ export class AssetCard extends CoreLitElement {
|
|
|
103
96
|
return addressOrComposite.split('-')[0]
|
|
104
97
|
}
|
|
105
98
|
|
|
106
|
-
private _extractTokenId(addressOrComposite: string): string | undefined {
|
|
107
|
-
const parts = addressOrComposite.split('-')
|
|
108
|
-
return parts.length > 1 ? parts[1] : undefined
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
private _copyToClipboard(text: string) {
|
|
112
|
-
if (navigator.clipboard) {
|
|
113
|
-
navigator.clipboard.writeText(text)
|
|
114
|
-
// Could dispatch a 'copied' event here for toast notifications
|
|
115
|
-
this.dispatchEvent(new CustomEvent('copied', { detail: { text } }))
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
99
|
private _renderAddressSection() {
|
|
120
100
|
const data = this._resolutionTask.value
|
|
121
101
|
if (!data) return ''
|
|
@@ -392,7 +372,7 @@ export class AssetCard extends CoreLitElement {
|
|
|
392
372
|
${when(
|
|
393
373
|
this.amount,
|
|
394
374
|
() => html`
|
|
395
|
-
<span class="">${formatUnits(BigInt(this.amount
|
|
375
|
+
<span class="">${formatUnits(BigInt(this.amount || 0), this._resolvedData?.decimals)}</span>
|
|
396
376
|
<span class="ml-1 text-neutral-60 max-w-[60px] whitespace-nowrap overflow-hidden text-ellipsis text-[14px] font-semibold">${
|
|
397
377
|
this._resolvedData?.lsp4TokenSymbol || ''
|
|
398
378
|
}</span>
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type ResolvedAddress,
|
|
4
|
-
useAddressResolver,
|
|
5
|
-
useImageLoader,
|
|
6
|
-
} from '@lukso/transaction-view-headless'
|
|
7
|
-
import { css, html, LitElement, nothing } from 'lit'
|
|
1
|
+
import type { ResolvedAddress } from '@lukso/transaction-view-headless'
|
|
2
|
+
import { css, html, LitElement } from 'lit'
|
|
8
3
|
import { property, state } from 'lit/decorators.js'
|
|
9
4
|
import { safeCustomElement } from '../shared/safe-custom-element'
|
|
10
5
|
import '../shared/load-web-components'
|
|
@@ -115,66 +110,6 @@ export class ContractCard extends LitElement {
|
|
|
115
110
|
@state() private _profileImageUrl?: string
|
|
116
111
|
@state() private _backgroundImageUrl?: string
|
|
117
112
|
|
|
118
|
-
private _resolutionTask = new Task(this, {
|
|
119
|
-
task: async ([address, resolved]) => {
|
|
120
|
-
if (resolved) {
|
|
121
|
-
this._resolvedData = resolved
|
|
122
|
-
return resolved
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const { resolveAddress } = useAddressResolver()
|
|
126
|
-
const baseAddress = this._extractBaseAddress(address as string)
|
|
127
|
-
const data = await resolveAddress(baseAddress)
|
|
128
|
-
this._resolvedData = data
|
|
129
|
-
return data
|
|
130
|
-
},
|
|
131
|
-
args: () => [this.address, this.resolved] as const,
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
private _profileImageTask = new Task(this, {
|
|
135
|
-
task: async ([resolved]) => {
|
|
136
|
-
const { loadProfileImage } = useImageLoader()
|
|
137
|
-
const data = resolved || this._resolvedData
|
|
138
|
-
|
|
139
|
-
if (!data) return null
|
|
140
|
-
|
|
141
|
-
const image = await loadProfileImage(data, {
|
|
142
|
-
width: 256,
|
|
143
|
-
height: 256,
|
|
144
|
-
dpr: window.devicePixelRatio || 1,
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
if (image?.src) {
|
|
148
|
-
this._profileImageUrl = image.src
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return image
|
|
152
|
-
},
|
|
153
|
-
args: () => [this._resolvedData] as const,
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
private _backgroundImageTask = new Task(this, {
|
|
157
|
-
task: async ([resolved]) => {
|
|
158
|
-
const { loadBackgroundImage } = useImageLoader()
|
|
159
|
-
const data = resolved || this._resolvedData
|
|
160
|
-
|
|
161
|
-
if (!data) return null
|
|
162
|
-
|
|
163
|
-
const image = await loadBackgroundImage(data, {
|
|
164
|
-
width: 800,
|
|
165
|
-
height: 200,
|
|
166
|
-
dpr: window.devicePixelRatio || 1,
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
if (image?.src) {
|
|
170
|
-
this._backgroundImageUrl = image.src
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return image
|
|
174
|
-
},
|
|
175
|
-
args: () => [this._resolvedData] as const,
|
|
176
|
-
})
|
|
177
|
-
|
|
178
113
|
private _extractBaseAddress(addressOrComposite: string): string {
|
|
179
114
|
return addressOrComposite.split('-')[0]
|
|
180
115
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type ResolvedAddress,
|
|
4
|
-
useAddressResolver,
|
|
5
|
-
} from '@lukso/transaction-view-headless'
|
|
1
|
+
import type { ResolvedAddress } from '@lukso/transaction-view-headless'
|
|
6
2
|
import { css, html, LitElement } from 'lit'
|
|
7
3
|
import { property, state } from 'lit/decorators.js'
|
|
8
4
|
import { classMap } from 'lit/directives/class-map.js'
|
|
@@ -34,25 +30,9 @@ export class InfoPanel extends LitElement {
|
|
|
34
30
|
@property({ type: String })
|
|
35
31
|
type: 'transfer' | 'mint' | 'burn' | 'approve' = 'transfer'
|
|
36
32
|
|
|
37
|
-
@state()
|
|
38
|
-
private _isAnimating = false
|
|
39
|
-
|
|
40
33
|
@state()
|
|
41
34
|
private _resolvedData?: ResolvedAddress
|
|
42
35
|
|
|
43
|
-
private _resolutionTask = new Task(this, {
|
|
44
|
-
task: async ([address]) => {
|
|
45
|
-
if (!address) return null
|
|
46
|
-
|
|
47
|
-
const { resolveAddress } = useAddressResolver()
|
|
48
|
-
// Resolve the full address (including tokenId if present) to get token-specific data
|
|
49
|
-
const data = await resolveAddress(address as string)
|
|
50
|
-
this._resolvedData = data
|
|
51
|
-
return data
|
|
52
|
-
},
|
|
53
|
-
args: () => [this.address] as const,
|
|
54
|
-
})
|
|
55
|
-
|
|
56
36
|
private _extractBaseAddress(addressOrComposite: string): string {
|
|
57
37
|
return addressOrComposite.split('-')[0]
|
|
58
38
|
}
|
|
@@ -231,7 +231,7 @@ export class TransactionPlayback extends LitElement {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
protected updated(
|
|
234
|
+
protected updated(_changedProperties: PropertyValues): void {
|
|
235
235
|
// Mount component after render
|
|
236
236
|
if (this.loadedComponent && this.componentContainerRef.value) {
|
|
237
237
|
// Clear existing content
|
|
@@ -364,14 +364,14 @@ export class TransactionPlayback extends LitElement {
|
|
|
364
364
|
() => html`
|
|
365
365
|
<div class="debug-item">
|
|
366
366
|
<span class="debug-label">Child Index:</span>
|
|
367
|
-
<span class="debug-value">${this.currentResult
|
|
367
|
+
<span class="debug-value">${this.currentResult?.indexInfo.childIndex}</span>
|
|
368
368
|
</div>
|
|
369
369
|
`
|
|
370
370
|
)}
|
|
371
371
|
<div class="debug-item">
|
|
372
372
|
<span class="debug-label">Available Indices:</span>
|
|
373
373
|
<span class="debug-value">
|
|
374
|
-
[${this.playbackState
|
|
374
|
+
[${this.playbackState?.batchInfo.availableIndices.join(', ')}]
|
|
375
375
|
</span>
|
|
376
376
|
</div>
|
|
377
377
|
${when(
|
|
@@ -379,7 +379,7 @@ export class TransactionPlayback extends LitElement {
|
|
|
379
379
|
() => html`
|
|
380
380
|
<div class="debug-item">
|
|
381
381
|
<span class="debug-label">Matched View:</span>
|
|
382
|
-
<span class="debug-value">${this.currentResult
|
|
382
|
+
<span class="debug-value">${this.currentResult?.match?.view.id}</span>
|
|
383
383
|
</div>
|
|
384
384
|
`
|
|
385
385
|
)}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useImageLoader,
|
|
5
5
|
} from '@lukso/transaction-view-headless'
|
|
6
6
|
import { css, html, LitElement } from 'lit'
|
|
7
|
-
import {
|
|
7
|
+
import { property } from 'lit/decorators.js'
|
|
8
8
|
import { safeCustomElement } from './safe-custom-element'
|
|
9
9
|
|
|
10
10
|
// LUKSO web components are loaded dynamically via plugin
|
|
@@ -96,17 +96,14 @@ export class AddressDisplay extends LitElement {
|
|
|
96
96
|
return this.value || this.address || ''
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// Internal state
|
|
100
|
-
@state() private imageData?: { src: string }
|
|
101
|
-
@state() private isLoadingImage = false
|
|
102
|
-
|
|
103
99
|
// Composables
|
|
104
100
|
private imageLoader = useImageLoader()
|
|
105
101
|
private addressResolver = useAddressResolver()
|
|
102
|
+
isLoadingImage = false
|
|
106
103
|
|
|
107
104
|
// Task for loading profile image
|
|
108
105
|
private imageTask = new Task(this, {
|
|
109
|
-
task: async ([resolved]
|
|
106
|
+
task: async ([resolved]) => {
|
|
110
107
|
if (!resolved) return null
|
|
111
108
|
|
|
112
109
|
this.isLoadingImage = true
|
|
@@ -90,7 +90,7 @@ export class AddressView extends CoreLitElement {
|
|
|
90
90
|
|
|
91
91
|
// Task for resolving address data
|
|
92
92
|
private addressTask = new Task(this, {
|
|
93
|
-
task: async ([address]
|
|
93
|
+
task: async ([address]) => {
|
|
94
94
|
if (!address) return null
|
|
95
95
|
|
|
96
96
|
this.isLoadingAddress = true
|
|
@@ -99,7 +99,7 @@ export class AddressView extends CoreLitElement {
|
|
|
99
99
|
const resolved = await this.addressResolver.resolveAddress(address)
|
|
100
100
|
this.requestUpdate() // Force re-render after resolution
|
|
101
101
|
return resolved
|
|
102
|
-
} catch (
|
|
102
|
+
} catch (_error) {
|
|
103
103
|
return null
|
|
104
104
|
} finally {
|
|
105
105
|
this.isLoadingAddress = false
|
|
@@ -129,22 +129,6 @@ export class AddressView extends CoreLitElement {
|
|
|
129
129
|
return this.label || computedName || 'Anonymous'
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
* Check if this is a contract address (non-profile)
|
|
134
|
-
*/
|
|
135
|
-
private get isContract(): boolean {
|
|
136
|
-
const resolved = this.addressTask.value
|
|
137
|
-
return resolved ? resolved.__gqltype !== 'Profile' : false
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Check if this should show the address hash (profiles show hash, contracts don't)
|
|
142
|
-
*/
|
|
143
|
-
private get shouldShowAddressHash(): boolean {
|
|
144
|
-
const resolved = this.addressTask.value
|
|
145
|
-
return resolved ? resolved.__gqltype === 'Profile' : true // Default to true for fallback
|
|
146
|
-
}
|
|
147
|
-
|
|
148
132
|
/**
|
|
149
133
|
* Get prefix for the address display
|
|
150
134
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import {
|
|
2
|
+
import { property } from 'lit/decorators.js'
|
|
3
3
|
import { safeCustomElement } from './safe-custom-element'
|
|
4
4
|
import './load-web-components'
|
|
5
5
|
import makeBlockie from 'ethereum-blockies-base64'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import {
|
|
2
|
+
import { property } from 'lit/decorators.js'
|
|
3
3
|
import { safeCustomElement } from './safe-custom-element'
|
|
4
4
|
import './load-web-components'
|
|
5
5
|
import { CoreLitElement } from '../styles'
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { Task } from '@lit/task'
|
|
2
|
-
import { useAddressResolver } from '@lukso/transaction-view-headless'
|
|
3
|
-
import makeBlockie from 'ethereum-blockies-base64'
|
|
4
1
|
import { html } from 'lit'
|
|
5
|
-
import {
|
|
2
|
+
import { property } from 'lit/decorators.js'
|
|
6
3
|
import { safeCustomElement } from './safe-custom-element'
|
|
7
4
|
import './load-web-components'
|
|
8
5
|
import { CoreLitElement } from '../styles'
|
|
@@ -148,7 +145,7 @@ export class GasProviderView extends CoreLitElement {
|
|
|
148
145
|
|
|
149
146
|
private displayRelayerResetDate() {
|
|
150
147
|
const date = new Date(this.relayerResetDate)
|
|
151
|
-
return isNaN(date.getTime()) ? 'N/A' : date.toLocaleDateString()
|
|
148
|
+
return Number.isNaN(date.getTime()) ? 'N/A' : date.toLocaleDateString()
|
|
152
149
|
}
|
|
153
150
|
|
|
154
151
|
override render() {
|
|
@@ -178,12 +175,12 @@ export class GasProviderView extends CoreLitElement {
|
|
|
178
175
|
? this.controllerAddress
|
|
179
176
|
: (() => {
|
|
180
177
|
const r = this.allRelayers.find(
|
|
181
|
-
(x) => x.id === this.selectedGasProvider
|
|
178
|
+
(x) => x.id === this.selectedGasProvider?.id
|
|
182
179
|
)
|
|
183
180
|
return (
|
|
184
181
|
r?.website ||
|
|
185
182
|
r?.apiUrl ||
|
|
186
|
-
`relayer:${this.selectedGasProvider
|
|
183
|
+
`relayer:${this.selectedGasProvider?.id}`
|
|
187
184
|
)
|
|
188
185
|
})()
|
|
189
186
|
: undefined
|
package/src/shared/icon-view.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Task } from '@lit/task'
|
|
2
2
|
import {
|
|
3
|
+
type ImageResult,
|
|
3
4
|
useAddressResolver,
|
|
4
5
|
useImageLoader,
|
|
5
6
|
} from '@lukso/transaction-view-headless'
|
|
6
7
|
import { html } from 'lit'
|
|
7
|
-
import {
|
|
8
|
+
import { property } from 'lit/decorators.js'
|
|
8
9
|
import { CoreLitElement } from '../styles'
|
|
9
10
|
import { safeCustomElement } from './safe-custom-element'
|
|
10
11
|
|
|
@@ -115,18 +116,15 @@ export class IconView extends CoreLitElement {
|
|
|
115
116
|
*/
|
|
116
117
|
@property({ type: Number, attribute: 'image-index' }) imageIndex?: number
|
|
117
118
|
|
|
118
|
-
// Internal state
|
|
119
|
-
@state() private imageData?: { src: string }
|
|
120
|
-
@state() private isLoadingImage = false
|
|
121
|
-
@state() private isLoadingAddress = false
|
|
122
|
-
|
|
123
119
|
// Composables
|
|
124
120
|
private imageLoader = useImageLoader()
|
|
125
121
|
private addressResolver = useAddressResolver()
|
|
122
|
+
isLoadingAddress = false
|
|
123
|
+
isLoadingImage = false
|
|
126
124
|
|
|
127
125
|
// Task for resolving address data
|
|
128
126
|
private addressTask = new Task(this, {
|
|
129
|
-
task: async ([address]
|
|
127
|
+
task: async ([address]) => {
|
|
130
128
|
if (!address) return null
|
|
131
129
|
|
|
132
130
|
this.isLoadingAddress = true
|
|
@@ -147,12 +145,12 @@ export class IconView extends CoreLitElement {
|
|
|
147
145
|
|
|
148
146
|
// Task for loading profile image
|
|
149
147
|
private imageTask = new Task(this, {
|
|
150
|
-
task: async ([resolved]
|
|
148
|
+
task: async ([resolved]) => {
|
|
151
149
|
if (!resolved) return null
|
|
152
150
|
|
|
153
151
|
this.isLoadingImage = true
|
|
154
152
|
try {
|
|
155
|
-
let image
|
|
153
|
+
let image: ImageResult | null = null
|
|
156
154
|
|
|
157
155
|
// If imageHint is specified, load directly from that property
|
|
158
156
|
if (this.imageHint && (resolved as any)[this.imageHint]) {
|
package/src/shared/image-list.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Task } from '@lit/task'
|
|
2
2
|
import { useAddressResolver } from '@lukso/transaction-view-headless'
|
|
3
3
|
import { html } from 'lit'
|
|
4
|
-
import {
|
|
4
|
+
import { property, state } from 'lit/decorators.js'
|
|
5
5
|
import { repeat } from 'lit/directives/repeat.js'
|
|
6
6
|
import { safeCustomElement } from './safe-custom-element'
|
|
7
7
|
import './icon-view.js'
|
|
@@ -72,7 +72,7 @@ export class ImageList extends CoreLitElement {
|
|
|
72
72
|
|
|
73
73
|
// Task for resolving address data
|
|
74
74
|
private addressTask = new Task(this, {
|
|
75
|
-
task: async ([address]
|
|
75
|
+
task: async ([address]) => {
|
|
76
76
|
if (!address) return null
|
|
77
77
|
|
|
78
78
|
this.isLoading = true
|
|
@@ -140,7 +140,7 @@ export class ImageList extends CoreLitElement {
|
|
|
140
140
|
* Render a single image item
|
|
141
141
|
*/
|
|
142
142
|
private renderImageItem(item: any, index: number) {
|
|
143
|
-
const
|
|
143
|
+
const _itemIndex = item.index !== undefined ? item.index : index
|
|
144
144
|
const isImage = this.isImageFile(item)
|
|
145
145
|
|
|
146
146
|
if (isImage) {
|
|
@@ -34,11 +34,12 @@ const originalDefine =
|
|
|
34
34
|
|
|
35
35
|
// Wrap customElements.define to catch duplicate registration errors
|
|
36
36
|
if (typeof customElements !== 'undefined' && originalDefine) {
|
|
37
|
-
customElements.define =
|
|
37
|
+
customElements.define = (
|
|
38
38
|
name: string,
|
|
39
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: This is the web-components api.
|
|
39
40
|
constructor: CustomElementConstructor,
|
|
40
41
|
options?: ElementDefinitionOptions
|
|
41
|
-
) {
|
|
42
|
+
) => {
|
|
42
43
|
// Check if already defined
|
|
43
44
|
if (!customElements.get(name)) {
|
|
44
45
|
originalDefine(name, constructor, options)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import {
|
|
2
|
+
import { property, state } from 'lit/decorators.js'
|
|
3
3
|
import { safeCustomElement } from './safe-custom-element'
|
|
4
4
|
import './load-web-components'
|
|
5
5
|
import { CoreLitElement } from '../styles'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import {
|
|
2
|
+
import { property } from 'lit/decorators.js'
|
|
3
3
|
import { CoreLitElement } from '../styles'
|
|
4
4
|
import { safeCustomElement } from './safe-custom-element'
|
|
5
5
|
|
|
@@ -42,15 +42,6 @@ export class ProgressView extends CoreLitElement {
|
|
|
42
42
|
`
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
private renderAddressLabel() {
|
|
46
|
-
return html`
|
|
47
|
-
<value-view
|
|
48
|
-
.value=${this.address}
|
|
49
|
-
.unit=${this.unit}
|
|
50
|
-
></value-view>
|
|
51
|
-
`
|
|
52
|
-
}
|
|
53
|
-
|
|
54
45
|
override render() {
|
|
55
46
|
const isError = (this.className || '').split(/\s+/).includes('error')
|
|
56
47
|
return html`
|
|
@@ -90,7 +90,9 @@ export class MultiSignalController implements ReactiveController {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
hostDisconnected() {
|
|
93
|
-
this.unsubscribes.forEach((unsubscribe) =>
|
|
93
|
+
this.unsubscribes.forEach((unsubscribe) => {
|
|
94
|
+
unsubscribe()
|
|
95
|
+
})
|
|
94
96
|
this.unsubscribes = []
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -255,7 +255,7 @@ export function useTransactionView(
|
|
|
255
255
|
/**
|
|
256
256
|
* Controller for working with transaction signals from the decoder
|
|
257
257
|
*/
|
|
258
|
-
export class TransactionSignalController<
|
|
258
|
+
export class TransactionSignalController<_T = any>
|
|
259
259
|
implements ReactiveController
|
|
260
260
|
{
|
|
261
261
|
private host: ReactiveControllerHost
|
package/src/shared/url-view.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit'
|
|
2
|
-
import {
|
|
2
|
+
import { property, state } from 'lit/decorators.js'
|
|
3
3
|
import { safeCustomElement } from './safe-custom-element'
|
|
4
4
|
import './load-web-components'
|
|
5
5
|
import { CoreLitElement } from '../styles'
|
|
@@ -56,7 +56,7 @@ export class UrlView extends CoreLitElement {
|
|
|
56
56
|
.replace(/-/g, ' ')
|
|
57
57
|
.replace(/\b\w/g, (c) => c.toUpperCase())
|
|
58
58
|
|
|
59
|
-
if (this.label
|
|
59
|
+
if (this.label?.trim()) {
|
|
60
60
|
this.displayName = this.label.trim()
|
|
61
61
|
} else {
|
|
62
62
|
this.displayName = hostnamePretty || this.url
|
|
@@ -64,7 +64,7 @@ export class UrlView extends CoreLitElement {
|
|
|
64
64
|
} catch {
|
|
65
65
|
this.favicon = undefined
|
|
66
66
|
// Fallback to raw string if URL parse fails
|
|
67
|
-
this.displayName = this.label
|
|
67
|
+
this.displayName = this.label?.trim() ? this.label : this.url
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
package/src/shared/value-view.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Task } from '@lit/task'
|
|
2
2
|
import { useAddressResolver } from '@lukso/transaction-view-headless'
|
|
3
|
-
import {
|
|
3
|
+
import { html } from 'lit'
|
|
4
4
|
import { property, state } from 'lit/decorators.js'
|
|
5
5
|
import { when } from 'lit/directives/when.js'
|
|
6
6
|
import { safeCustomElement } from './safe-custom-element'
|
|
@@ -111,13 +111,6 @@ export class ValueView extends CoreLitElement {
|
|
|
111
111
|
*/
|
|
112
112
|
@property() address?: string
|
|
113
113
|
|
|
114
|
-
// Internal state for resolved metadata
|
|
115
|
-
@state() private resolvedMetadata?: {
|
|
116
|
-
symbol?: string
|
|
117
|
-
decimals?: number
|
|
118
|
-
name?: string
|
|
119
|
-
}
|
|
120
|
-
|
|
121
114
|
// Tracks whether the component has any slotted content
|
|
122
115
|
@state() private _hasSlotContent = false
|
|
123
116
|
|
|
@@ -219,15 +212,16 @@ export class ValueView extends CoreLitElement {
|
|
|
219
212
|
if (value === undefined) return 'undefined'
|
|
220
213
|
|
|
221
214
|
switch (effectiveType) {
|
|
222
|
-
case 'currency':
|
|
215
|
+
case 'currency': {
|
|
223
216
|
const { numeric, symbol } = this.getCurrencyParts()
|
|
224
217
|
return `${numeric} ${symbol}`
|
|
218
|
+
}
|
|
225
219
|
|
|
226
220
|
case 'bigint':
|
|
227
221
|
if (typeof value === 'bigint') {
|
|
228
|
-
return value.toString()
|
|
222
|
+
return `${value.toString()}n`
|
|
229
223
|
}
|
|
230
|
-
return String(value)
|
|
224
|
+
return `${String(value)}n`
|
|
231
225
|
|
|
232
226
|
case 'boolean':
|
|
233
227
|
return value ? 'true' : 'false'
|
|
@@ -270,7 +264,7 @@ export class ValueView extends CoreLitElement {
|
|
|
270
264
|
try {
|
|
271
265
|
if (typeof value === 'bigint') {
|
|
272
266
|
numeric = formatUnits(value, effectiveDecimals)
|
|
273
|
-
} else if (typeof value === 'string' && !isNaN(Number(value))) {
|
|
267
|
+
} else if (typeof value === 'string' && !Number.isNaN(Number(value))) {
|
|
274
268
|
const bigintValue = BigInt(value)
|
|
275
269
|
numeric = formatUnits(bigintValue, effectiveDecimals)
|
|
276
270
|
}
|
package/src/styles/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "@lukso/web-components/
|
|
1
|
+
@import "@lukso/web-components/tools/styles/main.css";
|
package/src/vue-entry.ts
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
1
3
|
import autoprefixer from 'autoprefixer'
|
|
2
|
-
import { readFileSync } from 'fs'
|
|
3
|
-
import { dirname, resolve } from 'path'
|
|
4
4
|
import postcss from 'postcss'
|
|
5
5
|
import postcssImport from 'postcss-import'
|
|
6
6
|
import tailwindcss from 'tailwindcss'
|
|
@@ -37,7 +37,7 @@ export default defineConfig({
|
|
|
37
37
|
// Return with a special virtual path marker that the onLoad hook can recognize
|
|
38
38
|
// Use 'file' namespace to ensure esbuild calls our onLoad handler
|
|
39
39
|
return {
|
|
40
|
-
path: resolvedPath
|
|
40
|
+
path: `${resolvedPath}?__raw__`,
|
|
41
41
|
namespace: 'file',
|
|
42
42
|
}
|
|
43
43
|
})
|