@vasakgroup/vue-libvasak 0.4.0 → 0.5.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.
- package/dist/types/dropdown/DropdownMenu.vue.d.ts +23 -0
- package/dist/types/dropdown/DropdownMenuContent.vue.d.ts +22 -0
- package/dist/types/dropdown/DropdownMenuItem.vue.d.ts +24 -0
- package/dist/types/dropdown/DropdownMenuLabel.vue.d.ts +13 -0
- package/dist/types/dropdown/DropdownMenuSeparator.vue.d.ts +3 -0
- package/dist/types/dropdown/DropdownMenuTrigger.vue.d.ts +52 -0
- package/dist/types/dropdown/tipos.d.ts +50 -0
- package/dist/types/index.d.ts +9 -1
- package/dist/vue-libvasak.es.js +1022 -564
- package/dist/vue-libvasak.umd.js +1 -1
- package/package.json +1 -1
- package/readme.md +38 -0
|
@@ -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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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,7 +29,9 @@ 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
37
|
export type { ContextoDeLaBarra, OrientacionDeLaBarra, PosicionDeLaBarra, } from "./window/tipos";
|