@abraca/nuxt 2.93.0 → 2.96.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.93.0",
7
+ "version": "2.96.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -11,6 +11,7 @@ import { provideRendererSurface } from "../composables/useRendererSurface";
11
11
  import { useAbraLocale } from "../composables/useAbraLocale";
12
12
  import { useDocSlugs } from "../composables/useDocSlugs";
13
13
  import { useResizableWidth } from "../composables/useResizableWidth";
14
+ import { useSlideoverSwipe } from "../composables/useSlideoverSwipe";
14
15
  import AConnectionBadge from "./AConnectionBadge.vue";
15
16
  import AEditorUndoButton from "./editor/AEditorUndoButton.vue";
16
17
  import AEditorRedoButton from "./editor/AEditorRedoButton.vue";
@@ -135,6 +136,25 @@ const resize = useResizableWidth({
135
136
  cookieKey: "abraca-node-panel-width",
136
137
  direction: "left"
137
138
  });
139
+ const panelEl = ref(null);
140
+ const { offset: swipeOffset, dragging: swiping, active: swipeActive } = useSlideoverSwipe(
141
+ () => `node-panel:${props.nodeId ?? ""}`,
142
+ open,
143
+ "right",
144
+ { el: () => panelEl.value }
145
+ );
146
+ const contentStyle = computed(() => ({
147
+ ...resize.style.value ?? {},
148
+ paddingTop: "var(--a-safe-t, env(safe-area-inset-top, 0px))",
149
+ paddingRight: "var(--a-safe-r, env(safe-area-inset-right, 0px))",
150
+ paddingBottom: "var(--a-safe-b, env(safe-area-inset-bottom, 0px))",
151
+ ...swipeActive.value ? {
152
+ transform: `translate3d(${swipeOffset.value}px, 0, 0)`,
153
+ // Only the RELEASE is animated. A transition during the drag makes the
154
+ // panel lag the thumb, which reads as a slow app.
155
+ transition: swiping.value ? "none" : "transform 220ms cubic-bezier(0.22, 1, 0.36, 1)"
156
+ } : {}
157
+ }));
138
158
  const _runtimeFeatures = computed(() => {
139
159
  try {
140
160
  return useRuntimeConfig().public?.abracadabra?.features ?? {};
@@ -251,7 +271,7 @@ const addFieldMenuItems = computed(
251
271
  side="right"
252
272
  :title="resolvedLabel || 'Document'"
253
273
  :close="false"
254
- :content="{ style: resize.style.value }"
274
+ :content="{ style: contentStyle }"
255
275
  @update:open="(v) => !v && emit('close')"
256
276
  >
257
277
  <!-- We take full control of the panel chrome via #content (rather than
@@ -259,7 +279,10 @@ const addFieldMenuItems = computed(
259
279
  DocSlideover: a tight 40px control bar with icon-only tabs, then a
260
280
  flush content area. -->
261
281
  <template #content>
262
- <div class="flex flex-col h-full relative">
282
+ <div
283
+ ref="panelEl"
284
+ class="flex flex-col h-full relative"
285
+ >
263
286
  <!-- Resize handle: left edge of slideover, desktop only -->
264
287
  <div
265
288
  class="absolute left-0 top-0 bottom-0 w-1.5 z-10 cursor-col-resize hidden sm:block"
@@ -403,6 +426,16 @@ const addFieldMenuItems = computed(
403
426
  v-show="activeTab === 'pageType'"
404
427
  class="relative flex flex-col flex-1 min-h-0"
405
428
  >
429
+ <!-- `overflow-y-auto`, NOT `overflow-hidden`.
430
+ A renderer that manages its own scrolling (kanban, table,
431
+ outline — `flex-1 min-h-0 flex flex-col` with an inner
432
+ scroller) fills this box exactly and never scrolls it, so
433
+ nothing changes for them. A renderer shaped like a PAGE — the
434
+ whole of `@abraca/junis`, and this module's own
435
+ `<AOverviewRenderer>`, whose `overflow-y-auto` the injected
436
+ `overflow-hidden` was fighting — is taller than the panel and
437
+ had no way to reach its own bottom: the content was simply
438
+ clipped, with no scrollbar and no gesture. -->
406
439
  <component
407
440
  :is="docTypeDef.component"
408
441
  v-if="nodeId && usesPageRenderer"
@@ -411,7 +444,7 @@ const addFieldMenuItems = computed(
411
444
  :doc-label="resolvedLabel"
412
445
  :child-provider="panelProvider"
413
446
  :editable="panelEditable"
414
- class="flex-1 overflow-hidden"
447
+ class="flex-1 min-h-0 overflow-y-auto"
415
448
  />
416
449
  </div>
417
450
 
@@ -238,9 +238,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
238
238
  shortcut: string;
239
239
  autofocus: boolean;
240
240
  fullscreen: boolean;
241
+ dismissible: boolean;
241
242
  loading: boolean;
242
243
  colorMode: boolean;
243
- dismissible: boolean;
244
244
  overlay: boolean;
245
245
  modal: boolean;
246
246
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, __VLS_Slots>;
@@ -238,9 +238,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
238
238
  shortcut: string;
239
239
  autofocus: boolean;
240
240
  fullscreen: boolean;
241
+ dismissible: boolean;
241
242
  loading: boolean;
242
243
  colorMode: boolean;
243
- dismissible: boolean;
244
244
  overlay: boolean;
245
245
  modal: boolean;
246
246
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, __VLS_Slots>;
@@ -1,13 +1,22 @@
1
1
  /**
2
- * Slideover registry + swipe-to-close composable.
2
+ * Slideover registry + swipe-to-close.
3
3
  *
4
4
  * `useSlideoverRegistry()` is a shared singleton that tracks all open
5
5
  * slideovers. `useSlideoverSwipe()` auto-registers a slideover component
6
6
  * with the registry when it opens, and unregisters when it closes.
7
7
  *
8
- * Ported from cou-sh/app/composables/useSlideoverSwipe.ts.
8
+ * Ported from cou-sh/app/composables/useSlideoverSwipe.ts — with the half that
9
+ * port was missing. cou-sh's registry is driven by a WINDOW-level touch plugin
10
+ * and routed by its layout (`app:swipe-close-right` → `closeTopGesture`), so
11
+ * the registry alone is inert: nothing in this module ever called `closeTop`,
12
+ * and no consumer that mounts `<ANodePanel>` had a way to dismiss it by touch.
13
+ *
14
+ * So the gesture lives HERE, bound to the panel's own element, and a consumer
15
+ * gets swipe-to-close by passing `el` — no app-level plugin, no layout wiring.
16
+ * An app that already owns a global gesture layer (cou-sh does) simply leaves
17
+ * `el` off and keeps driving the registry itself.
9
18
  */
10
- import { type Ref } from 'vue';
19
+ import { type MaybeRefOrGetter, type Ref } from 'vue';
11
20
  interface SlideoverEntry {
12
21
  id: string;
13
22
  side: 'left' | 'right';
@@ -31,9 +40,28 @@ export declare const useSlideoverRegistry: () => {
31
40
  closeTop: (side?: "left" | "right") => boolean;
32
41
  hasOpen: (side?: "left" | "right") => boolean;
33
42
  };
43
+ export interface SlideoverSwipeOptions {
44
+ /**
45
+ * The panel element the finger lands on. Given one, the slideover follows
46
+ * the thumb and closes when the gesture commits; omitted, this composable is
47
+ * registry bookkeeping only, exactly as before.
48
+ */
49
+ el?: MaybeRefOrGetter<HTMLElement | null | undefined>;
50
+ /** Suppress the gesture without unmounting the caller. */
51
+ disabled?: MaybeRefOrGetter<boolean>;
52
+ }
34
53
  /**
35
- * Auto-register a slideover with the swipe registry.
36
- * Call this inside any component that uses USlideover.
54
+ * Auto-register a slideover with the swipe registry, and — given `el` — bind
55
+ * the gesture that closes it.
56
+ *
57
+ * Returns `offset` (px the panel should be translated by, live) and `dragging`
58
+ * (whether a finger is currently on it, so the caller can drop its transition
59
+ * for the duration — a transition during the drag makes the panel lag the
60
+ * thumb, which reads as a slow app).
37
61
  */
38
- export declare function useSlideoverSwipe(id: string | (() => string), open: Ref<boolean>, side?: 'left' | 'right'): void;
62
+ export declare function useSlideoverSwipe(id: string | (() => string), open: Ref<boolean>, side?: 'left' | 'right', options?: SlideoverSwipeOptions): {
63
+ offset: Ref<number, number>;
64
+ dragging: Ref<boolean, boolean>;
65
+ active: Ref<boolean, boolean>;
66
+ };
39
67
  export {};
@@ -1,4 +1,4 @@
1
- import { ref, watch, onBeforeUnmount } from "vue";
1
+ import { ref, watch, onBeforeUnmount, onScopeDispose, toValue } from "vue";
2
2
  import { createSharedComposable } from "@vueuse/core";
3
3
  const _useSlideoverRegistry = () => {
4
4
  const stack = ref([]);
@@ -26,8 +26,31 @@ const _useSlideoverRegistry = () => {
26
26
  return { stack, register, unregister, closeTop, hasOpen };
27
27
  };
28
28
  export const useSlideoverRegistry = createSharedComposable(_useSlideoverRegistry);
29
- export function useSlideoverSwipe(id, open, side = "right") {
30
- if (typeof window === "undefined") return;
29
+ const COMMIT_FRACTION = 0.25;
30
+ const COMMIT_VELOCITY = 0.5;
31
+ const AXIS_LOCK = 8;
32
+ const RUBBER_BAND = 0.15;
33
+ function ownsHorizontalAxis(target, root) {
34
+ let el = target;
35
+ let depth = 0;
36
+ while (el && el !== root && depth < 15) {
37
+ if (el.hasAttribute("data-swipe-ignore")) return true;
38
+ if (el.matches('input, textarea, select, [contenteditable="true"], [role="slider"]')) return true;
39
+ const style = getComputedStyle(el);
40
+ if (style.overflowX === "auto" || style.overflowX === "scroll") {
41
+ const box = el;
42
+ if (box.scrollWidth > box.clientWidth) return true;
43
+ }
44
+ el = el.parentElement;
45
+ depth++;
46
+ }
47
+ return false;
48
+ }
49
+ export function useSlideoverSwipe(id, open, side = "right", options = {}) {
50
+ const offset = ref(0);
51
+ const dragging = ref(false);
52
+ const active = ref(false);
53
+ if (typeof window === "undefined") return { offset, dragging, active };
31
54
  const registry = useSlideoverRegistry();
32
55
  const resolveId = typeof id === "function" ? id : () => id;
33
56
  watch(open, (isOpen) => {
@@ -42,7 +65,93 @@ export function useSlideoverSwipe(id, open, side = "right") {
42
65
  });
43
66
  } else {
44
67
  registry.unregister(resolveId());
68
+ offset.value = 0;
69
+ dragging.value = false;
70
+ active.value = false;
45
71
  }
46
72
  }, { immediate: true });
47
73
  onBeforeUnmount(() => registry.unregister(resolveId()));
74
+ const away = side === "right" ? 1 : -1;
75
+ let startX = 0;
76
+ let startY = 0;
77
+ let startT = 0;
78
+ let lastX = 0;
79
+ let axis = null;
80
+ let tracking = false;
81
+ let width = 0;
82
+ const SETTLE_MS = 260;
83
+ let settleTimer;
84
+ function endSettle() {
85
+ active.value = false;
86
+ }
87
+ function reset() {
88
+ tracking = false;
89
+ axis = null;
90
+ dragging.value = false;
91
+ offset.value = 0;
92
+ if (settleTimer) clearTimeout(settleTimer);
93
+ settleTimer = setTimeout(endSettle, SETTLE_MS);
94
+ }
95
+ function onTouchStart(e) {
96
+ tracking = false;
97
+ axis = null;
98
+ if (!open.value || toValue(options.disabled)) return;
99
+ if (e.touches.length !== 1) return;
100
+ const root = toValue(options.el);
101
+ if (!root) return;
102
+ const target = e.target;
103
+ if (!target || !root.contains(target)) return;
104
+ const touch = e.touches[0];
105
+ if (ownsHorizontalAxis(target, root)) return;
106
+ startX = lastX = touch.clientX;
107
+ startY = touch.clientY;
108
+ startT = e.timeStamp;
109
+ width = root.getBoundingClientRect().width || 1;
110
+ axis = null;
111
+ tracking = true;
112
+ }
113
+ function onTouchMove(e) {
114
+ if (!tracking) return;
115
+ if (toValue(options.disabled)) return reset();
116
+ const touch = e.touches[0];
117
+ if (!touch) return;
118
+ const dx = touch.clientX - startX;
119
+ const dy = touch.clientY - startY;
120
+ if (!axis) {
121
+ if (Math.abs(dx) < AXIS_LOCK && Math.abs(dy) < AXIS_LOCK) return;
122
+ axis = Math.abs(dx) > Math.abs(dy) ? "x" : "y";
123
+ if (axis === "y") return reset();
124
+ if (settleTimer) clearTimeout(settleTimer);
125
+ dragging.value = true;
126
+ active.value = true;
127
+ }
128
+ if (e.cancelable) e.preventDefault();
129
+ const travel = dx * away;
130
+ offset.value = away * (travel >= 0 ? travel : travel * RUBBER_BAND);
131
+ lastX = touch.clientX;
132
+ }
133
+ function onTouchEnd(e) {
134
+ if (!tracking) return;
135
+ const wasDragging = axis === "x";
136
+ const travel = (lastX - startX) * away;
137
+ const velocity = travel / Math.max(1, e.timeStamp - startT);
138
+ reset();
139
+ if (!wasDragging) return;
140
+ if (travel > width * COMMIT_FRACTION || velocity > COMMIT_VELOCITY) {
141
+ open.value = false;
142
+ registry.unregister(resolveId());
143
+ }
144
+ }
145
+ window.addEventListener("touchstart", onTouchStart, { passive: true });
146
+ window.addEventListener("touchmove", onTouchMove, { passive: false });
147
+ window.addEventListener("touchend", onTouchEnd, { passive: true });
148
+ window.addEventListener("touchcancel", reset, { passive: true });
149
+ onScopeDispose(() => {
150
+ if (settleTimer) clearTimeout(settleTimer);
151
+ window.removeEventListener("touchstart", onTouchStart);
152
+ window.removeEventListener("touchmove", onTouchMove);
153
+ window.removeEventListener("touchend", onTouchEnd);
154
+ window.removeEventListener("touchcancel", reset);
155
+ });
156
+ return { offset, dragging, active };
48
157
  }
@@ -6,6 +6,7 @@ import AColorPalettePopover from "../../components/editor/AColorPalettePopover.v
6
6
  import AIconPickerPopover from "../../components/editor/AIconPickerPopover.vue";
7
7
  import ALocationPickerPopover from "../../components/editor/ALocationPickerPopover.vue";
8
8
  import AMetaNumberStepper from "../../components/editor/AMetaNumberStepper.vue";
9
+ import ATagsEditor from "../../components/ATagsEditor.vue";
9
10
  import { useAbraLocale } from "../../composables/useAbraLocale";
10
11
  import {
11
12
  DateFormatter,
@@ -73,11 +74,6 @@ function getStr(key) {
73
74
  function getDateStr(key) {
74
75
  return getStr(key) || getStr(DATE_SIBLING_KEY[key] ?? "");
75
76
  }
76
- function getStrArr(key) {
77
- const v = storage()?.pageMeta?.[key];
78
- if (!v || !Array.isArray(v)) return [];
79
- return v;
80
- }
81
77
  function getObjArr(key) {
82
78
  const v = storage()?.pageMeta?.[key];
83
79
  if (!v || !Array.isArray(v)) return [];
@@ -420,6 +416,7 @@ const datetimePopoverOpen = ref(false);
420
416
  const timePopoverOpen = ref(false);
421
417
  const daterangePopoverOpen = ref(false);
422
418
  const datetimerangePopoverOpen = ref(false);
419
+ const tagsModalOpen = ref(false);
423
420
  onMounted(() => {
424
421
  const s = storage();
425
422
  if (!s?.pendingOpen) return;
@@ -466,6 +463,9 @@ onMounted(() => {
466
463
  case "datetimerange":
467
464
  datetimerangePopoverOpen.value = true;
468
465
  break;
466
+ case "tags":
467
+ tagsModalOpen.value = true;
468
+ break;
469
469
  }
470
470
  }, 150);
471
471
  });
@@ -489,6 +489,15 @@ function onToggleMember(user) {
489
489
  const exists = current.some((m) => m.id === user.id);
490
490
  patch({ [metaKey.value]: exists ? current.filter((m) => m.id !== user.id) : [...current, { id: user.id, label: user.label }] });
491
491
  }
492
+ const tagList = computed(() => {
493
+ const raw = storage()?.pageMeta?.[metaKey.value];
494
+ if (Array.isArray(raw)) return raw.map((t2) => String(t2).trim()).filter(Boolean);
495
+ if (typeof raw === "string") return raw.split(",").map((t2) => t2.trim()).filter(Boolean);
496
+ return [];
497
+ });
498
+ function onTagsSave(next) {
499
+ patch({ [metaKey.value]: next.length ? next : void 0 });
500
+ }
492
501
  const editingLabel = ref(false);
493
502
  const labelDraft = ref("");
494
503
  const labelInputEl = ref(null);
@@ -1094,13 +1103,37 @@ function removeOption(opt) {
1094
1103
 
1095
1104
  <!-- ── tags ───────────────────────────────────────────────────────────── -->
1096
1105
  <template v-else-if="fieldType === 'tags'">
1097
- <UInputTags
1106
+ <!-- A CHIP, like every other field in this header, not a bare
1107
+ `<UInputTags>`. The input was the one control here that was a form
1108
+ field rather than a chip: it took a fixed width whether or not the
1109
+ document had tags, sat a head taller than its neighbours, and read
1110
+ as a second, unrelated meta editor next to the renderer's own
1111
+ `<AMetaChip>` row. Same recipe as the chip now — button plus the
1112
+ shared `<ATagsEditor>` MODAL, which is also why this is not a
1113
+ popover: an `<UInputTags>` inside one loses its focus to the
1114
+ popover's focus trap on the first Enter. -->
1115
+ <UButton
1098
1116
  size="sm"
1099
- :model-value="getStrArr(metaKey)"
1100
- :placeholder="fieldLabel || t.addTag"
1101
- class="min-h-7"
1102
- @update:model-value="(v) => patch({ [metaKey]: v })"
1103
- @mousedown.stop
1117
+ color="neutral"
1118
+ variant="ghost"
1119
+ icon="i-lucide-tags"
1120
+ class="h-7 px-2.5 py-1 text-sm border border-(--ui-border) rounded-md hover:bg-(--ui-bg-elevated) gap-1.5 data-[state=open]:bg-(--ui-bg-elevated)"
1121
+ @click="isEditable && (tagsModalOpen = true)"
1122
+ >
1123
+ <span
1124
+ v-if="fieldLabel"
1125
+ class="text-(--ui-text-muted) text-xs"
1126
+ >{{ fieldLabel }}</span>
1127
+ <span
1128
+ class="max-w-44 truncate"
1129
+ :class="tagList.length ? '' : 'text-(--ui-text-muted)'"
1130
+ >{{ tagList.length ? tagList.join(", ") : t.addTag }}</span>
1131
+ </UButton>
1132
+ <ATagsEditor
1133
+ v-model:open="tagsModalOpen"
1134
+ :tags="tagList"
1135
+ :title="fieldLabel ? `Edit ${fieldLabel.toLowerCase()}` : 'Edit tags'"
1136
+ @save="onTagsSave"
1104
1137
  />
1105
1138
  </template>
1106
1139
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.93.0",
3
+ "version": "2.96.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,10 +173,10 @@
173
173
  }
174
174
  },
175
175
  "devDependencies": {
176
- "@abraca/convert": "^2.92.0",
177
- "@abraca/dabra": "^2.92.0",
178
- "@abraca/plugin": "^2.92.0",
179
- "@abraca/schema": "^2.92.0",
176
+ "@abraca/convert": "^2.95.0",
177
+ "@abraca/dabra": "^2.95.0",
178
+ "@abraca/plugin": "^2.95.0",
179
+ "@abraca/schema": "^2.95.0",
180
180
  "@codemirror/autocomplete": "^6.18.0",
181
181
  "@codemirror/commands": "^6.7.0",
182
182
  "@codemirror/lang-css": "^6.3.1",