@oottoo-core/oottoo-ui 0.0.4 → 0.0.6
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/README.md +33 -21
- package/dist/oottoo-ui.es.js +121 -161
- package/dist/oottoo-ui.umd.js +1 -3200
- package/package.json +1 -3
- package/dist/index-Bywq0IP9.js +0 -40854
- package/dist/index-jDA5PqgD.js +0 -4053
- package/dist/secp256k1-CipCme_y.js +0 -1479
- package/dist/secp256k1-DKwHNZkY.js +0 -1479
package/README.md
CHANGED
|
@@ -85,37 +85,45 @@ Requiere `@oottoo-core/oottoo-icons`:
|
|
|
85
85
|
|
|
86
86
|
### OVeChainLogin
|
|
87
87
|
|
|
88
|
-
Componente para
|
|
89
|
-
|
|
90
|
-
**Instalación de dependencia peer:**
|
|
91
|
-
```bash
|
|
92
|
-
npm install @vechain/dapp-kit-ui
|
|
93
|
-
```
|
|
88
|
+
Componente UI para login con wallet VeChain. Es un componente puro que requiere que la lógica de wallet se maneje desde la aplicación.
|
|
94
89
|
|
|
95
90
|
**Uso:**
|
|
96
91
|
```vue
|
|
97
92
|
<template>
|
|
98
|
-
<
|
|
93
|
+
<OVeChainLogin
|
|
99
94
|
variant="primary"
|
|
100
95
|
size="lg"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
:is-connected="isConnected"
|
|
97
|
+
:is-connecting="isConnecting"
|
|
98
|
+
:address="address"
|
|
99
|
+
:shorten-address-fn="shortenAddress"
|
|
100
|
+
@click="handleWalletClick"
|
|
101
|
+
@disconnect="handleDisconnect"
|
|
105
102
|
/>
|
|
106
103
|
</template>
|
|
107
104
|
|
|
108
105
|
<script setup>
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
import { ref } from 'vue'
|
|
107
|
+
|
|
108
|
+
const isConnected = ref(false)
|
|
109
|
+
const isConnecting = ref(false)
|
|
110
|
+
const address = ref(null)
|
|
111
|
+
|
|
112
|
+
const shortenAddress = (addr) => {
|
|
113
|
+
if (!addr || addr.length < 13) return addr
|
|
114
|
+
return `${addr.slice(0, 6)}...${addr.slice(-4)}`
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
const
|
|
114
|
-
|
|
117
|
+
const handleWalletClick = async () => {
|
|
118
|
+
// Aquí integrarías con @vechain/dapp-kit-ui o tu librería de wallet preferida
|
|
119
|
+
isConnecting.value = true
|
|
120
|
+
// ... lógica de conexión
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
const
|
|
118
|
-
|
|
123
|
+
const handleDisconnect = () => {
|
|
124
|
+
// ... lógica de desconexión
|
|
125
|
+
isConnected.value = false
|
|
126
|
+
address.value = null
|
|
119
127
|
}
|
|
120
128
|
</script>
|
|
121
129
|
```
|
|
@@ -123,12 +131,16 @@ const handleError = (error) => {
|
|
|
123
131
|
**Props:**
|
|
124
132
|
- `variant`: 'primary' | 'secondary' | 'ghost' (default: 'primary')
|
|
125
133
|
- `size`: 'sm' | 'md' | 'lg' (default: 'md')
|
|
126
|
-
- `
|
|
134
|
+
- `isConnected`: boolean (default: false) - Estado de conexión
|
|
135
|
+
- `isConnecting`: boolean (default: false) - Estado de carga
|
|
136
|
+
- `address`: string | null (default: null) - Dirección de la wallet
|
|
137
|
+
- `shortenAddressFn`: Function - Función para truncar la dirección
|
|
127
138
|
|
|
128
139
|
**Events:**
|
|
129
|
-
- `
|
|
130
|
-
- `
|
|
131
|
-
|
|
140
|
+
- `click`: Se emite al hacer click para conectar
|
|
141
|
+
- `disconnect`: Se emite al solicitar desconexión
|
|
142
|
+
|
|
143
|
+
**Nota:** Este componente es un UI puro. Para la integración completa con VeChain, usa `@vechain/dapp-kit-ui` en tu aplicación y pasa el estado al componente.
|
|
132
144
|
|
|
133
145
|
## 📄 Licencia
|
|
134
146
|
|
package/dist/oottoo-ui.es.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
|
|
3
|
-
const G = ["disabled", "type"], J = {
|
|
1
|
+
import { computed as d, openBlock as i, createElementBlock as a, normalizeClass as h, renderSlot as y, onMounted as f, onUnmounted as v, createBlock as _, Teleport as k, createVNode as C, Transition as w, withCtx as x, withModifiers as z, normalizeStyle as m, createElementVNode as r, createCommentVNode as p, inject as O, toDisplayString as b } from "vue";
|
|
2
|
+
const S = ["disabled", "type"], $ = {
|
|
4
3
|
__name: "OButton",
|
|
5
4
|
props: {
|
|
6
5
|
/**
|
|
@@ -37,29 +36,29 @@ const G = ["disabled", "type"], J = {
|
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
emits: ["click"],
|
|
40
|
-
setup(e, { emit:
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
},
|
|
39
|
+
setup(e, { emit: n }) {
|
|
40
|
+
const t = e, o = n, s = (c) => {
|
|
41
|
+
t.disabled || o("click", c);
|
|
42
|
+
}, l = d(() => [
|
|
44
43
|
"o-button",
|
|
45
|
-
`o-button--${
|
|
46
|
-
`o-button--${
|
|
44
|
+
`o-button--${t.variant}`,
|
|
45
|
+
`o-button--${t.size}`
|
|
47
46
|
]);
|
|
48
|
-
return (
|
|
49
|
-
class:
|
|
47
|
+
return (c, g) => (i(), a("button", {
|
|
48
|
+
class: h(l.value),
|
|
50
49
|
disabled: e.disabled,
|
|
51
50
|
type: e.type,
|
|
52
|
-
onClick:
|
|
51
|
+
onClick: s
|
|
53
52
|
}, [
|
|
54
|
-
|
|
55
|
-
], 10,
|
|
53
|
+
y(c.$slots, "default")
|
|
54
|
+
], 10, S));
|
|
56
55
|
}
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
for (const [o,
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
},
|
|
56
|
+
}, B = (e, n) => {
|
|
57
|
+
const t = e.__vccOpts || e;
|
|
58
|
+
for (const [o, s] of n)
|
|
59
|
+
t[o] = s;
|
|
60
|
+
return t;
|
|
61
|
+
}, M = { class: "o-modal-content" }, L = {
|
|
63
62
|
__name: "OModal",
|
|
64
63
|
props: {
|
|
65
64
|
/**
|
|
@@ -78,35 +77,35 @@ const G = ["disabled", "type"], J = {
|
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
79
|
emits: ["close"],
|
|
81
|
-
setup(e, { emit:
|
|
82
|
-
const
|
|
80
|
+
setup(e, { emit: n }) {
|
|
81
|
+
const t = e, o = n, s = () => {
|
|
83
82
|
o("close");
|
|
84
|
-
},
|
|
85
|
-
|
|
83
|
+
}, l = (c) => {
|
|
84
|
+
c.key === "Escape" && t.isOpen && s();
|
|
86
85
|
};
|
|
87
|
-
return
|
|
88
|
-
document.addEventListener("keydown",
|
|
89
|
-
}),
|
|
90
|
-
document.removeEventListener("keydown",
|
|
91
|
-
}), (
|
|
92
|
-
|
|
93
|
-
default:
|
|
94
|
-
e.isOpen ? (
|
|
86
|
+
return f(() => {
|
|
87
|
+
document.addEventListener("keydown", l);
|
|
88
|
+
}), v(() => {
|
|
89
|
+
document.removeEventListener("keydown", l);
|
|
90
|
+
}), (c, g) => (i(), _(k, { to: "body" }, [
|
|
91
|
+
C(w, { name: "o-modal" }, {
|
|
92
|
+
default: x(() => [
|
|
93
|
+
e.isOpen ? (i(), a("div", {
|
|
95
94
|
key: 0,
|
|
96
95
|
class: "o-modal-overlay",
|
|
97
|
-
style:
|
|
98
|
-
onClick:
|
|
96
|
+
style: m({ zIndex: e.zIndex }),
|
|
97
|
+
onClick: z(s, ["self"])
|
|
99
98
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
r("div", M, [
|
|
100
|
+
y(c.$slots, "default", {}, void 0, !0)
|
|
102
101
|
])
|
|
103
|
-
], 4)) :
|
|
102
|
+
], 4)) : p("", !0)
|
|
104
103
|
]),
|
|
105
104
|
_: 3
|
|
106
105
|
})
|
|
107
106
|
]));
|
|
108
107
|
}
|
|
109
|
-
},
|
|
108
|
+
}, I = /* @__PURE__ */ B(L, [["__scopeId", "data-v-882f88c1"]]), V = ["width", "height"], E = {
|
|
110
109
|
__name: "OLoading",
|
|
111
110
|
props: {
|
|
112
111
|
/**
|
|
@@ -134,24 +133,24 @@ const G = ["disabled", "type"], J = {
|
|
|
134
133
|
}
|
|
135
134
|
},
|
|
136
135
|
setup(e) {
|
|
137
|
-
const
|
|
136
|
+
const n = e, t = {
|
|
138
137
|
sm: 16,
|
|
139
138
|
md: 24,
|
|
140
139
|
lg: 32
|
|
141
|
-
}, o =
|
|
142
|
-
return (
|
|
140
|
+
}, o = d(() => t[n.size]);
|
|
141
|
+
return (s, l) => e.loading ? (i(), a("div", {
|
|
143
142
|
key: 0,
|
|
144
143
|
class: "o-loading",
|
|
145
|
-
style:
|
|
144
|
+
style: m({ color: e.color })
|
|
146
145
|
}, [
|
|
147
|
-
(
|
|
146
|
+
(i(), a("svg", {
|
|
148
147
|
width: o.value,
|
|
149
148
|
height: o.value,
|
|
150
149
|
viewBox: "0 0 24 24",
|
|
151
150
|
fill: "none",
|
|
152
151
|
xmlns: "http://www.w3.org/2000/svg"
|
|
153
|
-
}, [...
|
|
154
|
-
|
|
152
|
+
}, [...l[0] || (l[0] = [
|
|
153
|
+
r("circle", {
|
|
155
154
|
cx: "12",
|
|
156
155
|
cy: "12",
|
|
157
156
|
r: "10",
|
|
@@ -162,16 +161,16 @@ const G = ["disabled", "type"], J = {
|
|
|
162
161
|
"stroke-dashoffset": "20",
|
|
163
162
|
opacity: "0.25"
|
|
164
163
|
}, null, -1),
|
|
165
|
-
|
|
164
|
+
r("path", {
|
|
166
165
|
d: "M12 2C6.477 2 2 6.477 2 12",
|
|
167
166
|
stroke: "currentColor",
|
|
168
167
|
"stroke-width": "4",
|
|
169
168
|
"stroke-linecap": "round"
|
|
170
169
|
}, null, -1)
|
|
171
|
-
])], 8,
|
|
172
|
-
], 4)) :
|
|
170
|
+
])], 8, V))
|
|
171
|
+
], 4)) : p("", !0);
|
|
173
172
|
}
|
|
174
|
-
},
|
|
173
|
+
}, N = ["innerHTML"], H = {
|
|
175
174
|
__name: "OIcon",
|
|
176
175
|
props: {
|
|
177
176
|
/**
|
|
@@ -197,32 +196,32 @@ const G = ["disabled", "type"], J = {
|
|
|
197
196
|
}
|
|
198
197
|
},
|
|
199
198
|
setup(e) {
|
|
200
|
-
const
|
|
201
|
-
() => typeof
|
|
202
|
-
), o =
|
|
203
|
-
return (
|
|
199
|
+
const n = e, t = d(
|
|
200
|
+
() => typeof n.size == "number" ? `${n.size}px` : n.size
|
|
201
|
+
), o = O("oIcons", void 0), s = d(() => o ? o(n.name) : "");
|
|
202
|
+
return (l, c) => (i(), a("span", {
|
|
204
203
|
class: "o-icon",
|
|
205
|
-
style:
|
|
206
|
-
width:
|
|
207
|
-
height:
|
|
204
|
+
style: m({
|
|
205
|
+
width: t.value,
|
|
206
|
+
height: t.value,
|
|
208
207
|
color: e.color
|
|
209
208
|
}),
|
|
210
|
-
innerHTML:
|
|
211
|
-
}, null, 12,
|
|
209
|
+
innerHTML: s.value
|
|
210
|
+
}, null, 12, N));
|
|
212
211
|
}
|
|
213
|
-
},
|
|
212
|
+
}, T = ["disabled"], A = {
|
|
214
213
|
key: 0,
|
|
215
214
|
class: "o-vechain-login__text"
|
|
216
|
-
},
|
|
215
|
+
}, F = {
|
|
217
216
|
key: 1,
|
|
218
217
|
class: "o-vechain-login__text"
|
|
219
|
-
},
|
|
218
|
+
}, j = {
|
|
220
219
|
key: 2,
|
|
221
220
|
class: "o-vechain-login__text"
|
|
222
|
-
},
|
|
221
|
+
}, q = {
|
|
223
222
|
key: 3,
|
|
224
223
|
class: "o-vechain-login__disconnect-icon"
|
|
225
|
-
},
|
|
224
|
+
}, D = {
|
|
226
225
|
__name: "OVeChainLogin",
|
|
227
226
|
props: {
|
|
228
227
|
/**
|
|
@@ -244,139 +243,100 @@ const G = ["disabled", "type"], J = {
|
|
|
244
243
|
validator: (e) => ["sm", "md", "lg"].includes(e)
|
|
245
244
|
},
|
|
246
245
|
/**
|
|
247
|
-
*
|
|
248
|
-
* @values 'mainnet', 'testnet'
|
|
246
|
+
* Estado de conexión de la wallet
|
|
249
247
|
*/
|
|
250
|
-
|
|
248
|
+
isConnected: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
default: !1
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Estado de carga durante conexión
|
|
254
|
+
*/
|
|
255
|
+
isConnecting: {
|
|
256
|
+
type: Boolean,
|
|
257
|
+
default: !1
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* Dirección de la wallet conectada
|
|
261
|
+
*/
|
|
262
|
+
address: {
|
|
251
263
|
type: String,
|
|
252
|
-
default:
|
|
253
|
-
|
|
264
|
+
default: null
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* Función para truncar la dirección
|
|
268
|
+
*/
|
|
269
|
+
shortenAddressFn: {
|
|
270
|
+
type: Function,
|
|
271
|
+
default: (e) => !e || e.length < 13 ? e : `${e.slice(0, 6)}...${e.slice(-4)}`
|
|
254
272
|
}
|
|
255
273
|
},
|
|
256
274
|
emits: [
|
|
257
|
-
/** Se emite cuando se
|
|
258
|
-
"
|
|
259
|
-
/** Se emite cuando se
|
|
260
|
-
"
|
|
261
|
-
/** Se emite cuando hay un error de conexión */
|
|
262
|
-
"error"
|
|
275
|
+
/** Se emite cuando se hace click en el botón (para conectar) */
|
|
276
|
+
"click",
|
|
277
|
+
/** Se emite cuando se solicita desconexión */
|
|
278
|
+
"disconnect"
|
|
263
279
|
],
|
|
264
|
-
setup(e, { emit:
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
testnet: "https://testnet.vechain.org"
|
|
278
|
-
}, A = async () => {
|
|
279
|
-
try {
|
|
280
|
-
const { DAppKit: s } = await import("./index-Bywq0IP9.js").then((a) => a.A);
|
|
281
|
-
t.value || (t.value = document.createElement("vdk-button"), t.value.setAttribute("node-url", C[n.network]), document.addEventListener("vdk-connected", w), document.addEventListener("vdk-disconnected", b), t.value.style.display = "none", document.body.appendChild(t.value));
|
|
282
|
-
} catch (s) {
|
|
283
|
-
console.error("Error initializing VeChain DApp Kit:", s), g(s.message), o("error", s.message);
|
|
284
|
-
}
|
|
285
|
-
}, w = (s) => {
|
|
286
|
-
var z;
|
|
287
|
-
const a = (z = s.detail) == null ? void 0 : z.address;
|
|
288
|
-
a && ($(a), o("connected", a)), _();
|
|
289
|
-
}, b = () => {
|
|
290
|
-
k(), o("disconnected");
|
|
291
|
-
}, I = async () => {
|
|
292
|
-
var s;
|
|
293
|
-
if (m.value) {
|
|
294
|
-
V();
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
B();
|
|
298
|
-
try {
|
|
299
|
-
t.value ? t.value.click() : (s = c.value) == null || s.click();
|
|
300
|
-
} catch (a) {
|
|
301
|
-
g(a.message), o("error", a.message), _();
|
|
302
|
-
}
|
|
303
|
-
}, V = () => {
|
|
304
|
-
try {
|
|
305
|
-
if (t.value) {
|
|
306
|
-
const s = new CustomEvent("vdk-disconnect");
|
|
307
|
-
document.dispatchEvent(s);
|
|
308
|
-
}
|
|
309
|
-
k(), o("disconnected");
|
|
310
|
-
} catch (s) {
|
|
311
|
-
g(s.message), o("error", s.message);
|
|
312
|
-
}
|
|
313
|
-
}, N = p(() => [
|
|
314
|
-
"o-vechain-login",
|
|
315
|
-
`o-vechain-login--${n.variant}`,
|
|
316
|
-
`o-vechain-login--${n.size}`,
|
|
317
|
-
{
|
|
318
|
-
"o-vechain-login--connected": m.value,
|
|
319
|
-
"o-vechain-login--loading": h.value
|
|
320
|
-
}
|
|
321
|
-
]);
|
|
322
|
-
return E(() => {
|
|
323
|
-
A();
|
|
324
|
-
}), L(() => {
|
|
325
|
-
document.removeEventListener("vdk-connected", w), document.removeEventListener("vdk-disconnected", b), t.value && t.value.parentNode && t.value.parentNode.removeChild(t.value);
|
|
326
|
-
}), U(() => n.network, () => {
|
|
327
|
-
t.value && t.value.setAttribute("node-url", C[n.network]);
|
|
328
|
-
}), (s, a) => (l(), d("button", {
|
|
329
|
-
ref_key: "walletButtonRef",
|
|
330
|
-
ref: c,
|
|
331
|
-
class: x(N.value),
|
|
332
|
-
disabled: v(h),
|
|
280
|
+
setup(e, { emit: n }) {
|
|
281
|
+
const t = e, o = n, s = () => {
|
|
282
|
+
t.isConnected ? o("disconnect") : o("click");
|
|
283
|
+
}, l = d(() => ({
|
|
284
|
+
"o-vechain-login": !0,
|
|
285
|
+
[`o-vechain-login--${t.variant}`]: !0,
|
|
286
|
+
[`o-vechain-login--${t.size}`]: !0,
|
|
287
|
+
"o-vechain-login--connected": t.isConnected,
|
|
288
|
+
"o-vechain-login--loading": t.isConnecting
|
|
289
|
+
})), c = d(() => t.shortenAddressFn(t.address));
|
|
290
|
+
return (g, u) => (i(), a("button", {
|
|
291
|
+
class: h(l.value),
|
|
292
|
+
disabled: e.isConnecting,
|
|
333
293
|
type: "button",
|
|
334
|
-
onClick:
|
|
294
|
+
onClick: s
|
|
335
295
|
}, [
|
|
336
|
-
|
|
337
|
-
|
|
296
|
+
u[1] || (u[1] = r("span", { class: "o-vechain-login__icon" }, [
|
|
297
|
+
r("svg", {
|
|
338
298
|
viewBox: "0 0 24 24",
|
|
339
299
|
fill: "currentColor",
|
|
340
300
|
width: "1em",
|
|
341
301
|
height: "1em"
|
|
342
302
|
}, [
|
|
343
|
-
|
|
303
|
+
r("path", { d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" })
|
|
344
304
|
])
|
|
345
305
|
], -1)),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
306
|
+
e.isConnecting ? (i(), a("span", A, " Connecting... ")) : e.isConnected ? (i(), a("span", F, b(c.value), 1)) : (i(), a("span", j, " Connect Wallet ")),
|
|
307
|
+
e.isConnected ? (i(), a("span", q, [...u[0] || (u[0] = [
|
|
308
|
+
r("svg", {
|
|
349
309
|
viewBox: "0 0 24 24",
|
|
350
310
|
fill: "none",
|
|
351
311
|
stroke: "currentColor",
|
|
352
312
|
width: "1em",
|
|
353
313
|
height: "1em"
|
|
354
314
|
}, [
|
|
355
|
-
|
|
315
|
+
r("path", {
|
|
356
316
|
"stroke-linecap": "round",
|
|
357
317
|
"stroke-linejoin": "round",
|
|
358
318
|
"stroke-width": "2",
|
|
359
319
|
d: "M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
|
360
320
|
})
|
|
361
321
|
], -1)
|
|
362
|
-
])])) :
|
|
363
|
-
], 10,
|
|
322
|
+
])])) : p("", !0)
|
|
323
|
+
], 10, T));
|
|
364
324
|
}
|
|
365
|
-
},
|
|
325
|
+
}, W = {
|
|
366
326
|
/**
|
|
367
327
|
* Instala el plugin en la aplicación Vue
|
|
368
328
|
*
|
|
369
329
|
* @param {import('vue').App} app - Instancia de la aplicación
|
|
370
330
|
*/
|
|
371
331
|
install(e) {
|
|
372
|
-
e.component("OButton",
|
|
332
|
+
e.component("OButton", $), e.component("OModal", I), e.component("OLoading", E), e.component("OIcon", H), e.component("OVeChainLogin", D);
|
|
373
333
|
}
|
|
374
334
|
};
|
|
375
335
|
export {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
336
|
+
$ as OButton,
|
|
337
|
+
H as OIcon,
|
|
338
|
+
E as OLoading,
|
|
339
|
+
I as OModal,
|
|
340
|
+
D as OVeChainLogin,
|
|
341
|
+
W as default
|
|
382
342
|
};
|