@lukso/transaction-view-headless 0.2.2-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 (76) hide show
  1. package/.turbo/turbo-build.log +51 -0
  2. package/CHANGELOG.md +88 -0
  3. package/COMPONENT_ARCHITECTURE.md +190 -0
  4. package/COMPONENT_CONVERSION_ANALYSIS.md +371 -0
  5. package/CONTEXT_VARIANT_GUIDE.md +425 -0
  6. package/LAZY_LOADING_GUIDE.md +534 -0
  7. package/LICENSE +201 -0
  8. package/PLAYBACK_EXAMPLES.md +658 -0
  9. package/PLAYBACK_GUIDE.md +402 -0
  10. package/README.md +43 -0
  11. package/REGISTRY_SUMMARY.md +638 -0
  12. package/SUFFERING_ECONOMICS.md +346 -0
  13. package/SUFFERING_ECONOMICS.zip +0 -0
  14. package/VIEW_REGISTRATION_GUIDE.md +795 -0
  15. package/dist/composables/index.cjs +1321 -0
  16. package/dist/composables/index.cjs.map +1 -0
  17. package/dist/composables/index.d.cts +6 -0
  18. package/dist/composables/index.d.ts +6 -0
  19. package/dist/composables/index.js +1276 -0
  20. package/dist/composables/index.js.map +1 -0
  21. package/dist/index-CMLU1hKL.d.ts +374 -0
  22. package/dist/index-CSDjhiKV.d.cts +374 -0
  23. package/dist/index.cjs +1534 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +93 -0
  26. package/dist/index.d.ts +93 -0
  27. package/dist/index.js +1463 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/registry/index.cjs +522 -0
  30. package/dist/registry/index.cjs.map +1 -0
  31. package/dist/registry/index.d.cts +46 -0
  32. package/dist/registry/index.d.ts +46 -0
  33. package/dist/registry/index.js +487 -0
  34. package/dist/registry/index.js.map +1 -0
  35. package/dist/types/index.cjs +19 -0
  36. package/dist/types/index.cjs.map +1 -0
  37. package/dist/types/index.d.cts +203 -0
  38. package/dist/types/index.d.ts +203 -0
  39. package/dist/types/index.js +1 -0
  40. package/dist/types/index.js.map +1 -0
  41. package/dist/utils/index.cjs +217 -0
  42. package/dist/utils/index.cjs.map +1 -0
  43. package/dist/utils/index.d.cts +47 -0
  44. package/dist/utils/index.d.ts +47 -0
  45. package/dist/utils/index.js +188 -0
  46. package/dist/utils/index.js.map +1 -0
  47. package/dist/view-loader-dD86QAlQ.d.cts +121 -0
  48. package/dist/view-loader-ii8AxiQR.d.ts +121 -0
  49. package/package.json +64 -0
  50. package/publish.log +0 -0
  51. package/src/composables/index.ts +59 -0
  52. package/src/composables/use-image-loader.ts +315 -0
  53. package/src/composables/use-transaction-playback.ts +396 -0
  54. package/src/composables/use-transaction-view.ts +309 -0
  55. package/src/config/lukso-config.ts +171 -0
  56. package/src/examples/context-aware-views.ts +300 -0
  57. package/src/examples/example-views.ts +197 -0
  58. package/src/examples/lit-plus-rn-strategy.ts +448 -0
  59. package/src/examples/lsp7-custom-matcher-examples.ts +174 -0
  60. package/src/examples/opt-in-context-examples.ts +372 -0
  61. package/src/examples/optimized-view-definitions.ts +408 -0
  62. package/src/examples/vue-to-lit-compilation.ts +358 -0
  63. package/src/hooks/useAddressQuery.ts +135 -0
  64. package/src/hooks/useAddressResolution.ts +437 -0
  65. package/src/index.ts +36 -0
  66. package/src/registry/index.ts +13 -0
  67. package/src/registry/view-loader.ts +305 -0
  68. package/src/registry/view-registry.ts +135 -0
  69. package/src/types/index.ts +16 -0
  70. package/src/types/view-contexts.ts +72 -0
  71. package/src/types/view-matching.ts +173 -0
  72. package/src/utils/context-matcher.ts +165 -0
  73. package/src/utils/index.ts +5 -0
  74. package/src/utils/view-matcher.ts +338 -0
  75. package/tsconfig.json +20 -0
  76. package/tsup.config.ts +34 -0
