@abraca/nuxt 2.0.1 → 2.0.3

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 (116) hide show
  1. package/dist/module.d.mts +18 -7
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +21 -5
  4. package/dist/runtime/assets/aware-tokens.css +1 -0
  5. package/dist/runtime/components/AAccountSwitcherModal.d.vue.ts +16 -1
  6. package/dist/runtime/components/AAccountSwitcherModal.vue +33 -4
  7. package/dist/runtime/components/AAccountSwitcherModal.vue.d.ts +16 -1
  8. package/dist/runtime/components/AAuthLinkLanding.d.vue.ts +3 -0
  9. package/dist/runtime/components/AAuthLinkLanding.vue +85 -0
  10. package/dist/runtime/components/AAuthLinkLanding.vue.d.ts +3 -0
  11. package/dist/runtime/components/AClaimAccountModal.d.vue.ts +7 -1
  12. package/dist/runtime/components/AClaimAccountModal.vue +28 -13
  13. package/dist/runtime/components/AClaimAccountModal.vue.d.ts +7 -1
  14. package/dist/runtime/components/AEmailVerifyConfirmModal.d.vue.ts +30 -0
  15. package/dist/runtime/components/AEmailVerifyConfirmModal.vue +100 -0
  16. package/dist/runtime/components/AEmailVerifyConfirmModal.vue.d.ts +30 -0
  17. package/dist/runtime/components/AEmailVerifyRequestCard.d.vue.ts +22 -0
  18. package/dist/runtime/components/AEmailVerifyRequestCard.vue +65 -0
  19. package/dist/runtime/components/AEmailVerifyRequestCard.vue.d.ts +22 -0
  20. package/dist/runtime/components/AMnemonicLoginModal.d.vue.ts +1 -1
  21. package/dist/runtime/components/AMnemonicLoginModal.vue.d.ts +1 -1
  22. package/dist/runtime/components/ANodePanel.vue +2 -0
  23. package/dist/runtime/components/ANotificationBell.d.vue.ts +2 -2
  24. package/dist/runtime/components/ANotificationBell.vue.d.ts +2 -2
  25. package/dist/runtime/components/APasswordChangeModal.d.vue.ts +28 -0
  26. package/dist/runtime/components/APasswordChangeModal.vue +178 -0
  27. package/dist/runtime/components/APasswordChangeModal.vue.d.ts +28 -0
  28. package/dist/runtime/components/APasswordLoginModal.d.vue.ts +42 -0
  29. package/dist/runtime/components/APasswordLoginModal.vue +177 -0
  30. package/dist/runtime/components/APasswordLoginModal.vue.d.ts +42 -0
  31. package/dist/runtime/components/APasswordRegisterModal.d.vue.ts +49 -0
  32. package/dist/runtime/components/APasswordRegisterModal.vue +262 -0
  33. package/dist/runtime/components/APasswordRegisterModal.vue.d.ts +49 -0
  34. package/dist/runtime/components/APasswordResetConfirmModal.d.vue.ts +31 -0
  35. package/dist/runtime/components/APasswordResetConfirmModal.vue +154 -0
  36. package/dist/runtime/components/APasswordResetConfirmModal.vue.d.ts +31 -0
  37. package/dist/runtime/components/APasswordResetRequestModal.d.vue.ts +35 -0
  38. package/dist/runtime/components/APasswordResetRequestModal.vue +113 -0
  39. package/dist/runtime/components/APasswordResetRequestModal.vue.d.ts +35 -0
  40. package/dist/runtime/components/ASetPasswordCard.d.vue.ts +26 -0
  41. package/dist/runtime/components/ASetPasswordCard.vue +139 -0
  42. package/dist/runtime/components/ASetPasswordCard.vue.d.ts +26 -0
  43. package/dist/runtime/components/aware/AAccordion.d.vue.ts +2 -0
  44. package/dist/runtime/components/aware/AAccordion.vue +11 -1
  45. package/dist/runtime/components/aware/AAccordion.vue.d.ts +2 -0
  46. package/dist/runtime/components/aware/AButton.vue +3 -3
  47. package/dist/runtime/components/aware/ACollapsible.d.vue.ts +2 -0
  48. package/dist/runtime/components/aware/ACollapsible.vue +9 -1
  49. package/dist/runtime/components/aware/ACollapsible.vue.d.ts +2 -0
  50. package/dist/runtime/components/aware/AGlobalFocusLayer.vue +1 -1
  51. package/dist/runtime/components/aware/AHoverItem.vue +28 -3
  52. package/dist/runtime/components/aware/AModal.d.vue.ts +2 -0
  53. package/dist/runtime/components/aware/AModal.vue +9 -1
  54. package/dist/runtime/components/aware/AModal.vue.d.ts +2 -0
  55. package/dist/runtime/components/aware/APresenceBlobs.vue +1 -1
  56. package/dist/runtime/components/aware/APresenceCursors.vue +1 -1
  57. package/dist/runtime/components/aware/AScroll.d.vue.ts +2 -0
  58. package/dist/runtime/components/aware/AScroll.vue +13 -3
  59. package/dist/runtime/components/aware/AScroll.vue.d.ts +2 -0
  60. package/dist/runtime/components/aware/ASlideover.d.vue.ts +2 -0
  61. package/dist/runtime/components/aware/ASlideover.vue +9 -1
  62. package/dist/runtime/components/aware/ASlideover.vue.d.ts +2 -0
  63. package/dist/runtime/components/aware/ASlider.vue +1 -0
  64. package/dist/runtime/components/aware/ATabs.d.vue.ts +2 -0
  65. package/dist/runtime/components/aware/ATabs.vue +9 -1
  66. package/dist/runtime/components/aware/ATabs.vue.d.ts +2 -0
  67. package/dist/runtime/components/chat/ANodeChatPanel.vue +1 -0
  68. package/dist/runtime/components/editor/AEditorRedoButton.d.vue.ts +2 -2
  69. package/dist/runtime/components/editor/AEditorRedoButton.vue.d.ts +2 -2
  70. package/dist/runtime/components/editor/AEditorUndoButton.d.vue.ts +2 -2
  71. package/dist/runtime/components/editor/AEditorUndoButton.vue.d.ts +2 -2
  72. package/dist/runtime/components/shell/AUserProfilePopover.d.vue.ts +1 -1
  73. package/dist/runtime/components/shell/AUserProfilePopover.vue.d.ts +1 -1
  74. package/dist/runtime/composables/useAAField.js +7 -4
  75. package/dist/runtime/composables/useAAFocus.js +10 -5
  76. package/dist/runtime/composables/useAAFollowAnchor.js +68 -34
  77. package/dist/runtime/composables/useAAFollowPeer.d.ts +7 -4
  78. package/dist/runtime/composables/useAAFollowPeer.js +60 -11
  79. package/dist/runtime/composables/useAAViewport.d.ts +1 -1
  80. package/dist/runtime/composables/useAbracadabraAuth.d.ts +2 -0
  81. package/dist/runtime/composables/useAbracadabraAuth.js +2 -0
  82. package/dist/runtime/composables/useEmailVerification.d.ts +40 -26
  83. package/dist/runtime/composables/useEmailVerification.js +95 -43
  84. package/dist/runtime/composables/usePasswordAuth.d.ts +64 -0
  85. package/dist/runtime/composables/usePasswordAuth.js +126 -0
  86. package/dist/runtime/composables/useTiptapHistory.d.ts +2 -2
  87. package/dist/runtime/composables/useTiptapHistory.js +5 -5
  88. package/dist/runtime/extensions/views/MetaFieldView.vue +23 -6
  89. package/dist/runtime/plugin-abracadabra.client.js +57 -8
  90. package/dist/runtime/plugin-abracadabra.server.js +2 -0
  91. package/dist/runtime/server/plugins/abracadabra-service.js +20 -9
  92. package/dist/runtime/types.d.ts +11 -0
  93. package/dist/runtime/utils/awareRingStyle.js +1 -1
  94. package/package.json +7 -7
  95. package/dist/runtime/components/renderers/ASpatialRenderer.d.vue.ts +0 -19
  96. package/dist/runtime/components/renderers/ASpatialRenderer.vue +0 -459
  97. package/dist/runtime/components/renderers/ASpatialRenderer.vue.d.ts +0 -19
  98. package/dist/runtime/components/renderers/spatial/SpatialGround.d.vue.ts +0 -20
  99. package/dist/runtime/components/renderers/spatial/SpatialGround.vue +0 -26
  100. package/dist/runtime/components/renderers/spatial/SpatialGround.vue.d.ts +0 -20
  101. package/dist/runtime/components/renderers/spatial/SpatialObject.d.vue.ts +0 -17
  102. package/dist/runtime/components/renderers/spatial/SpatialObject.vue +0 -257
  103. package/dist/runtime/components/renderers/spatial/SpatialObject.vue.d.ts +0 -17
  104. package/dist/runtime/components/renderers/spatial/SpatialSceneBridge.d.vue.ts +0 -15
  105. package/dist/runtime/components/renderers/spatial/SpatialSceneBridge.vue +0 -18
  106. package/dist/runtime/components/renderers/spatial/SpatialSceneBridge.vue.d.ts +0 -15
  107. package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.d.vue.ts +0 -16
  108. package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.vue +0 -66
  109. package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.vue.d.ts +0 -16
  110. package/dist/runtime/components/renderers/spatial/SpatialUserAvatar.d.vue.ts +0 -8
  111. package/dist/runtime/components/renderers/spatial/SpatialUserAvatar.vue +0 -53
  112. package/dist/runtime/components/renderers/spatial/SpatialUserAvatar.vue.d.ts +0 -8
  113. package/dist/runtime/composables/useSpatialCamera.d.ts +0 -16
  114. package/dist/runtime/composables/useSpatialCamera.js +0 -175
  115. package/dist/runtime/composables/useSpatialDrag.d.ts +0 -14
  116. package/dist/runtime/composables/useSpatialDrag.js +0 -137
