@altafusion/fugue-content 0.0.0-stage → 0.3.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/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +352 -2
- package/app/components/FugueContent404Page.vue +48 -0
- package/app/components/FugueContentAuthSignOut.vue +16 -0
- package/app/components/FugueContentContentPage.vue +33 -0
- package/app/components/FugueContentEditContent.vue +76 -0
- package/app/components/FugueContentEditorMenu.vue +60 -0
- package/app/components/FugueContentFooterActions.vue +32 -0
- package/app/components/FugueContentFragment.vue +53 -0
- package/app/components/FugueContentHeaderActions.vue +37 -0
- package/app/components/FugueContentLandingPage.vue +69 -0
- package/app/components/FugueContentLayoutArticle.vue +22 -0
- package/app/components/FugueContentLayoutArticleAside.vue +88 -0
- package/app/components/FugueContentLayoutLanding.vue +5 -0
- package/app/components/LandingHeroMedia.vue +91 -0
- package/app/components/content/CallToAction.vue +35 -0
- package/app/components/content/Hero.vue +34 -0
- package/app/composables/useFugueContentCatchAllRoute.ts +91 -0
- package/app/composables/useFugueContentFragment.ts +70 -0
- package/app/composables/useFugueContentI18n.ts +77 -0
- package/app/composables/useFugueContentLanding.ts +24 -0
- package/app/composables/useFugueContentPage.ts +37 -0
- package/app/composables/useFugueContentSettings.ts +140 -0
- package/app/composables/useFugueContentStudioEdit.ts +38 -0
- package/app/pages/[...slug].vue +7 -0
- package/app/pages/fragments/[slug].vue +25 -0
- package/app/pages/index.vue +7 -0
- package/app/pages/login.vue +70 -0
- package/app/plugins/auth-session-sync.client.ts +33 -0
- package/app/plugins/landing-component-registry.ts +15 -0
- package/app/plugins/landing-nav.ts +26 -0
- package/app/plugins/qe-tools.client.ts +28 -0
- package/app/plugins/seo-defaults.ts +4 -0
- package/app/plugins/settings-bridge.ts +14 -0
- package/app/plugins/shell-display-name.ts +18 -0
- package/app/plugins/studio-auto-open.client.ts +30 -0
- package/app/plugins/studio-dev-shortcut.client.ts +24 -0
- package/app/plugins/studio-footer-actions.client.ts +27 -0
- package/app/plugins/studio-footer-actions.server.ts +11 -0
- package/app/plugins/studio-hash-cleanup.client.ts +12 -0
- package/app/plugins/studio-header-actions.client.ts +30 -0
- package/app/plugins/studio-header-actions.server.ts +13 -0
- package/app/utils/studio-mount.ts +72 -0
- package/composables/useFugueContentAuthMode.ts +16 -0
- package/composables/useFugueContentAuthSignOut.ts +82 -0
- package/composables/useFugueContentPeekSession.ts +31 -0
- package/composables/useFugueContentStudioEditorEntry.ts +112 -0
- package/composables/useFugueContentStudioSession.ts +81 -0
- package/content.config.ts +199 -0
- package/content.d.ts +25 -0
- package/eslint.config.mjs +4 -0
- package/lib/404-defaults.ts +41 -0
- package/lib/article-i18n.ts +10 -0
- package/lib/auth-resolve.ts +74 -0
- package/lib/auth-utils.ts +44 -0
- package/lib/define-site.ts +156 -0
- package/lib/header-actions-registration.ts +42 -0
- package/lib/i18n-locales.ts +22 -0
- package/lib/i18n-utils.ts +136 -0
- package/lib/i18n.ts +2 -0
- package/lib/landing.ts +129 -0
- package/lib/login-redirect.ts +12 -0
- package/lib/netlify-ssr.ts +113 -0
- package/lib/page-toc.ts +14 -0
- package/lib/qe-tools/index.ts +36 -0
- package/lib/qe-tools/studio-drafts.ts +315 -0
- package/lib/qe-tools/types.ts +14 -0
- package/lib/settings-state.ts +1 -0
- package/lib/site-config-registry.ts +80 -0
- package/lib/studio-activation-gated.d.ts +20 -0
- package/lib/studio-activation-gated.js +127 -0
- package/lib/studio-auto-open.ts +26 -0
- package/lib/studio-cookies.d.ts +10 -0
- package/lib/studio-cookies.js +11 -0
- package/lib/studio-document-edit.ts +61 -0
- package/lib/studio-editor-visibility.ts +54 -0
- package/lib/studio-open.ts +7 -0
- package/lib/studio-session.ts +91 -0
- package/modules/i18n.ts +80 -0
- package/modules/landing-components.ts +95 -0
- package/modules/studio-auth-gate.ts +48 -0
- package/modules/studio-entry.ts +23 -0
- package/nuxt.config.ts +90 -0
- package/package.json +75 -3
- package/schemas/site-settings.schema.json +127 -0
- package/server/middleware/studio-oauth-redirect.ts +36 -0
- package/server/middleware/studio-provider-check.ts +59 -0
- package/server/plugins/studio-hash-cleanup.ts +8 -0
- package/tsconfig.build.json +22 -0
- package/tsconfig.json +20 -0
- package/types/site.ts +79 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Collections } from '@nuxt/content'
|
|
2
|
+
import { fragmentsCollectionName, pagesCollectionName, settingsCollectionName } from '../../lib/i18n-utils'
|
|
3
|
+
|
|
4
|
+
export interface FugueContentPublicConfig {
|
|
5
|
+
i18nEnabled?: boolean
|
|
6
|
+
defaultLocale?: string
|
|
7
|
+
filteredLocales?: Array<{ code: string, name?: string }>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function useFugueContentI18n() {
|
|
11
|
+
const fugueContentConfig = useRuntimeConfig().public.cms as FugueContentPublicConfig | undefined
|
|
12
|
+
const nuxtApp = useNuxtApp()
|
|
13
|
+
|
|
14
|
+
const isEnabled = computed(() => !!fugueContentConfig?.i18nEnabled)
|
|
15
|
+
|
|
16
|
+
const locale = computed(() => {
|
|
17
|
+
if (!isEnabled.value)
|
|
18
|
+
return fugueContentConfig?.defaultLocale ?? 'en'
|
|
19
|
+
const i18n = nuxtApp.$i18n as { locale: { value: string } } | undefined
|
|
20
|
+
return i18n?.locale?.value ?? fugueContentConfig?.defaultLocale ?? 'en'
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const locales = computed(() => fugueContentConfig?.filteredLocales ?? [])
|
|
24
|
+
|
|
25
|
+
const pagesCollection = computed((): keyof Collections => {
|
|
26
|
+
const code = locale.value
|
|
27
|
+
if (!isEnabled.value)
|
|
28
|
+
return pagesCollectionName(fugueContentConfig?.defaultLocale ?? 'en') as keyof Collections
|
|
29
|
+
return pagesCollectionName(code) as keyof Collections
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const fragmentsCollection = computed((): keyof Collections => {
|
|
33
|
+
const code = locale.value
|
|
34
|
+
if (!isEnabled.value)
|
|
35
|
+
return fragmentsCollectionName(fugueContentConfig?.defaultLocale ?? 'en') as keyof Collections
|
|
36
|
+
return fragmentsCollectionName(code) as keyof Collections
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const settingsCollection = computed((): keyof Collections => {
|
|
40
|
+
const code = locale.value
|
|
41
|
+
if (!isEnabled.value)
|
|
42
|
+
return settingsCollectionName(fugueContentConfig?.defaultLocale ?? 'en') as keyof Collections
|
|
43
|
+
return settingsCollectionName(code) as keyof Collections
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const defaultLocale = computed(() => fugueContentConfig?.defaultLocale ?? 'en')
|
|
47
|
+
|
|
48
|
+
function localePath(path: string) {
|
|
49
|
+
if (!isEnabled.value)
|
|
50
|
+
return path
|
|
51
|
+
const fn = nuxtApp.$localePath as ((target: string) => string) | undefined
|
|
52
|
+
return fn?.(path) ?? path
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function switchLocalePath(target: string) {
|
|
56
|
+
const fn = nuxtApp.$switchLocalePath as ((_locale: string) => string) | undefined
|
|
57
|
+
return fn?.(target) ?? `/${target}`
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function t(key: string) {
|
|
61
|
+
const i18n = nuxtApp.$i18n as { t: (_key: string) => string } | undefined
|
|
62
|
+
return i18n?.t(key) ?? key
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
isEnabled,
|
|
67
|
+
locale,
|
|
68
|
+
locales,
|
|
69
|
+
defaultLocale,
|
|
70
|
+
pagesCollection,
|
|
71
|
+
fragmentsCollection,
|
|
72
|
+
settingsCollection,
|
|
73
|
+
localePath,
|
|
74
|
+
switchLocalePath,
|
|
75
|
+
t
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FugueContentLandingSection } from '../../lib/landing'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One-page landing sections from `content/{locale}/settings/site.yml` → `landing.sections`.
|
|
5
|
+
*/
|
|
6
|
+
export function useFugueContentLanding() {
|
|
7
|
+
const { settings, pending, error } = useFugueContentSettings()
|
|
8
|
+
|
|
9
|
+
const sections = computed((): FugueContentLandingSection[] => {
|
|
10
|
+
const landing = settings.value?.landing
|
|
11
|
+
if (!landing?.sections?.length)
|
|
12
|
+
return []
|
|
13
|
+
return landing.sections
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const hasLanding = computed(() => sections.value.length > 0)
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
sections,
|
|
20
|
+
hasLanding,
|
|
21
|
+
pending,
|
|
22
|
+
error
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface FugueContentPage {
|
|
2
|
+
path: string
|
|
3
|
+
stem?: string
|
|
4
|
+
title?: string
|
|
5
|
+
description?: string
|
|
6
|
+
layout?: 'landing' | 'article' | 'article-aside'
|
|
7
|
+
nav?: {
|
|
8
|
+
primary?: string
|
|
9
|
+
}
|
|
10
|
+
body?: unknown
|
|
11
|
+
[key: string]: unknown
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type FugueContentLayoutName = 'landing' | 'article' | 'article-aside'
|
|
15
|
+
|
|
16
|
+
const fugueContentPageKey = 'cms:page'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Holds the active content page for the current route (set by content route pages).
|
|
20
|
+
*/
|
|
21
|
+
export function useFugueContentPage() {
|
|
22
|
+
const page = useState<FugueContentPage | null>(fugueContentPageKey, () => null)
|
|
23
|
+
|
|
24
|
+
const layout = computed((): FugueContentLayoutName => {
|
|
25
|
+
const value = page.value?.layout
|
|
26
|
+
if (value === 'article-aside')
|
|
27
|
+
return 'article-aside'
|
|
28
|
+
if (value === 'article')
|
|
29
|
+
return 'article'
|
|
30
|
+
return 'landing'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
page,
|
|
35
|
+
layout
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Collections } from '@nuxt/content'
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue'
|
|
3
|
+
import type { FugueContentLandingManifest } from '../../lib/landing'
|
|
4
|
+
import { settingsCollectionName } from '../../lib/i18n-utils'
|
|
5
|
+
|
|
6
|
+
export interface FugueContentSettingsAddress {
|
|
7
|
+
street?: string
|
|
8
|
+
city?: string
|
|
9
|
+
region?: string
|
|
10
|
+
postalCode?: string
|
|
11
|
+
country?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FugueContentSettingsSeo {
|
|
15
|
+
title?: string
|
|
16
|
+
description?: string
|
|
17
|
+
titleTemplate?: string
|
|
18
|
+
ogImage?: string
|
|
19
|
+
twitterCard?: 'summary' | 'summary_large_image'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FugueContentSettingsTheme {
|
|
23
|
+
/** Dark canvas personality — overrides `sitePalette.darkCanvas` when set. */
|
|
24
|
+
darkCanvas?: 'gray' | 'black'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FugueContentSettings {
|
|
28
|
+
siteName?: string
|
|
29
|
+
phone?: string
|
|
30
|
+
email?: string
|
|
31
|
+
address?: FugueContentSettingsAddress
|
|
32
|
+
hours?: string
|
|
33
|
+
mapEmbedUrl?: string
|
|
34
|
+
social?: {
|
|
35
|
+
instagram?: string
|
|
36
|
+
facebook?: string
|
|
37
|
+
}
|
|
38
|
+
seo?: FugueContentSettingsSeo
|
|
39
|
+
landing?: FugueContentLandingManifest
|
|
40
|
+
theme?: FugueContentSettingsTheme
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function useFugueContentSettings() {
|
|
44
|
+
const nuxtApp = useNuxtApp()
|
|
45
|
+
const { locale, isEnabled, defaultLocale } = useFugueContentI18n()
|
|
46
|
+
|
|
47
|
+
const settingsCollection = computed((): keyof Collections => {
|
|
48
|
+
if (!isEnabled.value)
|
|
49
|
+
return settingsCollectionName(defaultLocale.value) as keyof Collections
|
|
50
|
+
return settingsCollectionName(locale.value) as keyof Collections
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const i18nReady = computed(() => !isEnabled.value || !!nuxtApp.$i18n)
|
|
54
|
+
|
|
55
|
+
const { data: settings, pending, error } = useAsyncData(
|
|
56
|
+
() => `fugue-content-settings:${isEnabled.value
|
|
57
|
+
? `${locale.value}:`
|
|
58
|
+
: ''}${defaultLocale.value}`,
|
|
59
|
+
() => {
|
|
60
|
+
if (!i18nReady.value)
|
|
61
|
+
return Promise.resolve(null)
|
|
62
|
+
return queryCollection(settingsCollection.value).first()
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
watch: [settingsCollection, locale, i18nReady]
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
settings: computed(() => (settings.value as FugueContentSettings | null) ?? null),
|
|
71
|
+
pending,
|
|
72
|
+
error
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface FugueContentSeoOverrides {
|
|
77
|
+
title?: MaybeRefOrGetter<string | undefined>
|
|
78
|
+
description?: MaybeRefOrGetter<string | undefined>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function resolveAssetUrl(path: string | undefined, origin: string) {
|
|
82
|
+
if (!path)
|
|
83
|
+
return undefined
|
|
84
|
+
if (path.startsWith('http://') || path.startsWith('https://'))
|
|
85
|
+
return path
|
|
86
|
+
return `${origin}${path.startsWith('/')
|
|
87
|
+
? path
|
|
88
|
+
: `/${path}`}`
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Site-wide and per-page SEO — merges Content `settings`, app `seo` config, and overrides.
|
|
93
|
+
*/
|
|
94
|
+
export function useFugueContentSiteSeo(overrides: FugueContentSeoOverrides = {}) {
|
|
95
|
+
const appConfig = useAppConfig() as { seo?: FugueContentSettingsSeo }
|
|
96
|
+
const { settings } = useFugueContentSettings()
|
|
97
|
+
const requestURL = useRequestURL()
|
|
98
|
+
|
|
99
|
+
const resolved = computed(() => {
|
|
100
|
+
const fromSettings = settings.value?.seo
|
|
101
|
+
const fromApp = appConfig.seo
|
|
102
|
+
const pageTitle = toValue(overrides.title)
|
|
103
|
+
const pageDescription = toValue(overrides.description)
|
|
104
|
+
|
|
105
|
+
const siteTitle = fromSettings?.title ?? fromApp?.title
|
|
106
|
+
const siteDescription = fromSettings?.description ?? fromApp?.description
|
|
107
|
+
const titleTemplate = fromSettings?.titleTemplate ?? fromApp?.titleTemplate
|
|
108
|
+
const ogImage = fromSettings?.ogImage ?? fromApp?.ogImage ?? '/favicon.svg'
|
|
109
|
+
const twitterCard = fromSettings?.twitterCard ?? fromApp?.twitterCard ?? 'summary_large_image'
|
|
110
|
+
|
|
111
|
+
const title = pageTitle ?? siteTitle
|
|
112
|
+
const description = pageDescription ?? siteDescription
|
|
113
|
+
const ogImageUrl = resolveAssetUrl(ogImage, requestURL.origin)
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
title,
|
|
117
|
+
description,
|
|
118
|
+
titleTemplate,
|
|
119
|
+
ogImageUrl,
|
|
120
|
+
twitterCard,
|
|
121
|
+
ogUrl: requestURL.href
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
useSeoMeta({
|
|
126
|
+
title: () => resolved.value.title,
|
|
127
|
+
description: () => resolved.value.description,
|
|
128
|
+
titleTemplate: () => resolved.value.titleTemplate ?? null,
|
|
129
|
+
ogTitle: () => resolved.value.title,
|
|
130
|
+
ogDescription: () => resolved.value.description,
|
|
131
|
+
ogImage: () => resolved.value.ogImageUrl,
|
|
132
|
+
ogUrl: () => resolved.value.ogUrl,
|
|
133
|
+
twitterCard: () => resolved.value.twitterCard,
|
|
134
|
+
twitterTitle: () => resolved.value.title,
|
|
135
|
+
twitterDescription: () => resolved.value.description,
|
|
136
|
+
twitterImage: () => resolved.value.ogImageUrl
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
return { resolved }
|
|
140
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { fragmentFsPath, pageFsPath } from '../../lib/i18n-utils'
|
|
2
|
+
import { requestFugueContentStudioDocumentEdit } from '../../lib/studio-document-edit'
|
|
3
|
+
import { resolveFugueContentShowFragmentEdit } from '../../lib/studio-editor-visibility'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Open embedded fragments or routed pages in Nuxt Studio (local dev and production after `/login`).
|
|
7
|
+
* Uses the same `studio:document:edit` hook as Studio's dbl-click and "Edit this page" controls.
|
|
8
|
+
*/
|
|
9
|
+
export function useFugueContentStudioEdit() {
|
|
10
|
+
const { locale, isEnabled, defaultLocale } = useFugueContentI18n()
|
|
11
|
+
const { isAuthenticated } = useFugueContentStudioSession()
|
|
12
|
+
|
|
13
|
+
const canEdit = computed(() => resolveFugueContentShowFragmentEdit({
|
|
14
|
+
isAuthenticated: isAuthenticated.value
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
async function editFragment(slug: string) {
|
|
18
|
+
if (!canEdit.value)
|
|
19
|
+
return
|
|
20
|
+
|
|
21
|
+
const fsPath = fragmentFsPath(slug, locale.value, defaultLocale.value, isEnabled.value)
|
|
22
|
+
await requestFugueContentStudioDocumentEdit(fsPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function editPage(stem: string) {
|
|
26
|
+
if (!canEdit.value || !stem)
|
|
27
|
+
return
|
|
28
|
+
|
|
29
|
+
const fsPath = pageFsPath(stem, locale.value, defaultLocale.value, isEnabled.value)
|
|
30
|
+
await requestFugueContentStudioDocumentEdit(fsPath)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
canEdit,
|
|
35
|
+
editFragment,
|
|
36
|
+
editPage
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const route = useRoute()
|
|
3
|
+
|
|
4
|
+
const slug = computed(() => {
|
|
5
|
+
const param = route.params.slug
|
|
6
|
+
const raw = typeof param === 'string' ? param : param?.[0]
|
|
7
|
+
return raw ?? ''
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const { fragment } = useFugueContentFragment(slug)
|
|
11
|
+
|
|
12
|
+
/** Studio preview route for embed-only fragments — not linked in app nav. */
|
|
13
|
+
definePageMeta({ layout: 'default' })
|
|
14
|
+
|
|
15
|
+
useFugueContentSiteSeo({
|
|
16
|
+
title: () => fragment.value?.title,
|
|
17
|
+
description: () => fragment.value?.description,
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="mx-auto max-w-3xl py-8">
|
|
23
|
+
<FugueContentFragment :slug="slug" />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { resolveFugueContentLoginRedirect } from '../../lib/login-redirect'
|
|
3
|
+
|
|
4
|
+
definePageMeta({
|
|
5
|
+
layout: false,
|
|
6
|
+
header: false,
|
|
7
|
+
footer: false,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const route = useRoute()
|
|
11
|
+
const { authMode } = useFugueContentAuthMode()
|
|
12
|
+
const { isAuthenticated, pending, activateDevSession } = useFugueContentStudioSession()
|
|
13
|
+
const studioConfig = useRuntimeConfig().public.studio
|
|
14
|
+
|
|
15
|
+
const redirectTo = computed(() => resolveFugueContentLoginRedirect(route.query.redirect))
|
|
16
|
+
|
|
17
|
+
useSeoMeta({
|
|
18
|
+
title: 'Sign in',
|
|
19
|
+
robots: 'noindex, nofollow',
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const started = ref(false)
|
|
23
|
+
|
|
24
|
+
function goToStudioOAuth(redirectPath: string) {
|
|
25
|
+
const redirect = encodeURIComponent(redirectPath)
|
|
26
|
+
window.location.assign(`${studioConfig!.route}?redirect=${redirect}`)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function completeStudioLogin() {
|
|
30
|
+
if (started.value || authMode !== 'studio')
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
if (pending.value)
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
started.value = true
|
|
37
|
+
|
|
38
|
+
if (isAuthenticated.value) {
|
|
39
|
+
await navigateTo(redirectTo.value)
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (import.meta.dev) {
|
|
44
|
+
activateDevSession()
|
|
45
|
+
await nextTick()
|
|
46
|
+
await navigateTo(redirectTo.value)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
goToStudioOAuth(redirectTo.value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
watch([pending, isAuthenticated], () => {
|
|
54
|
+
if (import.meta.client)
|
|
55
|
+
void completeStudioLogin()
|
|
56
|
+
}, { immediate: true })
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<UApp>
|
|
61
|
+
<div
|
|
62
|
+
v-if="authMode === 'studio'"
|
|
63
|
+
class="min-h-dvh flex items-center justify-center bg-default px-4"
|
|
64
|
+
>
|
|
65
|
+
<p class="text-sm text-muted">
|
|
66
|
+
Redirecting to sign in…
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
</UApp>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FugueSimpleAuthConfig } from '@altafusion/fugue-simple-auth/types/config'
|
|
2
|
+
import { useSimpleAuthSession } from '@altafusion/fugue-simple-auth/composables/useSimpleAuthSession'
|
|
3
|
+
import { shouldClearStaleAuthSession } from '@altafusion/fugue-simple-auth/lib/login'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Drop orphan peek-gate cookies when the session API says they are inactive
|
|
7
|
+
* (rotated access key, gate disabled on server, or invalid HMAC).
|
|
8
|
+
*/
|
|
9
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
10
|
+
const { hasPeekGate } = useFugueContentAuthMode()
|
|
11
|
+
if (!hasPeekGate)
|
|
12
|
+
return
|
|
13
|
+
|
|
14
|
+
const config = useRuntimeConfig().public.fugueSimpleAuth as FugueSimpleAuthConfig | undefined
|
|
15
|
+
if (!config?.apiPrefix)
|
|
16
|
+
return
|
|
17
|
+
|
|
18
|
+
const { data: session, refresh } = useSimpleAuthSession()
|
|
19
|
+
|
|
20
|
+
nuxtApp.hook('app:mounted', async () => {
|
|
21
|
+
await refresh()
|
|
22
|
+
|
|
23
|
+
if (!shouldClearStaleAuthSession(session.value))
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
await $fetch(`${config.apiPrefix}/logout`, { method: 'POST' })
|
|
28
|
+
await refresh()
|
|
29
|
+
} catch {
|
|
30
|
+
// Non-fatal — UI still gates on session.required / authenticated.
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
2
|
+
import { defineAsyncComponent } from 'vue'
|
|
3
|
+
import { localComponentLoaders } from '#content/components'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Register app Vue components globally so `FugueContentLandingPage` can resolve manifest
|
|
7
|
+
* `component` names in dynamic `:is` (auto-imports are compile-time only).
|
|
8
|
+
*/
|
|
9
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
10
|
+
for (const [name, loader] of Object.entries(localComponentLoaders)) {
|
|
11
|
+
if (nuxtApp.vueApp.component(name))
|
|
12
|
+
continue
|
|
13
|
+
nuxtApp.vueApp.component(name, defineAsyncComponent(loader as () => Promise<Component>))
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { landingNavItems } from '../../lib/landing'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* When `settings/site.yml` defines `landing.sections` with `nav`, register shell header links.
|
|
5
|
+
* Overrides `runtimeConfig.public.appNav` via `setAppNavItems`.
|
|
6
|
+
*/
|
|
7
|
+
export default defineNuxtPlugin(() => {
|
|
8
|
+
const { settings } = useFugueContentSettings()
|
|
9
|
+
const { locale, isEnabled } = useFugueContentI18n()
|
|
10
|
+
const { localePath } = useShellI18n()
|
|
11
|
+
|
|
12
|
+
function syncNav() {
|
|
13
|
+
const items = landingNavItems(settings.value?.landing?.sections, localePath)
|
|
14
|
+
if (items.length)
|
|
15
|
+
setAppNavItems(items)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
watch(
|
|
19
|
+
[
|
|
20
|
+
() => settings.value?.landing?.sections,
|
|
21
|
+
() => (isEnabled.value ? locale.value : null)
|
|
22
|
+
],
|
|
23
|
+
syncNav,
|
|
24
|
+
{ immediate: true, deep: true }
|
|
25
|
+
)
|
|
26
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createQeTools } from '../../lib/qe-tools'
|
|
2
|
+
|
|
3
|
+
const QE_TOOLS_URL_PARAM = 'qetools'
|
|
4
|
+
|
|
5
|
+
function hasQeToolsUrlParam(): boolean {
|
|
6
|
+
return [
|
|
7
|
+
...new URLSearchParams(window.location.search).keys()
|
|
8
|
+
]
|
|
9
|
+
.some(key => key.toLowerCase() === QE_TOOLS_URL_PARAM)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers `window.qeTools` for operator troubleshooting (dev + production).
|
|
14
|
+
* Console-only — no on-page panel. Use DevTools → Console: `qeTools.help()`.
|
|
15
|
+
* Optional: `?qetools` or `?qetools=1` prints help when the page loads (open Console first).
|
|
16
|
+
*/
|
|
17
|
+
export default defineNuxtPlugin({
|
|
18
|
+
name: 'fugue-content:qe-tools',
|
|
19
|
+
setup() {
|
|
20
|
+
if (typeof indexedDB === 'undefined')
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
window.qeTools = createQeTools()
|
|
24
|
+
|
|
25
|
+
if (hasQeToolsUrlParam())
|
|
26
|
+
window.qeTools.help()
|
|
27
|
+
}
|
|
28
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FugueContentSettings } from '../composables/useFugueContentSettings'
|
|
2
|
+
import { FUGUE_CONTENT_SETTINGS_STATE } from '../../lib/settings-state'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Publish CMS settings for cross-layer consumers (e.g. fugue-theme dark canvas).
|
|
6
|
+
*/
|
|
7
|
+
export default defineNuxtPlugin(() => {
|
|
8
|
+
const { settings } = useFugueContentSettings()
|
|
9
|
+
const fugueContentSettings = useState<FugueContentSettings | null>(FUGUE_CONTENT_SETTINGS_STATE, () => null)
|
|
10
|
+
|
|
11
|
+
watch(settings, (value) => {
|
|
12
|
+
fugueContentSettings.value = value
|
|
13
|
+
}, { immediate: true })
|
|
14
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shellDisplayNameKey } from '@altafusion/shell/lib/injection-keys'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wire `settings.site.yml` → `siteName` into shell header title (see Settings & Metadata doc).
|
|
5
|
+
* Logo/favicon remain developer-owned in `app.config.ts` `brand`.
|
|
6
|
+
*
|
|
7
|
+
* Uses `vueApp.provide` on `app:created` — Nuxt plugin `setup()` is not a Vue component setup,
|
|
8
|
+
* so calling `provide()` there triggers SSR warnings.
|
|
9
|
+
*/
|
|
10
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
11
|
+
nuxtApp.hook('app:created', (vueApp) => {
|
|
12
|
+
nuxtApp.runWithContext(() => {
|
|
13
|
+
const { settings } = useFugueContentSettings()
|
|
14
|
+
const displayName = computed(() => settings.value?.siteName)
|
|
15
|
+
vueApp.provide(shellDisplayNameKey, displayName)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { onNuxtReady } from '#app'
|
|
2
|
+
import { openFugueContentStudioEditorPanel } from '../../lib/studio-auto-open'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mount Studio whenever an editor session exists — initial load, refresh, and SPA navigations.
|
|
6
|
+
*/
|
|
7
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
8
|
+
const studioRoute = useRuntimeConfig().public.studio?.route
|
|
9
|
+
if (!studioRoute)
|
|
10
|
+
return
|
|
11
|
+
|
|
12
|
+
const { isAuthenticated } = useFugueContentStudioSession()
|
|
13
|
+
|
|
14
|
+
async function restoreStudioEditor() {
|
|
15
|
+
await nextTick()
|
|
16
|
+
|
|
17
|
+
if (!isAuthenticated.value)
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
await openFugueContentStudioEditorPanel()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onNuxtReady(() => {
|
|
24
|
+
void restoreStudioEditor()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
nuxtApp.hook('page:finish', () => {
|
|
28
|
+
void restoreStudioEditor()
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FUGUE_CONTENT_STUDIO_OPEN_EVENT } from '../../lib/studio-open'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dev-only: header **Edit** opens Studio in-page; **⌘.** / **Ctrl+.** is the keyboard alias.
|
|
5
|
+
*/
|
|
6
|
+
export default defineNuxtPlugin({
|
|
7
|
+
name: 'fugue-content:studio-dev-shortcut',
|
|
8
|
+
setup() {
|
|
9
|
+
if (!import.meta.dev)
|
|
10
|
+
return
|
|
11
|
+
|
|
12
|
+
const { openEditor } = useFugueContentStudioEditorEntry()
|
|
13
|
+
|
|
14
|
+
const open = () => {
|
|
15
|
+
void openEditor()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window.addEventListener(FUGUE_CONTENT_STUDIO_OPEN_EVENT, open)
|
|
19
|
+
|
|
20
|
+
defineShortcuts({
|
|
21
|
+
'meta_.': open
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FugueContentPublicAuthConfig } from '../../lib/header-actions-registration'
|
|
2
|
+
import { onNuxtReady } from '#app'
|
|
3
|
+
import {
|
|
4
|
+
scheduleFugueContentHeaderActionsRegistration,
|
|
5
|
+
shouldRegisterFugueContentHeaderActions
|
|
6
|
+
} from '../../lib/header-actions-registration'
|
|
7
|
+
import FugueContentFooterActions from '../components/FugueContentFooterActions.vue'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Register trailing footer Edit entry after hydration.
|
|
11
|
+
* Never set during SSR or the initial hydrate pass — avoids slot / ClientOnly drift.
|
|
12
|
+
*/
|
|
13
|
+
export default defineNuxtPlugin({
|
|
14
|
+
name: 'fugue-content:studio-footer-actions',
|
|
15
|
+
setup() {
|
|
16
|
+
const publicConfig = useRuntimeConfig().public
|
|
17
|
+
|
|
18
|
+
if (!shouldRegisterFugueContentHeaderActions(publicConfig as FugueContentPublicAuthConfig))
|
|
19
|
+
return
|
|
20
|
+
|
|
21
|
+
scheduleFugueContentHeaderActionsRegistration({
|
|
22
|
+
clear: () => setShellFooterRight(null),
|
|
23
|
+
register: () => setShellFooterRight(FugueContentFooterActions),
|
|
24
|
+
scheduleAfterHydration: registerFn => onNuxtReady(registerFn)
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reset module-scoped footer actions before each SSR request.
|
|
3
|
+
* Prevents dev-server / warm-lambda leaks from rendering editor chrome on the server.
|
|
4
|
+
*/
|
|
5
|
+
export default defineNuxtPlugin({
|
|
6
|
+
name: 'fugue-content:studio-footer-actions-reset',
|
|
7
|
+
enforce: 'pre',
|
|
8
|
+
setup() {
|
|
9
|
+
setShellFooterRight(null)
|
|
10
|
+
}
|
|
11
|
+
})
|