@innertia-solutions/innertia-nuxt 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -24,6 +24,13 @@ export default defineNuxtConfig({
24
24
  innertia: {
25
25
  mode: 'saas', // 'saas' (default) | 'app'
26
26
 
27
+ branding: { name: 'MyApp', version: '1.0.0' },
28
+ // Tema Preline — define el "feel" completo (paleta neutral, dark mode tone).
29
+ // Ver https://preline.co/docs/themes.html
30
+ theme: 'moon', // 'default' | 'harvest' | 'retro' | 'ocean' | 'autumn' | 'moon' | 'bubblegum' | 'cashmere' | 'olive'
31
+ // Override del brand color del tema
32
+ colors: { primary: 'violet', secondary: 'slate' },
33
+
27
34
  apps: {
28
35
  backoffice: {
29
36
  path: '/backoffice',
package/app.config.ts CHANGED
@@ -30,16 +30,39 @@ export default defineAppConfig({
30
30
  },
31
31
 
32
32
  /**
33
- * Colores primario y secundario. Acepta:
33
+ * Tema Preline. Cada tema define el "feel" completo (paleta neutral, fondos,
34
+ * bordes, sombras) tanto en light como en dark mode. Es el equivalente a
35
+ * "darkTone" pero más expresivo — distintos temas tienen distintos tonos.
36
+ *
37
+ * Cada tema viene con un brand color default (puedes overridearlo con `colors.primary`):
38
+ * - 'default' → blue (neutral, profesional)
39
+ * - 'harvest' → amber (cálido, tierra)
40
+ * - 'retro' → fuchsia (vibrante, ochenta)
41
+ * - 'ocean' → cyan (frío, acuático)
42
+ * - 'autumn' → yellow (otoñal)
43
+ * - 'moon' → gray (gris, dark-friendly elegante)
44
+ * - 'bubblegum' → pink (suave, juvenil)
45
+ * - 'cashmere' → mauve (cálido morado)
46
+ * - 'olive' → avocado (verde tierra)
47
+ *
48
+ * Ver https://preline.co/docs/themes.html para preview de cada uno.
49
+ */
50
+ theme: 'default' as PrelineTheme,
51
+
52
+ /**
53
+ * Colores primario y secundario. Overridean el brand color default del tema.
54
+ * Acepta:
34
55
  * - Nombre de color de Tailwind (string): 'violet', 'indigo', 'emerald', etc.
35
56
  * - Scale custom (object): { 50: '#f5f3ff', ..., 950: '#2e1065' }
36
57
  *
58
+ * Si no se declara, se usa el brand color default del `theme` elegido.
59
+ *
37
60
  * El plugin `colors` aplica estos valores a las CSS vars `--primary-{50..950}`
38
61
  * y `--secondary-{50..950}` en SSR y cliente.
39
62
  */
40
63
  colors: {
41
- primary: 'blue' as ColorOption,
42
- secondary: 'slate' as ColorOption,
64
+ primary: undefined as ColorOption | undefined,
65
+ secondary: undefined as ColorOption | undefined,
43
66
  },
44
67
 
45
68
  /**
@@ -108,6 +131,18 @@ export type AppMobileMode = 'allow' | 'block' | 'redirect'
108
131
  export type ColorScale = Partial<Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950, string>>
109
132
  export type ColorOption = string | ColorScale
110
133
 
134
+ /** Temas Preline disponibles — cada uno define un "feel" completo (light + dark). */
135
+ export type PrelineTheme =
136
+ | 'default' // blue
137
+ | 'harvest' // amber
138
+ | 'retro' // fuchsia
139
+ | 'ocean' // cyan
140
+ | 'autumn' // yellow
141
+ | 'moon' // gray
142
+ | 'bubblegum' // pink
143
+ | 'cashmere' // mauve
144
+ | 'olive' // avocado
145
+
111
146
  /** Proveedor OAuth — slug del provider (matchea con backend SocialAuthController). */
112
147
  export type OAuthProvider = 'google' | 'microsoft' | 'apple' | 'github'
113
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",
package/plugins/colors.ts CHANGED
@@ -1,30 +1,40 @@
1
- import type { ColorOption, ColorScale } from '../app.config'
1
+ import type { ColorOption, ColorScale, PrelineTheme } from '../app.config'
2
2
 
3
3
  const SCALE_LEVELS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const
4
4
 
5
5
  /**
6
- * Aplica las CSS vars `--primary-{50..950}` y `--secondary-{50..950}` desde
7
- * `appConfig.innertia.colors`. Funciona en SSR (inyecta <style> en head) y cliente.
6
+ * Aplica el theming completo desde `appConfig.innertia`:
7
+ * - `theme` → setea `data-theme="theme-{name}"` en <html> (Preline themes)
8
+ * - `colors.primary` → override del brand color del tema → --primary-{50..950}
9
+ * - `colors.secondary` → --secondary-{50..950}
8
10
  *
9
- * Acepta:
11
+ * Funciona en SSR (inyecta <style> + htmlAttrs en head) y cliente.
12
+ *
13
+ * `colors.primary/secondary` acepta:
10
14
  * - Nombre Tailwind: 'violet' → mapea a var(--color-violet-50..950)
11
15
  * - Scale custom: { 50: '#f5f3ff', ..., 950: '#2e1065' }
12
16
  *
13
- * También deriva las vars semánticas `--primary`, `--primary-hover`, `--primary-foreground`,
14
- * etc., usando el nivel 600 (default) o el más cercano en una scale custom.
17
+ * El "tono dark" se controla via `theme` — cada tema Preline incluye su propia
18
+ * paleta neutral para light y dark. Ej. `theme: 'moon'` da un dark grisáceo elegante.
15
19
  */
16
20
  export default defineNuxtPlugin(() => {
17
21
  const appConfig = useAppConfig()
22
+ const theme = appConfig.innertia?.theme as PrelineTheme | undefined
18
23
  const colors = appConfig.innertia?.colors as { primary?: ColorOption; secondary?: ColorOption } | undefined
19
- if (!colors) return
20
24
 
25
+ // ── Aplicar tema Preline via data-theme ─────────────────────────────────
26
+ if (theme && theme !== 'default') {
27
+ useHead({ htmlAttrs: { 'data-theme': `theme-${theme}` } })
28
+ }
29
+
30
+ // ── Aplicar overrides de primary/secondary via <style> ───────────────────
31
+ if (!colors || (!colors.primary && !colors.secondary)) return
21
32
  const css = buildColorCSS(colors)
22
33
  if (!css) return
23
34
 
24
35
  useHead({
25
36
  style: [
26
37
  {
27
- // Marcamos como innertia para poder identificarla en debug
28
38
  id: 'innertia-colors',
29
39
  children: css,
30
40
  },
@@ -1,7 +0,0 @@
1
- export default defineNuxtPlugin(() => {
2
- const appConfig = useAppConfig() as { spark?: { theme?: string } }
3
- const theme = appConfig.spark?.theme
4
- if (theme && theme !== 'default') {
5
- document.documentElement.setAttribute('data-theme', `theme-${theme}`)
6
- }
7
- })