@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,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
resolveFugueContentShowFooterEdit,
|
|
4
|
+
} from '../../lib/studio-editor-visibility'
|
|
5
|
+
|
|
6
|
+
const runtimeConfig = useRuntimeConfig()
|
|
7
|
+
const { authMode, hasPeekGate } = useFugueContentAuthMode()
|
|
8
|
+
const { isActive, isClientReady } = useFugueContentStudioEditorEntry()
|
|
9
|
+
const { isAuthenticated } = useFugueContentStudioSession()
|
|
10
|
+
const { showPeekSignOut } = useFugueContentAuthSignOut()
|
|
11
|
+
|
|
12
|
+
const editorChrome = computed(() => ({
|
|
13
|
+
authMode,
|
|
14
|
+
hasStudioRoute: Boolean(runtimeConfig.public.studio?.route),
|
|
15
|
+
isClientReady: isClientReady.value,
|
|
16
|
+
isStudioActive: isActive.value,
|
|
17
|
+
hasStudioSession: isAuthenticated.value,
|
|
18
|
+
hasPeekGate,
|
|
19
|
+
peekSession: null,
|
|
20
|
+
peekPending: false,
|
|
21
|
+
showPeekSignOut: showPeekSignOut.value,
|
|
22
|
+
}))
|
|
23
|
+
|
|
24
|
+
const showEdit = computed(() => resolveFugueContentShowFooterEdit(editorChrome.value))
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<FugueContentEditContent
|
|
29
|
+
v-if="showEdit"
|
|
30
|
+
:require-session="false"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
slug,
|
|
4
|
+
prose = true,
|
|
5
|
+
} = defineProps<{
|
|
6
|
+
/** Fragment file stem — e.g. `app-demo` for `content/{locale}/fragments/app-demo.md` */
|
|
7
|
+
slug: string
|
|
8
|
+
/** Typography scale for rendered markdown — matches landing section body text */
|
|
9
|
+
prose?: boolean
|
|
10
|
+
}>()
|
|
11
|
+
const { fragment, contentId, error, loading } = useFugueContentFragment(() => slug)
|
|
12
|
+
const { canEdit } = useFugueContentStudioEdit()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="fugue-content-fragment flex flex-col gap-2">
|
|
17
|
+
<div
|
|
18
|
+
v-if="canEdit"
|
|
19
|
+
class="flex justify-end"
|
|
20
|
+
>
|
|
21
|
+
<FugueContentEditContent
|
|
22
|
+
:fragment-slug="slug"
|
|
23
|
+
:require-session="false"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<div
|
|
27
|
+
v-if="loading"
|
|
28
|
+
:data-content-id="contentId"
|
|
29
|
+
class="text-muted"
|
|
30
|
+
aria-busy="true"
|
|
31
|
+
/>
|
|
32
|
+
<div
|
|
33
|
+
v-else-if="error"
|
|
34
|
+
class="rounded-lg border border-error/30 bg-error/5 p-4 text-sm text-muted"
|
|
35
|
+
>
|
|
36
|
+
Failed to load content fragment.
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
v-else-if="!fragment"
|
|
40
|
+
class="rounded-lg border border-dashed border-muted/40 p-4 text-sm text-muted"
|
|
41
|
+
>
|
|
42
|
+
Fragment not found: <code>{{ slug }}</code>
|
|
43
|
+
</div>
|
|
44
|
+
<!-- ContentRenderer adds data-content-id in dev/preview — do not duplicate on a wrapper -->
|
|
45
|
+
<div
|
|
46
|
+
v-else
|
|
47
|
+
:data-content-id="contentId"
|
|
48
|
+
:class="prose ? 'prose prose-lg max-w-none text-muted md:prose-xl' : undefined"
|
|
49
|
+
>
|
|
50
|
+
<ContentRenderer :value="fragment" />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
resolveFugueContentShowEditorMenu,
|
|
4
|
+
resolveFugueContentShowHeaderActions,
|
|
5
|
+
} from '../../lib/studio-editor-visibility'
|
|
6
|
+
|
|
7
|
+
const runtimeConfig = useRuntimeConfig()
|
|
8
|
+
const { authMode, hasPeekGate } = useFugueContentAuthMode()
|
|
9
|
+
const { isActive, isClientReady } = useFugueContentStudioEditorEntry()
|
|
10
|
+
const { isAuthenticated } = useFugueContentStudioSession()
|
|
11
|
+
const { showPeekSignOut } = useFugueContentAuthSignOut()
|
|
12
|
+
|
|
13
|
+
const editorChrome = computed(() => ({
|
|
14
|
+
authMode,
|
|
15
|
+
hasStudioRoute: Boolean(runtimeConfig.public.studio?.route),
|
|
16
|
+
isClientReady: isClientReady.value,
|
|
17
|
+
isStudioActive: isActive.value,
|
|
18
|
+
hasStudioSession: isAuthenticated.value,
|
|
19
|
+
hasPeekGate,
|
|
20
|
+
peekSession: null,
|
|
21
|
+
peekPending: false,
|
|
22
|
+
showPeekSignOut: showPeekSignOut.value,
|
|
23
|
+
}))
|
|
24
|
+
|
|
25
|
+
const showEditorMenu = computed(() => resolveFugueContentShowEditorMenu(editorChrome.value))
|
|
26
|
+
const showChrome = computed(() => resolveFugueContentShowHeaderActions(editorChrome.value))
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div
|
|
31
|
+
v-if="showChrome"
|
|
32
|
+
class="flex items-center"
|
|
33
|
+
>
|
|
34
|
+
<FugueContentAuthSignOut v-if="hasPeekGate && showPeekSignOut && !isAuthenticated" />
|
|
35
|
+
<FugueContentEditorMenu v-if="showEditorMenu" />
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component } from 'vue'
|
|
3
|
+
import { landingSectionClasses, landingSectionComponentName, landingSectionProps } from '../../lib/landing'
|
|
4
|
+
import FugueContentFragment from './FugueContentFragment.vue'
|
|
5
|
+
import LandingHeroMedia from './LandingHeroMedia.vue'
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
sectionClass = 'fugue-content-landing-section',
|
|
9
|
+
components,
|
|
10
|
+
} = defineProps<{
|
|
11
|
+
/** Base CSS class for each `<section>` — section-based BEM, e.g. `landing-section` */
|
|
12
|
+
sectionClass?: string
|
|
13
|
+
/** Override or extend resolvable section components by name */
|
|
14
|
+
components?: Record<string, Component | string>
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const { sections, pending, error, hasLanding } = useFugueContentLanding()
|
|
18
|
+
|
|
19
|
+
/** Layer components — auto-imports are not visible to `resolveComponent` in dynamic `:is`. */
|
|
20
|
+
const defaultComponents: Record<string, Component> = {
|
|
21
|
+
FugueContentFragment,
|
|
22
|
+
LandingHeroMedia,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function resolveSectionComponent(name: string): Component | string {
|
|
26
|
+
if (components?.[name])
|
|
27
|
+
return components[name]
|
|
28
|
+
if (defaultComponents[name])
|
|
29
|
+
return defaultComponents[name]
|
|
30
|
+
const registered = useNuxtApp().vueApp.component(name)
|
|
31
|
+
if (registered)
|
|
32
|
+
return registered as Component
|
|
33
|
+
return resolveComponent(name)
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div class="fugue-content-landing flex flex-col">
|
|
39
|
+
<div
|
|
40
|
+
v-if="pending && !hasLanding"
|
|
41
|
+
class="text-muted"
|
|
42
|
+
aria-busy="true"
|
|
43
|
+
/>
|
|
44
|
+
<div
|
|
45
|
+
v-else-if="error"
|
|
46
|
+
class="rounded-lg border border-error/30 bg-error/5 p-4 text-sm text-muted"
|
|
47
|
+
>
|
|
48
|
+
Failed to load landing manifest.
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
v-else-if="!hasLanding"
|
|
52
|
+
class="rounded-lg border border-dashed border-muted/40 p-4 text-sm text-muted"
|
|
53
|
+
>
|
|
54
|
+
No landing sections configured. Add <code>landing.sections</code> to <code>settings/site.yml</code>.
|
|
55
|
+
</div>
|
|
56
|
+
<section
|
|
57
|
+
v-for="section in sections"
|
|
58
|
+
v-else
|
|
59
|
+
:id="section.anchor"
|
|
60
|
+
:key="`${section.anchor}-${section.slug}`"
|
|
61
|
+
:class="landingSectionClasses(section, sectionClass)"
|
|
62
|
+
>
|
|
63
|
+
<component
|
|
64
|
+
:is="resolveSectionComponent(landingSectionComponentName(section))"
|
|
65
|
+
v-bind="landingSectionProps(section)"
|
|
66
|
+
/>
|
|
67
|
+
</section>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
stem?: string
|
|
4
|
+
}>()
|
|
5
|
+
|
|
6
|
+
const { canEdit } = useFugueContentStudioEdit()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<article class="prose prose-neutral dark:prose-invert mx-auto w-full max-w-3xl">
|
|
11
|
+
<div
|
|
12
|
+
v-if="canEdit && stem"
|
|
13
|
+
class="mb-4 flex justify-end"
|
|
14
|
+
>
|
|
15
|
+
<FugueContentEditContent
|
|
16
|
+
:page-stem="stem"
|
|
17
|
+
:require-session="false"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<slot />
|
|
21
|
+
</article>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FugueContentPage } from '../composables/useFugueContentPage'
|
|
3
|
+
import { FUGUE_CONTENT_ARTICLE_DEFAULTS, FUGUE_CONTENT_ARTICLE_I18N_KEYS } from '../../lib/article-i18n'
|
|
4
|
+
import { fugueContentPageTocLinks } from '../../lib/page-toc'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
page: FugueContentPage
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const { t } = useShellI18n()
|
|
11
|
+
const { canEdit } = useFugueContentStudioEdit()
|
|
12
|
+
|
|
13
|
+
const tocLinks = computed(() => fugueContentPageTocLinks(props.page.body))
|
|
14
|
+
|
|
15
|
+
const tocTitle = computed(() =>
|
|
16
|
+
t(FUGUE_CONTENT_ARTICLE_I18N_KEYS.onThisPage, FUGUE_CONTENT_ARTICLE_DEFAULTS.onThisPage),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const stem = computed(() => {
|
|
20
|
+
const value = props.page.stem
|
|
21
|
+
return typeof value === 'string' ? value : ''
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<UContainer class="py-8">
|
|
27
|
+
<!-- self-start on #right grid cell — stretch was blocking sticky float -->
|
|
28
|
+
<UPage :ui="{ right: 'lg:self-start' }">
|
|
29
|
+
<UPageBody>
|
|
30
|
+
<details
|
|
31
|
+
v-if="tocLinks.length"
|
|
32
|
+
class="fugue-content-article-aside__mobile-toc lg:hidden"
|
|
33
|
+
>
|
|
34
|
+
<summary class="cursor-pointer text-sm font-medium text-highlighted">
|
|
35
|
+
{{ tocTitle }}
|
|
36
|
+
</summary>
|
|
37
|
+
<UContentToc
|
|
38
|
+
:links="tocLinks"
|
|
39
|
+
class="mt-3"
|
|
40
|
+
/>
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
<article class="prose prose-neutral dark:prose-invert mx-auto w-full max-w-3xl">
|
|
44
|
+
<div
|
|
45
|
+
v-if="canEdit && stem"
|
|
46
|
+
class="mb-4 flex justify-end"
|
|
47
|
+
>
|
|
48
|
+
<FugueContentEditContent
|
|
49
|
+
:page-stem="stem"
|
|
50
|
+
:require-session="false"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
<slot />
|
|
54
|
+
</article>
|
|
55
|
+
</UPageBody>
|
|
56
|
+
|
|
57
|
+
<template
|
|
58
|
+
v-if="tocLinks.length"
|
|
59
|
+
#right
|
|
60
|
+
>
|
|
61
|
+
<UPageAside
|
|
62
|
+
:ui="{
|
|
63
|
+
root: 'lg:sticky lg:top-[calc(var(--shell-header-height,2.5rem)+1px)] lg:self-start lg:overflow-visible lg:max-h-none',
|
|
64
|
+
}"
|
|
65
|
+
>
|
|
66
|
+
<UContentToc
|
|
67
|
+
:links="tocLinks"
|
|
68
|
+
:title="tocTitle"
|
|
69
|
+
highlight
|
|
70
|
+
class="hidden lg:block"
|
|
71
|
+
:ui="{
|
|
72
|
+
root: 'lg:static lg:top-auto lg:overflow-visible lg:max-h-none',
|
|
73
|
+
}"
|
|
74
|
+
/>
|
|
75
|
+
</UPageAside>
|
|
76
|
+
</template>
|
|
77
|
+
</UPage>
|
|
78
|
+
</UContainer>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.fugue-content-article-aside__mobile-toc {
|
|
83
|
+
margin-bottom: var(--space-6, 1.5rem);
|
|
84
|
+
border: 1px solid var(--color-border, rgb(255 255 255 / 0.12));
|
|
85
|
+
border-radius: var(--radius-lg, 0.5rem);
|
|
86
|
+
padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component } from 'vue'
|
|
3
|
+
import FugueContentFragment from './FugueContentFragment.vue'
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
src,
|
|
7
|
+
alt,
|
|
8
|
+
slug,
|
|
9
|
+
contentComponent,
|
|
10
|
+
mobileHeight = 'h-48',
|
|
11
|
+
desktopMinHeight = 'min-h-48',
|
|
12
|
+
objectFit = 'cover',
|
|
13
|
+
loading = 'eager',
|
|
14
|
+
} = defineProps<{
|
|
15
|
+
/** Public path to the hero image — e.g. `/assets/img/hero.jpg` */
|
|
16
|
+
src: string
|
|
17
|
+
alt: string
|
|
18
|
+
/** Fragment stem for slot content when `contentComponent` is omitted */
|
|
19
|
+
slug?: string
|
|
20
|
+
/** Registered Vue component name for slot content (app-specific heroes) */
|
|
21
|
+
contentComponent?: string
|
|
22
|
+
/** Tailwind height utility for the mobile banner */
|
|
23
|
+
mobileHeight?: string
|
|
24
|
+
/** Tailwind min-height utility for the desktop banner wrapper */
|
|
25
|
+
desktopMinHeight?: string
|
|
26
|
+
objectFit?: 'cover' | 'contain'
|
|
27
|
+
loading?: 'eager' | 'lazy'
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const objectFitClass = computed(() =>
|
|
31
|
+
objectFit === 'contain' ? 'object-contain' : 'object-cover',
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const mobileImageClass = computed(() =>
|
|
35
|
+
[mobileHeight, 'w-full', objectFitClass.value].join(' '),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const desktopImageClass = computed(() =>
|
|
39
|
+
['h-full w-full object-center', objectFitClass.value].join(' '),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
function resolveNamedComponent(name: string): Component | string {
|
|
43
|
+
const registered = useNuxtApp().vueApp.component(name)
|
|
44
|
+
if (registered)
|
|
45
|
+
return registered as Component
|
|
46
|
+
return resolveComponent(name)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const resolvedContentComponent = computed(() =>
|
|
50
|
+
contentComponent ? resolveNamedComponent(contentComponent) : null,
|
|
51
|
+
)
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="landing-hero-media">
|
|
56
|
+
<div class="landing-hero-media__banner landing-hero-media__banner--mobile md:hidden">
|
|
57
|
+
<img
|
|
58
|
+
:src="src"
|
|
59
|
+
:alt="alt"
|
|
60
|
+
:class="mobileImageClass"
|
|
61
|
+
:loading="loading"
|
|
62
|
+
>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div
|
|
66
|
+
v-if="resolvedContentComponent || slug"
|
|
67
|
+
class="landing-hero-media__content"
|
|
68
|
+
>
|
|
69
|
+
<component
|
|
70
|
+
:is="resolvedContentComponent"
|
|
71
|
+
v-if="resolvedContentComponent"
|
|
72
|
+
/>
|
|
73
|
+
<FugueContentFragment
|
|
74
|
+
v-else-if="slug"
|
|
75
|
+
:slug="slug"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div
|
|
80
|
+
class="landing-hero-media__banner landing-hero-media__banner--desktop hidden md:block"
|
|
81
|
+
:class="desktopMinHeight"
|
|
82
|
+
>
|
|
83
|
+
<img
|
|
84
|
+
:src="src"
|
|
85
|
+
:alt="alt"
|
|
86
|
+
:class="desktopImageClass"
|
|
87
|
+
:loading="loading"
|
|
88
|
+
>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
label,
|
|
4
|
+
to,
|
|
5
|
+
variant = 'primary',
|
|
6
|
+
} = defineProps<{
|
|
7
|
+
/** Used when the markdown block has no body. Body text wins when both are set. */
|
|
8
|
+
label?: string
|
|
9
|
+
to: string
|
|
10
|
+
variant?: 'primary' | 'neutral'
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const slots = useSlots()
|
|
14
|
+
const { localePath } = useFugueContentI18n()
|
|
15
|
+
|
|
16
|
+
const href = computed(() => localePath(to))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="py-0">
|
|
21
|
+
<UButton
|
|
22
|
+
:to="href"
|
|
23
|
+
:label="slots.default ? undefined : label"
|
|
24
|
+
:variant="variant === 'neutral' ? 'outline' : 'solid'"
|
|
25
|
+
:color="variant === 'neutral' ? 'neutral' : 'primary'"
|
|
26
|
+
size="lg"
|
|
27
|
+
>
|
|
28
|
+
<MDCSlot
|
|
29
|
+
v-if="slots.default"
|
|
30
|
+
:use="slots.default"
|
|
31
|
+
unwrap="p"
|
|
32
|
+
/>
|
|
33
|
+
</UButton>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
title: string
|
|
4
|
+
description?: string
|
|
5
|
+
actionLabel?: string
|
|
6
|
+
actionTo?: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const { localePath } = useFugueContentI18n()
|
|
10
|
+
|
|
11
|
+
const actionHref = computed(() => props.actionTo ? localePath(props.actionTo) : undefined)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<section class="flex flex-col gap-4 py-8 sm:py-12">
|
|
16
|
+
<h1 class="text-4xl font-bold tracking-tight text-highlighted sm:text-5xl">
|
|
17
|
+
{{ title }}
|
|
18
|
+
</h1>
|
|
19
|
+
<p
|
|
20
|
+
v-if="description"
|
|
21
|
+
class="max-w-2xl text-lg text-muted"
|
|
22
|
+
>
|
|
23
|
+
{{ description }}
|
|
24
|
+
</p>
|
|
25
|
+
<slot />
|
|
26
|
+
<UButton
|
|
27
|
+
v-if="actionLabel && actionHref"
|
|
28
|
+
:to="actionHref"
|
|
29
|
+
:label="actionLabel"
|
|
30
|
+
size="lg"
|
|
31
|
+
class="self-start"
|
|
32
|
+
/>
|
|
33
|
+
</section>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FugueContentPage } from './useFugueContentPage'
|
|
2
|
+
import { FUGUE_CONTENT_404_DEFAULTS, isFugueContent404, resolveFugueContent404Copy } from '../../lib/404-defaults'
|
|
3
|
+
|
|
4
|
+
export function useFugueContentCatchAllRoute() {
|
|
5
|
+
const route = useRoute()
|
|
6
|
+
const nuxtApp = useNuxtApp()
|
|
7
|
+
const { page } = useFugueContentPage()
|
|
8
|
+
const { locale, isEnabled, pagesCollection } = useFugueContentI18n()
|
|
9
|
+
|
|
10
|
+
const contentPath = computed(() => route.path || '/')
|
|
11
|
+
|
|
12
|
+
/** Avoid querying locale collections before @nuxtjs/i18n is mounted (dev restart / HMR). */
|
|
13
|
+
const i18nReady = computed(() => !isEnabled.value || !!nuxtApp.$i18n)
|
|
14
|
+
|
|
15
|
+
const { data: contentPage, error, pending } = useAsyncData<FugueContentPage | null>(
|
|
16
|
+
() => `fugue-content-page:${isEnabled.value
|
|
17
|
+
? `${locale.value}:`
|
|
18
|
+
: ''}${contentPath.value}`,
|
|
19
|
+
async () => {
|
|
20
|
+
if (!i18nReady.value)
|
|
21
|
+
return null
|
|
22
|
+
const result = await queryCollection(pagesCollection.value).path(contentPath.value).first()
|
|
23
|
+
return (result as FugueContentPage | null) ?? null
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
watch: [
|
|
27
|
+
pagesCollection,
|
|
28
|
+
locale,
|
|
29
|
+
contentPath,
|
|
30
|
+
i18nReady
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
const loading = computed(() => pending.value || (isEnabled.value && !i18nReady.value))
|
|
36
|
+
|
|
37
|
+
const { t } = useShellI18n()
|
|
38
|
+
|
|
39
|
+
const notFound = computed(() => isFugueContent404({
|
|
40
|
+
loading: loading.value,
|
|
41
|
+
error: error.value,
|
|
42
|
+
contentPage: contentPage.value,
|
|
43
|
+
i18nReady: i18nReady.value
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
const notFoundCopy = computed(() => resolveFugueContent404Copy(t))
|
|
47
|
+
|
|
48
|
+
useFugueContentSiteSeo({
|
|
49
|
+
title: () => contentPage.value?.title ?? (notFound.value ? notFoundCopy.value.title : undefined),
|
|
50
|
+
description: () => contentPage.value?.description ?? (notFound.value ? notFoundCopy.value.description : undefined)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
watch(notFound, (value) => {
|
|
54
|
+
if (value && import.meta.server) {
|
|
55
|
+
const event = useRequestEvent()
|
|
56
|
+
if (event)
|
|
57
|
+
setResponseStatus(event, FUGUE_CONTENT_404_DEFAULTS.statusCode)
|
|
58
|
+
}
|
|
59
|
+
}, { immediate: true })
|
|
60
|
+
|
|
61
|
+
watch(
|
|
62
|
+
contentPage,
|
|
63
|
+
(fugueContentPage) => {
|
|
64
|
+
page.value = fugueContentPage ?? null
|
|
65
|
+
|
|
66
|
+
if (!fugueContentPage)
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
if (fugueContentPage.nav?.primary) {
|
|
70
|
+
route.meta.nav = {
|
|
71
|
+
...(typeof route.meta.nav === 'object' && route.meta.nav
|
|
72
|
+
? route.meta.nav
|
|
73
|
+
: {}),
|
|
74
|
+
primary: fugueContentPage.nav.primary
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (fugueContentPage.layout === 'article' && fugueContentPage.title)
|
|
79
|
+
route.meta.title = fugueContentPage.title
|
|
80
|
+
else
|
|
81
|
+
delete route.meta.title
|
|
82
|
+
},
|
|
83
|
+
{ immediate: true }
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
contentPage,
|
|
88
|
+
error,
|
|
89
|
+
loading
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue'
|
|
2
|
+
import { fragmentContentId, fragmentContentPath } from '../../lib/i18n-utils'
|
|
3
|
+
|
|
4
|
+
export interface FugueContentFragment {
|
|
5
|
+
path: string
|
|
6
|
+
title?: string
|
|
7
|
+
description?: string
|
|
8
|
+
body?: unknown
|
|
9
|
+
images?: Array<{ src: string, alt: string, span?: number }>
|
|
10
|
+
[key: string]: unknown
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Load a Studio-editable markdown fragment for embedding in Vue product pages.
|
|
15
|
+
* Fragments live in `content/{locale}/fragments/{slug}.md` — not served by the catch-all.
|
|
16
|
+
*/
|
|
17
|
+
export function useFugueContentFragment(slug: MaybeRefOrGetter<string>) {
|
|
18
|
+
const nuxtApp = useNuxtApp()
|
|
19
|
+
const slugValue = computed(() => toValue(slug))
|
|
20
|
+
const { locale, isEnabled, fragmentsCollection, defaultLocale } = useFugueContentI18n()
|
|
21
|
+
|
|
22
|
+
const contentPath = computed(() =>
|
|
23
|
+
fragmentContentPath(slugValue.value, locale.value, defaultLocale.value)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
/** Stable id for Studio click-to-edit — available before async fragment load completes. */
|
|
27
|
+
const contentId = computed(() =>
|
|
28
|
+
fragmentContentId(
|
|
29
|
+
slugValue.value,
|
|
30
|
+
locale.value,
|
|
31
|
+
defaultLocale.value,
|
|
32
|
+
String(fragmentsCollection.value)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
/** Avoid querying locale collections before @nuxtjs/i18n is mounted (dev restart / HMR). */
|
|
37
|
+
const i18nReady = computed(() => !isEnabled.value || !!nuxtApp.$i18n)
|
|
38
|
+
|
|
39
|
+
const { data: fragment, error, pending } = useAsyncData(
|
|
40
|
+
() => `fugue-content-fragment:${isEnabled.value
|
|
41
|
+
? `${locale.value}:`
|
|
42
|
+
: ''}${slugValue.value}`,
|
|
43
|
+
() => {
|
|
44
|
+
if (!i18nReady.value)
|
|
45
|
+
return Promise.resolve(null)
|
|
46
|
+
return queryCollection(fragmentsCollection.value).path(contentPath.value).first()
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
watch: [
|
|
50
|
+
fragmentsCollection,
|
|
51
|
+
locale,
|
|
52
|
+
contentPath,
|
|
53
|
+
i18nReady,
|
|
54
|
+
slugValue
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
/** Keep SSR/hydrated content visible while i18n or locale refetch runs. */
|
|
60
|
+
const loading = computed(
|
|
61
|
+
() => !fragment.value && (pending.value || (isEnabled.value && !i18nReady.value))
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
fragment: computed(() => (fragment.value as FugueContentFragment | null) ?? null),
|
|
66
|
+
contentId,
|
|
67
|
+
error,
|
|
68
|
+
loading
|
|
69
|
+
}
|
|
70
|
+
}
|