@abraca/nuxt 2.34.0 → 2.35.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.
Files changed (46) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/ANodeSettingsPanel.d.vue.ts +11 -4
  3. package/dist/runtime/components/ANodeSettingsPanel.vue +63 -9
  4. package/dist/runtime/components/ANodeSettingsPanel.vue.d.ts +11 -4
  5. package/dist/runtime/components/aware/AMedia.d.vue.ts +1 -1
  6. package/dist/runtime/components/aware/AMedia.vue.d.ts +1 -1
  7. package/dist/runtime/components/chat/ANodeChatPanel.vue +4 -0
  8. package/dist/runtime/components/renderers/ASheetsRenderer.client.vue +160 -1
  9. package/dist/runtime/components/renderers/sheets/ASheetsCell.d.vue.ts +3 -0
  10. package/dist/runtime/components/renderers/sheets/ASheetsCell.vue +30 -34
  11. package/dist/runtime/components/renderers/sheets/ASheetsCell.vue.d.ts +3 -0
  12. package/dist/runtime/components/renderers/sheets/ASheetsConditionalModal.d.vue.ts +15 -0
  13. package/dist/runtime/components/renderers/sheets/ASheetsConditionalModal.vue +226 -0
  14. package/dist/runtime/components/renderers/sheets/ASheetsConditionalModal.vue.d.ts +15 -0
  15. package/dist/runtime/components/renderers/sheets/ASheetsFindPanel.d.vue.ts +31 -0
  16. package/dist/runtime/components/renderers/sheets/ASheetsFindPanel.vue +130 -0
  17. package/dist/runtime/components/renderers/sheets/ASheetsFindPanel.vue.d.ts +31 -0
  18. package/dist/runtime/components/renderers/sheets/ASheetsGrid.vue +25 -6
  19. package/dist/runtime/components/renderers/sheets/ASheetsToolbar.d.vue.ts +6 -0
  20. package/dist/runtime/components/renderers/sheets/ASheetsToolbar.vue +39 -3
  21. package/dist/runtime/components/renderers/sheets/ASheetsToolbar.vue.d.ts +6 -0
  22. package/dist/runtime/components/renderers/sheets/ASheetsValidationModal.d.vue.ts +15 -0
  23. package/dist/runtime/components/renderers/sheets/ASheetsValidationModal.vue +185 -0
  24. package/dist/runtime/components/renderers/sheets/ASheetsValidationModal.vue.d.ts +15 -0
  25. package/dist/runtime/components/settings/ASettingsAdminPanel.vue +168 -1
  26. package/dist/runtime/components/settings/ASettingsInvitesPanel.vue +73 -11
  27. package/dist/runtime/components/shell/ADocPanelSettings.d.vue.ts +25 -3
  28. package/dist/runtime/components/shell/ADocPanelSettings.vue +28 -10
  29. package/dist/runtime/components/shell/ADocPanelSettings.vue.d.ts +25 -3
  30. package/dist/runtime/components/shell/AUserMenu.d.vue.ts +2 -2
  31. package/dist/runtime/components/shell/AUserMenu.vue.d.ts +2 -2
  32. package/dist/runtime/composables/useChatUsers.d.ts +50 -4
  33. package/dist/runtime/composables/useChatUsers.js +57 -17
  34. package/dist/runtime/composables/useDocPermissions.d.ts +137 -0
  35. package/dist/runtime/composables/useDocPermissions.js +258 -0
  36. package/dist/runtime/composables/useIdentityDoc.d.ts +1 -1
  37. package/dist/runtime/composables/useOrphans.d.ts +58 -0
  38. package/dist/runtime/composables/useOrphans.js +87 -0
  39. package/dist/runtime/composables/useSheetsFind.d.ts +35 -0
  40. package/dist/runtime/composables/useSheetsFind.js +44 -0
  41. package/dist/runtime/composables/useSheetsFormat.d.ts +40 -0
  42. package/dist/runtime/composables/useSheetsFormat.js +132 -0
  43. package/dist/runtime/composables/useSheetsValidation.d.ts +22 -0
  44. package/dist/runtime/composables/useSheetsValidation.js +38 -0
  45. package/dist/runtime/types.d.ts +52 -10
  46. package/package.json +1 -1
