@innertia-solutions/innertia-nuxt 0.1.19 → 0.1.21

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.
@@ -8,8 +8,6 @@ const props = defineProps({
8
8
  color: { type: String, default: 'slate' },
9
9
  })
10
10
 
11
- const slots = useSlots()
12
-
13
11
  const iconComponent = computed(() => props.icon ? TablerIcons[props.icon] ?? null : null)
14
12
 
15
13
  const iconColorClass = computed(() => ({
@@ -27,30 +25,30 @@ const iconColorClass = computed(() => ({
27
25
  <template>
28
26
  <div class="relative space-y-2">
29
27
 
30
- <!-- Page header card -->
31
- <div v-if="title" class="sticky top-0 z-20 -mx-3 -mt-3 px-3 pt-3 bg-background-1">
32
- <div v-if="$slots.breadcrumb" class="flex items-center gap-x-1 px-1 pt-2 pb-0.5">
33
- <slot name="breadcrumb" />
34
- </div>
35
- <div class="flex items-center justify-between bg-card border border-card-line rounded-2xl shadow-sm px-4 py-3">
36
- <div class="flex items-center gap-x-4 min-w-0">
37
- <div v-if="iconComponent" class="shrink-0 size-10 rounded-xl flex items-center justify-center border border-current/15" :class="iconColorClass">
38
- <component :is="iconComponent" class="size-5" stroke="1.5" />
39
- </div>
40
- <div class="min-w-0">
41
- <div class="flex items-baseline gap-x-2 flex-wrap">
28
+ <!-- Page header -->
29
+ <div v-if="title" class="sticky top-0 z-20 -mx-3 -mt-3 px-3 bg-background/60 backdrop-blur-md">
30
+
31
+ <!-- Breadcrumb -->
32
+ <div v-if="$slots.breadcrumb" class="flex items-center gap-x-1 px-1 pt-2 pb-0.5">
33
+ <slot name="breadcrumb" />
34
+ </div>
35
+
36
+ <!-- Header: icono + título + acciones -->
37
+ <div class="flex items-center justify-between px-1 py-2">
38
+ <div class="flex items-center gap-x-3 min-w-0">
39
+ <div v-if="iconComponent" class="shrink-0 size-10 rounded-xl flex items-center justify-center border border-current/15" :class="iconColorClass">
40
+ <component :is="iconComponent" class="size-5" stroke="1.5" />
41
+ </div>
42
+ <div class="min-w-0">
42
43
  <h1 class="text-lg font-semibold text-foreground">{{ title }}</h1>
43
- <template v-if="description">
44
- <span class="size-1 rounded-full bg-surface-1 shrink-0 self-center hidden sm:block" />
45
- <p class="text-sm text-muted-foreground">{{ description }}</p>
46
- </template>
44
+ <p v-if="description" class="text-sm text-muted-foreground">{{ description }}</p>
47
45
  </div>
48
46
  </div>
47
+ <div v-if="$slots.actions" class="flex items-center gap-x-2 shrink-0 ms-4">
48
+ <slot name="actions" />
49
+ </div>
49
50
  </div>
50
- <div v-if="$slots.actions" class="flex items-center gap-x-2 shrink-0 ms-4">
51
- <slot name="actions" />
52
- </div>
53
- </div>
51
+
54
52
  </div>
55
53
 
56
54
  <!-- Tabs -->
@@ -59,7 +57,9 @@ const iconColorClass = computed(() => ({
59
57
  </div>
60
58
 
61
59
  <!-- Page content -->
62
- <div class="relative"><slot /></div>
60
+ <div class="relative">
61
+ <slot />
62
+ </div>
63
63
 
64
64
  </div>
65
65
  </template>
@@ -0,0 +1,29 @@
1
+ // useAppStore + useInnertiaMode auto-importados.
2
+ // Server-only: en app mode hace fetch de /status (branding + features + demo) y
3
+ // puebla useAppStore. Equivalente app-mode de 02.validate-tenant (saas).
4
+ // Solo activo en mode === 'app'.
5
+ export default defineNuxtRouteMiddleware(async () => {
6
+ if (!useInnertiaMode().isApp()) return
7
+ if (!import.meta.server) return
8
+
9
+ const appStore = useAppStore()
10
+ if (appStore.branding?.name) return // ya poblado este request
11
+
12
+ const config = useRuntimeConfig()
13
+ const internalUrl = (config as any).apiInternalUrl || 'http://api:80'
14
+
15
+ try {
16
+ const data = await $fetch<{
17
+ ok: boolean
18
+ branding?: { name?: string; demo?: { email: string; password: string } | null }
19
+ features?: Record<string, any>
20
+ }>(`${internalUrl}/status`, {
21
+ headers: { Accept: 'application/json' },
22
+ timeout: 5000,
23
+ })
24
+ appStore.setStatus(data)
25
+ } catch (e: any) {
26
+ // No romper la navegación: el login debe funcionar aunque no haya demo.
27
+ console.warn('[app-status] /status no disponible:', e?.message)
28
+ }
29
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",
package/stores/app.js ADDED
@@ -0,0 +1,18 @@
1
+ import { defineStore } from 'pinia'
2
+
3
+ // Estado de la app (modo single-tenant). Poblado por el middleware 04.app-status
4
+ // desde GET /status. Equivalente app-mode del tenantStore de saas.
5
+ export const useAppStore = defineStore('app', {
6
+ state: () => ({
7
+ branding: {}, // { name }
8
+ features: {}, // { organizations, teams, oauth }
9
+ demo: null, // { email, password } | null
10
+ }),
11
+ actions: {
12
+ setStatus(status) {
13
+ this.branding = status?.branding ?? {}
14
+ this.features = status?.features ?? {}
15
+ this.demo = status?.branding?.demo ?? null
16
+ },
17
+ },
18
+ })