@abraca/nuxt 2.83.0 → 2.84.0

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.83.0",
7
+ "version": "2.84.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -443,10 +443,14 @@ const addFieldMenuItems = computed(
443
443
  v-show="activeTab === 'chat'"
444
444
  class="flex flex-col flex-1 min-h-0"
445
445
  >
446
+ <!-- `:closable="false"` — this panel's own header already carries a
447
+ close and an expand, so the chat header put a SECOND X directly
448
+ beneath the first, both closing the same slideover. -->
446
449
  <ANodeChatPanel
447
450
  v-if="nodeId"
448
451
  :doc-id="nodeId"
449
452
  :label="resolvedLabel || 'Chat'"
453
+ :closable="false"
450
454
  class="flex-1 min-h-0"
451
455
  />
452
456
  </div>
@@ -1,3 +1,9 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ /** Paint only the peer currently being followed. Off = every peer. */
3
+ followOnly?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ followOnly: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
8
  declare const _default: typeof __VLS_export;
3
9
  export default _default;
@@ -2,9 +2,20 @@
2
2
  import { computed, onBeforeUnmount, onMounted, ref } from "vue";
3
3
  import { useRoute } from "#imports";
4
4
  import { useAAEphemeral } from "../../composables/useAAEphemeral";
5
+ import { useAAFollowPeer } from "../../composables/useAAFollowPeer";
5
6
  import { rangeFromPaths } from "../../utils/domPath";
7
+ const props = defineProps({
8
+ followOnly: { type: Boolean, required: false, default: false }
9
+ });
6
10
  const { peers } = useAAEphemeral("aa:focus");
11
+ const { followingClientId } = useAAFollowPeer();
7
12
  const route = useRoute();
13
+ const visiblePeers = computed(() => {
14
+ if (!props.followOnly) return peers.value;
15
+ const cid = followingClientId.value;
16
+ if (cid == null) return [];
17
+ return peers.value.filter((p) => p.clientId === cid);
18
+ });
8
19
  const selections = ref([]);
9
20
  let raf = 0;
10
21
  let mo = null;
