@altafusion/fugue-content 0.6.2 → 0.6.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @altafusion/fugue-content
|
|
2
2
|
|
|
3
|
+
## 0.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 431c0d0: Add buttons to the Studio drafts section of the dev tools drawer, and show it to signed-in editors in production.
|
|
8
|
+
|
|
9
|
+
- **Delete Matching** removes every draft whose key contains some text (`qeTools.studioDrafts.deleteMatching`), **Clear All Drafts** removes them all after a second click to confirm (`clearAll`), each row shows its status, and a **Reload Page To Apply** button appears after a delete (Studio keeps a merged copy in memory).
|
|
10
|
+
- The section is privileged, and without an access resolver it only showed in development. `fugue-content` now sets one: development, or a signed-in Studio editor (the `studio-session-check` cookie). A site that wants a different rule calls `setAccessResolver` after it. It is a UI convenience, not a security boundary: the section only touches the browser's own drafts.
|
|
11
|
+
- The section is now called **Studio Drafts**, comes first so it opens by default, and sits in a thin bordered card (`max-w-xl`) with Refresh and Clear All Drafts at the top, Delete Matching under them, then the list.
|
|
12
|
+
- The drawer's section switcher is a Nuxt UI `UTabs` (pill, no content) instead of a row of buttons, and a section no longer repeats its title under the tabs; with a single section there are no tabs, so the title still shows.
|
|
13
|
+
- @altafusion/fugue-simple-auth@0.6.3
|
|
14
|
+
- @altafusion/fugue-theme@0.6.3
|
|
15
|
+
- @altafusion/nuxt-base@0.6.3
|
|
16
|
+
- @altafusion/shell@0.6.3
|
|
17
|
+
|
|
3
18
|
## 0.6.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,71 +1,215 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { StudioDraftSummary } from '../../lib/qe-tools'
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The Studio drafts section of the dev tools drawer: the UI over `window.qeTools.studioDrafts`. List the unpublished drafts
|
|
6
|
+
* kept in this browser, delete one, delete every draft whose key contains some text, or clear them all. Studio keeps a merged
|
|
7
|
+
* copy in memory, so the page has to reload after a delete.
|
|
8
|
+
*/
|
|
5
9
|
const drafts = ref<StudioDraftSummary[]>([])
|
|
10
|
+
const match = ref('')
|
|
6
11
|
const loading = ref(false)
|
|
12
|
+
const confirmClear = ref(false)
|
|
13
|
+
const message = ref('')
|
|
7
14
|
const error = ref('')
|
|
15
|
+
const changed = ref(false)
|
|
8
16
|
|
|
9
|
-
async function
|
|
17
|
+
async function run(task: (api: NonNullable<Window['qeTools']>['studioDrafts']) => Promise<string>) {
|
|
10
18
|
const api = window.qeTools?.studioDrafts
|
|
11
|
-
if (!api)
|
|
19
|
+
if (!api) {
|
|
20
|
+
error.value = 'qeTools.studioDrafts is not available in this browser.'
|
|
12
21
|
return
|
|
22
|
+
}
|
|
13
23
|
loading.value = true
|
|
14
24
|
error.value = ''
|
|
15
25
|
try {
|
|
16
|
-
|
|
26
|
+
message.value = await task(api)
|
|
17
27
|
} catch (e) {
|
|
18
28
|
error.value = e instanceof Error ? e.message : String(e)
|
|
19
29
|
} finally {
|
|
20
30
|
loading.value = false
|
|
31
|
+
confirmClear.value = false
|
|
21
32
|
}
|
|
22
33
|
}
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
await
|
|
26
|
-
|
|
27
|
-
}
|
|
35
|
+
const refresh = () => run(async (api) => {
|
|
36
|
+
drafts.value = await api.list()
|
|
37
|
+
return ''
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const remove = (key: string) => run(async (api) => {
|
|
41
|
+
await api.deleteOne(key)
|
|
42
|
+
changed.value = true
|
|
43
|
+
drafts.value = await api.list()
|
|
44
|
+
return `Deleted ${key}.`
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const removeMatching = () => run(async (api) => {
|
|
48
|
+
const text = match.value.trim()
|
|
49
|
+
const removed = await api.deleteMatching(text)
|
|
50
|
+
changed.value = changed.value || removed.length > 0
|
|
51
|
+
drafts.value = await api.list()
|
|
52
|
+
return `Deleted ${removed.length} draft(s) matching "${text}".`
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const clearAll = () => run(async (api) => {
|
|
56
|
+
const before = drafts.value.length
|
|
57
|
+
await api.clearAll()
|
|
58
|
+
changed.value = true
|
|
59
|
+
drafts.value = await api.list()
|
|
60
|
+
return `Cleared all drafts (${before} listed before).`
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const reload = () => window.location.reload()
|
|
64
|
+
|
|
65
|
+
// A transparent card with the stronger `accented` border, so it reads on the drawer's solid background.
|
|
66
|
+
const cardUi = { root: 'bg-transparent ring-accented', header: 'px-3 py-2 sm:px-3', body: 'p-3 sm:p-3' }
|
|
28
67
|
|
|
29
68
|
onMounted(refresh)
|
|
30
69
|
</script>
|
|
31
70
|
|
|
32
71
|
<template>
|
|
33
|
-
<div class="
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class="
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
<div class="grid w-full gap-4 text-sm sm:grid-cols-2">
|
|
73
|
+
<UCard :ui="cardUi">
|
|
74
|
+
<template #header>
|
|
75
|
+
<div class="flex items-center justify-between gap-2">
|
|
76
|
+
<span class="font-medium">Actions</span>
|
|
77
|
+
<UBadge
|
|
78
|
+
:label="`${drafts.length} in this browser`"
|
|
79
|
+
size="sm"
|
|
80
|
+
color="neutral"
|
|
81
|
+
variant="subtle"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<div class="space-y-3">
|
|
87
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
88
|
+
<UButton
|
|
89
|
+
label="Refresh"
|
|
90
|
+
icon="i-lucide-refresh-cw"
|
|
91
|
+
size="xs"
|
|
92
|
+
color="neutral"
|
|
93
|
+
variant="outline"
|
|
94
|
+
:loading="loading"
|
|
95
|
+
@click="refresh"
|
|
96
|
+
/>
|
|
97
|
+
<UButton
|
|
98
|
+
v-if="!confirmClear"
|
|
99
|
+
label="Clear All Drafts"
|
|
100
|
+
icon="i-lucide-eraser"
|
|
101
|
+
size="xs"
|
|
102
|
+
color="error"
|
|
103
|
+
variant="outline"
|
|
104
|
+
:disabled="loading || !drafts.length"
|
|
105
|
+
@click="confirmClear = true"
|
|
106
|
+
/>
|
|
107
|
+
<template v-else>
|
|
108
|
+
<UButton
|
|
109
|
+
label="Yes, Clear Everything"
|
|
110
|
+
icon="i-lucide-triangle-alert"
|
|
111
|
+
size="xs"
|
|
112
|
+
color="error"
|
|
113
|
+
:loading="loading"
|
|
114
|
+
@click="clearAll"
|
|
115
|
+
/>
|
|
116
|
+
<UButton
|
|
117
|
+
label="Cancel"
|
|
118
|
+
size="xs"
|
|
119
|
+
color="neutral"
|
|
120
|
+
variant="ghost"
|
|
121
|
+
@click="confirmClear = false"
|
|
122
|
+
/>
|
|
123
|
+
</template>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<form @submit.prevent="removeMatching">
|
|
127
|
+
<UFieldGroup class="w-full">
|
|
128
|
+
<UInput
|
|
129
|
+
v-model="match"
|
|
130
|
+
placeholder="Text in the draft key, e.g. about"
|
|
131
|
+
size="xs"
|
|
132
|
+
class="flex-1"
|
|
133
|
+
/>
|
|
134
|
+
<UButton
|
|
135
|
+
type="submit"
|
|
136
|
+
label="Delete Matching"
|
|
137
|
+
icon="i-lucide-trash-2"
|
|
138
|
+
size="xs"
|
|
139
|
+
color="warning"
|
|
140
|
+
variant="outline"
|
|
141
|
+
:disabled="!match.trim()"
|
|
142
|
+
:loading="loading"
|
|
143
|
+
/>
|
|
144
|
+
</UFieldGroup>
|
|
145
|
+
</form>
|
|
146
|
+
|
|
147
|
+
<UAlert
|
|
148
|
+
v-if="message"
|
|
149
|
+
:description="message"
|
|
150
|
+
color="neutral"
|
|
151
|
+
variant="subtle"
|
|
152
|
+
icon="i-lucide-info"
|
|
153
|
+
/>
|
|
154
|
+
<UAlert
|
|
155
|
+
v-if="error"
|
|
156
|
+
:description="error"
|
|
157
|
+
color="error"
|
|
158
|
+
variant="subtle"
|
|
159
|
+
icon="i-lucide-circle-alert"
|
|
160
|
+
/>
|
|
161
|
+
|
|
58
162
|
<UButton
|
|
59
|
-
|
|
163
|
+
v-if="changed"
|
|
164
|
+
label="Reload Page To Apply"
|
|
165
|
+
icon="i-lucide-rotate-cw"
|
|
60
166
|
size="xs"
|
|
61
|
-
|
|
62
|
-
variant="ghost"
|
|
63
|
-
@click="remove(draft.key)"
|
|
167
|
+
@click="reload"
|
|
64
168
|
/>
|
|
65
|
-
</
|
|
66
|
-
</
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
169
|
+
</div>
|
|
170
|
+
</UCard>
|
|
171
|
+
|
|
172
|
+
<UCard :ui="cardUi">
|
|
173
|
+
<template #header>
|
|
174
|
+
<span class="font-medium">Drafts</span>
|
|
175
|
+
</template>
|
|
176
|
+
|
|
177
|
+
<ul
|
|
178
|
+
v-if="drafts.length"
|
|
179
|
+
class="max-h-40 divide-y divide-default overflow-y-auto"
|
|
180
|
+
>
|
|
181
|
+
<li
|
|
182
|
+
v-for="draft in drafts"
|
|
183
|
+
:key="draft.key"
|
|
184
|
+
class="flex items-center justify-between gap-2 py-1"
|
|
185
|
+
>
|
|
186
|
+
<span class="truncate font-mono text-xs">{{ draft.key }}</span>
|
|
187
|
+
<span class="flex shrink-0 items-center gap-1">
|
|
188
|
+
<UBadge
|
|
189
|
+
:label="draft.status"
|
|
190
|
+
size="sm"
|
|
191
|
+
color="neutral"
|
|
192
|
+
variant="subtle"
|
|
193
|
+
/>
|
|
194
|
+
<UButton
|
|
195
|
+
label="Delete"
|
|
196
|
+
size="xs"
|
|
197
|
+
color="error"
|
|
198
|
+
variant="ghost"
|
|
199
|
+
:disabled="loading"
|
|
200
|
+
@click="remove(draft.key)"
|
|
201
|
+
/>
|
|
202
|
+
</span>
|
|
203
|
+
</li>
|
|
204
|
+
</ul>
|
|
205
|
+
<UEmpty
|
|
206
|
+
v-else
|
|
207
|
+
icon="i-lucide-inbox"
|
|
208
|
+
title="No Drafts"
|
|
209
|
+
description="Unpublished Studio edits in this browser show up here."
|
|
210
|
+
size="sm"
|
|
211
|
+
variant="naked"
|
|
212
|
+
/>
|
|
213
|
+
</UCard>
|
|
70
214
|
</div>
|
|
71
215
|
</template>
|
|
@@ -10,8 +10,11 @@ interface DevToolsRegistrar {
|
|
|
10
10
|
id: string
|
|
11
11
|
label: string
|
|
12
12
|
component: Component
|
|
13
|
+
/** Lower numbers come first; the first visible section opens by default. */
|
|
14
|
+
order?: number
|
|
13
15
|
access?: 'public' | 'privileged'
|
|
14
16
|
}) => () => void
|
|
17
|
+
setAccessResolver: (resolver: () => boolean) => void
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
function hasQeToolsUrlParam(): boolean {
|
|
@@ -25,6 +28,9 @@ function hasQeToolsUrlParam(): boolean {
|
|
|
25
28
|
* Registers `window.qeTools` for operator troubleshooting (dev + production).
|
|
26
29
|
* When `@altafusion/fugue-devtools` is installed, the drawer is the UI over it: the Studio drafts become a (privileged)
|
|
27
30
|
* section and `?qetools` opens the drawer. Without it, `?qetools` or `?qetools=1` prints the console help on load.
|
|
31
|
+
* The section is privileged, so this plugin also lets a signed-in Studio editor see it in production (in development it shows
|
|
32
|
+
* for everyone). A site that wants a stricter or wider rule calls `setAccessResolver` itself after this runs. The gate is a
|
|
33
|
+
* convenience, not security: the section only touches this browser's own drafts.
|
|
28
34
|
*/
|
|
29
35
|
export default defineNuxtPlugin({
|
|
30
36
|
name: 'fugue-content:qe-tools',
|
|
@@ -33,14 +39,17 @@ export default defineNuxtPlugin({
|
|
|
33
39
|
return
|
|
34
40
|
|
|
35
41
|
window.qeTools = createQeTools()
|
|
42
|
+
const sessionCheck = useFugueContentStudioSessionCheckCookie()
|
|
36
43
|
|
|
37
44
|
// `app:created` runs after every plugin has set up, so the order of the layers does not matter.
|
|
38
45
|
nuxtApp.hook('app:created', () => {
|
|
39
46
|
const devtools = (nuxtApp as unknown as { $fugueDevtools?: DevToolsRegistrar }).$fugueDevtools
|
|
40
47
|
if (devtools) {
|
|
48
|
+
devtools.setAccessResolver(() => import.meta.dev || sessionCheck.value === 'true')
|
|
41
49
|
devtools.registerSection({
|
|
42
50
|
id: 'studio-drafts',
|
|
43
|
-
label: 'Studio
|
|
51
|
+
label: 'Studio Drafts',
|
|
52
|
+
order: -10,
|
|
44
53
|
component: FugueContentQeToolsDrafts,
|
|
45
54
|
access: 'privileged'
|
|
46
55
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altafusion/fugue-content",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"description": "Nuxt layer for Fugue Content sites — editorial pages, Studio, and MDC, composed with shell.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/altafusion/fugue/tree/main/packages-consumer/fugue-content#readme",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"main": "./nuxt.config.ts",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@altafusion/fugue-theme": "0.6.
|
|
29
|
+
"@altafusion/fugue-theme": "0.6.3",
|
|
30
30
|
"better-sqlite3": "^12.11.1",
|
|
31
31
|
"h3": "^1.15.0",
|
|
32
32
|
"nuxt": "^4.7.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"vue-router": "^5.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@altafusion/fugue-simple-auth": "0.6.
|
|
38
|
-
"@altafusion/nuxt-base": "0.6.
|
|
39
|
-
"@altafusion/shell": "0.6.
|
|
37
|
+
"@altafusion/fugue-simple-auth": "0.6.3",
|
|
38
|
+
"@altafusion/nuxt-base": "0.6.3",
|
|
39
|
+
"@altafusion/shell": "0.6.3",
|
|
40
40
|
"@nuxt/content": "^3.17.0",
|
|
41
41
|
"@nuxt/kit": "^4.7.0",
|
|
42
42
|
"@nuxtjs/i18n": "^10.7.0",
|
|
@@ -45,12 +45,13 @@
|
|
|
45
45
|
"ufo": "^1.6.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@altafusion/eslint-config": "0.6.
|
|
49
|
-
"@altafusion/fugue-theme": "0.6.
|
|
48
|
+
"@altafusion/eslint-config": "0.6.3",
|
|
49
|
+
"@altafusion/fugue-theme": "0.6.3",
|
|
50
50
|
"@iconify-json/lucide": "^1.2.160",
|
|
51
51
|
"@types/node": "^26.6.11",
|
|
52
52
|
"better-sqlite3": "^12.11.1",
|
|
53
53
|
"eslint": "^10.15.0",
|
|
54
|
+
"fake-indexeddb": "6.2.8",
|
|
54
55
|
"nuxt": "^4.7.0",
|
|
55
56
|
"typescript": "^6.0.3",
|
|
56
57
|
"vitest": "^5.1.2",
|