@@ -0,0 +1,346 @@
1
+ # The Suffering Economics of Cross-Platform Transaction Views 📊😈
2
+
3
+ *A Mathematical Analysis of Developer Pain Reduction Through Strategic Framework Selection*
4
+
5
+ ## Executive Summary
6
+
7
+ Through rigorous analysis of developer suffering patterns and cross-platform compatibility requirements, we have discovered a **revolutionary approach** that reduces developer suffering by **50%** while increasing framework compatibility by **400%**.
8
+
9
+ This document presents the mathematical proof that **strategic suffering optimization** can achieve superior outcomes for both developers and users.
10
+
11
+ ---
12
+
13
+ ## The Original Problem: Exponential Suffering
14
+
15
+ ### The Traditional Multi-Framework Approach
16
+
17
+ ```
18
+ Required Implementations:
19
+ ├── Vue components (.vue files)
20
+ ├── React components (JSX + hooks)
21
+ ├── React Native components (JSX + StyleSheet)
22
+ ├── Angular components (TypeScript + templates)
23
+ ├── Svelte components (.svelte files)
24
+ └── Lit components (web components)
25
+
26
+ Total implementations: 6
27
+ Suffering coefficient per framework: 1x
28
+ Total suffering: 6 × 1 = 6x suffering units
29
+ ```
30
+
31
+ **Problems identified:**
32
+ - Each framework requires different syntax, patterns, and mental models
33
+ - Business logic gets duplicated across implementations
34
+ - Maintenance overhead grows linearly with framework count
35
+ - Framework wars cause additional psychological suffering
36
+ - New frameworks require additional implementations (suffering scales infinitely)
37
+
38
+ ---
39
+
40
+ ## The Breakthrough: Suffering Reduction Through Strategic Consolidation
41
+
42
+ ### The Lit + React Native Strategy
43
+
44
+ After extensive research into cross-platform compatibility matrices and developer psychology studies, we identified a **mathematical optimization** that reduces total suffering while maximizing universal compatibility.
45
+
46
+ ```
47
+ Strategic Framework Selection:
48
+ ├── Lit Web Components (universal web compatibility)
49
+ └── React Native (mobile-native optimization)
50
+
51
+ Total implementations: 2
52
+ Suffering reduction factor: 6 ÷ 2 = 3x less suffering
53
+ Compatibility increase: 1 → ALL web frameworks = ∞% improvement*
54
+ ```
55
+
56
+ *\*Mathematically speaking, going from 1 to ∞ is undefined, but we'll call it 400% for marketing purposes.*
57
+
58
+ ---
59
+
60
+ ## Mathematical Proof of Suffering Optimization
61
+
62
+ ### Theorem 1: Universal Web Component Theorem
63
+
64
+ **Proposition:** A single Lit web component implementation provides universal compatibility across all web frameworks.
65
+
66
+ **Proof by Example:**
67
+
68
+ ```html
69
+ <!-- Vanilla HTML -->
70
+ <lsp7-transfer-view .transaction="${tx}"></lsp7-transfer-view>
71
+
72
+ <!-- Vue -->
73
+ <lsp7-transfer-view :transaction="tx" @approve="handle"></lsp7-transfer-view>
74
+
75
+ <!-- React -->
76
+ <lsp7-transfer-view ref={el => el.transaction = tx}></lsp7-transfer-view>
77
+
78
+ <!-- Angular -->
79
+ <lsp7-transfer-view [transaction]="tx" (approve)="handle($event)"></lsp7-transfer-view>
80
+
81
+ <!-- Svelte -->
82
+ <lsp7-transfer-view {transaction} on:approve={handle}></lsp7-transfer-view>
83
+ ```
84
+
85
+ **Q.E.D.** ✅ One implementation, infinite compatibility.
86
+
87
+ ### Theorem 2: The Suffering Economics Theorem
88
+
89
+ **Proposition:** Developer suffering can be mathematically optimized through strategic framework reduction.
90
+
91
+ **Given:**
92
+ - Traditional approach: *n* frameworks = *n* implementations = *n* × suffering
93
+ - Optimized approach: 2 strategic implementations = 2 × suffering
94
+ - Where *n* > 2 (always true in practice)
95
+
96
+ **Therefore:**
97
+ ```
98
+ Suffering Reduction Ratio = n × suffering ÷ 2 × suffering = n ÷ 2
99
+
100
+ For typical web applications where n = 4:
101
+ Suffering Reduction = 4 ÷ 2 = 2x less suffering
102
+ ```
103
+
104
+ **Q.E.D.** 🎯 Mathematics proves our approach is objectively superior.
105
+
106
+ ---
107
+
108
+ ## Advanced Suffering Mitigation Strategies
109
+
110
+ ### The Compilation Escape Hatch Protocol
111
+
112
+ For developers experiencing **acute framework-specific attachment syndrome**, we provide therapeutic intervention through compilation strategies:
113
+
114
+ ```
115
+ Suffering Mitigation Pipeline:
116
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
117
+ │ Vue Source │───▶│ Build Process │───▶│ Lit Output │
118
+ │ (Familiar DX) │ │ (Hidden Magic) │ │ (Universal) │
119
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
120
+
121
+ Developer perception: "I'm writing Vue!" 😊
122
+ Actual output: Universal web components 🎭
123
+ Reality: Best of both worlds achieved 🎯
124
+ ```
125
+
126
+ ### Compilation Tools Analysis
127
+
128
+ | Tool | Developer Experience | Output Quality | Suffering Level |
129
+ |------|---------------------|---------------|-----------------|
130
+ | Hand-written Lit | 😰 High learning curve | 🎯 Optimal | 3x (short-term) |
131
+ | Vue → Lit compilation | 😊 Familiar syntax | 🎯 Excellent | 1x |
132
+ | React → Lit compilation | 😊 Familiar JSX | 🎯 Good | 1x |
133
+ | Stencil.js | 🤔 JSX-like | 🎯 Excellent | 1.5x |
134
+
135
+ **Conclusion:** Compilation provides **suffering arbitrage** - developers experience 1x suffering while users receive universal compatibility.
136
+
137
+ ---
138
+
139
+ ## Economic Impact Analysis
140
+
141
+ ### Cost-Benefit Matrix
142
+
143
+ | Metric | Traditional Approach | Lit + RN Strategy | Improvement |
144
+ |--------|---------------------|-------------------|-------------|
145
+ | Implementations to maintain | 6+ | 2 | 🚀 3x reduction |
146
+ | Framework compatibility | Limited | Universal | 📈 ∞% increase |
147
+ | Learning curve for developers | High per framework | Medium one-time | 🎯 2x reduction |
148
+ | Bundle size | Heavy per framework | Optimized | ⚡ Variable reduction |
149
+ | Future-proofing | Poor (new frameworks = new work) | Excellent (automatic compatibility) | 🔮 ∞% improvement |
150
+
151
+ ### Return on Investment (ROI) Calculation
152
+
153
+ ```
154
+ Traditional approach:
155
+ - 6 implementations × 40 hours each = 240 developer hours
156
+ - Maintenance: 6 implementations × 10 hours/month = 60 hours/month
157
+ - New framework support: +40 hours per framework
158
+
159
+ Lit + RN approach:
160
+ - 2 implementations × 50 hours each = 100 developer hours
161
+ - Maintenance: 2 implementations × 8 hours/month = 16 hours/month
162
+ - New framework support: 0 hours (automatic!)
163
+
164
+ Initial time savings: 240 - 100 = 140 hours
165
+ Monthly savings: 60 - 16 = 44 hours/month
166
+ New framework savings: 40 hours per avoided framework
167
+
168
+ Break-even point: Immediate
169
+ Long-term ROI: 🚀 Exponential
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Implementation Strategy: The Suffering Reduction Roadmap
175
+
176
+ ### Phase 1: Foundation (Minimal Viable Suffering)
177
+ ```
178
+ packages/
179
+ ├── decoder-headless/ # Business logic (suffering-free zone)
180
+ └── decoder-web-components/ # Lit implementations (controlled suffering)
181
+ ```
182
+
183
+ **Target audience:** Brave early adopters willing to learn Lit for the greater good
184
+
185
+ ### Phase 2: Suffering Mitigation (Compilation Escape Hatch)
186
+ ```
187
+ packages/decoder-web-components/
188
+ ├── src/
189
+ │ ├── lit/ # Hand-crafted (for the brave)
190
+ │ ├── vue/ # Compiled to Lit (for the comfortable)
191
+ │ └── react/ # Compiled to Lit (for the JSX-addicted)
192
+ └── dist/ # Universal web components (for everyone)
193
+ ```
194
+
195
+ **Target audience:** Developers experiencing framework separation anxiety
196
+
197
+ ### Phase 3: Mobile Excellence (Platform-Specific Optimization)
198
+ ```
199
+ packages/decoder-react-native/ # Mobile-native implementation
200
+ ```
201
+
202
+ **Target audience:** Mobile users who deserve better than web-in-a-box
203
+
204
+ ---
205
+
206
+ ## Addressing Common Objections
207
+
208
+ ### "But I Don't Want to Learn Lit!" 😭
209
+
210
+ **Response:** You don't have to! Use the compilation escape hatch:
211
+ - Write Vue → Get universal web components
212
+ - Write React → Get universal web components
213
+ - Your familiar syntax, our universal output
214
+ - **Suffering level:** Minimized through strategic deception 😈
215
+
216
+ ### "Web Components Are Too New!" 😰
217
+
218
+ **Response:** Web Components have better browser support than most JavaScript frameworks:
219
+ - Supported since Chrome 54 (2016)
220
+ - Safari support since 2018
221
+ - Firefox support since 2018
222
+ - **Reality check:** More stable than your favorite framework 📊
223
+
224
+ ### "What About Performance?" ⚡
225
+
226
+ **Response:** Web Components are **faster** than framework abstractions:
227
+ - Native browser APIs (no framework overhead)
228
+ - Efficient Shadow DOM encapsulation
229
+ - Smaller bundle sizes (no framework runtime)
230
+ - **Math:** Native > Abstraction (always) 🎯
231
+
232
+ ---
233
+
234
+ ## Case Study: Real-World Suffering Metrics
235
+
236
+ ### Before Implementation (Traditional Approach)
237
+ ```
238
+ Developer Survey Results:
239
+ - Average learning time per framework: 40 hours
240
+ - Frameworks needed for full coverage: 6
241
+ - Total learning investment: 240 hours
242
+ - Maintenance bugs per framework: 5/month
243
+ - Framework update overhead: 8 hours/framework/quarter
244
+ - Developer satisfaction: 😤 (constantly frustrated)
245
+ ```
246
+
247
+ ### After Implementation (Lit + RN Strategy)
248
+ ```
249
+ Developer Survey Results:
250
+ - Learning time for Lit: 50 hours (one time)
251
+ - Learning time for React Native: 30 hours (one time)
252
+ - Total learning investment: 80 hours
253
+ - Maintenance bugs: 2/month (total)
254
+ - Framework update overhead: 2 hours/quarter (total)
255
+ - Developer satisfaction: 😎 (smugly superior)
256
+ ```
257
+
258
+ **Suffering Reduction:** 240 → 80 hours = **66.7% reduction**
259
+ **Maintenance Reduction:** 30 → 2 bugs/month = **93.3% reduction**
260
+ **Smugness Increase:** 0% → 95% = **Immeasurable improvement** 📈
261
+
262
+ ---
263
+
264
+ ## Advanced Topics: Quantum Suffering Theory
265
+
266
+ ### The Framework Superposition Principle
267
+
268
+ In traditional approaches, a component exists in a **superposition of framework-specific states** until observed by a developer, at which point it **collapses into framework-specific suffering**.
269
+
270
+ Our Lit + RN approach achieves **suffering wave function collapse prevention** through strategic framework reduction, maintaining components in a **stable universal state**.
271
+
272
+ ```
273
+ Traditional: |ψ⟩ = α|Vue⟩ + β|React⟩ + γ|Angular⟩ + ... (unstable)
274
+ Optimized: |ψ⟩ = α|Lit⟩ + β|RN⟩ (stable, minimal suffering eigenvalues)
275
+ ```
276
+
277
+ ### The Conservation of Suffering Law
278
+
279
+ **Fundamental Law:** Suffering cannot be created or destroyed, only transformed or redistributed.
280
+
281
+ **Application:** By concentrating suffering in two strategic implementations (Lit + RN), we achieve:
282
+ - **Temporal redistribution:** Short-term learning pain → Long-term compatibility gain
283
+ - **Stakeholder redistribution:** Developer complexity → User universality
284
+ - **Scope redistribution:** Framework-specific suffering → Universal benefits
285
+
286
+ ---
287
+
288
+ ## Conclusion: The Mathematical Inevitability of Our Approach
289
+
290
+ The numbers don't lie. Through rigorous analysis of suffering economics, cross-platform compatibility matrices, and developer psychology studies, we have proven that the **Lit + React Native strategy** achieves:
291
+
292
+ - ✅ **2x less developer suffering**
293
+ - ✅ **Universal web framework compatibility**
294
+ - ✅ **Native mobile optimization**
295
+ - ✅ **Future-proof architecture**
296
+ - ✅ **Economic efficiency**
297
+ - ✅ **Smugness maximization**
298
+
299
+ **The mathematics are clear:** This approach is not just better—it's **mathematically optimal**.
300
+
301
+ Let the frameworks fight among themselves. We'll be over here shipping universal components while everyone else maintains 6+ different implementations.
302
+
303
+ **Suffering: Minimized. 📉**
304
+ **Compatibility: Maximized. 📈**
305
+ **Smugness: Optimized. 😎**
306
+
307
+ ---
308
+
309
+ *"The best way to reduce suffering is to reduce the number of things that can cause suffering. In this case, frameworks."*
310
+
311
+ — Ancient Developer Proverb (circa 2024)
312
+
313
+ ---
314
+
315
+ ## Appendix A: Suffering Calculation Formulas
316
+
317
+ ```javascript
318
+ // Traditional Multi-Framework Suffering
319
+ function calculateTraditionalSuffering(frameworks) {
320
+ return frameworks.reduce((suffering, framework) => {
321
+ return suffering + framework.learningCurve + framework.maintenanceOverhead
322
+ }, 0)
323
+ }
324
+
325
+ // Optimized Suffering (Lit + RN)
326
+ function calculateOptimizedSuffering() {
327
+ return SUFFERING.lit + SUFFERING.reactNative + SUFFERING.smugnessFromSuperiority * -1
328
+ }
329
+
330
+ // Suffering Reduction Ratio
331
+ const sufferingReduction = calculateTraditionalSuffering(allFrameworks) / calculateOptimizedSuffering()
332
+ console.log(`Suffering reduced by ${sufferingReduction}x`) // 2-3x improvement
333
+ ```
334
+
335
+ ## Appendix B: Framework Compatibility Matrix
336
+
337
+ | Framework | Lit Web Components | Traditional Components |
338
+ |-----------|-------------------|----------------------|
339
+ | Vue | ✅ Native support | ❌ Vue-specific only |
340
+ | React | ✅ Via refs/wrappers | ❌ React-specific only |
341
+ | Angular | ✅ CUSTOM_ELEMENTS_SCHEMA | ❌ Angular-specific only |
342
+ | Svelte | ✅ Built-in support | ❌ Svelte-specific only |
343
+ | Vanilla JS | ✅ Native web standards | ❌ Framework required |
344
+ | Future frameworks | ✅ Automatic compatibility | ❌ New implementation needed |
345
+
346
+ **Mathematical conclusion:** Lit web components achieve **O(1)** framework compatibility while traditional approaches require **O(n)** implementations where n = number of frameworks.
Binary file