@vasakgroup/vue-libvasak 0.4.1 → 0.6.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.
@@ -0,0 +1,23 @@
1
+ type __VLS_Props = {
2
+ /** Atado desde afuera. Sin esto el menú se abre y se cierra solo. */
3
+ open?: boolean;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:open": (value: boolean) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
13
+ }>, {
14
+ open: boolean;
15
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
19
+ type __VLS_WithSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -0,0 +1,22 @@
1
+ type __VLS_Props = {
2
+ side?: 'top' | 'bottom' | 'left' | 'right';
3
+ align?: 'start' | 'center' | 'end';
4
+ sideOffset?: number;
5
+ };
6
+ declare var __VLS_16: {};
7
+ type __VLS_Slots = {} & {
8
+ default?: (props: typeof __VLS_16) => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ side: "top" | "bottom" | "left" | "right";
12
+ align: "start" | "center" | "end";
13
+ sideOffset: number;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,24 @@
1
+ type __VLS_Props = {
2
+ disabled?: boolean;
3
+ };
4
+ declare var __VLS_1: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ select: () => any;
10
+ click: (evento: Event) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onSelect?: (() => any) | undefined;
13
+ onClick?: ((evento: Event) => any) | undefined;
14
+ }>, {
15
+ disabled: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Lo que abre el menú.
3
+ *
4
+ * # Por qué es una función de render y no una plantilla
5
+ *
6
+ * `aria-haspopup` y `aria-expanded` tienen que ir **en el botón**, que es lo
7
+ * que el lector de pantalla anuncia y lo que recibe el foco. Envolverlo en un
8
+ * `div` y ponérselos al `div` no sirve de nada: quien tabula llega al botón y
9
+ * oye «botón», sin que haya un menú ni un estado abierto por ningún lado.
10
+ *
11
+ * Con `as-child` el disparador no dibuja nada suyo: clona el hijo que le
12
+ * pasaron y le agrega los atributos y los manejadores. Sin `as-child` sí
13
+ * envuelve, que es lo que necesita un menú contextual anclado a un punto.
14
+ *
15
+ * # El teclado y el clic sintético
16
+ *
17
+ * Enter y Espacio se atienden en `keydown` y con `preventDefault`. Sobre un
18
+ * `<button>` de verdad el navegador **también** dispara un clic por esas dos
19
+ * teclas: sin cortarlo, el menú se abriría con la tecla y se cerraría con el
20
+ * clic que viene detrás, y desde afuera parece que la tecla no hace nada.
21
+ */
22
+ import { type VNode } from 'vue';
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
25
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
26
+ /** Sin envoltorio: los atributos van sobre el hijo que se le pasó. */
27
+ asChild: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ /** El disparador no abre nada; lo abre la aplicación por su cuenta. */
32
+ disabled: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
37
+ [key: string]: any;
38
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
39
+ /** Sin envoltorio: los atributos van sobre el hijo que se le pasó. */
40
+ asChild: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ /** El disparador no abre nada; lo abre la aplicación por su cuenta. */
45
+ disabled: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ }>> & Readonly<{}>, {
50
+ disabled: boolean;
51
+ asChild: boolean;
52
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * El contrato entre las seis piezas de un menú desplegable.
3
+ *
4
+ * Un menú es un componente repartido: el disparador está en la barra, el
5
+ * contenido se teletransporta al `body` y los ítems son hijos del contenido
6
+ * pero nietos de quien los escribió. Nada de eso se puede coordinar por
7
+ * propiedades, así que la raíz lo **provee** y las demás piezas lo inyectan.
8
+ *
9
+ * Lo que se coordina no es sólo «está abierto»: para que el menú se comporte
10
+ * como un menú hace falta saber **con qué extremo** abrirlo —la flecha de
11
+ * arriba abre por el último ítem— y **a quién** devolverle el foco al cerrar.
12
+ * Eso último no es el disparador: en un menú contextual el disparador es un
13
+ * ancla invisible de cero por cero, y devolverle el foco es perderlo.
14
+ */
15
+ import { type InjectionKey, type Ref } from 'vue';
16
+ /**
17
+ * Qué se enfoca al abrir.
18
+ *
19
+ * `primero` y `ultimo` los pide el teclado —flecha abajo y flecha arriba—;
20
+ * `ninguno` es lo que pasa con el ratón, y ahí el foco va al propio menú, que
21
+ * es lo que deja andar las flechas y el Escape sin haber elegido nada todavía.
22
+ */
23
+ export type FocoAlAbrir = 'primero' | 'ultimo' | 'ninguno';
24
+ export interface ContextoDelMenu {
25
+ abierto: Ref<boolean>;
26
+ /** El `id` del `role="menu"`, que es lo que apunta el `aria-controls`. */
27
+ idDelMenu: string;
28
+ /** El `id` de la etiqueta del menú, si hay una, para su `aria-labelledby`. */
29
+ idDeLaEtiqueta: Ref<string | null>;
30
+ ponerLaEtiqueta: (id: string | null) => void;
31
+ disparador: Ref<HTMLElement | null>;
32
+ ponerElDisparador: (elemento: HTMLElement | null) => void;
33
+ focoAlAbrir: Ref<FocoAlAbrir>;
34
+ abrir: (foco?: FocoAlAbrir) => void;
35
+ /** Cerrar devolviendo el foco es lo que corresponde al Escape y a elegir. */
36
+ cerrar: (opciones?: {
37
+ devolverElFoco?: boolean;
38
+ }) => void;
39
+ alternar: (foco?: FocoAlAbrir) => void;
40
+ }
41
+ export declare const CLAVE_DEL_MENU: InjectionKey<ContextoDelMenu>;
42
+ /**
43
+ * El menú que envuelve a este componente.
44
+ *
45
+ * Fuera de un `DropdownMenu` devuelve un contexto suelto en vez de reventar: un
46
+ * ítem montado solo —en una prueba, en una vista previa— tiene que dibujarse
47
+ * igual, con su `role` y su teclado, aunque no haya nada que abrir ni cerrar.
48
+ */
49
+ export declare function usarElMenu(): ContextoDelMenu;
50
+ export declare function siguienteIdDeMenu(): string;
@@ -12,6 +12,12 @@ import BarSearch from "./bar/BarSearch.vue";
12
12
  import ActionButton from "./controls/ActionButton.vue";
13
13
  import ConfigSection from "./layout/ConfigSection.vue";
14
14
  import DeviceCard from "./cards/DeviceCard.vue";
15
+ import DropdownMenu from "./dropdown/DropdownMenu.vue";
16
+ import DropdownMenuContent from "./dropdown/DropdownMenuContent.vue";
17
+ import DropdownMenuItem from "./dropdown/DropdownMenuItem.vue";
18
+ import DropdownMenuLabel from "./dropdown/DropdownMenuLabel.vue";
19
+ import DropdownMenuSeparator from "./dropdown/DropdownMenuSeparator.vue";
20
+ import DropdownMenuTrigger from "./dropdown/DropdownMenuTrigger.vue";
15
21
  import FormGroup from "./forms/FormGroup.vue";
16
22
  import ListCard from "./cards/ListCard.vue";
17
23
  import SliderControl from "./forms/SliderControl.vue";
@@ -23,9 +29,11 @@ declare const _default: {
23
29
  install(app: App): void;
24
30
  };
25
31
  export default _default;
26
- export { SideBar, SideButton, SideGroup, SelectField, ThemeIcon, WindowFrame, AppBar, WindowControls, TabBar, TabItem, BarSearch, ActionButton, ConfigSection, DeviceCard, FormGroup, ListCard, SliderControl, SwitchToggle, ToggleControl, TrayIconButton, };
32
+ export { SideBar, SideButton, SideGroup, SelectField, ThemeIcon, WindowFrame, AppBar, WindowControls, TabBar, TabItem, BarSearch, ActionButton, ConfigSection, DeviceCard, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, FormGroup, ListCard, SliderControl, SwitchToggle, ToggleControl, TrayIconButton, };
33
+ export type { ContextoDelMenu, FocoAlAbrir } from "./dropdown/tipos";
34
+ export { CLAVE_DEL_MENU, usarElMenu } from "./dropdown/tipos";
27
35
  export type { SidebarCategory, SidebarItem } from "./sidebar/tipos";
28
36
  export type { AccionDePestana, ElementoDePestana } from "./tabs/tipos";
29
- export type { ContextoDeLaBarra, OrientacionDeLaBarra, PosicionDeLaBarra, } from "./window/tipos";
30
- export { CLAVE_DE_LA_BARRA, esPosicion, orientacionDe, POSICIONES, usarLaBarra } from "./window/tipos";
37
+ export type { ContextoDeLaBarra, ControlDeVentana, OrientacionDeLaBarra, PosicionDeLaBarra, } from "./window/tipos";
38
+ export { CLAVE_DE_LA_BARRA, esPosicion, LOS_TRES_CONTROLES, orientacionDe, POSICIONES, usarLaBarra, } from "./window/tipos";
31
39
  export { posicionDe, usarLaPosicionDeLaBarra } from "./window/preferencia";
@@ -1,4 +1,4 @@
1
- import { type PosicionDeLaBarra } from './tipos';
1
+ import { type ControlDeVentana, type PosicionDeLaBarra } from './tipos';
2
2
  type __VLS_Props = {
3
3
  /** Sin esto toma la del marco que la envuelve. */
4
4
  position?: PosicionDeLaBarra | null;
@@ -7,10 +7,15 @@ type __VLS_Props = {
7
7
  minimizeLabel?: string;
8
8
  maximizeLabel?: string;
9
9
  closeLabel?: string;
10
- /** Para una ventana sin botones propios: un diálogo, un asistente. */
11
- hideControls?: boolean;
10
+ /**
11
+ * Cuáles de los tres botones de ventana lleva.
12
+ *
13
+ * Vacío en un cuadro de diálogo y en el instalador; sólo `close` en el
14
+ * mini-reproductor. Ver `WindowControls`.
15
+ */
16
+ controls?: ControlDeVentana[];
12
17
  };
13
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
18
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_14: {};
14
19
  type __VLS_Slots = {} & {
15
20
  identidad?: (props: typeof __VLS_1) => any;
16
21
  } & {
@@ -19,14 +24,24 @@ type __VLS_Slots = {} & {
19
24
  default?: (props: typeof __VLS_5) => any;
20
25
  } & {
21
26
  acciones?: (props: typeof __VLS_7) => any;
27
+ } & {
28
+ centro?: (props: typeof __VLS_14) => any;
22
29
  };
23
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
30
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ close: () => any;
32
+ minimize: () => any;
33
+ maximize: () => any;
34
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
+ onClose?: (() => any) | undefined;
36
+ onMinimize?: (() => any) | undefined;
37
+ onMaximize?: (() => any) | undefined;
38
+ }>, {
24
39
  title: string;
40
+ controls: ControlDeVentana[];
25
41
  minimizeLabel: string;
26
42
  maximizeLabel: string;
27
43
  closeLabel: string;
28
44
  position: PosicionDeLaBarra | null;
29
- hideControls: boolean;
30
45
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
46
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
47
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,21 @@
1
+ import { type ControlDeVentana } from './tipos';
1
2
  type __VLS_Props = {
3
+ /** Cuáles de los tres se dibujan, y en este orden. */
4
+ controls?: ControlDeVentana[];
2
5
  minimizeLabel?: string;
3
6
  maximizeLabel?: string;
4
7
  closeLabel?: string;
5
8
  };
6
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ close: () => any;
11
+ minimize: () => any;
12
+ maximize: () => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onClose?: (() => any) | undefined;
15
+ onMinimize?: (() => any) | undefined;
16
+ onMaximize?: (() => any) | undefined;
17
+ }>, {
18
+ controls: ControlDeVentana[];
7
19
  minimizeLabel: string;
8
20
  maximizeLabel: string;
9
21
  closeLabel: string;
@@ -1,4 +1,4 @@
1
- import { type PosicionDeLaBarra } from './tipos';
1
+ import { type ControlDeVentana, type PosicionDeLaBarra } from './tipos';
2
2
  type __VLS_Props = {
3
3
  /** Fija la barra a un lado, ignorando la preferencia del escritorio. */
4
4
  position?: PosicionDeLaBarra | null;
@@ -6,29 +6,43 @@ type __VLS_Props = {
6
6
  minimizeLabel?: string;
7
7
  maximizeLabel?: string;
8
8
  closeLabel?: string;
9
- hideControls?: boolean;
9
+ /**
10
+ * Cuáles de los tres botones de ventana lleva. Vacío en un cuadro de
11
+ * diálogo y en el instalador; sólo `close` en el mini-reproductor.
12
+ */
13
+ controls?: ControlDeVentana[];
10
14
  /** Para una ventana que dibuja su propia barra o no lleva ninguna. */
11
15
  hideBar?: boolean;
12
16
  };
13
- declare var __VLS_8: {}, __VLS_11: {}, __VLS_14: {}, __VLS_16: {}, __VLS_18: {};
17
+ declare var __VLS_8: {}, __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_19: {}, __VLS_21: {};
14
18
  type __VLS_Slots = {} & {
15
19
  identidad?: (props: typeof __VLS_8) => any;
16
20
  } & {
17
21
  titulo?: (props: typeof __VLS_11) => any;
18
22
  } & {
19
- acciones?: (props: typeof __VLS_14) => any;
23
+ centro?: (props: typeof __VLS_14) => any;
20
24
  } & {
21
- barra?: (props: typeof __VLS_16) => any;
25
+ acciones?: (props: typeof __VLS_17) => any;
22
26
  } & {
23
- default?: (props: typeof __VLS_18) => any;
27
+ barra?: (props: typeof __VLS_19) => any;
28
+ } & {
29
+ default?: (props: typeof __VLS_21) => any;
24
30
  };
25
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
31
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ close: () => any;
33
+ minimize: () => any;
34
+ maximize: () => any;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onClose?: (() => any) | undefined;
37
+ onMinimize?: (() => any) | undefined;
38
+ onMaximize?: (() => any) | undefined;
39
+ }>, {
26
40
  title: string;
41
+ controls: ControlDeVentana[];
27
42
  minimizeLabel: string;
28
43
  maximizeLabel: string;
29
44
  closeLabel: string;
30
45
  position: PosicionDeLaBarra | null;
31
- hideControls: boolean;
32
46
  hideBar: boolean;
33
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
48
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Los manejadores que hay que pasarle al componente de abajo, y sólo ésos.
3
+ *
4
+ * `WindowControls` decide qué hace cada botón mirando si alguien escucha el
5
+ * evento: sin oyente cierra la ventana, con oyente emite y no la toca. Eso sólo
6
+ * funciona si la cadena de arriba —`WindowFrame` → `AppBar` → `WindowControls`—
7
+ * reenvía los eventos que de verdad le llegaron y no los tres siempre.
8
+ *
9
+ * Escribir `@close="emit('close')"` fijo en el marco hace que el botón vea un
10
+ * oyente puesto aunque la aplicación no haya escuchado nada, y entonces ninguna
11
+ * ventana se cierra nunca: el clic emite hacia arriba y se pierde. Pasó, y no da
12
+ * ningún error.
13
+ *
14
+ * Se mira el `vnode` y no `useAttrs()` porque un evento declarado en `emits` no
15
+ * aparece en los atributos: Vue lo saca de ahí justamente por estar declarado.
16
+ *
17
+ * Se llama desde la plantilla (`v-on="reenviarSiEscuchan([...])"`) para que se
18
+ * evalúe en cada dibujado: el `vnode` se reemplaza y un `computed` sin
19
+ * dependencias reactivas se quedaría con los oyentes del primero.
20
+ */
21
+ export declare function reenviarSiEscuchan(eventos: string[]): Record<string, () => void>;
@@ -46,3 +46,7 @@ export declare function esPosicion(valor: unknown): valor is PosicionDeLaBarra;
46
46
  * marco se dibujaba de costado. Lo encontró una prueba de `aria-orientation`.
47
47
  */
48
48
  export declare function usarLaBarra(): ContextoDeLaBarra;
49
+ /** Los tres botones de la ventana, por nombre. */
50
+ export type ControlDeVentana = 'minimize' | 'maximize' | 'close';
51
+ /** Los tres, que es lo que lleva una ventana normal. */
52
+ export declare const LOS_TRES_CONTROLES: ControlDeVentana[];