@edc-motor/ui 0.5.21 → 0.5.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edc-motor/ui",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "EdC Motor — componentes públicos Vue 3 + tokens SCSS para webs de juegos de mesa (paquete fuente: lo compila el consumidor con Vite)",
5
5
  "license": "GPL-3.0-only",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -63,6 +63,7 @@ export {
63
63
  } from './lib/splash'
64
64
  export { readCache, writeCache } from './lib/localCache'
65
65
  export { createSwrGet, type SwrGetter } from './lib/swr'
66
+ export { isStandalonePwa } from './lib/standalone'
66
67
  export { useToast, type Toast } from './composables/useToast'
67
68
  export { useConfirm, type ConfirmOptions } from './composables/useConfirm'
68
69
  export { useTheme, type ThemeMode } from './composables/useTheme'
@@ -0,0 +1,18 @@
1
+ // ¿Corre la web como PWA INSTALADA (ventana propia, sin pestañas ni barra)?
2
+ // Importa para los PDFs: en la app instalada no hay «pestaña nueva» ni visor
3
+ // con controles — navegar a un PDF inline deja la ventana en blanco sin
4
+ // escape mientras bajan decenas de MB. En standalone se sirve la descarga
5
+ // nativa (Content-Disposition: attachment): el gestor de descargas del
6
+ // sistema da progreso y la app sigue viva.
7
+ export function isStandalonePwa(): boolean {
8
+ if (typeof window === 'undefined') return false
9
+ // display-mode cubre Chrome/Edge/Android; navigator.standalone es el
10
+ // equivalente histórico de iOS Safari.
11
+ return (
12
+ window.matchMedia('(display-mode: standalone)').matches ||
13
+ window.matchMedia('(display-mode: minimal-ui)').matches ||
14
+ window.matchMedia('(display-mode: fullscreen)').matches ||
15
+ ('standalone' in window.navigator &&
16
+ Boolean((window.navigator as { standalone?: boolean }).standalone))
17
+ )
18
+ }