diff --git a/apps/docs/app/app.config.ts b/apps/docs/app/app.config.ts index 84267127..a5b60215 100644 --- a/apps/docs/app/app.config.ts +++ b/apps/docs/app/app.config.ts @@ -40,6 +40,20 @@ export default defineAppConfig({ }, ], }, + /** + * Frameworks offered by the sidebar select and the in-content + * `FrameworkSwitcher`, in display order. `value` is the MDC slot name used + * in content (`#react`, `#other`, `#vue`) and the persisted preference + * token. The layer ships no default list — which frameworks styleframe + * documents is a styleframe fact — so this array is the only source. + */ + docsTheme: { + frameworks: [ + { value: "react", label: "React", icon: "i-mdi-react" }, + { value: "other", label: "Vanilla", icon: "i-mdi-language-typescript" }, + { value: "vue", label: "Vue", icon: "i-mdi-vuejs" }, + ], + }, /** * @docs https://www.docus.dev/concepts/configuration#socials-links */ diff --git a/apps/docs/app/app.vue b/apps/docs/app/app.vue deleted file mode 100644 index 0fe0a1cb..00000000 --- a/apps/docs/app/app.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/apps/docs/app/components/LanguageSelect.vue b/apps/docs/app/components/LanguageSelect.vue deleted file mode 100644 index 015dc133..00000000 --- a/apps/docs/app/components/LanguageSelect.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - {{ getEmojiFlag(locale) }} - - - - - - - - - - {{ localeItem.name }} - - - {{ getEmojiFlag(localeItem.code) }} - - - - - - - diff --git a/apps/docs/app/components/app/AppHeader.vue b/apps/docs/app/components/app/AppHeader.vue deleted file mode 100644 index e2d8d64a..00000000 --- a/apps/docs/app/components/app/AppHeader.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/docs/app/components/content/BrowserFrame.vue b/apps/docs/app/components/content/BrowserFrame.vue deleted file mode 100644 index 565357a9..00000000 --- a/apps/docs/app/components/content/BrowserFrame.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - {{ title }} - - - - - - - diff --git a/apps/docs/app/components/content/FrameworkSwitcher.vue b/apps/docs/app/components/content/FrameworkSwitcher.vue deleted file mode 100644 index 6951ea68..00000000 --- a/apps/docs/app/components/content/FrameworkSwitcher.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - Not available for {{ current?.label }} — showing {{ fallback.label }}. - - - - - diff --git a/apps/docs/app/components/content/GradientPageHero.vue b/apps/docs/app/components/content/GradientPageHero.vue deleted file mode 100644 index 1d63a0e0..00000000 --- a/apps/docs/app/components/content/GradientPageHero.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/apps/docs/app/components/content/Video.vue b/apps/docs/app/components/content/Video.vue deleted file mode 100644 index 15f9230d..00000000 --- a/apps/docs/app/components/content/Video.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - diff --git a/apps/docs/app/components/docs/DocsAsideLeftBody.vue b/apps/docs/app/components/docs/DocsAsideLeftBody.vue index 8977985c..54970172 100644 --- a/apps/docs/app/components/docs/DocsAsideLeftBody.vue +++ b/apps/docs/app/components/docs/DocsAsideLeftBody.vue @@ -1,4 +1,11 @@ - - - - diff --git a/apps/docs/app/composables/useAppI18n.ts b/apps/docs/app/composables/useAppI18n.ts deleted file mode 100644 index 96b614a5..00000000 --- a/apps/docs/app/composables/useAppI18n.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { LocaleObject } from "@nuxtjs/i18n"; -import type { Ref } from "vue"; -import en from "~~/i18n/locales/en.json"; - -/** - * `@nuxtjs/i18n` auto-imports. This app ships with i18n disabled — the module is - * not registered (see apps/shared/modules/config.ts) — so the enabled branch - * below is inert. These declarations let the file typecheck without the module - * generating the globals; when i18n is enabled the real composables are used. - */ -declare function useI18n(): { locale: Ref; t: (key: string) => string }; -declare function useLocalePath(): (route: string, locale?: string) => string; -declare function useSwitchLocalePath(): (locale: string) => string; - -export const useAppI18n = () => { - const config = useRuntimeConfig().public; - const isEnabled = ref(!!config.i18n); - - if (!isEnabled.value) { - return { - isEnabled, - locale: ref("en"), - locales: [], - localePath: (path: string) => path, - switchLocalePath: (_locale?: string): string => "", - t: (key: string): string => { - const path = key.split("."); - return path.reduce( - (acc: unknown, curr) => (acc as Record)?.[curr], - en, - ) as string; - }, - }; - } - - const { locale, t } = useI18n(); - const filteredLocales = - (config.docus as { filteredLocales: LocaleObject[] }) - ?.filteredLocales || []; - - return { - isEnabled, - locale, - locales: filteredLocales, - t, - localePath: useLocalePath(), - switchLocalePath: useSwitchLocalePath(), - }; -}; diff --git a/apps/docs/app/composables/useDocsSections.ts b/apps/docs/app/composables/useDocsSections.ts index 5f5fa88f..a1312b10 100644 --- a/apps/docs/app/composables/useDocsSections.ts +++ b/apps/docs/app/composables/useDocsSections.ts @@ -22,6 +22,15 @@ function findFirstLeafPath( return items[0]?.path; } +/** + * Local override of the layer's `useDocsSections`. + * + * The delta is the `theme` branch: styleframe splits one content collection into + * four sub-header tabs via `THEME_SUBSECTIONS`, which is a styleframe content + * shape, not a theme feature. The rest of the shape — including + * `hasSectionSwitcher` — must stay identical to the layer copy, since the + * layer's `AppSubHeader` consumes it. + */ export function useDocsSections() { const route = useRoute(); const navigation = @@ -67,5 +76,12 @@ export function useDocsSections() { sections.value.find((section) => section.active), ); - return { sections, activeSection }; + /** + * Whether the section switcher is worth rendering. A single section (or none) + * gives the reader nothing to switch between, so the sub-header is suppressed + * entirely rather than rendering an empty bar. + */ + const hasSectionSwitcher = computed(() => sections.value.length > 1); + + return { sections, activeSection, hasSectionSwitcher }; } diff --git a/apps/docs/app/composables/useDocusI18n.ts b/apps/docs/app/composables/useDocusI18n.ts deleted file mode 100644 index 242f498a..00000000 --- a/apps/docs/app/composables/useDocusI18n.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { LocaleObject } from "@nuxtjs/i18n"; -import type { Ref } from "vue"; -import en from "../../i18n/locales/en.json"; - -/** - * `@nuxtjs/i18n` auto-imports. This app ships with i18n disabled — the module is - * not registered (see apps/shared/modules/config.ts) — so the enabled branch - * below is inert. These declarations let the file typecheck without the module - * generating the globals; when i18n is enabled the real composables are used. - */ -declare function useI18n(): { locale: Ref; t: (key: string) => string }; -declare function useLocalePath(): (route: string, locale?: string) => string; -declare function useSwitchLocalePath(): (locale: string) => string; - -export const useDocusI18n = () => { - const config = useRuntimeConfig().public; - const isEnabled = ref(!!config.i18n); - - if (!isEnabled.value) { - return { - isEnabled, - locale: ref("en"), - locales: [], - localePath: (path: string) => path, - switchLocalePath: (_locale?: string): string => "", - t: (key: string): string => { - const path = key.split("."); - return path.reduce( - (acc: unknown, curr) => (acc as Record)?.[curr], - en, - ) as string; - }, - }; - } - - const { locale, t } = useI18n(); - const filteredLocales = - (config.docus as { filteredLocales: LocaleObject[] }) - ?.filteredLocales || []; - - return { - isEnabled, - locale, - locales: filteredLocales, - t, - localePath: useLocalePath(), - switchLocalePath: useSwitchLocalePath(), - }; -}; diff --git a/apps/docs/app/composables/useFramework.ts b/apps/docs/app/composables/useFramework.ts deleted file mode 100644 index e43c1c9d..00000000 --- a/apps/docs/app/composables/useFramework.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useLocalStorage } from "@vueuse/core"; - -export type Framework = "vue" | "react" | "other"; - -export interface FrameworkOption { - value: Framework; - label: string; - icon: string; -} - -export const FRAMEWORKS: readonly FrameworkOption[] = [ - { value: "react", label: "React", icon: "i-mdi-react" }, - { - value: "other", - label: "Vanilla", - icon: "i-mdi-language-typescript", - }, - { value: "vue", label: "Vue", icon: "i-mdi-vuejs" }, -] as const; - -const STORAGE_KEY = "styleframe-docs:framework"; - -export const useFramework = () => { - const framework = useLocalStorage(STORAGE_KEY, "react", { - initOnMounted: true, - }); - - return { - framework, - frameworks: FRAMEWORKS, - }; -}; diff --git a/apps/docs/app/error.vue b/apps/docs/app/error.vue deleted file mode 100644 index bec74e08..00000000 --- a/apps/docs/app/error.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/apps/docs/app/layouts/default.vue b/apps/docs/app/layouts/default.vue deleted file mode 100644 index 7e000d1c..00000000 --- a/apps/docs/app/layouts/default.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/docs/app/pages/[[lang]]/[...slug].vue b/apps/docs/app/pages/[[lang]]/[...slug].vue index d882756f..e83a5600 100644 --- a/apps/docs/app/pages/[[lang]]/[...slug].vue +++ b/apps/docs/app/pages/[[lang]]/[...slug].vue @@ -1,4 +1,12 @@
- Not available for {{ current?.label }} — showing {{ fallback.label }}. -