@lukso/transaction-view-core 0.3.1-dev.a8c9315

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 (62) hide show
  1. package/.turbo/turbo-build.log +33 -0
  2. package/CHANGELOG.md +104 -0
  3. package/LICENSE +201 -0
  4. package/README.md +264 -0
  5. package/dist/index.cjs +4573 -0
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/index.d.cts +493 -0
  8. package/dist/index.d.ts +493 -0
  9. package/dist/index.js +4534 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/shared/index.cjs +2480 -0
  12. package/dist/shared/index.cjs.map +1 -0
  13. package/dist/shared/index.d.cts +887 -0
  14. package/dist/shared/index.d.ts +887 -0
  15. package/dist/shared/index.js +2437 -0
  16. package/dist/shared/index.js.map +1 -0
  17. package/dist/styles/index.cjs +58 -0
  18. package/dist/styles/index.cjs.map +1 -0
  19. package/dist/styles/index.d.cts +9 -0
  20. package/dist/styles/index.d.ts +9 -0
  21. package/dist/styles/index.js +31 -0
  22. package/dist/styles/index.js.map +1 -0
  23. package/package.json +57 -0
  24. package/publish.log +0 -0
  25. package/src/components/asset-card.ts +426 -0
  26. package/src/components/contract-card.ts +238 -0
  27. package/src/components/description-view.ts +605 -0
  28. package/src/components/index.ts +20 -0
  29. package/src/components/info-panel.ts +437 -0
  30. package/src/components/permissions-block.ts +138 -0
  31. package/src/components/transaction-playback.ts +429 -0
  32. package/src/components/universal-token-view.ts +281 -0
  33. package/src/declaration.d.ts +4 -0
  34. package/src/examples/INTEGRATION_GUIDE.md +240 -0
  35. package/src/examples/TransactionContentWithReplacement.vue +269 -0
  36. package/src/index.ts +38 -0
  37. package/src/registry/index.ts +31 -0
  38. package/src/registry/lit-view-loader.ts +191 -0
  39. package/src/shared/address-display.ts +370 -0
  40. package/src/shared/address-view.ts +385 -0
  41. package/src/shared/custom-select.ts +164 -0
  42. package/src/shared/function-name-view.ts +89 -0
  43. package/src/shared/gas-provider-view.ts +218 -0
  44. package/src/shared/icon-view.ts +288 -0
  45. package/src/shared/image-list.ts +261 -0
  46. package/src/shared/image-loader-controller.ts +160 -0
  47. package/src/shared/index.ts +34 -0
  48. package/src/shared/load-web-components.ts +56 -0
  49. package/src/shared/notification-view.ts +132 -0
  50. package/src/shared/progress-view.ts +86 -0
  51. package/src/shared/safe-custom-element.ts +35 -0
  52. package/src/shared/scroll-to-bottom-button.ts +55 -0
  53. package/src/shared/signal-controller.ts +124 -0
  54. package/src/shared/transaction-view-controller.ts +345 -0
  55. package/src/shared/url-view.ts +129 -0
  56. package/src/shared/value-view.ts +510 -0
  57. package/src/styles/index.ts +28 -0
  58. package/src/styles/styles.css +1 -0
  59. package/src/vue-entry.ts +15 -0
  60. package/tailwind.config.cjs +9 -0
  61. package/tsconfig.json +22 -0
  62. package/tsup.config.ts +90 -0