@@ -12,7 +23,7 @@ function recompute() {
12
23
  cancelAnimationFrame(raf);
13
24
  raf = requestAnimationFrame(() => {
14
25
  const out = [];
15
- for (const p of peers.value) {
26
+ for (const p of visiblePeers.value) {
16
27
  const v = p.value;
17
28
  if (!v || v.kind !== "selection" || v.route !== route.path || !v.start || !v.end) continue;
18
29
  const range = rangeFromPaths(v.start, v.end);
@@ -44,7 +55,7 @@ onBeforeUnmount(() => {
44
55
  mo?.disconnect();
45
56
  });
46
57
  import { watch } from "vue";
47
- watch(peers, recompute, { deep: true, flush: "post" });
58
+ watch(visiblePeers, recompute, { deep: true, flush: "post" });
48
59
  watch(() => route.path, recompute);
49
60
  function tintFor(p) {
50
61
  return p.user?.color ?? "#888";
@@ -1,3 +1,9 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ /** Paint only the peer currently being followed. Off = every peer. */
3
+ followOnly?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ followOnly: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
8
  declare const _default: typeof __VLS_export;
3
9
  export default _default;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- total: boolean;
16
15
  controls: boolean;
16
+ total: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- total: boolean;
16
15
  controls: boolean;
16
+ total: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -25,6 +25,15 @@ type __VLS_Props = {
25
25
  mentionUsers?: ChatMentionUser[];
26
26
  /** Input placeholder */
27
27
  placeholder?: string;
28
+ /**
29
+ * Show the header's close button.
30
+ *
31
+ * `false` where the panel is EMBEDDED in chrome that already closes it — the
32
+ * `<ANodePanel>` Chat tab is the case this exists for: its toolbar carries a
33
+ * close and an expand, and the chat header put a second X directly beneath
34
+ * the first, three rows from the top of the same slideover.
35
+ */
36
+ closable?: boolean;
28
37
  /** Whether to auto-focus the input */
29
38
  autofocus?: boolean;
30
39
  /** Empty state customization */
@@ -77,6 +86,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
77
86
  mentionUsers: ChatMentionUser[];
78
87
  typingUsers: TypingUser[];
79
88
  activeAgents: ActiveAgent[];
89
+ closable: boolean;
80
90
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
81
91
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
82
92
  declare const _default: typeof __VLS_export;
@@ -9,6 +9,7 @@ const props = defineProps({
9
9
  activeAgents: { type: Array, required: false, default: () => [] },
10
10
  mentionUsers: { type: Array, required: false, default: () => [] },
11
11
  placeholder: { type: String, required: false, default: "Type a message\u2026" },
12
+ closable: { type: Boolean, required: false, default: true },
12
13
  autofocus: { type: Boolean, required: false, default: false },
13
14
  emptyIcon: { type: String, required: false, default: "i-lucide-message-circle" },
14
15
  emptyText: { type: String, required: false, default: "No messages yet" },
@@ -60,6 +61,7 @@ defineExpose({
60
61
  </h3>
61
62
  <slot name="trailing" />
62
63
  <UButton
64
+ v-if="closable"
63
65
  icon="i-lucide-x"
64
66
  color="neutral"
65
67
  variant="ghost"
@@ -25,6 +25,15 @@ type __VLS_Props = {
25
25
  mentionUsers?: ChatMentionUser[];
26
26
  /** Input placeholder */
27
27
  placeholder?: string;
28
+ /**
29
+ * Show the header's close button.
30
+ *
31
+ * `false` where the panel is EMBEDDED in chrome that already closes it — the
32
+ * `<ANodePanel>` Chat tab is the case this exists for: its toolbar carries a
33
+ * close and an expand, and the chat header put a second X directly beneath
34
+ * the first, three rows from the top of the same slideover.
35
+ */
36
+ closable?: boolean;
28
37
  /** Whether to auto-focus the input */
29
38
  autofocus?: boolean;
30
39
  /** Empty state customization */
@@ -77,6 +86,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
77
86
  mentionUsers: ChatMentionUser[];
78
87
  typingUsers: TypingUser[];
79
88
  activeAgents: ActiveAgent[];
89
+ closable: boolean;
80
90
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
81
91
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
82
92
  declare const _default: typeof __VLS_export;
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  placeholder?: string;
8
8
  /** Auto-focus the input when mounted. */
9
9
  autofocus?: boolean;
10
+ /** Show the header close button. Off when embedded in chrome that has one. */
11
+ closable?: boolean;
10
12
  emptyIcon?: string;
11
13
  emptyText?: string;
12
14
  emptySubtext?: string;
@@ -31,6 +33,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
31
33
  emptyText: string;
32
34
  emptyIcon: string;
33
35
  emptySubtext: string;
36
+ closable: boolean;
34
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
39
  declare const _default: typeof __VLS_export;
@@ -9,6 +9,7 @@ const props = defineProps({
9
9
  label: { type: String, required: false },
10
10
  placeholder: { type: String, required: false, default: "Type a message\u2026" },
11
11
  autofocus: { type: Boolean, required: false, default: false },
12
+ closable: { type: Boolean, required: false, default: true },
12
13
  emptyIcon: { type: String, required: false, default: "i-lucide-message-circle" },
13
14
  emptyText: { type: String, required: false, default: "No messages yet" },
14
15
  emptySubtext: { type: String, required: false, default: "Be the first to send a message" }
@@ -38,6 +39,7 @@ const typingUsersAdapted = computed(
38
39
  :active-agents="channelAgents"
39
40
  :placeholder="placeholder"
40
41
  :autofocus="autofocus"
42
+ :closable="closable"
41
43
  :empty-icon="emptyIcon"
42
44
  :empty-text="emptyText"
43
45
  :empty-subtext="emptySubtext"
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  placeholder?: string;
8
8
  /** Auto-focus the input when mounted. */
9
9
  autofocus?: boolean;
10
+ /** Show the header close button. Off when embedded in chrome that has one. */
11
+ closable?: boolean;
10
12
  emptyIcon?: string;
11
13
  emptyText?: string;
12
14
  emptySubtext?: string;
@@ -31,6 +33,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
31
33
  emptyText: string;
32
34
  emptyIcon: string;
33
35
  emptySubtext: string;
36
+ closable: boolean;
34
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
39
  declare const _default: typeof __VLS_export;
@@ -63,6 +63,24 @@ export interface AAFocusPayload {
63
63
  * *content* position regardless of either tab's scroll state. */
64
64
  pointer?: AAPointerAnchor;
65
65
  }
66
- export declare function useAAFocus(): {
66
+ export interface UseAAFocusOptions {
67
+ /**
68
+ * Publish TEXT SELECTIONS only — no pointer anchor, no scroll anchors, and
69
+ * no listeners for either.
70
+ *
71
+ * The full broadcast is not cheap: it re-serialises on every `pointermove`,
72
+ * and `collectScrollers()` walks `document.querySelectorAll('*')` on each one
73
+ * to find every overflow container on the page. On a long or tile-heavy page
74
+ * that is thousands of elements per move — worth it when something is
75
+ * consuming the anchors (smart follow-scroll, presence blobs), and pure waste
76
+ * when the only consumer is `<AGlobalFocusLayer>`, which reads `kind:
77
+ * 'selection'` and nothing else.
78
+ *
79
+ * In this mode the only listener is `selectionchange`, and a collapsed
80
+ * selection clears the slot rather than falling back to an anchor.
81
+ */
82
+ selectionOnly?: boolean;
83
+ }
84
+ export declare function useAAFocus(options?: UseAAFocusOptions): {
67
85
  snapshot: () => void;
68
86
  };
@@ -2,18 +2,21 @@ import { onMounted, onScopeDispose } from "vue";
2
2
  import { useRoute } from "#imports";
3
3
  import { useAAEphemeral } from "./useAAEphemeral.js";
4
4
  import { serializeRangeEndpoint, pathFromElement } from "../utils/domPath.js";
5
- export function useAAFocus() {
5
+ export function useAAFocus(options = {}) {
6
+ const selectionOnly = options.selectionOnly === true;
6
7
  const { setLocal } = useAAEphemeral("aa:focus");
7
8
  const route = useRoute();
8
9
  let raf = 0;
9
10
  let lastSerialized = null;
10
11
  const pointer = { clientX: 0, clientY: 0, fresh: false };
11
12
  function publish(payload) {
12
- if (pointer.fresh) {
13
- const anchor = serializePointer(pointer.clientX, pointer.clientY);
14
- if (anchor) payload.pointer = anchor;
13
+ if (!selectionOnly) {
14
+ if (pointer.fresh) {
15
+ const anchor = serializePointer(pointer.clientX, pointer.clientY);
16
+ if (anchor) payload.pointer = anchor;
17
+ }
18
+ payload.scrollers = collectScrollers();
15
19
  }
16
- payload.scrollers = collectScrollers();
17
20
  const json = JSON.stringify(payload);
18
21
  if (json === lastSerialized) return;
19
22
  lastSerialized = json;
@@ -126,6 +129,10 @@ export function useAAFocus() {
126
129
  return;
127
130
  }
128
131
  }
132
+ if (selectionOnly) {
133
+ clear();
134
+ return;
135
+ }
129
136
  const picked = pickAnchorElement();
130
137
  if (!picked) {
131
138
  clear();
@@ -160,19 +167,23 @@ export function useAAFocus() {
160
167
  }
161
168
  onMounted(() => {
162
169
  document.addEventListener("selectionchange", onSelectionChange);
163
- document.addEventListener("scroll", onScroll, { passive: true, capture: true });
164
- document.addEventListener("pointermove", onPointerMove, { passive: true });
165
- document.addEventListener("pointerleave", onPointerLeave);
166
- window.addEventListener("resize", onResize, { passive: true });
170
+ if (!selectionOnly) {
171
+ document.addEventListener("scroll", onScroll, { passive: true, capture: true });
172
+ document.addEventListener("pointermove", onPointerMove, { passive: true });
173
+ document.addEventListener("pointerleave", onPointerLeave);
174
+ window.addEventListener("resize", onResize, { passive: true });
175
+ }
167
176
  snapshot();
168
177
  });
169
178
  onScopeDispose(() => {
170
179
  cancelAnimationFrame(raf);
171
180
  document.removeEventListener("selectionchange", onSelectionChange);
172
- document.removeEventListener("scroll", onScroll, { capture: true });
173
- document.removeEventListener("pointermove", onPointerMove);
174
- document.removeEventListener("pointerleave", onPointerLeave);
175
- window.removeEventListener("resize", onResize);
181
+ if (!selectionOnly) {
182
+ document.removeEventListener("scroll", onScroll, { capture: true });
183
+ document.removeEventListener("pointermove", onPointerMove);
184
+ document.removeEventListener("pointerleave", onPointerLeave);
185
+ window.removeEventListener("resize", onResize);
186
+ }
176
187
  clear();
177
188
  });
178
189
  return { snapshot };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.83.0",
3
+ "version": "2.84.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",
@@ -173,9 +173,9 @@
173
173
  }
174
174
  },
175
175
  "devDependencies": {
176
- "@abraca/convert": "^2.5.0",
177
- "@abraca/dabra": "^2.5.0",
178
- "@abraca/plugin": "^2.5.0",
176
+ "@abraca/convert": "^2.83.0",
177
+ "@abraca/dabra": "^2.83.0",
178
+ "@abraca/plugin": "^2.83.0",
179
179
  "@codemirror/autocomplete": "^6.18.0",
180
180
  "@codemirror/commands": "^6.7.0",
181
181
  "@codemirror/lang-css": "^6.3.1",