@altafusion/shell 0.0.0-stage → 0.2.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 (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +110 -2
  4. package/app/app.config.ts +15 -0
  5. package/app/components/ShellAsidePlaceholder.vue +16 -0
  6. package/app/components/ShellBrandLogo.vue +26 -0
  7. package/app/components/ShellLangToggle.vue +129 -0
  8. package/app/components/ShellPageHeader.vue +25 -0
  9. package/app/components/ShellSiteHeader.vue +63 -0
  10. package/app/composables/useAppNav.ts +67 -0
  11. package/app/composables/useBrandTheme.ts +37 -0
  12. package/app/composables/usePageChrome.ts +40 -0
  13. package/app/composables/useShellChrome.ts +122 -0
  14. package/app/composables/useShellFooterRight.ts +13 -0
  15. package/app/composables/useShellHeaderActions.ts +18 -0
  16. package/app/composables/useShellHeaderRight.ts +13 -0
  17. package/app/composables/useShellI18n.ts +31 -0
  18. package/app/layouts/default.vue +68 -0
  19. package/app/layouts/fullscreen.vue +20 -0
  20. package/app/layouts/minimal.vue +11 -0
  21. package/app/layouts/product.vue +23 -0
  22. package/app/plugins/brand-theme.ts +29 -0
  23. package/app/plugins/shell-brand-head.ts +30 -0
  24. package/assets/css/brand-variants.css +50 -0
  25. package/assets/css/sections/landing-header.css +249 -0
  26. package/assets/css/sections/shell-chrome.css +34 -0
  27. package/assets/css/shell-sections.css +2 -0
  28. package/components/BaseButton.vue +106 -0
  29. package/eslint.config.mjs +4 -0
  30. package/lib/fugue-content-public-config.ts +39 -0
  31. package/lib/injection-keys.ts +9 -0
  32. package/lib/locale-switch-path.ts +20 -0
  33. package/lib/nuxt-ui-icons.ts +14 -0
  34. package/nuxt.config.ts +61 -0
  35. package/package.json +49 -3
  36. package/themes/tailwind-shell.css +35 -0
  37. package/types/app-brand.ts +42 -0
  38. package/types/nuxt-shell.d.ts +38 -0
  39. package/utils/altafusionBrandTheme.ts +15 -0
  40. package/utils/formatDate.ts +13 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shell layout canvas — applies to all header visual styles.
3
+ */
4
+ @layer base {
5
+ .shell {
6
+ min-height: 100dvh;
7
+ background-color: var(--ui-bg);
8
+ color: var(--ui-text);
9
+ }
10
+
11
+ main.shell-main:not(.shell-main--padded) {
12
+ min-height: unset;
13
+ padding: 0;
14
+ background-color: var(--ui-bg);
15
+ }
16
+
17
+ main.shell-main.shell-main--padded {
18
+ min-height: unset;
19
+ padding-top: 0;
20
+ padding-left: 0;
21
+ padding-right: 0;
22
+ padding-bottom: 0;
23
+ background-color: var(--ui-bg);
24
+ }
25
+
26
+ .shell:has(.landing-header--fixed) main.shell-main {
27
+ padding-top: var(--shell-header-height, 2.5rem);
28
+ }
29
+
30
+ /* Static landing header — content does not need fixed offset */
31
+ .shell:has(.landing-header--static) main.shell-main {
32
+ padding-top: 0;
33
+ }
34
+ }
@@ -0,0 +1,2 @@
1
+ @import './sections/landing-header.css';
2
+ @import './sections/shell-chrome.css';
@@ -0,0 +1,106 @@
1
+ <script setup lang="ts">
2
+ defineOptions({ inheritAttrs: false })
3
+
4
+ const {
5
+ variant = 'primary',
6
+ size = 'default',
7
+ disabled = false,
8
+ } = defineProps<{
9
+ variant?: 'primary' | 'secondary' | 'danger'
10
+ size?: 'small' | 'default' | 'large'
11
+ disabled?: boolean
12
+ }>()
13
+
14
+ defineEmits<{
15
+ (e: 'click', event: MouseEvent): void
16
+ }>()
17
+ </script>
18
+
19
+ <template>
20
+ <button
21
+ v-bind="$attrs"
22
+ class="base-button" :class="[
23
+ `base-button--${variant}`,
24
+ size !== 'default' && `base-button--${size}`,
25
+ ]"
26
+ :disabled="disabled"
27
+ @click="$emit('click', $event)"
28
+ >
29
+ <slot />
30
+ </button>
31
+ </template>
32
+
33
+ <style scoped>
34
+ .base-button {
35
+ display: inline-flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ padding: var(--button-padding-y) var(--button-padding-x);
39
+ border: var(--button-border-width) solid transparent;
40
+ border-radius: var(--button-border-radius);
41
+ font-size: var(--button-font-size);
42
+ font-weight: var(--button-font-weight);
43
+ cursor: pointer;
44
+ transition: all var(--button-transition);
45
+ text-decoration: none;
46
+ user-select: none;
47
+ }
48
+
49
+ .base-button:disabled {
50
+ opacity: 0.5;
51
+ cursor: not-allowed;
52
+ }
53
+
54
+ .base-button--primary {
55
+ background-color: var(--button-primary-bg);
56
+ color: var(--button-primary-text);
57
+ border-color: var(--button-primary-border);
58
+ }
59
+
60
+ .base-button--primary:hover:not(:disabled) {
61
+ background-color: var(--button-primary-bg-hover);
62
+ }
63
+
64
+ .base-button--primary:active:not(:disabled) {
65
+ background-color: var(--button-primary-bg-active);
66
+ }
67
+
68
+ .base-button--secondary {
69
+ background-color: var(--button-secondary-bg);
70
+ color: var(--button-secondary-text);
71
+ border-color: var(--button-secondary-border);
72
+ }
73
+
74
+ .base-button--secondary:hover:not(:disabled) {
75
+ background-color: var(--button-secondary-bg-hover);
76
+ }
77
+
78
+ .base-button--secondary:active:not(:disabled) {
79
+ background-color: var(--button-secondary-bg-active);
80
+ }
81
+
82
+ .base-button--danger {
83
+ background-color: var(--button-danger-bg);
84
+ color: var(--button-danger-text);
85
+ border-color: var(--button-danger-border);
86
+ }
87
+
88
+ .base-button--danger:hover:not(:disabled) {
89
+ background-color: var(--button-danger-bg-hover);
90
+ }
91
+
92
+ .base-button--danger:active:not(:disabled) {
93
+ background-color: var(--button-danger-bg-active);
94
+ }
95
+
96
+ /* Size variants */
97
+ .base-button--small {
98
+ padding: var(--space-1_5) var(--space-3);
99
+ font-size: var(--font-size-xs);
100
+ }
101
+
102
+ .base-button--large {
103
+ padding: var(--space-3) var(--space-6);
104
+ font-size: var(--font-size-base);
105
+ }
106
+ </style>
@@ -0,0 +1,4 @@
1
+ // @ts-check
2
+ import { createPackageEslintConfig } from '@altafusion/eslint-config'
3
+
4
+ export default createPackageEslintConfig()
@@ -0,0 +1,39 @@
1
+ export interface FugueContentLocaleEntry {
2
+ code: string
3
+ name?: string
4
+ }
5
+
6
+ export interface ShellFugueContentPublicConfig {
7
+ i18nEnabled?: boolean
8
+ defaultLocale?: string
9
+ filteredLocales?: FugueContentLocaleEntry[]
10
+ }
11
+
12
+ function isFugueContentLocaleEntry(value: unknown): value is FugueContentLocaleEntry {
13
+ return typeof value === 'object'
14
+ && value !== null
15
+ && typeof (value as FugueContentLocaleEntry).code === 'string'
16
+ }
17
+
18
+ export function normalizeFugueContentLocales(value: unknown): FugueContentLocaleEntry[] {
19
+ if (!Array.isArray(value))
20
+ return []
21
+ return value.filter(isFugueContentLocaleEntry)
22
+ }
23
+
24
+ /** Read `runtimeConfig.public.cms` with normalized locale entries. */
25
+ export function useShellFugueContentPublicConfig(): ShellFugueContentPublicConfig | undefined {
26
+ const cms = useRuntimeConfig().public.cms
27
+ if (!cms || typeof cms !== 'object')
28
+ return undefined
29
+
30
+ const record = cms as Record<string, unknown>
31
+
32
+ return {
33
+ i18nEnabled: record.i18nEnabled === true,
34
+ defaultLocale: typeof record.defaultLocale === 'string'
35
+ ? record.defaultLocale
36
+ : undefined,
37
+ filteredLocales: normalizeFugueContentLocales(record.filteredLocales)
38
+ }
39
+ }
@@ -0,0 +1,9 @@
1
+ import type { InjectionKey, Ref } from 'vue'
2
+
3
+ /**
4
+ * Optional Studio-driven display name from `settings.site.yml` (`siteName`).
5
+ * Provided by `@altafusion/fugue-content` when the settings collection is enabled.
6
+ */
7
+ export const shellDisplayNameKey: InjectionKey<Ref<string | undefined>> = Symbol(
8
+ 'altafusion:shell-display-name'
9
+ )
@@ -0,0 +1,20 @@
1
+ const STUDIO_SCAN_HASH = '#_studio_scan'
2
+
3
+ /**
4
+ * Path-only locale switch target — strips fragments so SSR and client hydration agree.
5
+ * Browsers do not send the hash to the server; @nuxtjs/i18n may add it on the client only.
6
+ */
7
+ export function localeSwitchPathBase(raw: string): string {
8
+ let path = raw.replace(/#_studio_scan$/, '')
9
+ const hashIndex = path.indexOf('#')
10
+ if (hashIndex !== -1)
11
+ path = path.slice(0, hashIndex)
12
+ return path || '/'
13
+ }
14
+
15
+ /** Re-apply in-page anchor after hydration (hash-nav one-page sites). */
16
+ export function localeSwitchPathWithHash(base: string, hash: string | undefined): string {
17
+ if (!hash || hash === STUDIO_SCAN_HASH)
18
+ return base
19
+ return `${base}${hash}`
20
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Lucide icons used by Nuxt UI + shell chrome.
3
+ * Bundled via `@nuxt/icon` clientBundle so SSR does not HTTP-fetch `/api/_nuxt_icon` (self-deadlock timeout).
4
+ */
5
+ export const nuxtUiLucideIcons = [
6
+ 'lucide:menu',
7
+ 'lucide:x',
8
+ 'lucide:sun',
9
+ 'lucide:moon',
10
+ 'lucide:globe',
11
+ 'lucide:chevron-down',
12
+ 'lucide:home',
13
+ 'lucide:info'
14
+ ] as const
package/nuxt.config.ts ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @altafusion/shell — Nuxt layer
3
+ *
4
+ * Site layouts (default, minimal), product layout (Nuxt UI page chrome),
5
+ * shell composables, Altafusion brand theme CSS (`assets/css/brand-variants.css`),
6
+ * landing/shell section CSS, Noto fonts, and runtime brand switcher.
7
+ * Extends fugue-ui for generic widgets.
8
+ */
9
+
10
+ /// <reference path="./types/nuxt-shell.d.ts" />
11
+
12
+ import { resolve } from 'node:path'
13
+ import { fileURLToPath } from 'node:url'
14
+ import { nuxtUiLucideIcons } from './lib/nuxt-ui-icons'
15
+
16
+ const layerRoot = fileURLToPath(new URL('.', import.meta.url))
17
+
18
+ export default defineNuxtConfig({
19
+ extends: ['@altafusion/fugue-ui'],
20
+
21
+ /** Product sans/serif/mono — declared in themes/tailwind-shell.css @theme; loaded by @nuxt/fonts. */
22
+ fonts: {
23
+ families: [
24
+ {
25
+ name: 'Noto Sans',
26
+ provider: 'google',
27
+ weights: [300, 400, 500, 600, 700],
28
+ global: true
29
+ },
30
+ { name: 'Noto Sans Display', provider: 'google' },
31
+ { name: 'DM Mono', provider: 'google' }
32
+ ]
33
+ },
34
+
35
+ css: [
36
+ resolve(layerRoot, './assets/css/brand-variants.css'),
37
+ resolve(layerRoot, './assets/css/shell-sections.css')
38
+ ],
39
+
40
+ icon: {
41
+ clientBundle: {
42
+ icons: [...nuxtUiLucideIcons]
43
+ },
44
+ serverBundle: {
45
+ collections: ['lucide']
46
+ }
47
+ },
48
+
49
+ imports: {
50
+ dirs: [
51
+ resolve(layerRoot, 'utils')
52
+ ]
53
+ },
54
+
55
+ components: [
56
+ {
57
+ path: './components',
58
+ pathPrefix: false
59
+ }
60
+ ]
61
+ })
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@altafusion/shell",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "type": "module",
4
+ "version": "0.2.0",
5
+ "description": "Shared site layout shells and Altafusion brand theme for consumer apps",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": "./nuxt.config.ts",
12
+ "./app/composables/useBrandTheme": "./app/composables/useBrandTheme.ts",
13
+ "./utils/altafusionBrandTheme": "./utils/altafusionBrandTheme.ts",
14
+ "./lib/fugue-content-public-config": "./lib/fugue-content-public-config.ts",
15
+ "./lib/injection-keys": "./lib/injection-keys.ts",
16
+ "./themes/tailwind-shell.css": "./themes/tailwind-shell.css"
17
+ },
18
+ "main": "./nuxt.config.ts",
19
+ "peerDependencies": {
20
+ "nuxt": ">=4.0.0",
21
+ "vue": "^3.5.0",
22
+ "vue-router": "^5.0.0"
23
+ },
24
+ "dependencies": {
25
+ "@altafusion/fugue-ui": "0.2.0"
26
+ },
27
+ "devDependencies": {
28
+ "@altafusion/eslint-config": "0.2.0",
29
+ "@altafusion/nuxt-base": "0.2.0",
30
+ "@iconify-json/lucide": "^1.2.157",
31
+ "@types/node": "^26.6.6",
32
+ "eslint": "^10.15.0",
33
+ "nuxt": "^4.6.4",
34
+ "typescript": "^6.0.3",
35
+ "vue": "^3.5.46",
36
+ "vue-router": "^5.5.1"
37
+ },
38
+ "files": [
39
+ "**",
40
+ "!**/*.test.ts",
41
+ "!**/.nuxt",
42
+ "!**/.output",
43
+ "!**/.data",
44
+ "!**/coverage",
45
+ "!**/node_modules"
46
+ ],
47
+ "scripts": {
48
+ "clean": "rm -rf .output .nuxt node_modules/.cache dist",
49
+ "lint": "eslint .",
50
+ "lint:fix": "eslint . --fix"
51
+ }
6
52
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Altafusion product Tailwind extensions — Noto typography and shell header height.
3
+ * Import after `@altafusion/fugue-theme/themes/tailwind.css` in app `main.css`.
4
+ */
5
+
6
+ @layer theme {
7
+ :root {
8
+ --ui-header-height: calc(var(--shell-header-height, 2.5rem) + 1px);
9
+ }
10
+
11
+ @media (width >= 48rem) {
12
+ :root {
13
+ --ui-header-height: calc(3rem + 1px);
14
+ }
15
+ }
16
+ }
17
+
18
+ @theme {
19
+ --font-sans: 'Noto Sans', ui-sans-serif, system-ui, sans-serif;
20
+ --font-heading: 'Noto Sans', ui-sans-serif, system-ui, sans-serif;
21
+ --font-serif: 'Noto Sans Display', ui-serif, Georgia, serif;
22
+ --font-mono: 'DM Mono', ui-monospace, monospace;
23
+ }
24
+
25
+ @layer base {
26
+ html {
27
+ font-family: var(--font-sans);
28
+ }
29
+
30
+ html,
31
+ body {
32
+ max-width: 100%;
33
+ overflow-x: clip;
34
+ }
35
+ }
@@ -0,0 +1,42 @@
1
+ /** Product app branding — set in each app's `app.config.ts`. */
2
+ export interface ShellBrandConfig {
3
+ /** Display name (header title fallback, logo alt fallback). */
4
+ name?: string
5
+ /** Public asset path, e.g. `/infinite-logo.svg`. */
6
+ logo?: string
7
+ logoAlt?: string
8
+ /** Extra classes on the logo `<img>` (e.g. `dark:brightness-0 dark:invert`). */
9
+ logoClass?: string
10
+ /** Public favicon path, e.g. `/favicon.svg`. */
11
+ favicon?: string
12
+ }
13
+
14
+ /** Resolved brand values after shell composable fallbacks. */
15
+ export interface ShellBrand {
16
+ name: string
17
+ logo?: string
18
+ logoAlt: string
19
+ logoClass?: string
20
+ favicon?: string
21
+ }
22
+
23
+ export interface ShellSeoConfig {
24
+ title?: string
25
+ titleTemplate?: string
26
+ description?: string
27
+ ogImage?: string
28
+ twitterCard?: 'summary' | 'summary_large_image'
29
+ }
30
+
31
+ export interface ShellHeaderConfig {
32
+ title?: string
33
+ showColorMode?: boolean
34
+ /** Structural chrome preset — `default` (UHeader) or landing hash-nav styles. */
35
+ visualStyle?: 'default' | 'landing-fixed' | 'landing-static'
36
+ }
37
+
38
+ export interface ShellAppConfig {
39
+ brand?: ShellBrandConfig
40
+ seo?: ShellSeoConfig
41
+ header?: ShellHeaderConfig
42
+ }
@@ -0,0 +1,38 @@
1
+ import type { ModuleOptions as NuxtFontsOptions } from '@nuxt/fonts'
2
+ import type { ShellAppConfig } from './app-brand'
3
+
4
+ declare module '@nuxt/schema' {
5
+ interface NuxtConfig {
6
+ fonts?: NuxtFontsOptions | false
7
+ }
8
+ interface NuxtConfigInput {
9
+ fonts?: NuxtFontsOptions | false
10
+ }
11
+ }
12
+
13
+ declare module '#app' {
14
+ interface PageMeta {
15
+ /** Product layout: primary nav highlight and optional aside panels */
16
+ nav?: {
17
+ primary?: string
18
+ /** Aside slot ids enabled for this route (filter panels, etc.) */
19
+ aside?: string[]
20
+ }
21
+ /** Page title for chrome composables and headers */
22
+ title?: string
23
+ /** Single breadcrumb label from route meta (v0 stub) */
24
+ breadcrumb?: string
25
+ /** Shell layout chrome overrides (`default`, `fullscreen`, `minimal`) */
26
+ shell?: {
27
+ header?: boolean
28
+ footer?: boolean
29
+ mainPadding?: boolean
30
+ }
31
+ }
32
+
33
+ interface AppConfig extends ShellAppConfig {}
34
+
35
+ interface AppConfigInput extends ShellAppConfig {}
36
+ }
37
+
38
+ export {}
@@ -0,0 +1,15 @@
1
+ import type { BrandThemeConfig } from '@altafusion/fugue-ui/utils/brandTheme'
2
+
3
+ export const ALTAFUSION_BRANDS = [
4
+ { id: 'default' as const, label: 'Default', primary: 'blue' as const },
5
+ { id: 'violet' as const, label: 'Violet', primary: 'violet' as const },
6
+ { id: 'green' as const, label: 'Green', primary: 'green' as const }
7
+ ] as const
8
+
9
+ export const ALTAFUSION_BRAND_THEME = {
10
+ brands: ALTAFUSION_BRANDS,
11
+ cookieKey: 'altafusion:brand',
12
+ defaultBrandId: 'default' as const
13
+ } as const satisfies BrandThemeConfig<typeof ALTAFUSION_BRANDS>
14
+
15
+ export type BrandId = typeof ALTAFUSION_BRANDS[number]['id']
@@ -0,0 +1,13 @@
1
+ /**
2
+ * formatDate – a utility shared across product apps via the @altafusion/shell layer.
3
+ *
4
+ * Files placed in `packages-product/shell/utils/` are auto-imported by every app
5
+ * that extends this layer, just like composables.
6
+ */
7
+ export function formatDate(
8
+ date: Date | string | number,
9
+ locale = 'en-US',
10
+ options: Intl.DateTimeFormatOptions = { dateStyle: 'medium' }
11
+ ): string {
12
+ return new Intl.DateTimeFormat(locale, options).format(new Date(date))
13
+ }