@@ -0,0 +1,493 @@
1
+ export { AddressData, AddressDisplay, AddressView, CustomOption, CustomSelect, FunctionNameView, GasProviderView, IconView, ImageLoadState, ImageLoaderController, MultiSignalController, NotificationView, ProgressSegment, ProgressView, ScrollToBottomButton, SelectOption, SignalController, TransactionSignalController, TransactionViewController, TransactionViewState, UrlView, ValueView, useImageLoader, useSignal, useSignals, useTransactionSignal, useTransactionView } from './shared/index.js';
2
+ import * as lit from 'lit';
3
+ import { LitElement } from 'lit';
4
+ import { CoreLitElement } from './styles/index.js';
5
+ import { ResolvedAddress, ViewMatch, FrameworkViewConfig } from '@lukso/transaction-view-headless';
6
+ export { DecoderRecordForSelection, DefaultViewRegistry, FrameworkSupport, FrameworkViewConfig, ViewContext, ViewDefinition, ViewLoader, ViewMatch, ViewMatchOptions, ViewRegistry, getGlobalRegistry, resetGlobalRegistry, setGlobalRegistry } from '@lukso/transaction-view-headless';
7
+ export { DecoderResult } from '@lukso/transaction-decoder';
8
+ import '@preact/signals-core';
9
+
10
+ /**
11
+ * Image list component for displaying arrays of images/assets
12
+ *
13
+ * Displays a list of images from a resolved address property (e.g., 'images', 'assets').
14
+ * If items have an 'index' property, shows only items with matching indices.
15
+ * Handles different file types (images, videos, audio, generic files).
16
+ *
17
+ * @example
18
+ * ```html
19
+ * <!-- Display all images -->
20
+ * <image-list
21
+ * address="0x1234..."
22
+ * image-hint="images"
23
+ * ></image-list>
24
+ *
25
+ * <!-- Display images with index 0-5 -->
26
+ * <image-list
27
+ * address="0x1234..."
28
+ * image-hint="images"
29
+ * min-index="0"
30
+ * max-index="5"
31
+ * ></image-list>
32
+ * ```
33
+ */
34
+ declare class ImageList extends CoreLitElement {
35
+ /**
36
+ * The address to display (required)
37
+ */
38
+ address: string;
39
+ /**
40
+ * Property name to use for loading images (e.g., 'images', 'assets')
41
+ * This should point to an array property on the resolved data
42
+ */
43
+ imageHint: string;
44
+ /**
45
+ * Minimum index to display (only applies if items have index property)
46
+ */
47
+ minIndex?: number;
48
+ /**
49
+ * Maximum index to display (only applies if items have index property)
50
+ */
51
+ maxIndex?: number;
52
+ /**
53
+ * Display size for images
54
+ */
55
+ size: 'x-small' | 'small' | 'medium' | 'large';
56
+ /**
57
+ * Optional card view: wrap list in a bordered, padded container
58
+ */
59
+ isCardView: boolean;
60
+ private isLoading;
61
+ private addressResolver;
62
+ private addressTask;
63
+ /**
64
+ * Get the list of items to display from resolved data
65
+ */
66
+ private getDisplayItems;
67
+ /**
68
+ * Check if an item is an actual image based on fileType
69
+ */
70
+ private isImageFile;
71
+ /**
72
+ * Get file type icon for non-image files
73
+ */
74
+ private getFileTypeIcon;
75
+ /**
76
+ * Render a single image item
77
+ */
78
+ private renderImageItem;
79
+ private getImageMinSizePx;
80
+ render(): lit.TemplateResult<1>;
81
+ }
82
+ declare global {
83
+ interface HTMLElementTagNameMap {
84
+ 'image-list': ImageList;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Expandable info panel for displaying detailed asset information
90
+ * Auto-resolves data from address or address-tokenId
91
+ */
92
+ declare class InfoPanel extends LitElement {
93
+ /**
94
+ * Address or address-tokenId to display info for
95
+ */
96
+ address: string;
97
+ open: boolean;
98
+ standard: string;
99
+ type: 'transfer' | 'mint' | 'burn' | 'approve';
100
+ private _isAnimating;
101
+ private _resolvedData?;
102
+ private _resolutionTask;
103
+ private _extractBaseAddress;
104
+ private _extractTokenId;
105
+ static styles: lit.CSSResult;
106
+ private _handleClose;
107
+ private _copyToClipboard;
108
+ private _renderHeader;
109
+ private _renderContractAddress;
110
+ private _renderTokenId;
111
+ private _renderDescription;
112
+ private _renderLinks;
113
+ private _renderImages;
114
+ private _renderAssets;
115
+ private _handleBackdropClick;
116
+ render(): lit.TemplateResult<1>;
117
+ }
118
+ declare global {
119
+ interface HTMLElementTagNameMap {
120
+ 'info-panel': InfoPanel;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Asset card component for displaying token/NFT information
126
+ * Replaces the DigitalAssetInfo helper component
127
+ */
128
+ declare class AssetCard extends CoreLitElement {
129
+ address: string | undefined;
130
+ tokenId: string | undefined;
131
+ amount: string | undefined;
132
+ /** Function name associated with the asset (e.g., "LSP4DigitalAsset") */
133
+ functionName: string | undefined;
134
+ /** Standard associated with the asset (e.g., "LSP4") */
135
+ standard: string | undefined;
136
+ /** Function icon name */
137
+ functionIcon: string;
138
+ size: 'small' | 'medium' | 'large';
139
+ showInfoButton: boolean;
140
+ showCreator: boolean;
141
+ private displayDetails;
142
+ private _resolvedData?;
143
+ private _imageError;
144
+ private _handleImageError;
145
+ private _handleInfoClick;
146
+ private addressResolver;
147
+ private _resolutionTask;
148
+ private _extractBaseAddress;
149
+ private _extractTokenId;
150
+ private _copyToClipboard;
151
+ private _renderAddressSection;
152
+ private _renderCreatorSection;
153
+ private _renderContractAddress;
154
+ private _renderAssetLongName;
155
+ private _renderAssetSymbol;
156
+ private get displayedTokenId();
157
+ private _renderTokenId;
158
+ private _renderDescription;
159
+ private _renderLinks;
160
+ private _renderImages;
161
+ private _renderAssets;
162
+ private _renderStandards;
163
+ private _renderTokenDetails;
164
+ private renderFormattedTokenIdBadge;
165
+ render(): lit.TemplateResult<1>;
166
+ }
167
+ declare global {
168
+ interface HTMLElementTagNameMap {
169
+ 'asset-card': AssetCard;
170
+ }
171
+ }
172
+
173
+ type EnhancedInfo$1 = {
174
+ address: `0x${string}`;
175
+ standard?: string;
176
+ tokenId?: `0x${string}`;
177
+ name?: string;
178
+ __gqltype?: 'Profile' | 'Asset' | 'Token';
179
+ [key: string]: unknown;
180
+ };
181
+ interface TransactionInfo {
182
+ /** Transaction hash */
183
+ hash?: string;
184
+ /** Block number */
185
+ blockNumber?: bigint | string;
186
+ /** Block timestamp */
187
+ timestamp?: bigint | string | Date;
188
+ /** Gas used */
189
+ gasUsed?: bigint | string;
190
+ /** Gas price */
191
+ gasPrice?: bigint | string;
192
+ /** Transaction status */
193
+ status?: 'success' | 'failed' | 'pending';
194
+ /** Network/chain name */
195
+ network?: string;
196
+ }
197
+ interface DescriptionItem {
198
+ /** Label for the description item */
199
+ label: string;
200
+ /** Value to display */
201
+ value: string;
202
+ /** Optional secondary value or subtitle */
203
+ subtitle?: string;
204
+ /** Whether this item is highlighted */
205
+ highlighted?: boolean;
206
+ /** Whether to show copy button */
207
+ copyable?: boolean;
208
+ /** Custom icon for this item */
209
+ icon?: string;
210
+ /** Link URL if this item should be clickable */
211
+ link?: string;
212
+ }
213
+ interface DescriptionViewData {
214
+ /** Main title/heading */
215
+ title?: string;
216
+ /** Main description text */
217
+ description?: string;
218
+ /** Address key (format: "ADDRESS" or "ADDRESS-TOKENID") */
219
+ address?: string;
220
+ /** Value being transferred */
221
+ value?: bigint | string;
222
+ /** Raw transaction object */
223
+ transaction?: any;
224
+ /** Enhanced info from decoder (contains metadata) */
225
+ enhancedInfo?: EnhancedInfo$1;
226
+ /** Transaction-specific information */
227
+ transactionInfo?: TransactionInfo;
228
+ /** Additional custom items to display */
229
+ customItems?: DescriptionItem[];
230
+ /** Transaction type for styling */
231
+ type?: 'transfer' | 'mint' | 'burn' | 'approve' | 'execute' | 'deploy';
232
+ /** Loading state */
233
+ loading?: boolean;
234
+ }
235
+ /**
236
+ * Description view component for displaying transaction details and metadata
237
+ * Provides flexible key-value display with support for various transaction types
238
+ */
239
+ declare class DescriptionView extends LitElement {
240
+ data: DescriptionViewData;
241
+ variant: 'default' | 'compact' | 'detailed';
242
+ static styles: lit.CSSResult;
243
+ private _copyToClipboard;
244
+ private _handleItemClick;
245
+ private _renderHeader;
246
+ private _renderItems;
247
+ render(): lit.TemplateResult<1>;
248
+ }
249
+ declare global {
250
+ interface HTMLElementTagNameMap {
251
+ 'description-view': DescriptionView;
252
+ }
253
+ }
254
+
255
+ type EnhancedInfo = {
256
+ address: `0x${string}`;
257
+ standard?: string;
258
+ tokenId?: `0x${string}`;
259
+ name?: string;
260
+ __gqltype?: 'Profile' | 'Asset' | 'Token';
261
+ [key: string]: unknown;
262
+ };
263
+ interface UniversalTokenViewData {
264
+ /** Main transaction address key (ADDRESS or ADDRESS-TOKENID) */
265
+ address?: string;
266
+ /** Value being transferred */
267
+ value?: bigint | string;
268
+ /** Raw transaction object (DecoderResult) */
269
+ transaction?: any;
270
+ /** Enhanced info from resolver */
271
+ enhancedInfo?: EnhancedInfo;
272
+ /** Transaction type */
273
+ type?: 'transfer' | 'mint' | 'burn' | 'approve' | 'execute' | 'deploy';
274
+ /** Title text (e.g., "Transfer Token", "Mint Token") */
275
+ title?: string;
276
+ /** Title icon name */
277
+ icon?: string;
278
+ /** Standard tag text (e.g., "LSP7-DigitalAsset", "LSP8-IdentifiableDigitalAsset") */
279
+ standard?: string;
280
+ /** Loading states */
281
+ loading?: {
282
+ asset?: boolean;
283
+ metadata?: boolean;
284
+ transaction?: boolean;
285
+ };
286
+ }
287
+ /**
288
+ * Universal token view component that combines all core components
289
+ * Can replace most individual Vue transaction views
290
+ */
291
+ declare class UniversalTokenView extends LitElement {
292
+ data: UniversalTokenViewData;
293
+ private _infoPanelOpen;
294
+ static styles: lit.CSSResult;
295
+ private _handleInfoPanelToggle;
296
+ private _handleInfoPanelClose;
297
+ private _buildAssetCardData;
298
+ private _renderLoadingState;
299
+ private _renderErrorState;
300
+ render(): lit.TemplateResult<1>;
301
+ }
302
+ declare global {
303
+ interface HTMLElementTagNameMap {
304
+ 'universal-token-view': UniversalTokenView;
305
+ }
306
+ }
307
+
308
+ /**
309
+ * ContractCard Component
310
+ *
311
+ * A wrapper around lukso-card that auto-resolves contract/token metadata from an address or address-tokenId.
312
+ * Provides the same variants and styling as lukso-card with automatic data population.
313
+ *
314
+ * @example
315
+ * ```html
316
+ * <!-- Basic contract card -->
317
+ * <contract-card address="0x1234..."></contract-card>
318
+ *
319
+ * <!-- Profile variant with token ID -->
320
+ * <contract-card
321
+ * address="0x1234..."
322
+ * variant="profile"
323
+ * ></contract-card>
324
+ *
325
+ * <!-- With custom slots -->
326
+ * <contract-card address="0x1234..." variant="with-header">
327
+ * <div slot="header">Custom Header</div>
328
+ * <div slot="content">Custom Content</div>
329
+ * </contract-card>
330
+ * ```
331
+ *
332
+ * @slot header - Custom header content (for with-header variant)
333
+ * @slot content - Custom content area
334
+ * @slot bottom - Bottom slot content
335
+ *
336
+ * @fires address-click - Fired when the card is clicked (if clickable=true)
337
+ */
338
+ declare class ContractCard extends LitElement {
339
+ /**
340
+ * Contract address or address-tokenId format
341
+ */
342
+ address: string;
343
+ /**
344
+ * Pre-resolved address data (optional, for performance optimization)
345
+ */
346
+ resolved?: ResolvedAddress;
347
+ /**
348
+ * Card variant (maps to lukso-card variants)
349
+ * - basic: Simple card with content slot
350
+ * - with-header: Card with header and content sections
351
+ * - profile: Profile card layout
352
+ * - profile-2: Alternative profile layout
353
+ * - hero: Large hero-style card
354
+ * - dapp: DApp-specific card layout
355
+ */
356
+ variant: 'basic' | 'with-header' | 'profile' | 'profile-2' | 'hero' | 'dapp';
357
+ /**
358
+ * Border radius size
359
+ */
360
+ borderRadius: 'small' | 'medium' | 'none';
361
+ /**
362
+ * Shadow size
363
+ */
364
+ shadow: 'small' | 'medium' | 'large';
365
+ /**
366
+ * Card width in pixels
367
+ */
368
+ width?: number;
369
+ /**
370
+ * Card height in pixels
371
+ */
372
+ height?: number;
373
+ /**
374
+ * Whether the card is hoverable
375
+ */
376
+ isHoverable: boolean;
377
+ /**
378
+ * Whether the card has an overlay
379
+ */
380
+ hasOverlay: boolean;
381
+ /**
382
+ * Custom CSS class for the card
383
+ */
384
+ customClass: string;
385
+ /**
386
+ * Custom CSS class for the header
387
+ */
388
+ headerClass: string;
389
+ private _resolvedData?;
390
+ private _profileImageUrl?;
391
+ private _backgroundImageUrl?;
392
+ private _resolutionTask;
393
+ private _profileImageTask;
394
+ private _backgroundImageTask;
395
+ private _extractBaseAddress;
396
+ private _handleClick;
397
+ static styles: lit.CSSResult;
398
+ render(): lit.TemplateResult<1>;
399
+ }
400
+ declare global {
401
+ interface HTMLElementTagNameMap {
402
+ 'contract-card': ContractCard;
403
+ }
404
+ }
405
+
406
+ type PermissionLevels = {
407
+ permissionName: string;
408
+ type: string;
409
+ icon?: string;
410
+ isActive: boolean;
411
+ isForward?: boolean;
412
+ info: string;
413
+ };
414
+ /**
415
+ * Permissions block card
416
+ *
417
+ * Lit/Web Component equivalent of the provided Vue PermissionsBlock.
418
+ * - Uses Tailwind utility classes for styling
419
+ * - Uses LUKSO web components where applicable (lukso-icon)
420
+ */
421
+ declare class PermissionsBlock extends CoreLitElement {
422
+ /** Header icon name */
423
+ icon: string;
424
+ /** Optional action icon name (reserved, not displayed yet) */
425
+ actionIcon: string;
426
+ /** CSS color (e.g., var(--blue-75)) applied to icons */
427
+ color: string;
428
+ /** Title text */
429
+ title: string;
430
+ /** Description text */
431
+ description: string;
432
+ /** Control identifier used by parent (informational only here) */
433
+ control: string;
434
+ /** Permission levels to render */
435
+ permissions: PermissionLevels[];
436
+ render(): lit.TemplateResult<1>;
437
+ private renderPermission;
438
+ }
439
+ declare global {
440
+ interface HTMLElementTagNameMap {
441
+ 'permissions-block': PermissionsBlock;
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Lit component view loader
447
+ * Handles loading of Lit web components for transaction views
448
+ */
449
+ declare class LitViewLoader {
450
+ private loadedComponents;
451
+ /**
452
+ * Load a component from a view match
453
+ */
454
+ loadFromMatch(match: ViewMatch): Promise<any>;
455
+ /**
456
+ * Load a component based on framework config
457
+ */
458
+ loadComponent(config: FrameworkViewConfig): Promise<any>;
459
+ /**
460
+ * Load a custom element (Web Component)
461
+ */
462
+ private loadCustomElement;
463
+ /**
464
+ * Load via dynamic import
465
+ */
466
+ private loadDynamicImport;
467
+ /**
468
+ * Load via static import (not really possible at runtime, but for completeness)
469
+ */
470
+ private loadStaticImport;
471
+ /**
472
+ * Create a component instance with data
473
+ */
474
+ createInstance(componentClass: any, data: any): HTMLElement;
475
+ /**
476
+ * Clear component cache
477
+ */
478
+ clearCache(): void;
479
+ }
480
+ /**
481
+ * Get the global Lit view loader
482
+ */
483
+ declare function getGlobalLitLoader(): LitViewLoader;
484
+ /**
485
+ * Set a custom global Lit loader (useful for testing)
486
+ */
487
+ declare function setGlobalLitLoader(loader: LitViewLoader): void;
488
+ /**
489
+ * Reset the global Lit loader (mainly for testing)
490
+ */
491
+ declare function resetGlobalLitLoader(): void;
492
+
493
+ export { LitViewLoader, getGlobalLitLoader, resetGlobalLitLoader, setGlobalLitLoader };