@abraca/nuxt 2.0.8 → 2.0.9

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "2.0.8",
7
+ "version": "2.0.9",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -238,8 +238,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
238
238
  transition: boolean;
239
239
  autofocus: boolean;
240
240
  loading: boolean;
241
- overlay: boolean;
242
241
  colorMode: boolean;
242
+ overlay: boolean;
243
243
  dismissible: boolean;
244
244
  fullscreen: boolean;
245
245
  modal: boolean;
@@ -238,8 +238,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
238
238
  transition: boolean;
239
239
  autofocus: boolean;
240
240
  loading: boolean;
241
- overlay: boolean;
242
241
  colorMode: boolean;
242
+ overlay: boolean;
243
243
  dismissible: boolean;
244
244
  fullscreen: boolean;
245
245
  modal: boolean;
@@ -194,6 +194,7 @@ export function useSmoothedCursors(provider, posKey = "pos", lerpFactor = 0.3) {
194
194
  const localId = computed(() => provider.value?.awareness?.clientID ?? 0);
195
195
  const cursors = ref([]);
196
196
  let frame;
197
+ const EPS_SQ = 25e-4;
197
198
  const tick = () => {
198
199
  const activeIds = /* @__PURE__ */ new Set();
199
200
  for (const s of states.value) {
@@ -204,11 +205,14 @@ export function useSmoothedCursors(provider, posKey = "pos", lerpFactor = 0.3) {
204
205
  const entry = cursors.value.find((c) => c.clientId === s.clientId);
205
206
  if (!entry) {
206
207
  cursors.value.push({ clientId: s.clientId, x: pos.x, y: pos.y, state: s });
207
- } else {
208
- entry.x += (pos.x - entry.x) * lerpFactor;
209
- entry.y += (pos.y - entry.y) * lerpFactor;
210
- entry.state = s;
208
+ continue;
211
209
  }
210
+ const dx = pos.x - entry.x;
211
+ const dy = pos.y - entry.y;
212
+ if (dx * dx + dy * dy < EPS_SQ && entry.state === s) continue;
213
+ entry.x += dx * lerpFactor;
214
+ entry.y += dy * lerpFactor;
215
+ entry.state = s;
212
216
  }
213
217
  for (let i = cursors.value.length - 1; i >= 0; i--) {
214
218
  if (!activeIds.has(cursors.value[i].clientId)) cursors.value.splice(i, 1);
@@ -525,17 +525,44 @@ export default defineNuxtPlugin({
525
525
  window.location.hostname,
526
526
  "Abracadabra"
527
527
  );
528
- await client.value.addKey({
529
- publicKey: newPubKey,
530
- x25519Key: x25519PublicKey,
531
- deviceName: "Hardware Auth (" + (navigator.platform || "Device") + ")"
532
- });
528
+ const hasSession = client.value.isTokenValid();
529
+ const deviceName = "Hardware Auth (" + (navigator.platform || "Device") + ")";
530
+ if (hasSession) {
531
+ await client.value.addKey({
532
+ publicKey: newPubKey,
533
+ x25519Key: x25519PublicKey,
534
+ deviceName
535
+ });
536
+ } else {
537
+ addLog("No active session \u2014 registering passkey from scratch", "auth");
538
+ await client.value.registerWithKey({
539
+ publicKey: newPubKey,
540
+ deviceName,
541
+ displayName: userName.value,
542
+ inviteCode: pendingInviteCode.value ?? void 0
543
+ });
544
+ if (pendingInviteCode.value) {
545
+ addLog("Invite code applied during registration", "auth");
546
+ pendingInviteCode.value = null;
547
+ }
548
+ await client.value.loginWithKey(newPubKey, (ch) => keystore.value.sign(ch));
549
+ addLog("Authenticated via Ed25519 challenge-response", "auth");
550
+ }
533
551
  publicKeyB64.value = newPubKey;
534
552
  identityState.value = "claimed";
535
553
  localStorage.removeItem("abracadabra_privkey");
536
554
  localStorage.setItem(CLAIMED_FLAG_KEY, "1");
537
555
  localStorage.setItem(PUBKEY_KEY, newPubKey);
538
556
  addLog("Account protected by hardware/biometrics", "auth");
557
+ if (!hasSession) {
558
+ _teardown();
559
+ _initPromise = null;
560
+ _initPromise = init(currentServerUrl.value);
561
+ await _initPromise;
562
+ } else if (_wsp) {
563
+ _wsp.disconnect();
564
+ setTimeout(() => _wsp?.connect(), 300);
565
+ }
539
566
  return true;
540
567
  } catch (e) {
541
568
  addLog(`Claim failed: ${e instanceof Error ? e.message : String(e)}`, "auth");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",
@@ -54,11 +54,28 @@
54
54
  "@nuxt/ui": "^3.0.0",
55
55
  "@tanstack/vue-virtual": "^3.10.0",
56
56
  "@tiptap/core": "^3.0.0",
57
+ "@tiptap/extension-character-count": "^3.0.0",
58
+ "@tiptap/extension-code-block-lowlight": "^3.0.0",
57
59
  "@tiptap/extension-collaboration": "^3.0.0",
58
60
  "@tiptap/extension-collaboration-caret": "^3.0.0",
61
+ "@tiptap/extension-color": "^3.0.0",
62
+ "@tiptap/extension-emoji": "^3.0.0",
63
+ "@tiptap/extension-highlight": "^3.0.0",
64
+ "@tiptap/extension-subscript": "^3.0.0",
65
+ "@tiptap/extension-superscript": "^3.0.0",
66
+ "@tiptap/extension-table": "^3.0.0",
67
+ "@tiptap/extension-table-cell": "^3.0.0",
68
+ "@tiptap/extension-table-header": "^3.0.0",
69
+ "@tiptap/extension-table-row": "^3.0.0",
70
+ "@tiptap/extension-task-item": "^3.0.0",
71
+ "@tiptap/extension-task-list": "^3.0.0",
72
+ "@tiptap/extension-text-align": "^3.0.0",
73
+ "@tiptap/extension-text-style": "^3.0.0",
74
+ "@tiptap/starter-kit": "^3.0.0",
59
75
  "@tiptap/vue-3": "^3.0.0",
60
76
  "d3-force": "^3.0.0",
61
77
  "jszip": "^3.0.0",
78
+ "lowlight": "^3.0.0",
62
79
  "mapbox-gl": "^3.0.0",
63
80
  "nuxt": "^4.0.0",
64
81
  "vue": "^3.4.0",
@@ -77,26 +94,12 @@
77
94
  "mapbox-gl": {
78
95
  "optional": true
79
96
  },
80
- "@tiptap/core": {
81
- "optional": false
82
- },
83
- "@tiptap/extension-collaboration": {
84
- "optional": false
85
- },
86
- "@tiptap/extension-collaboration-caret": {
87
- "optional": false
88
- },
89
- "@tiptap/vue-3": {
90
- "optional": false
91
- }
92
- },
93
- "dependenciesMeta": {
94
- "@abraca/dabra": {
95
- "injected": true
97
+ "@tiptap/extension-emoji": {
98
+ "optional": true
96
99
  }
97
100
  },
98
101
  "devDependencies": {
99
- "@abraca/dabra": "^2.0.8",
102
+ "@abraca/dabra": "^2.0.9",
100
103
  "@iconify-json/lucide": "^1.2.105",
101
104
  "@noble/ed25519": "^3.1.0",
102
105
  "@noble/hashes": "^2.2.0",