@@ -70,6 +70,17 @@ const NUXT_UI_PRIMARY_COLORS = /* @__PURE__ */ new Set([
70
70
  ]);
71
71
  const NUXT_UI_NEUTRAL_COLORS = /* @__PURE__ */ new Set(["slate", "gray", "zinc", "neutral", "stone"]);
72
72
  const CUSTOM_TO_NUXT_UI_PRIMARY = {
73
+ // Identity-color names from `UI_COLORS` (types.ts) that aren't Nuxt UI standard.
74
+ // Without these, picking any of `coral`, `chartreuse`, `jade`, `sapphire`,
75
+ // `magenta`, `oxidized` would silently fall back to `blue` — and the app
76
+ // chrome would never reflect the user's chosen identity color.
77
+ coral: "orange",
78
+ chartreuse: "lime",
79
+ jade: "emerald",
80
+ sapphire: "blue",
81
+ magenta: "fuchsia",
82
+ oxidized: "teal",
83
+ // Legacy / themed names sometimes used as `primary` in app.config.ts.
73
84
  grass: "green",
74
85
  diamond: "cyan",
75
86
  gold: "amber",
@@ -78,7 +89,26 @@ const CUSTOM_TO_NUXT_UI_PRIMARY = {
78
89
  wood: "orange",
79
90
  discord: "indigo",
80
91
  steam: "lime",
81
- oxidized: "teal"
92
+ // Neutral names occasionally mis-used as primary (e.g. playground default
93
+ // `primary: 'mist'`) — pick a defensible warm-neutral primary instead of
94
+ // collapsing to plain blue.
95
+ mist: "sky",
96
+ mauve: "violet",
97
+ sand: "amber",
98
+ dusk: "indigo",
99
+ bark: "orange",
100
+ sage: "emerald",
101
+ moss: "green",
102
+ lavender: "violet",
103
+ blush: "pink",
104
+ cream: "amber",
105
+ wine: "rose",
106
+ cobblestone: "cyan",
107
+ bedrock: "sky",
108
+ copper: "orange",
109
+ mint: "emerald",
110
+ fog: "sky",
111
+ peach: "orange"
82
112
  };
83
113
  const CUSTOM_TO_NUXT_UI_NEUTRAL = {
84
114
  cobblestone: "stone",
@@ -241,6 +271,16 @@ export default defineNuxtPlugin({
241
271
  const userStatusIcon = ref(localStorage.getItem("abracadabra_status_icon") ?? "");
242
272
  const userStatusText = ref(localStorage.getItem("abracadabra_status_text") ?? "");
243
273
  const userStatusAsAvatar = ref(localStorage.getItem("abracadabra_status_as_avatar") === "1");
274
+ const hasPassword = ref(false);
275
+ async function refreshHasPassword() {
276
+ const c = client.value;
277
+ if (!c) return;
278
+ try {
279
+ const me = await c.getMe();
280
+ hasPassword.value = !!me?.hasPassword;
281
+ } catch {
282
+ }
283
+ }
244
284
  watch([status, synced], ([s, sy]) => {
245
285
  try {
246
286
  const ready = s === "connected" && sy;
@@ -597,6 +637,7 @@ export default defineNuxtPlugin({
597
637
  if (!client.value) throw new Error("Not connected");
598
638
  await client.value.login(opts);
599
639
  addLog(`Logged in as ${opts.username}`, "auth");
640
+ hasPassword.value = true;
600
641
  if (_wsp) {
601
642
  _wsp.disconnect();
602
643
  setTimeout(() => _wsp?.connect(), 300);
@@ -607,6 +648,7 @@ export default defineNuxtPlugin({
607
648
  await client.value.register(opts);
608
649
  await client.value.login({ username: opts.username, password: opts.password });
609
650
  addLog(`Registered + logged in as ${opts.username}`, "auth");
651
+ hasPassword.value = true;
610
652
  if (_wsp) {
611
653
  _wsp.disconnect();
612
654
  setTimeout(() => _wsp?.connect(), 300);
@@ -625,6 +667,7 @@ export default defineNuxtPlugin({
625
667
  async function setPassword(newPassword) {
626
668
  if (!client.value) throw new Error("Not connected");
627
669
  await client.value.setPassword(newPassword);
670
+ hasPassword.value = true;
628
671
  addLog("Password set", "auth");
629
672
  }
630
673
  async function redeemInvite(code) {
@@ -705,18 +748,21 @@ export default defineNuxtPlugin({
705
748
  try {
706
749
  const [
707
750
  sdkModule,
708
- ed,
751
+ edModule,
709
752
  { sha512 }
710
753
  ] = await Promise.all([
711
754
  import("@abraca/dabra"),
712
755
  import("@noble/ed25519"),
713
- import("@noble/hashes/sha512")
756
+ import("@noble/hashes/sha2.js")
714
757
  ]);
715
758
  setSdkModule(sdkModule);
716
759
  const { AbracadabraClient, AbracadabraProvider, AbracadabraWS, CryptoIdentityKeystore } = sdkModule;
717
- const edEtc = ed.etc;
718
- edEtc.sha512Sync = (...m) => sha512(edEtc.concatBytes(...m));
719
- edEtc.sha512Async = (...m) => Promise.resolve(edEtc.sha512Sync(...m));
760
+ const ed = edModule.default ?? edModule;
761
+ if (!ed.hashes) {
762
+ throw new Error("@noble/ed25519 v3: `hashes` export missing from imported namespace \u2014 check Vite optimizeDeps");
763
+ }
764
+ ed.hashes.sha512 = sha512;
765
+ ed.hashes.sha512Async = (m) => Promise.resolve(sha512(m));
720
766
  const ks = new CryptoIdentityKeystore();
721
767
  keystore.value = ks;
722
768
  let privKey = null;
@@ -742,7 +788,7 @@ export default defineNuxtPlugin({
742
788
  privKey = fromBase64Url(storedPrivKey);
743
789
  addLog("Using guest identity (soft key)", "auth");
744
790
  } else {
745
- privKey = ed.utils.randomPrivateKey();
791
+ privKey = ed.utils.randomSecretKey();
746
792
  localStorage.setItem("abracadabra_privkey", toBase64Url(privKey));
747
793
  addLog("Created new guest identity (soft key)", "auth");
748
794
  }
@@ -790,7 +836,8 @@ export default defineNuxtPlugin({
790
836
  let useExistingToken = _client.isTokenValid();
791
837
  if (useExistingToken) {
792
838
  try {
793
- await _client.getMe();
839
+ const me = await _client.getMe();
840
+ hasPassword.value = !!me?.hasPassword;
794
841
  } catch (e) {
795
842
  const status2 = e?.status ?? 0;
796
843
  if (status2 === 401) {
@@ -1140,6 +1187,8 @@ export default defineNuxtPlugin({
1140
1187
  confirmPasswordReset,
1141
1188
  changePassword,
1142
1189
  setPassword,
1190
+ hasPassword,
1191
+ refreshHasPassword,
1143
1192
  addServer,
1144
1193
  removeServer,
1145
1194
  switchServer,
@@ -68,6 +68,8 @@ export default defineNuxtPlugin({
68
68
  createInvite: async () => ({}),
69
69
  listInvites: async () => [],
70
70
  revokeInvite: noopAsync,
71
+ hasPassword: ref(false),
72
+ refreshHasPassword: noopAsync,
71
73
  init: noopAsync
72
74
  });
73
75
  }
@@ -45,7 +45,7 @@ async function loadOrCreateAutoIdentity(opts) {
45
45
  );
46
46
  return null;
47
47
  }
48
- const sk = opts.ed.utils.randomPrivateKey();
48
+ const sk = opts.ed.utils.randomSecretKey();
49
49
  const pk = await opts.ed.getPublicKey(sk);
50
50
  const publicKey = toBase64Url(pk);
51
51
  const privateKey = toBase64Url(sk);
@@ -101,18 +101,28 @@ export default defineNitroPlugin(async (nitroApp) => {
101
101
  try {
102
102
  const [
103
103
  { AbracadabraClient, AbracadabraProvider, AbracadabraWS },
104
- ed,
104
+ edModule,
105
105
  { sha512 },
106
- Y
106
+ Y,
107
+ wsModule
107
108
  ] = await Promise.all([
108
109
  import("@abraca/dabra"),
109
110
  import("@noble/ed25519"),
110
- import("@noble/hashes/sha512"),
111
- import("yjs")
111
+ import("@noble/hashes/sha2.js"),
112
+ import("yjs"),
113
+ import("ws")
112
114
  ]);
113
- const edEtc = ed.etc;
114
- edEtc.sha512Sync = (...m) => sha512(edEtc.concatBytes(...m));
115
- edEtc.sha512Async = (...m) => Promise.resolve(edEtc.sha512Sync(...m));
115
+ const ed = edModule.default ?? edModule;
116
+ const WSImpl = wsModule.WebSocket ?? wsModule.default;
117
+ if (typeof globalThis.WebSocket === "undefined" && WSImpl) {
118
+ ;
119
+ globalThis.WebSocket = WSImpl;
120
+ }
121
+ if (!ed.hashes) {
122
+ throw new Error("@noble/ed25519 v3: `hashes` export missing \u2014 check Vite optimizeDeps");
123
+ }
124
+ ed.hashes.sha512 = sha512;
125
+ ed.hashes.sha512Async = (m) => Promise.resolve(sha512(m));
116
126
  let pubKeyB64 = explicitPubKey;
117
127
  let privKeyB64 = explicitPrivKey;
118
128
  if (!pubKeyB64 || !privKeyB64) {
@@ -142,7 +152,8 @@ export default defineNitroPlugin(async (nitroApp) => {
142
152
  maxDelay: 3e4,
143
153
  factor: 2,
144
154
  jitter: true,
145
- maxAttempts: 50
155
+ maxAttempts: 50,
156
+ WebSocketPolyfill: WSImpl
146
157
  });
147
158
  let rootDocId = rootDocIdOverride;
148
159
  if (!rootDocId) {
@@ -500,6 +500,17 @@ export interface AbracadabraState {
500
500
  }) => Promise<void>;
501
501
  /** Add a password to a key-only account. 409s if one is already set. */
502
502
  setPassword: (newPassword: string) => Promise<void>;
503
+ /**
504
+ * Whether the current user has a password set on the server. Drives the
505
+ * "Set password" vs "Change password" branching in `<AClaimAccountModal>`,
506
+ * `<AAccountSwitcherModal>`, and consumer settings panels. Populated from
507
+ * `getMe().hasPassword` after each successful auth event.
508
+ */
509
+ hasPassword: Ref<boolean>;
510
+ /** Force-refresh `hasPassword` from `getMe()`. Call after a successful
511
+ * `setPassword`/`changePassword` if the consumer wants to read the
512
+ * server's authoritative state instead of trusting the optimistic flip. */
513
+ refreshHasPassword: () => Promise<void>;
503
514
  reconnect: () => void;
504
515
  addServer: (url: string) => Promise<void>;
505
516
  removeServer: (url: string) => void;
@@ -11,6 +11,6 @@ export function awareRingStyle(input) {
11
11
  return {
12
12
  boxShadow: layers.join(", "),
13
13
  borderRadius: radius ?? "var(--ui-radius, 0.375rem)",
14
- transition: "box-shadow 100ms ease, filter 120ms ease"
14
+ transition: "box-shadow var(--aa-state-fade-shadow), filter var(--aa-state-fade-filter)"
15
15
  };
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",
@@ -48,9 +48,9 @@
48
48
  "nanoevents": "^9.1.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@abraca/dabra": "^2.0.0",
52
- "@noble/ed25519": "~2.3.0",
53
- "@noble/hashes": "^1.8.0",
51
+ "@abraca/dabra": "^2.0.3",
52
+ "@noble/ed25519": "^3.1.0",
53
+ "@noble/hashes": "^2.2.0",
54
54
  "@nuxt/ui": "^3.0.0",
55
55
  "@tanstack/vue-virtual": "^3.10.0",
56
56
  "@tiptap/core": "^3.0.0",
@@ -96,10 +96,10 @@
96
96
  }
97
97
  },
98
98
  "devDependencies": {
99
- "@abraca/dabra": "^2.0.1",
99
+ "@abraca/dabra": "^2.0.3",
100
100
  "@iconify-json/lucide": "^1.2.105",
101
- "@noble/ed25519": "~2.3.0",
102
- "@noble/hashes": "^1.8.0",
101
+ "@noble/ed25519": "^3.1.0",
102
+ "@noble/hashes": "^2.2.0",
103
103
  "@nuxt/eslint-config": "^1.15.2",
104
104
  "@nuxt/module-builder": "^1.0.2",
105
105
  "@nuxt/schema": "^4.4.4",
@@ -1,19 +0,0 @@
1
- import { type RendererBaseProps } from '../../composables/useRendererBase.js';
2
- import type { AbracadabraLocale } from '../../locale.js';
3
- type __VLS_Props = RendererBaseProps & {
4
- labels?: Partial<AbracadabraLocale['renderers']>;
5
- editable?: boolean;
6
- };
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
8
- connectedUsers: import("vue").ComputedRef<{
9
- clientId: number;
10
- name: string;
11
- color: string;
12
- avatar: string | undefined;
13
- publicKey: any;
14
- }[]>;
15
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
- editable: boolean;
17
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
- declare const _default: typeof __VLS_export;
19
- export default _default;