@innertia-solutions/innertia-nuxt 0.1.16 → 0.1.17

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.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * useTheme — lee y cambia el tema dark/light.
3
+ *
4
+ * Usa la cookie `hs_theme` para compatibilidad SSR con el plugin appearance.ts
5
+ * y con el componente <AppSwitchColorTheme />.
6
+ */
7
+ export function useTheme() {
8
+ const cookie = useCookie<'dark' | 'light'>('hs_theme', {
9
+ default: () => 'light',
10
+ sameSite: 'lax',
11
+ maxAge: 60 * 60 * 24 * 365,
12
+ })
13
+
14
+ const isDark = computed(() => cookie.value === 'dark')
15
+
16
+ const toggle = () => {
17
+ const next = cookie.value === 'dark' ? 'light' : 'dark'
18
+ cookie.value = next
19
+ if (import.meta.client) {
20
+ document.documentElement.classList.toggle('dark', next === 'dark')
21
+ localStorage.setItem('hs_theme', next)
22
+ }
23
+ }
24
+
25
+ return { isDark, toggle }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",