@ghostdagger/ghostlink-vue 0.0.0-stage → 0.1.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GhostDagger contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # Temporary Holding Version
1
+ # @ghostdagger/ghostlink-vue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Native Vue 3.5+ components for Ghostlink. Requires `@ghostdagger/ghostlink-core` and a configured `@ghostdagger/ghostlink-server` backend.
4
+
5
+ The composable and component slots expose the same read-only snapshot type, including nested session, wallet, error, and capability data. Neither the snapshot ref nor its nested values should be assigned; use client methods to change state. Packaged declarations preserve component/composable hover guidance, including lifecycle behavior and prop defaults.
6
+
7
+ Start with the [complete Vue integration guide](https://github.com/ghostdagger-labs/ghostlink/blob/main/docs/integration/vue.md) for copyable app and backend files, login, protected requests, session restoration, and logout.
8
+
9
+ ```ts
10
+ import { createGhostlink } from '@ghostdagger/ghostlink-core';
11
+ import { GhostlinkPlugin } from '@ghostdagger/ghostlink-vue';
12
+ import '@ghostdagger/ghostlink-core/styles.css';
13
+ import '@ghostdagger/ghostlink-core/fonts.css';
14
+ const client = createGhostlink({ app: { name: 'Your dApp', url: 'https://app.example' } });
15
+ app.use(GhostlinkPlugin, client);
16
+ ```
17
+
18
+ Render one `<GhostlinkModal />` and a `<GhostlinkConnectButton />`. Both accept `theme="dark" | "light"` and a `variables` map of `--ghostlink-*` branding overrides. `useGhostlink()` returns `{ client, snapshot }`, where snapshot is a shallow readonly ref. `GhostlinkProvider` offers component-local injection as an alternative to the app plugin.
19
+
20
+ The connect button's default slot receives `snapshot` and `open`. The modal's `content` slot receives `snapshot` and `client`; custom content assumes accessibility/review responsibilities. Subscriptions clean up with component scopes.
21
+
22
+ The plugin activates the client when the app root mounts and releases it when the app unmounts. `GhostlinkProvider` does the same for its component lifetime. Both initialize without a connect button. They borrow supplied clients: cleanup stops the final attachment's browser activity without destroying the client or signing out an established session. Keep a stable client per provider lifetime; use a new provider `key` to replace it deliberately.
23
+
24
+ Gate identity-dependent UI on `snapshot.value.initialization === 'ready'` (or `snapshot.initialization` in templates). `idle` and `restoring` are unresolved; `error` exposes `initializationError`. Retry with `client.restoreSession()`. A retained session is only the last known session until readiness is restored. The standard connect button is disabled while the check is pending.
25
+
26
+ Imports, construction, provider rendering and plugin installation are passive during SSR. Create a separate client per request; discovery and restoration begin after browser mounting. Normal provider/plugin cleanup releases active resources. The creator calls `client.destroy()` only when permanently retiring an instance.
27
+
28
+ Pre-release. Generic compatibility signing is verified by the backend but does not provide wallet-side domain enforcement. Real-wallet acceptance is recorded separately from automated provider fixtures in the repository documentation.
29
+
30
+ Beta acceptance status: live protected-API and real testnet transaction checks are deferred. Transaction APIs remain enabled; automated fixtures do not constitute real-wallet certification. See the [compatibility record](https://github.com/ghostdagger-labs/ghostlink/blob/main/docs/testing/compatibility-v1.json).
@@ -0,0 +1,93 @@
1
+ import * as vue from 'vue';
2
+ import { Plugin } from 'vue';
3
+ import * as _ghostdagger_ghostlink_core from '@ghostdagger/ghostlink-core';
4
+ import { Ghostlink } from '@ghostdagger/ghostlink-core';
5
+
6
+ type __VLS_Props$2 = {
7
+ /** Stable client for this provider lifetime. Use a new provider key to deliberately replace it. */
8
+ client: Ghostlink;
9
+ };
10
+ declare const __VLS_template$2: () => {
11
+ __VLS_Slots: {
12
+ default?: (props: {}) => any;
13
+ };
14
+ };
15
+ type __VLS_Slots$2 = ReturnType<typeof __VLS_template$2>['__VLS_Slots'];
16
+ declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export$2: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
18
+ declare const _default$2: typeof __VLS_export$2;
19
+
20
+ type __VLS_WithSlots$2<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
25
+
26
+ type __VLS_Props$1 = {
27
+ /** Scoped color theme. Defaults to dark. */
28
+ theme?: 'dark' | 'light';
29
+ /** Scoped --ghostlink-* CSS custom properties. Import @ghostdagger/ghostlink-core/styles.css once. */
30
+ variables?: Record<string, string>;
31
+ /** Signed-out button/accessibility label. Defaults to Connect wallet. */
32
+ label?: string;
33
+ };
34
+ declare const __VLS_template$1: () => {
35
+ __VLS_Slots: {
36
+ default?: (props: {
37
+ snapshot: _ghostdagger_ghostlink_core.GhostlinkSnapshot;
38
+ open: () => void;
39
+ }) => any;
40
+ };
41
+ };
42
+ type __VLS_Slots$1 = ReturnType<typeof __VLS_template$1>['__VLS_Slots'];
43
+ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
44
+ declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
45
+ declare const _default$1: typeof __VLS_export$1;
46
+
47
+ type __VLS_WithSlots$1<T, S> = T & {
48
+ new (): {
49
+ $slots: S;
50
+ };
51
+ };
52
+
53
+ type __VLS_Props = {
54
+ /** Scoped color theme. Defaults to dark. */
55
+ theme?: 'dark' | 'light';
56
+ /** Scoped --ghostlink-* CSS custom properties. Import @ghostdagger/ghostlink-core/styles.css once. */
57
+ variables?: Record<string, string>;
58
+ };
59
+ declare const __VLS_template: () => {
60
+ __VLS_Slots: {
61
+ content?: (props: {
62
+ snapshot: _ghostdagger_ghostlink_core.GhostlinkSnapshot;
63
+ client: _ghostdagger_ghostlink_core.Ghostlink;
64
+ }) => any;
65
+ };
66
+ };
67
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
68
+ declare const __VLS_base: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
69
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
70
+ declare const _default: typeof __VLS_export;
71
+
72
+ type __VLS_WithSlots<T, S> = T & {
73
+ new (): {
74
+ $slots: S;
75
+ };
76
+ };
77
+
78
+ /** Install once with app.use(GhostlinkPlugin, client). Borrows a stable client, initializes on root mount, and releases on unmount without destroying it or signing out. Passive during SSR; create a client per request. */
79
+ declare const GhostlinkPlugin: Plugin<[Ghostlink]>;
80
+ /** Read the injected client and readonly snapshot ref; nested snapshot data is readonly too. Use snapshot.value in script and wait for initialization === 'ready' before using identity. Cleans up with the component scope; requires GhostlinkPlugin or GhostlinkProvider. */
81
+ declare function useGhostlink(): {
82
+ client: Ghostlink;
83
+ snapshot: vue.ComputedRef<_ghostdagger_ghostlink_core.GhostlinkSnapshot>;
84
+ };
85
+
86
+ /** Component-scoped alternative to GhostlinkPlugin. Borrows a stable client and owns its mounted lifecycle; SSR is passive and unmount does not sign out or destroy the client. */
87
+ declare const GhostlinkProvider: typeof _default$2;
88
+ /** Open wallet login or account details. Disabled while initialization is idle/restoring; the provider owns initialization. The default slot receives a readonly snapshot and open action. Theme defaults to dark, label to Connect wallet; variables scopes --ghostlink-* CSS properties. */
89
+ declare const GhostlinkConnectButton: typeof _default$1;
90
+ /** Render one modal host per client. The content slot can replace the body; custom content owns accessible review controls and client actions. Theme defaults to dark; variables scopes --ghostlink-* CSS properties. */
91
+ declare const GhostlinkModal: typeof _default;
92
+
93
+ export { GhostlinkConnectButton, GhostlinkModal, GhostlinkPlugin, GhostlinkProvider, useGhostlink };
package/dist/index.js ADDED
@@ -0,0 +1,715 @@
1
+ import { inject as se, shallowRef as le, onScopeDispose as ae, computed as q, defineComponent as z, provide as ne, watch as A, onMounted as j, onUnmounted as H, renderSlot as M, openBlock as i, createElementBlock as r, unref as t, normalizeStyle as Y, Fragment as h, createElementVNode as e, createTextVNode as g, toDisplayString as o, useId as oe, ref as w, nextTick as D, createBlock as N, Teleport as ie, withModifiers as K, createVNode as b, createCommentVNode as y, renderList as I, withDirectives as B, vModelText as P } from "vue";
2
+ import { GhostlinkError as re, getPresentation as F, createMessageQr as ce, trapDialogFocus as ue, remainingTime as de, scanQrCamera as ge, scanQrImage as pe } from "@ghostdagger/ghostlink-core";
3
+ import { ArrowLeft as ve, X as be, ScanLine as me, LoaderCircle as ye, Link2 as V, Check as W, TriangleAlert as X, Clock as he, Copy as ke, Camera as we, CircleX as _e } from "@lucide/vue";
4
+ const T = /* @__PURE__ */ Symbol("Ghostlink"), ps = {
5
+ install(u, n) {
6
+ u.provide(T, n);
7
+ let s;
8
+ u.mixin({
9
+ mounted() {
10
+ this.$parent === null && (s = n.attach());
11
+ },
12
+ // Root replacement during HMR can unmount the component without app.unmount().
13
+ beforeUnmount() {
14
+ this.$parent === null && (s?.(), s = void 0);
15
+ }
16
+ }), u.onUnmount(() => {
17
+ s?.();
18
+ });
19
+ }
20
+ };
21
+ function O() {
22
+ const u = se(T);
23
+ if (!u) throw new Error("Install GhostlinkPlugin or wrap this component in GhostlinkProvider.");
24
+ const n = le(u.getSnapshot()), s = u.subscribe(() => {
25
+ n.value = u.getSnapshot();
26
+ });
27
+ return ae(s), { client: u, snapshot: q(() => n.value) };
28
+ }
29
+ const fe = /* @__PURE__ */ z({
30
+ __name: "GhostlinkProvider",
31
+ props: {
32
+ client: {}
33
+ },
34
+ setup(u) {
35
+ const n = u, s = n.client;
36
+ ne(T, s), A(() => n.client, (k) => {
37
+ if (k !== s) throw new re("INVALID_REQUEST", "GhostlinkProvider requires a stable client. Remount the provider with a new key to replace it.");
38
+ }, { flush: "sync" });
39
+ let c;
40
+ return j(() => {
41
+ c = s.attach();
42
+ }), H(() => {
43
+ c?.();
44
+ }), (k, p) => M(k.$slots, "default");
45
+ }
46
+ }), Ce = ["data-ghostlink-theme", "data-authenticated", "disabled", "aria-label"], Se = ["data-wallet"], xe = ["src"], Re = /* @__PURE__ */ z({
47
+ __name: "GhostlinkConnectButton",
48
+ props: {
49
+ theme: {},
50
+ variables: {},
51
+ label: {}
52
+ },
53
+ setup(u) {
54
+ const { client: n, snapshot: s } = O(), c = q(() => F(s.value, n.app));
55
+ return (k, p) => (i(), r("button", {
56
+ type: "button",
57
+ class: "gl-theme gl-connect",
58
+ "data-ghostlink-theme": u.theme ?? "dark",
59
+ style: Y(u.variables),
60
+ "data-authenticated": !!t(s).session,
61
+ disabled: t(s).initialization === "idle" || t(s).initialization === "restoring",
62
+ onClick: p[0] || (p[0] = //@ts-ignore
63
+ (...x) => t(n).open && t(n).open(...x)),
64
+ "aria-label": t(s).session ? `Account ${t(s).session.address}` : u.label ?? "Connect wallet"
65
+ }, [
66
+ M(k.$slots, "default", {
67
+ snapshot: t(s),
68
+ open: t(n).open
69
+ }, () => [
70
+ t(s).session ? (i(), r(h, { key: 0 }, [
71
+ e("span", {
72
+ class: "gl-wallet-mark",
73
+ "data-wallet": c.value.wallet?.id
74
+ }, [
75
+ c.value.wallet?.icon ? (i(), r("img", {
76
+ key: 0,
77
+ src: c.value.wallet.icon,
78
+ alt: ""
79
+ }, null, 8, xe)) : (i(), r(h, { key: 1 }, [
80
+ g(o(c.value.wallet?.mark ?? "K"), 1)
81
+ ], 64))
82
+ ], 8, Se),
83
+ g(o(c.value.address), 1)
84
+ ], 64)) : (i(), r(h, { key: 1 }, [
85
+ p[1] || (p[1] = e("svg", {
86
+ width: "14",
87
+ height: "14",
88
+ viewBox: "0 0 34 20",
89
+ fill: "none",
90
+ "aria-hidden": "true",
91
+ focusable: "false"
92
+ }, [
93
+ e("circle", {
94
+ cx: "11",
95
+ cy: "10",
96
+ r: "6.4",
97
+ fill: "currentColor"
98
+ }),
99
+ e("circle", {
100
+ cx: "23",
101
+ cy: "10",
102
+ r: "6.4",
103
+ stroke: "currentColor",
104
+ "stroke-width": "2.1"
105
+ })
106
+ ], -1)),
107
+ g(o(u.label ?? "Connect wallet"), 1)
108
+ ], 64))
109
+ ])
110
+ ], 12, Ce));
111
+ }
112
+ }), Ie = ["data-ghostlink-theme"], Ae = { class: "gl-header" }, qe = ["disabled"], $e = ["data-active"], Ee = {
113
+ key: 0,
114
+ class: "gl-body"
115
+ }, Ge = { class: "gl-wallets" }, Ke = ["disabled", "onClick"], ze = ["data-wallet"], Me = ["src"], Te = { class: "gl-wallet-copy" }, Ue = { class: "gl-wallet-name" }, Le = { class: "gl-wallet-note" }, Qe = ["data-installed"], De = {
116
+ key: 0,
117
+ class: "gl-copy gl-center"
118
+ }, Ne = ["disabled"], Be = { class: "gl-footer" }, Pe = {
119
+ key: 1,
120
+ class: "gl-wait",
121
+ "aria-live": "polite"
122
+ }, Ve = { class: "gl-wait-mark" }, We = ["data-wallet"], Xe = ["src"], je = { class: "gl-heading" }, He = { class: "gl-copy" }, Ye = { class: "gl-progress" }, Fe = {
123
+ key: 2,
124
+ class: "gl-body"
125
+ }, Oe = { class: "gl-app-card" }, Je = { class: "gl-app-icon" }, Ze = ["src"], et = { class: "gl-app-name" }, tt = { class: "gl-domain" }, st = { class: "gl-rows" }, lt = { class: "gl-row" }, at = { class: "gl-chip" }, nt = { class: "gl-row" }, ot = { class: "gl-chips" }, it = { class: "gl-rows" }, rt = { class: "gl-row" }, ct = { class: "gl-row-value" }, ut = { class: "gl-notice" }, dt = { class: "gl-actions" }, gt = ["disabled"], pt = {
126
+ key: 3,
127
+ class: "gl-body"
128
+ }, vt = { class: "gl-field" }, bt = ["placeholder"], mt = ["disabled"], yt = { class: "gl-notice" }, ht = {
129
+ key: 4,
130
+ class: "gl-body"
131
+ }, kt = { class: "gl-rows" }, wt = { class: "gl-row" }, _t = { class: "gl-row-value" }, ft = {
132
+ key: 0,
133
+ class: "gl-qr-frame"
134
+ }, Ct = ["src"], St = { class: "gl-timer" }, xt = {
135
+ class: "gl-message",
136
+ style: { "margin-top": "12px" }
137
+ }, Rt = { class: "gl-field" }, It = { class: "gl-actions" }, At = { class: "gl-button" }, qt = ["disabled"], $t = ["disabled"], Et = {
138
+ key: 1,
139
+ role: "status",
140
+ class: "gl-copy",
141
+ style: { "margin-top": "12px" }
142
+ }, Gt = {
143
+ key: 5,
144
+ class: "gl-body"
145
+ }, Kt = { class: "gl-app-card" }, zt = { class: "gl-app-icon" }, Mt = { class: "gl-app-name" }, Tt = { class: "gl-domain" }, Ut = { class: "gl-message" }, Lt = { class: "gl-label" }, Qt = { class: "gl-row" }, Dt = { class: "gl-row-value" }, Nt = { class: "gl-actions" }, Bt = ["disabled"], Pt = {
146
+ key: 6,
147
+ class: "gl-connected"
148
+ }, Vt = {
149
+ class: "gl-center",
150
+ style: { "margin-bottom": "16px" }
151
+ }, Wt = { class: "gl-success-icon" }, Xt = {
152
+ class: "gl-copy",
153
+ style: { margin: "4px 0 0" }
154
+ }, jt = { class: "gl-rows" }, Ht = { class: "gl-row-label" }, Yt = ["title"], Ft = {
155
+ key: 0,
156
+ class: "gl-copy"
157
+ }, Ot = {
158
+ key: 7,
159
+ class: "gl-body gl-center",
160
+ style: { padding: "30px 22px 20px" }
161
+ }, Jt = { class: "gl-error-icon" }, Zt = { class: "gl-heading" }, es = {
162
+ class: "gl-copy",
163
+ role: "alert"
164
+ }, ts = { class: "gl-code" }, ss = ["href"], ls = { class: "gl-actions" }, as = ["disabled"], ns = {
165
+ key: 8,
166
+ class: "gl-body"
167
+ }, os = { class: "gl-onboarding" }, is = ["href"], rs = {
168
+ key: 0,
169
+ role: "status",
170
+ class: "gl-error",
171
+ style: { padding: "0 18px 12px" }
172
+ }, cs = /* @__PURE__ */ z({
173
+ __name: "GhostlinkModal",
174
+ props: {
175
+ theme: {},
176
+ variables: {}
177
+ },
178
+ setup(u) {
179
+ const { client: n, snapshot: s } = O(), c = q(() => F(s.value, n.app)), k = `ghostlink-${oe()}`, p = w(), x = w(), $ = w(""), _ = w(""), R = w(""), m = w(""), f = w(!1), E = w(Date.now());
180
+ let U, L, G;
181
+ const Q = q(() => !!s.value.challenge && Date.parse(s.value.challenge.expiresAt) <= E.value);
182
+ async function v(d) {
183
+ m.value = "";
184
+ try {
185
+ await d();
186
+ } catch {
187
+ }
188
+ }
189
+ async function J() {
190
+ try {
191
+ await navigator.clipboard.writeText(s.value.challenge?.message ?? ""), m.value = "Message copied";
192
+ } catch {
193
+ m.value = "Select and copy the message below.";
194
+ }
195
+ }
196
+ function C() {
197
+ G?.(), G = void 0, f.value = !1;
198
+ }
199
+ async function Z() {
200
+ m.value = "", f.value = !0, await D();
201
+ try {
202
+ const d = await ge(x.value, (l) => {
203
+ _.value = l.trim(), C();
204
+ });
205
+ f.value ? G = d : d();
206
+ } catch {
207
+ f.value = !1, m.value = "Camera unavailable. Paste the signature or upload its QR image.";
208
+ }
209
+ }
210
+ async function ee(d) {
211
+ const l = d.target.files?.[0];
212
+ if (l)
213
+ try {
214
+ _.value = (await pe(l)).trim(), m.value = "Signature scanned";
215
+ } catch {
216
+ m.value = "No readable QR code found. Paste the signature instead.";
217
+ }
218
+ }
219
+ async function te() {
220
+ if (c.value.wallet?.kind === "manual" && s.value.error?.code === "INVALID_REQUEST" && s.value.walletId)
221
+ await v(() => n.connect(s.value.walletId));
222
+ else if (s.value.error?.code === "NETWORK_MISMATCH" && !s.value.session && s.value.walletId) {
223
+ const d = s.value.walletId;
224
+ await v(async () => {
225
+ await n.switchWalletNetwork(), await n.connect(d);
226
+ });
227
+ } else s.value.session ? n.open() : s.value.account ? await v(() => n.prepareAuthentication()) : s.value.walletId ? await v(() => n.connect(s.value.walletId)) : n.back();
228
+ }
229
+ return A(() => s.value.open, async (d) => {
230
+ await D(), d && !p.value?.open ? p.value?.showModal() : !d && p.value?.open && p.value.close(), d || C();
231
+ }, { flush: "post" }), A(() => s.value.challenge?.id, async () => {
232
+ _.value = "", R.value = "";
233
+ const d = s.value.challenge?.message;
234
+ if (d) {
235
+ const l = await ce(d);
236
+ d === s.value.challenge?.message && (R.value = l);
237
+ }
238
+ }), A(() => s.value.step, () => {
239
+ m.value = "", C();
240
+ }), j(() => {
241
+ L = n.attachUI(), U = setInterval(() => {
242
+ E.value = Date.now();
243
+ }, 1e3), s.value.open && p.value?.showModal();
244
+ }), H(() => {
245
+ clearInterval(U), L?.(), C();
246
+ }), (d, l) => (i(), N(ie, { to: "body" }, [
247
+ e("dialog", {
248
+ ref_key: "dialog",
249
+ ref: p,
250
+ class: "gl-theme gl-dialog",
251
+ "data-ghostlink-theme": u.theme ?? "dark",
252
+ style: Y(u.variables),
253
+ "aria-labelledby": k,
254
+ onKeydown: l[18] || (l[18] = (a) => t(ue)(a, p.value)),
255
+ onCancel: l[19] || (l[19] = K(
256
+ //@ts-ignore
257
+ (...a) => t(n).close && t(n).close(...a),
258
+ ["prevent"]
259
+ )),
260
+ onClick: l[20] || (l[20] = (a) => {
261
+ if (a.target === p.value) {
262
+ const S = p.value.getBoundingClientRect();
263
+ (a.clientX < S.left || a.clientX > S.right || a.clientY < S.top || a.clientY > S.bottom) && t(n).close();
264
+ }
265
+ })
266
+ }, [
267
+ e("header", Ae, [
268
+ ["choose", "connected"].includes(t(s).step) ? y("", !0) : (i(), r("button", {
269
+ key: 0,
270
+ type: "button",
271
+ class: "gl-icon-button",
272
+ "aria-label": "Back",
273
+ disabled: t(s).busy,
274
+ onClick: l[0] || (l[0] = //@ts-ignore
275
+ (...a) => t(n).back && t(n).back(...a))
276
+ }, [
277
+ b(t(ve), { size: 15 })
278
+ ], 8, qe)),
279
+ e("h2", {
280
+ id: k,
281
+ class: "gl-title"
282
+ }, o(t(s).request?.title ?? c.value.title), 1),
283
+ e("span", {
284
+ class: "gl-status",
285
+ "data-active": !!t(s).session
286
+ }, [
287
+ l[21] || (l[21] = e("span", { class: "gl-dot" }, null, -1)),
288
+ g(o(c.value.status), 1)
289
+ ], 8, $e),
290
+ e("button", {
291
+ type: "button",
292
+ class: "gl-icon-button",
293
+ "aria-label": "Close",
294
+ onClick: l[1] || (l[1] = //@ts-ignore
295
+ (...a) => t(n).close && t(n).close(...a))
296
+ }, [
297
+ b(t(be), { size: 15 })
298
+ ])
299
+ ]),
300
+ M(d.$slots, "content", {
301
+ snapshot: t(s),
302
+ client: t(n)
303
+ }, () => [
304
+ t(s).step === "choose" ? (i(), r("section", Ee, [
305
+ e("div", Ge, [
306
+ (i(!0), r(h, null, I(t(s).wallets, (a) => (i(), r("button", {
307
+ key: a.id,
308
+ type: "button",
309
+ class: "gl-wallet",
310
+ disabled: t(s).busy,
311
+ onClick: (S) => v(() => t(n).connect(a.id))
312
+ }, [
313
+ e("span", {
314
+ class: "gl-wallet-mark",
315
+ "data-wallet": a.id
316
+ }, [
317
+ a.icon ? (i(), r("img", {
318
+ key: 0,
319
+ src: a.icon,
320
+ alt: ""
321
+ }, null, 8, Me)) : (i(), r(h, { key: 1 }, [
322
+ g(o(a.mark), 1)
323
+ ], 64))
324
+ ], 8, ze),
325
+ e("span", Te, [
326
+ e("span", Ue, o(a.name), 1),
327
+ e("span", Le, o(a.kind === "manual" ? "Mobile · manual message signing" : "Browser wallet"), 1)
328
+ ]),
329
+ e("span", {
330
+ class: "gl-badge",
331
+ "data-installed": a.kind === "injected" && a.available
332
+ }, o(a.kind === "manual" ? "QR / paste" : a.available ? "Installed" : "Install"), 9, Qe)
333
+ ], 8, Ke))), 128)),
334
+ t(s).wallets.length ? y("", !0) : (i(), r("p", De, "No wallets configured."))
335
+ ]),
336
+ t(s).wallets.some((a) => a.id === "kaspium") ? (i(), r("button", {
337
+ key: 0,
338
+ type: "button",
339
+ class: "gl-button gl-mobile-button",
340
+ disabled: t(s).busy,
341
+ onClick: l[2] || (l[2] = (a) => v(() => t(n).connect("kaspium")))
342
+ }, [
343
+ b(t(me), { size: 16 }),
344
+ l[22] || (l[22] = g("Sign with a mobile wallet", -1))
345
+ ], 8, Ne)) : y("", !0),
346
+ e("div", Be, [
347
+ l[23] || (l[23] = e("span", null, "Don't have a Kaspa wallet?", -1)),
348
+ e("button", {
349
+ type: "button",
350
+ class: "gl-link",
351
+ onClick: l[3] || (l[3] = //@ts-ignore
352
+ (...a) => t(n).showWalletHelp && t(n).showWalletHelp(...a))
353
+ }, "Get started →")
354
+ ])
355
+ ])) : t(s).step === "connecting" || t(s).step === "verifying" ? (i(), r("section", Pe, [
356
+ e("div", Ve, [
357
+ e("span", {
358
+ class: "gl-wallet-mark",
359
+ "data-wallet": c.value.wallet?.id
360
+ }, [
361
+ c.value.wallet?.icon ? (i(), r("img", {
362
+ key: 0,
363
+ src: c.value.wallet.icon,
364
+ alt: ""
365
+ }, null, 8, Xe)) : (i(), r(h, { key: 1 }, [
366
+ g(o(c.value.wallet?.mark ?? "K"), 1)
367
+ ], 64))
368
+ ], 8, We)
369
+ ]),
370
+ e("h3", je, o(t(s).step === "verifying" ? "Verifying your signature" : `Waiting for ${c.value.wallet?.name ?? "your wallet"}`), 1),
371
+ e("p", He, o(t(s).step === "verifying" ? "Confirming your account and establishing a secure application session." : "Review and approve the request in your wallet. Your private keys stay there."), 1),
372
+ e("div", Ye, [
373
+ b(t(ye), {
374
+ class: "gl-spin",
375
+ size: 14
376
+ }),
377
+ g(o(t(s).step === "verifying" ? "Checking signature" : "Awaiting wallet approval"), 1)
378
+ ]),
379
+ e("button", {
380
+ type: "button",
381
+ class: "gl-button gl-full",
382
+ onClick: l[4] || (l[4] = //@ts-ignore
383
+ (...a) => t(n).close && t(n).close(...a))
384
+ }, "Cancel")
385
+ ])) : t(s).step === "review" ? (i(), r("section", Fe, [
386
+ e("div", Oe, [
387
+ e("span", Je, [
388
+ t(n).app.icon ? (i(), r("img", {
389
+ key: 0,
390
+ src: t(n).app.icon,
391
+ alt: ""
392
+ }, null, 8, Ze)) : (i(), N(t(V), {
393
+ key: 1,
394
+ size: 20
395
+ }))
396
+ ]),
397
+ e("span", null, [
398
+ e("span", et, o(t(n).app.name), 1),
399
+ e("span", tt, o(c.value.domain), 1)
400
+ ])
401
+ ]),
402
+ l[27] || (l[27] = e("h3", { class: "gl-label" }, "Requested access · Kaspa", -1)),
403
+ e("div", st, [
404
+ e("div", lt, [
405
+ l[24] || (l[24] = e("span", { class: "gl-row-label" }, "chain", -1)),
406
+ e("span", at, "kaspa:" + o(t(s).network), 1)
407
+ ]),
408
+ e("div", nt, [
409
+ l[25] || (l[25] = e("span", { class: "gl-row-label" }, "requests", -1)),
410
+ e("span", ot, [
411
+ (i(!0), r(h, null, I(c.value.methods, (a) => (i(), r("span", {
412
+ key: a,
413
+ class: "gl-chip"
414
+ }, o(a), 1))), 128))
415
+ ])
416
+ ])
417
+ ]),
418
+ l[28] || (l[28] = e("h3", { class: "gl-label" }, "Signing account", -1)),
419
+ e("div", it, [
420
+ e("div", rt, [
421
+ b(t(W), { size: 16 }),
422
+ e("span", ct, o(t(s).account?.address), 1)
423
+ ])
424
+ ]),
425
+ e("div", ut, [
426
+ b(t(X), { size: 15 }),
427
+ l[26] || (l[26] = e("span", null, [
428
+ g("This session can "),
429
+ e("strong", null, "request signatures"),
430
+ g(", but every transaction still needs a separate in-wallet approval.")
431
+ ], -1))
432
+ ]),
433
+ e("div", dt, [
434
+ e("button", {
435
+ type: "button",
436
+ class: "gl-button",
437
+ onClick: l[5] || (l[5] = (a) => v(() => t(n).disconnect()))
438
+ }, "Reject"),
439
+ e("button", {
440
+ type: "button",
441
+ class: "gl-button gl-primary",
442
+ disabled: t(s).busy,
443
+ onClick: l[6] || (l[6] = (a) => v(() => t(n).prepareAuthentication()))
444
+ }, "Continue to sign in", 8, gt)
445
+ ])
446
+ ])) : t(s).step === "address" ? (i(), r("section", pt, [
447
+ l[30] || (l[30] = e("p", { class: "gl-copy" }, "Copy your receiving address from Kaspium and paste it below. Choose that same address in Kaspium’s Sign message tool.", -1)),
448
+ e("form", {
449
+ onSubmit: l[8] || (l[8] = K((a) => v(() => t(n).prepareAuthentication($.value)), ["prevent"]))
450
+ }, [
451
+ e("label", vt, [
452
+ e("span", null, "Signing address · " + o(t(s).network), 1),
453
+ B(e("input", {
454
+ "onUpdate:modelValue": l[7] || (l[7] = (a) => $.value = a),
455
+ class: "gl-input",
456
+ "aria-label": "Signing address",
457
+ placeholder: t(s).network === "mainnet" ? "kaspa:…" : "kaspatest:…",
458
+ required: "",
459
+ maxlength: "100",
460
+ autocomplete: "off",
461
+ spellcheck: "false"
462
+ }, null, 8, bt), [
463
+ [P, $.value]
464
+ ])
465
+ ]),
466
+ e("button", {
467
+ class: "gl-button gl-primary gl-full",
468
+ disabled: t(s).busy
469
+ }, "Create login message", 8, mt)
470
+ ], 32),
471
+ e("div", yt, [
472
+ b(t(X), { size: 15 }),
473
+ l[29] || (l[29] = e("span", null, "Signing proves control of this address. It does not create a live connection to Kaspium.", -1))
474
+ ])
475
+ ])) : t(s).step === "manual" ? (i(), r("section", ht, [
476
+ l[36] || (l[36] = e("p", { class: "gl-copy gl-center" }, [
477
+ g("In Kaspium, open "),
478
+ e("strong", null, "Settings → Advanced → Sign message"),
479
+ g(". Select this address, then use the QR button inside the message field. Return the signature here.")
480
+ ], -1)),
481
+ e("div", kt, [
482
+ e("div", wt, [
483
+ l[31] || (l[31] = e("span", { class: "gl-row-label" }, "Account", -1)),
484
+ e("span", _t, o(t(s).account?.address), 1)
485
+ ])
486
+ ]),
487
+ R.value ? (i(), r("div", ft, [
488
+ e("img", {
489
+ src: R.value,
490
+ alt: "QR code containing the exact login message"
491
+ }, null, 8, Ct)
492
+ ])) : y("", !0),
493
+ e("div", St, [
494
+ b(t(he), { size: 13 }),
495
+ g(o(Q.value ? "Message expired" : `Login expires in ${t(de)(t(s).challenge?.expiresAt, E.value)}`), 1)
496
+ ]),
497
+ e("button", {
498
+ type: "button",
499
+ class: "gl-button gl-full",
500
+ onClick: J
501
+ }, [
502
+ b(t(ke), { size: 14 }),
503
+ l[32] || (l[32] = g("Copy login message", -1))
504
+ ]),
505
+ e("details", xt, [
506
+ l[33] || (l[33] = e("summary", { class: "gl-label" }, "Review exact message", -1)),
507
+ e("pre", null, o(t(s).challenge?.message), 1)
508
+ ]),
509
+ e("form", {
510
+ onSubmit: l[12] || (l[12] = K((a) => v(() => t(n).authenticate({ signature: _.value.trim() })), ["prevent"]))
511
+ }, [
512
+ e("label", Rt, [
513
+ l[34] || (l[34] = e("span", null, "Signature from Kaspium", -1)),
514
+ B(e("textarea", {
515
+ "onUpdate:modelValue": l[9] || (l[9] = (a) => _.value = a),
516
+ class: "gl-input",
517
+ "aria-label": "Signature from Kaspium",
518
+ rows: "3",
519
+ maxlength: "132",
520
+ placeholder: "Paste the complete signature",
521
+ required: "",
522
+ autocomplete: "off",
523
+ spellcheck: "false"
524
+ }, null, 512), [
525
+ [P, _.value]
526
+ ])
527
+ ]),
528
+ e("div", It, [
529
+ e("button", {
530
+ type: "button",
531
+ class: "gl-button",
532
+ onClick: l[10] || (l[10] = (a) => f.value ? C() : Z())
533
+ }, [
534
+ b(t(we), { size: 14 }),
535
+ g(o(f.value ? "Stop camera" : "Scan signature"), 1)
536
+ ]),
537
+ e("label", At, [
538
+ l[35] || (l[35] = g("Upload QR", -1)),
539
+ e("input", {
540
+ type: "file",
541
+ accept: "image/*",
542
+ "aria-label": "Upload signature QR",
543
+ class: "gl-sr-only",
544
+ onChange: ee
545
+ }, null, 32)
546
+ ])
547
+ ]),
548
+ f.value ? (i(), r("video", {
549
+ key: 0,
550
+ ref_key: "video",
551
+ ref: x,
552
+ class: "gl-video",
553
+ autoplay: "",
554
+ muted: "",
555
+ playsinline: "",
556
+ "aria-label": "Signature QR scanner"
557
+ }, null, 512)) : y("", !0),
558
+ Q.value ? (i(), r("button", {
559
+ key: 1,
560
+ type: "button",
561
+ class: "gl-button gl-primary gl-full",
562
+ style: { "margin-top": "14px" },
563
+ disabled: t(s).busy,
564
+ onClick: l[11] || (l[11] = (a) => v(() => t(n).prepareAuthentication()))
565
+ }, "Generate a new message", 8, qt)) : (i(), r("button", {
566
+ key: 2,
567
+ class: "gl-button gl-primary gl-full",
568
+ style: { "margin-top": "14px" },
569
+ disabled: t(s).busy || !_.value.trim()
570
+ }, "Verify and sign in", 8, $t))
571
+ ], 32),
572
+ m.value ? (i(), r("p", Et, o(m.value), 1)) : y("", !0)
573
+ ])) : t(s).step === "sign" ? (i(), r("section", Gt, [
574
+ e("div", Kt, [
575
+ e("span", zt, [
576
+ b(t(V), { size: 18 })
577
+ ]),
578
+ e("span", null, [
579
+ e("span", Mt, o(t(s).request?.title ?? "Signature request"), 1),
580
+ e("span", Tt, o(c.value.domain), 1)
581
+ ])
582
+ ]),
583
+ e("div", Ut, [
584
+ e("h3", Lt, o(t(s).request ? "Request" : "Message"), 1),
585
+ e("pre", null, o(t(s).request?.message ?? t(s).challenge?.message), 1)
586
+ ]),
587
+ e("div", Qt, [
588
+ l[37] || (l[37] = e("span", { class: "gl-row-label" }, "Account", -1)),
589
+ e("span", Dt, o(c.value.address), 1)
590
+ ]),
591
+ l[38] || (l[38] = e("p", {
592
+ class: "gl-copy",
593
+ style: { "margin-top": "12px" }
594
+ }, "Continue to your wallet to review and approve.", -1)),
595
+ e("div", Nt, [
596
+ e("button", {
597
+ type: "button",
598
+ class: "gl-button",
599
+ onClick: l[13] || (l[13] = //@ts-ignore
600
+ (...a) => t(n).close && t(n).close(...a))
601
+ }, "Cancel"),
602
+ e("button", {
603
+ type: "button",
604
+ class: "gl-button gl-primary",
605
+ disabled: t(s).busy && !t(s).request,
606
+ onClick: l[14] || (l[14] = (a) => t(s).request ? t(n).confirmRequest() : v(() => t(n).authenticate()))
607
+ }, o(t(s).request ? "Continue in wallet" : "Sign message"), 9, Bt)
608
+ ])
609
+ ])) : t(s).step === "connected" && t(s).session ? (i(), r("section", Pt, [
610
+ e("div", Vt, [
611
+ e("span", Wt, [
612
+ b(t(W), { size: 30 })
613
+ ]),
614
+ l[39] || (l[39] = e("h3", { class: "gl-heading" }, "Session active", -1)),
615
+ e("p", Xt, o(c.value.wallet?.name ?? "Kaspa account") + " · " + o(c.value.networkLabel), 1)
616
+ ]),
617
+ e("div", jt, [
618
+ (i(!0), r(h, null, I(c.value.sessionRows, (a) => (i(), r("div", {
619
+ key: a.label,
620
+ class: "gl-row"
621
+ }, [
622
+ e("span", Ht, o(a.label), 1),
623
+ e("span", {
624
+ class: "gl-row-value",
625
+ title: a.full
626
+ }, o(a.value), 9, Yt)
627
+ ]))), 128))
628
+ ]),
629
+ t(s).connection !== "connected" ? (i(), r("p", Ft, "Your application session is authenticated. Automated wallet requests require a live provider connection.")) : y("", !0),
630
+ e("button", {
631
+ type: "button",
632
+ class: "gl-button gl-danger gl-full",
633
+ onClick: l[15] || (l[15] = (a) => v(() => t(n).disconnect()))
634
+ }, "Sign out")
635
+ ])) : t(s).step === "error" ? (i(), r("section", Ot, [
636
+ e("span", Jt, [
637
+ b(t(_e), { size: 28 })
638
+ ]),
639
+ e("h3", Zt, o(t(s).error?.code === "USER_REJECTED" ? "Request rejected" : t(s).error?.code === "EXPIRED" ? "Login request expired" : "Unable to complete request"), 1),
640
+ e("p", es, o(t(s).error?.message), 1),
641
+ e("span", ts, o(t(s).error?.code), 1),
642
+ t(s).error?.code === "UNAVAILABLE" && c.value.wallet ? (i(), r("a", {
643
+ key: 0,
644
+ class: "gl-button gl-full",
645
+ href: c.value.wallet.installUrl,
646
+ target: "_blank",
647
+ rel: "noopener noreferrer",
648
+ style: { "margin-top": "12px" }
649
+ }, "Get " + o(c.value.wallet.name), 9, ss)) : y("", !0),
650
+ e("div", ls, [
651
+ e("button", {
652
+ type: "button",
653
+ class: "gl-button",
654
+ onClick: l[16] || (l[16] = //@ts-ignore
655
+ (...a) => t(n).back && t(n).back(...a))
656
+ }, "All wallets"),
657
+ e("button", {
658
+ type: "button",
659
+ class: "gl-button gl-primary",
660
+ disabled: t(s).busy,
661
+ onClick: te
662
+ }, o(t(s).session ? "Back to session" : c.value.wallet?.kind === "manual" && t(s).error?.code === "INVALID_REQUEST" ? "Edit address" : t(s).error?.code === "NETWORK_MISMATCH" ? `Switch to ${t(s).network}` : "Try again"), 9, as)
663
+ ])
664
+ ])) : t(s).step === "getwallet" ? (i(), r("section", ns, [
665
+ l[42] || (l[42] = e("p", { class: "gl-copy" }, "A wallet holds your KAS and signs for you. Install a wallet, then return to sign in. Login itself requires no funds.", -1)),
666
+ e("div", os, [
667
+ l[41] || (l[41] = e("span", { class: "gl-number" }, "1", -1)),
668
+ e("div", null, [
669
+ l[40] || (l[40] = e("strong", null, "Choose a Kaspa wallet", -1)),
670
+ e("p", null, [
671
+ (i(!0), r(h, null, I(t(s).wallets, (a) => (i(), r("a", {
672
+ key: a.id,
673
+ href: a.installUrl,
674
+ target: "_blank",
675
+ rel: "noopener noreferrer",
676
+ style: { "margin-right": "12px" }
677
+ }, o(a.name), 9, is))), 128))
678
+ ])
679
+ ])
680
+ ]),
681
+ l[43] || (l[43] = e("div", { class: "gl-onboarding" }, [
682
+ e("span", { class: "gl-number" }, "2"),
683
+ e("div", null, [
684
+ e("strong", null, "Back up your recovery phrase"),
685
+ e("p", null, "Keep it offline. Ghostlink will never ask for your recovery phrase or private key.")
686
+ ])
687
+ ], -1)),
688
+ l[44] || (l[44] = e("div", { class: "gl-onboarding" }, [
689
+ e("span", { class: "gl-number" }, "3"),
690
+ e("div", null, [
691
+ e("strong", null, "Return and connect"),
692
+ e("p", null, "Approve the login message in your wallet to prove ownership of your account.")
693
+ ])
694
+ ], -1)),
695
+ e("button", {
696
+ type: "button",
697
+ class: "gl-button gl-primary gl-full",
698
+ style: { "margin-top": "7px" },
699
+ onClick: l[17] || (l[17] = //@ts-ignore
700
+ (...a) => t(n).back && t(n).back(...a))
701
+ }, "I have a wallet now")
702
+ ])) : y("", !0)
703
+ ]),
704
+ t(s).revocationPending ? (i(), r("p", rs, "Session revocation pending. Reconnecting to the authentication server…")) : y("", !0)
705
+ ], 44, Ie)
706
+ ]));
707
+ }
708
+ }), vs = fe, bs = Re, ms = cs;
709
+ export {
710
+ bs as GhostlinkConnectButton,
711
+ ms as GhostlinkModal,
712
+ ps as GhostlinkPlugin,
713
+ vs as GhostlinkProvider,
714
+ O as useGhostlink
715
+ };
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@ghostdagger/ghostlink-vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-beta.1",
4
+ "type": "module",
5
+ "description": "Native Vue components for Ghostlink",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "sideEffects": false,
20
+ "dependencies": {
21
+ "@lucide/vue": "^1.76.0",
22
+ "@ghostdagger/ghostlink-core": "0.1.0-beta.1"
23
+ },
24
+ "peerDependencies": {
25
+ "vue": "^3.5.0"
26
+ },
27
+ "devDependencies": {
28
+ "vue": "^3.5.45"
29
+ },
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/ghostdagger-labs/ghostlink.git",
34
+ "directory": "packages/ghostlink-vue"
35
+ },
36
+ "homepage": "https://github.com/ghostdagger-labs/ghostlink#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/ghostdagger-labs/ghostlink/issues"
39
+ },
40
+ "publishConfig": {
41
+ "registry": "https://registry.npmjs.org/",
42
+ "access": "public",
43
+ "tag": "candidate"
44
+ },
45
+ "scripts": {
46
+ "build": "vite build && vue-tsc -p tsconfig.build.json && tsup dist/index.d.ts --format esm --dts-only --out-dir .types && node ../../tools/finalize-vue-types.mjs",
47
+ "typecheck": "vue-tsc -p tsconfig.json"
48
+ }
6
49
  }