@@ -0,0 +1,185 @@
1
+ <script setup>
2
+ import { ref, computed, watch } from "vue";
3
+ const props = defineProps({
4
+ open: { type: Boolean, required: true },
5
+ columnLabel: { type: String, required: true },
6
+ spec: { type: null, required: true }
7
+ });
8
+ const emit = defineEmits(["update:open", "save"]);
9
+ const type = ref("none");
10
+ const listText = ref("");
11
+ const min = ref();
12
+ const max = ref();
13
+ const dateMin = ref("");
14
+ const dateMax = ref("");
15
+ const reject = ref(false);
16
+ watch(() => props.open, (isOpen) => {
17
+ if (!isOpen) return;
18
+ const s = props.spec;
19
+ type.value = s?.type ?? "none";
20
+ listText.value = (s?.values ?? []).join("\n");
21
+ min.value = s?.min;
22
+ max.value = s?.max;
23
+ dateMin.value = s?.dateMin ?? "";
24
+ dateMax.value = s?.dateMax ?? "";
25
+ reject.value = s?.reject ?? false;
26
+ });
27
+ const typeItems = computed(() => [
28
+ { label: "None", value: "none" },
29
+ { label: "List (dropdown)", value: "list" },
30
+ { label: "Number", value: "number" },
31
+ { label: "Date", value: "date" },
32
+ { label: "Text length", value: "text" }
33
+ ]);
34
+ function apply() {
35
+ if (type.value === "none") {
36
+ emit("save", void 0);
37
+ emit("update:open", false);
38
+ return;
39
+ }
40
+ const spec = { type: type.value };
41
+ if (type.value === "list") {
42
+ spec.values = listText.value.split("\n").map((s) => s.trim()).filter(Boolean);
43
+ }
44
+ if (type.value === "number" || type.value === "text") {
45
+ if (min.value !== void 0 && min.value !== null) spec.min = Number(min.value);
46
+ if (max.value !== void 0 && max.value !== null) spec.max = Number(max.value);
47
+ }
48
+ if (type.value === "date") {
49
+ if (dateMin.value) spec.dateMin = dateMin.value;
50
+ if (dateMax.value) spec.dateMax = dateMax.value;
51
+ }
52
+ spec.reject = reject.value;
53
+ emit("save", spec);
54
+ emit("update:open", false);
55
+ }
56
+ </script>
57
+
58
+ <template>
59
+ <UModal
60
+ :open="open"
61
+ title="Data validation"
62
+ @update:open="emit('update:open', $event)"
63
+ >
64
+ <template #content>
65
+ <UCard>
66
+ <template #header>
67
+ <div class="flex items-center justify-between">
68
+ <h3 class="text-base font-semibold">
69
+ Data validation · <span class="font-mono text-(--ui-text-muted)">{{ columnLabel }}</span>
70
+ </h3>
71
+ <UButton
72
+ color="neutral"
73
+ variant="ghost"
74
+ icon="i-lucide-x"
75
+ size="sm"
76
+ @click="emit('update:open', false)"
77
+ />
78
+ </div>
79
+ </template>
80
+
81
+ <div class="space-y-3 min-w-[24rem]">
82
+ <UFormField label="Type">
83
+ <USelectMenu
84
+ v-model="type"
85
+ :items="typeItems"
86
+ value-key="value"
87
+ size="sm"
88
+ />
89
+ </UFormField>
90
+
91
+ <UFormField
92
+ v-if="type === 'list'"
93
+ label="Options"
94
+ hint="One per line"
95
+ >
96
+ <UTextarea
97
+ v-model="listText"
98
+ :rows="5"
99
+ class="w-full font-mono text-sm"
100
+ placeholder="Low&#10;Medium&#10;High"
101
+ />
102
+ </UFormField>
103
+
104
+ <div
105
+ v-if="type === 'number' || type === 'text'"
106
+ class="flex gap-2"
107
+ >
108
+ <UFormField
109
+ :label="type === 'text' ? 'Min length' : 'Min'"
110
+ class="flex-1"
111
+ >
112
+ <UInput
113
+ v-model="min"
114
+ type="number"
115
+ size="sm"
116
+ />
117
+ </UFormField>
118
+ <UFormField
119
+ :label="type === 'text' ? 'Max length' : 'Max'"
120
+ class="flex-1"
121
+ >
122
+ <UInput
123
+ v-model="max"
124
+ type="number"
125
+ size="sm"
126
+ />
127
+ </UFormField>
128
+ </div>
129
+
130
+ <div
131
+ v-if="type === 'date'"
132
+ class="flex gap-2"
133
+ >
134
+ <UFormField
135
+ label="From"
136
+ class="flex-1"
137
+ >
138
+ <UInput
139
+ v-model="dateMin"
140
+ type="date"
141
+ size="sm"
142
+ />
143
+ </UFormField>
144
+ <UFormField
145
+ label="To"
146
+ class="flex-1"
147
+ >
148
+ <UInput
149
+ v-model="dateMax"
150
+ type="date"
151
+ size="sm"
152
+ />
153
+ </UFormField>
154
+ </div>
155
+
156
+ <label
157
+ v-if="type !== 'none'"
158
+ class="flex items-center justify-between gap-2 cursor-pointer pt-1"
159
+ >
160
+ <span class="text-sm">Reject invalid input (instead of just flagging)</span>
161
+ <USwitch
162
+ v-model="reject"
163
+ size="sm"
164
+ />
165
+ </label>
166
+ </div>
167
+
168
+ <template #footer>
169
+ <div class="flex justify-end gap-2">
170
+ <UButton
171
+ color="neutral"
172
+ variant="ghost"
173
+ label="Cancel"
174
+ @click="emit('update:open', false)"
175
+ />
176
+ <UButton
177
+ label="Apply"
178
+ @click="apply"
179
+ />
180
+ </div>
181
+ </template>
182
+ </UCard>
183
+ </template>
184
+ </UModal>
185
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { SheetsValidation } from '../../../types.js';
2
+ type __VLS_Props = {
3
+ open: boolean;
4
+ columnLabel: string;
5
+ spec: SheetsValidation | undefined;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ "update:open": (value: boolean) => any;
9
+ save: (spec: SheetsValidation | undefined) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
12
+ onSave?: ((spec: SheetsValidation | undefined) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -1,12 +1,17 @@
1
1
  <script setup>
2
2
  import { ref, computed, watch } from "vue";
3
+ import { useToast } from "#imports";
3
4
  import { useAbracadabra } from "../../composables/useAbracadabra";
4
5
  import { useAwarenessPeers } from "../../composables/useAwarenessPeers";
6
+ import { useAbraAdmin } from "../../composables/useAbraAdmin";
5
7
  const abra = useAbracadabra();
8
+ const toast = useToast();
9
+ const admin = useAbraAdmin();
6
10
  const { peers } = useAwarenessPeers();
7
11
  const effectiveRole = computed(() => abra.provider.value?.effectiveRole ?? null);
8
12
  const canView = computed(() => effectiveRole.value === "admin" || effectiveRole.value === "service");
9
- const _canModify = computed(() => effectiveRole.value === "admin" || effectiveRole.value === "service");
13
+ const canManageRoles = computed(() => effectiveRole.value === "service");
14
+ const busyId = ref(null);
10
15
  const users = ref([]);
11
16
  const loading = ref(false);
12
17
  async function loadUsers() {
@@ -31,6 +36,79 @@ function roleBadgeColor(role) {
31
36
  if (role === "admin") return "warning";
32
37
  return "neutral";
33
38
  }
39
+ async function setAdmin(user, makeAdmin) {
40
+ busyId.value = user.id;
41
+ try {
42
+ if (makeAdmin) await admin.promoteUser(user.id);
43
+ else await admin.demoteUser(user.id);
44
+ toast.add({
45
+ title: makeAdmin ? "Promoted to admin" : "Demoted from admin",
46
+ description: user.displayName ?? user.username,
47
+ color: "success"
48
+ });
49
+ await loadUsers();
50
+ } catch (e) {
51
+ toast.add({ title: "Role change failed", description: e.message, color: "error" });
52
+ } finally {
53
+ busyId.value = null;
54
+ }
55
+ }
56
+ function actionsFor(user) {
57
+ if (!canManageRoles.value || user.role === "service") return [];
58
+ const items = [];
59
+ if (user.role === "admin") {
60
+ items.push({ label: "Demote from admin", icon: "i-lucide-shield-minus", onSelect: () => setAdmin(user, false) });
61
+ } else {
62
+ items.push({ label: "Promote to admin", icon: "i-lucide-shield-plus", onSelect: () => setAdmin(user, true) });
63
+ }
64
+ return [items];
65
+ }
66
+ const storage = ref(null);
67
+ const storageLoading = ref(false);
68
+ const storageBusy = ref(null);
69
+ function formatBytes(n) {
70
+ if (!n) return "0 B";
71
+ const units = ["B", "KB", "MB", "GB", "TB"];
72
+ const i = Math.min(Math.floor(Math.log(n) / Math.log(1024)), units.length - 1);
73
+ return `${(n / 1024 ** i).toFixed(i ? 1 : 0)} ${units[i]}`;
74
+ }
75
+ async function loadStorage() {
76
+ if (!canView.value || !abra.client.value) return;
77
+ storageLoading.value = true;
78
+ try {
79
+ storage.value = await admin.storageStats();
80
+ } catch {
81
+ } finally {
82
+ storageLoading.value = false;
83
+ }
84
+ }
85
+ async function runSweep() {
86
+ storageBusy.value = "sweep";
87
+ try {
88
+ const r = await admin.storageSweep();
89
+ toast.add({ title: "Storage swept", description: `${r.blobsDeleted} orphaned blob(s) removed`, color: "success" });
90
+ await loadStorage();
91
+ } catch (e) {
92
+ toast.add({ title: "Sweep failed", description: e.message, color: "error" });
93
+ } finally {
94
+ storageBusy.value = null;
95
+ }
96
+ }
97
+ async function runRepair() {
98
+ storageBusy.value = "repair";
99
+ try {
100
+ const r = await admin.storageRepair();
101
+ toast.add({ title: "Storage repaired", description: `${r.refCountsRepaired} ref-count(s) fixed, ${r.blobsSwept} blob(s) swept`, color: "success" });
102
+ await loadStorage();
103
+ } catch (e) {
104
+ toast.add({ title: "Repair failed", description: e.message, color: "error" });
105
+ } finally {
106
+ storageBusy.value = null;
107
+ }
108
+ }
109
+ watch(() => abra.isReady.value, (ready) => {
110
+ if (ready && canView.value) loadStorage();
111
+ }, { immediate: true });
34
112
  </script>
35
113
 
36
114
  <template>
@@ -144,6 +222,18 @@ function roleBadgeColor(role) {
144
222
  </template>
145
223
  </p>
146
224
  </div>
225
+ <UDropdownMenu
226
+ v-if="actionsFor(user).length"
227
+ :items="actionsFor(user)"
228
+ >
229
+ <UButton
230
+ icon="i-lucide-ellipsis-vertical"
231
+ color="neutral"
232
+ variant="ghost"
233
+ size="xs"
234
+ :loading="busyId === user.id"
235
+ />
236
+ </UDropdownMenu>
147
237
  </div>
148
238
  </div>
149
239
 
@@ -153,6 +243,83 @@ function roleBadgeColor(role) {
153
243
  >
154
244
  No users found.
155
245
  </div>
246
+
247
+ <!-- Storage maintenance -->
248
+ <USeparator class="my-5" />
249
+ <div class="flex items-center justify-between mb-3">
250
+ <p class="text-xs font-medium text-(--ui-text-muted) uppercase tracking-wide">
251
+ Storage
252
+ </p>
253
+ <UButton
254
+ icon="i-lucide-refresh-cw"
255
+ color="neutral"
256
+ variant="ghost"
257
+ size="xs"
258
+ :loading="storageLoading"
259
+ @click="loadStorage"
260
+ />
261
+ </div>
262
+
263
+ <div
264
+ v-if="storage"
265
+ class="grid grid-cols-2 sm:grid-cols-4 gap-2 mb-3"
266
+ >
267
+ <div class="rounded-lg border border-(--ui-border) p-3">
268
+ <p class="text-lg font-semibold tabular-nums">
269
+ {{ storage.uploadCount }}
270
+ </p>
271
+ <p class="text-xs text-(--ui-text-muted)">
272
+ Uploads
273
+ </p>
274
+ </div>
275
+ <div class="rounded-lg border border-(--ui-border) p-3">
276
+ <p class="text-lg font-semibold tabular-nums">
277
+ {{ storage.blobCount }}
278
+ </p>
279
+ <p class="text-xs text-(--ui-text-muted)">
280
+ Unique blobs
281
+ </p>
282
+ </div>
283
+ <div class="rounded-lg border border-(--ui-border) p-3">
284
+ <p class="text-lg font-semibold tabular-nums">
285
+ {{ formatBytes(storage.physicalBytes) }}
286
+ </p>
287
+ <p class="text-xs text-(--ui-text-muted)">
288
+ On disk
289
+ </p>
290
+ </div>
291
+ <div class="rounded-lg border border-(--ui-border) p-3">
292
+ <p class="text-lg font-semibold tabular-nums text-(--ui-text-success)">
293
+ {{ formatBytes(storage.dedupSaved) }}
294
+ </p>
295
+ <p class="text-xs text-(--ui-text-muted)">
296
+ Dedup saved
297
+ </p>
298
+ </div>
299
+ </div>
300
+
301
+ <div class="flex flex-wrap gap-2">
302
+ <UButton
303
+ icon="i-lucide-trash-2"
304
+ label="Sweep orphaned blobs"
305
+ color="neutral"
306
+ variant="subtle"
307
+ size="sm"
308
+ :loading="storageBusy === 'sweep'"
309
+ :disabled="storageBusy !== null"
310
+ @click="runSweep"
311
+ />
312
+ <UButton
313
+ icon="i-lucide-wrench"
314
+ label="Repair ref-counts"
315
+ color="neutral"
316
+ variant="subtle"
317
+ size="sm"
318
+ :loading="storageBusy === 'repair'"
319
+ :disabled="storageBusy !== null"
320
+ @click="runRepair"
321
+ />
322
+ </div>
156
323
  </template>
157
324
  </ClientOnly>
158
325
  </div>
@@ -6,6 +6,7 @@ const { invites, loading, error, create, revoke, refresh } = useInvites();
6
6
  const { copy, copied } = useClipboard();
7
7
  const newRole = ref("editor");
8
8
  const newMaxUses = ref(void 0);
9
+ const newExpiry = ref(void 0);
9
10
  const creating = ref(false);
10
11
  const createdCode = ref(null);
11
12
  const roleItems = [
@@ -13,12 +14,32 @@ const roleItems = [
13
14
  { value: "editor", label: "Editor" },
14
15
  { value: "admin", label: "Admin" }
15
16
  ];
17
+ const expiryItems = [
18
+ { value: void 0, label: "Never" },
19
+ { value: 3600, label: "1 hour" },
20
+ { value: 86400, label: "1 day" },
21
+ { value: 604800, label: "7 days" },
22
+ { value: 2592e3, label: "30 days" }
23
+ ];
24
+ function inviteUrl(code) {
25
+ if (typeof window === "undefined") return code;
26
+ return `${window.location.origin}/invite?code=${code}`;
27
+ }
28
+ function copyUrl(code) {
29
+ copy(inviteUrl(code));
30
+ }
31
+ function expiryLabel(invite) {
32
+ if (!invite.expires_at) return null;
33
+ if (invite.expires_at < Date.now()) return "expired";
34
+ return `expires ${formatDate(invite.expires_at)}`;
35
+ }
16
36
  async function handleCreate() {
17
37
  creating.value = true;
18
38
  try {
19
39
  const invite = await create({
20
40
  role: newRole.value,
21
- maxUses: newMaxUses.value
41
+ maxUses: newMaxUses.value,
42
+ expiresIn: newExpiry.value
22
43
  });
23
44
  createdCode.value = invite.code;
24
45
  } finally {
@@ -95,6 +116,18 @@ function formatDate(ts) {
95
116
  class="w-24"
96
117
  />
97
118
  </div>
119
+ <div>
120
+ <p class="text-xs text-(--ui-text-muted) mb-1">
121
+ Expires
122
+ </p>
123
+ <USelect
124
+ v-model="newExpiry"
125
+ :items="expiryItems"
126
+ value-key="value"
127
+ size="sm"
128
+ class="w-28"
129
+ />
130
+ </div>
98
131
  <UButton
99
132
  label="Create"
100
133
  icon="i-lucide-plus"
@@ -104,19 +137,31 @@ function formatDate(ts) {
104
137
  />
105
138
  </div>
106
139
 
107
- <!-- Created code display -->
140
+ <!-- Created code + link display -->
108
141
  <div
109
142
  v-if="createdCode"
110
- class="flex items-center gap-2 p-2 rounded bg-(--ui-bg-elevated)"
143
+ class="space-y-1.5"
111
144
  >
112
- <code class="text-sm font-mono flex-1">{{ createdCode }}</code>
113
- <UButton
114
- :icon="copied ? 'i-lucide-check' : 'i-lucide-copy'"
115
- color="neutral"
116
- variant="ghost"
117
- size="xs"
118
- @click="copy(createdCode ?? '')"
119
- />
145
+ <div class="flex items-center gap-2 p-2 rounded bg-(--ui-bg-elevated)">
146
+ <code class="text-sm font-mono flex-1 truncate">{{ createdCode }}</code>
147
+ <UButton
148
+ :icon="copied ? 'i-lucide-check' : 'i-lucide-copy'"
149
+ color="neutral"
150
+ variant="ghost"
151
+ size="xs"
152
+ @click="copy(createdCode ?? '')"
153
+ />
154
+ </div>
155
+ <div class="flex items-center gap-2 p-2 rounded bg-(--ui-bg-elevated)">
156
+ <code class="text-xs font-mono flex-1 truncate text-(--ui-text-muted)">{{ inviteUrl(createdCode) }}</code>
157
+ <UButton
158
+ icon="i-lucide-link"
159
+ color="neutral"
160
+ variant="ghost"
161
+ size="xs"
162
+ @click="copyUrl(createdCode)"
163
+ />
164
+ </div>
120
165
  </div>
121
166
  </div>
122
167
 
@@ -135,8 +180,25 @@ function formatDate(ts) {
135
180
  <code class="text-sm font-mono">{{ invite.code }}</code>
136
181
  <p class="text-xs text-(--ui-text-muted)">
137
182
  {{ invite.role }} · {{ invite.uses }}/{{ invite.max_uses ?? "\u221E" }} uses · Created {{ formatDate(invite.created_at) }}
183
+ <template v-if="expiryLabel(invite)">
184
+ · {{ expiryLabel(invite) }}
185
+ </template>
138
186
  </p>
139
187
  </div>
188
+ <UButton
189
+ icon="i-lucide-copy"
190
+ color="neutral"
191
+ variant="ghost"
192
+ size="xs"
193
+ @click="copy(invite.code)"
194
+ />
195
+ <UButton
196
+ icon="i-lucide-link"
197
+ color="neutral"
198
+ variant="ghost"
199
+ size="xs"
200
+ @click="copyUrl(invite.code)"
201
+ />
140
202
  <UButton
141
203
  icon="i-lucide-trash-2"
142
204
  color="error"
@@ -63,18 +63,31 @@ type __VLS_Props = {
63
63
  pendingSnapshotVersion?: number | null;
64
64
  /** Whether a snapshot is currently being created */
65
65
  creatingSnapshot?: boolean;
66
+ /** Current public-access value (`'inherit' | 'none' | 'viewer' | 'editor'`). */
67
+ publicAccessValue?: string;
68
+ /** Public-access options for the editable control. */
69
+ publicAccessOptions?: {
70
+ label: string;
71
+ value: string;
72
+ description?: string;
73
+ }[];
74
+ /** When true, the public-access indicator becomes an editable select (owner only). */
75
+ canEditPublicAccess?: boolean;
76
+ /** Whether a public-access change is currently in flight. */
77
+ savingPublicAccess?: boolean;
66
78
  };
67
- declare var __VLS_223: {}, __VLS_387: {};
79
+ declare var __VLS_230: {}, __VLS_394: {};
68
80
  type __VLS_Slots = {} & {
69
- encryption?: (props: typeof __VLS_223) => any;
81
+ encryption?: (props: typeof __VLS_230) => any;
70
82
  } & {
71
- extra?: (props: typeof __VLS_387) => any;
83
+ extra?: (props: typeof __VLS_394) => any;
72
84
  };
73
85
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
74
86
  "update-meta": (patch: Partial<DocPageMeta>) => any;
75
87
  "grant-permission": (userId: string, role: string) => any;
76
88
  "change-role": (userId: string, role: string) => any;
77
89
  "revoke-permission": (userId: string) => any;
90
+ "set-public-access": (value: string) => any;
78
91
  "create-invite": (options: {
79
92
  role: string;
80
93
  maxUses?: number;
@@ -94,6 +107,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
94
107
  "onGrant-permission"?: ((userId: string, role: string) => any) | undefined;
95
108
  "onChange-role"?: ((userId: string, role: string) => any) | undefined;
96
109
  "onRevoke-permission"?: ((userId: string) => any) | undefined;
110
+ "onSet-public-access"?: ((value: string) => any) | undefined;
97
111
  "onCreate-invite"?: ((options: {
98
112
  role: string;
99
113
  maxUses?: number;
@@ -132,6 +146,14 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
132
146
  hasMoreSnapshots: boolean;
133
147
  pendingSnapshotVersion: number | null;
134
148
  creatingSnapshot: boolean;
149
+ publicAccessValue: string;
150
+ publicAccessOptions: {
151
+ label: string;
152
+ value: string;
153
+ description?: string;
154
+ }[];
155
+ canEditPublicAccess: boolean;
156
+ savingPublicAccess: boolean;
135
157
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
136
158
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
137
159
  declare const _default: typeof __VLS_export;
@@ -26,9 +26,13 @@ const props = defineProps({
26
26
  snapshotsError: { type: [String, null], required: false, default: null },
27
27
  hasMoreSnapshots: { type: Boolean, required: false, default: false },
28
28
  pendingSnapshotVersion: { type: [Number, null], required: false, default: null },
29
- creatingSnapshot: { type: Boolean, required: false, default: false }
29
+ creatingSnapshot: { type: Boolean, required: false, default: false },
30
+ publicAccessValue: { type: String, required: false, default: "inherit" },
31
+ publicAccessOptions: { type: Array, required: false, default: () => [] },
32
+ canEditPublicAccess: { type: Boolean, required: false, default: false },
33
+ savingPublicAccess: { type: Boolean, required: false, default: false }
30
34
  });
31
- const emit = defineEmits(["grant-permission", "change-role", "revoke-permission", "create-invite", "sync-doc", "open-encryption", "user-context-menu", "update-meta", "create-snapshot", "delete-snapshot", "restore-snapshot", "fork-snapshot", "preview-snapshot", "load-more-snapshots"]);
35
+ const emit = defineEmits(["grant-permission", "change-role", "revoke-permission", "set-public-access", "create-invite", "sync-doc", "open-encryption", "user-context-menu", "update-meta", "create-snapshot", "delete-snapshot", "restore-snapshot", "fork-snapshot", "preview-snapshot", "load-more-snapshots"]);
32
36
  const grantUserId = ref("");
33
37
  const grantRole = ref("editor");
34
38
  const showManualKeyInput = ref(false);
@@ -385,7 +389,7 @@ function patchMeta(key, value) {
385
389
  </div>
386
390
  </Transition>
387
391
 
388
- <!-- Default access indicator -->
392
+ <!-- Public / default access -->
389
393
  <div
390
394
  v-if="!loadingPermissions"
391
395
  class="flex items-center gap-2 px-3 py-2 text-xs text-(--ui-text-dimmed)"
@@ -394,13 +398,27 @@ function patchMeta(key, value) {
394
398
  name="i-lucide-globe"
395
399
  class="size-3.5 shrink-0"
396
400
  />
397
- <span>Default access</span>
398
- <UBadge
399
- :label="defaultRole"
400
- variant="subtle"
401
- size="xs"
402
- class="capitalize"
403
- />
401
+ <template v-if="canEditPublicAccess">
402
+ <span class="shrink-0">Public access</span>
403
+ <USelect
404
+ :model-value="publicAccessValue"
405
+ :items="publicAccessOptions"
406
+ value-key="value"
407
+ :loading="savingPublicAccess"
408
+ size="xs"
409
+ class="ml-auto w-40"
410
+ @update:model-value="(v) => emit('set-public-access', v)"
411
+ />
412
+ </template>
413
+ <template v-else>
414
+ <span>Default access</span>
415
+ <UBadge
416
+ :label="defaultRole"
417
+ variant="subtle"
418
+ size="xs"
419
+ class="capitalize"
420
+ />
421
+ </template>
404
422
  </div>
405
423
 
406
424
  <!-- Grant access (owner only) -->