@vasakgroup/vue-libvasak 0.3.0 → 0.3.1
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/cards/DeviceCard.vue.d.ts +32 -0
- package/dist/types/cards/ListCard.vue.d.ts +24 -0
- package/dist/types/controls/ActionButton.vue.d.ts +35 -0
- package/dist/types/controls/ToggleControl.vue.d.ts +23 -0
- package/dist/types/forms/FormGroup.vue.d.ts +23 -0
- package/dist/types/forms/SliderControl.vue.d.ts +28 -0
- package/dist/types/forms/SwitchToggle.vue.d.ts +21 -0
- package/{src/index.ts → dist/types/index.d.ts} +4 -40
- package/dist/types/layout/ConfigSection.vue.d.ts +21 -0
- package/dist/types/sidebar/SideBar.vue.d.ts +51 -0
- package/dist/types/sidebar/SideButton.vue.d.ts +21 -0
- package/dist/types/sidebar/SideGroup.vue.d.ts +21 -0
- package/dist/types/sidebar/tipos.d.ts +15 -0
- package/dist/types/tray/TrayIconButton.vue.d.ts +37 -0
- package/dist/types/window/TopBar.vue.d.ts +9 -0
- package/dist/types/window/WindowFrame.vue.d.ts +20 -0
- package/package.json +7 -7
- package/src/cards/DeviceCard.vue +0 -82
- package/src/cards/ListCard.vue +0 -40
- package/src/controls/ActionButton.vue +0 -85
- package/src/controls/ToggleControl.vue +0 -55
- package/src/forms/FormGroup.vue +0 -27
- package/src/forms/SliderControl.vue +0 -100
- package/src/forms/SwitchToggle.vue +0 -49
- package/src/layout/ConfigSection.vue +0 -28
- package/src/shims-vue.d.ts +0 -15
- package/src/sidebar/SideBar.vue +0 -183
- package/src/sidebar/SideButton.vue +0 -115
- package/src/sidebar/SideGroup.vue +0 -46
- package/src/sidebar/tipos.ts +0 -16
- package/src/tray/TrayIconButton.vue +0 -80
- package/src/types/vue-libvasak.d.ts +0 -191
- package/src/window/TopBar.vue +0 -46
- package/src/window/WindowFrame.vue +0 -21
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
/**
|
|
3
|
-
* Un grupo de elementos de la barra, con su título plegable.
|
|
4
|
-
*
|
|
5
|
-
* Plegada la barra, el título del grupo no se muestra —no entra— y el grupo se
|
|
6
|
-
* abre sí o sí: un grupo cerrado sin título visible sería contenido escondido
|
|
7
|
-
* detrás de nada.
|
|
8
|
-
*/
|
|
9
|
-
import { ref, watch } from 'vue';
|
|
10
|
-
|
|
11
|
-
const props = withDefaults(
|
|
12
|
-
defineProps<{ title: string; collapsed?: boolean; defaultOpen?: boolean }>(),
|
|
13
|
-
{ collapsed: false, defaultOpen: true }
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const abierto = ref(props.defaultOpen);
|
|
17
|
-
|
|
18
|
-
watch(
|
|
19
|
-
() => props.collapsed,
|
|
20
|
-
(plegada) => {
|
|
21
|
-
if (plegada) {
|
|
22
|
-
abierto.value = true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<section class="flex flex-col gap-2">
|
|
30
|
-
<button
|
|
31
|
-
v-if="!collapsed"
|
|
32
|
-
type="button"
|
|
33
|
-
class="group flex w-full items-center justify-between rounded-corner px-2 py-1 text-tx-muted text-xs uppercase tracking-[0.08em] hover:bg-ui-surface/60"
|
|
34
|
-
:aria-expanded="abierto"
|
|
35
|
-
@click="abierto = !abierto">
|
|
36
|
-
<span>{{ title }}</span>
|
|
37
|
-
<span class="text-[10px] transition-transform duration-200" :class="abierto ? 'rotate-180' : ''">
|
|
38
|
-
v
|
|
39
|
-
</span>
|
|
40
|
-
</button>
|
|
41
|
-
|
|
42
|
-
<div v-if="abierto || collapsed" class="flex flex-col gap-1">
|
|
43
|
-
<slot />
|
|
44
|
-
</div>
|
|
45
|
-
</section>
|
|
46
|
-
</template>
|
package/src/sidebar/tipos.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Un elemento de la barra lateral: un lugar al que se va. */
|
|
2
|
-
export interface SidebarItem {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
/** Un nombre del tema de iconos del escritorio, no una ruta. */
|
|
6
|
-
icon?: string;
|
|
7
|
-
badge?: string | number;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** Un grupo de elementos, con su título plegable. */
|
|
12
|
-
export interface SidebarCategory {
|
|
13
|
-
id: string;
|
|
14
|
-
title: string;
|
|
15
|
-
items: SidebarItem[];
|
|
16
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="p-1 rounded-corner relative hover:bg-primary dark:hover:bg-primary-dark group transition-all duration-300"
|
|
4
|
-
:class="customClass"
|
|
5
|
-
:title="tooltip"
|
|
6
|
-
@click="handleClick"
|
|
7
|
-
@mouseenter="showTooltip = true"
|
|
8
|
-
@mouseleave="showTooltip = false"
|
|
9
|
-
>
|
|
10
|
-
<img
|
|
11
|
-
:src="icon"
|
|
12
|
-
:alt="alt"
|
|
13
|
-
class="m-auto h-5.5 w-auto transition-all duration-300"
|
|
14
|
-
:class="iconClass"
|
|
15
|
-
/>
|
|
16
|
-
|
|
17
|
-
<!-- Badge/Counter -->
|
|
18
|
-
<div
|
|
19
|
-
v-if="badge !== null && badge > 0"
|
|
20
|
-
class="absolute bottom-1 right-1 bg-primary dark:bg-primary-dark text-white text-xs rounded-full w-4 h-4 flex items-center justify-center font-bold animate-bounce"
|
|
21
|
-
>
|
|
22
|
-
{{ badge }}
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<!-- Tooltip personalizado -->
|
|
26
|
-
<div
|
|
27
|
-
v-if="showCustomTooltip && customTooltipText"
|
|
28
|
-
class="absolute top-1 left-1/2 transform -translate-x-1/2 text-xs font-semibold p-1 rounded-corner transition-all duration-300 pointer-events-none background"
|
|
29
|
-
:class="[
|
|
30
|
-
tooltipClass,
|
|
31
|
-
{
|
|
32
|
-
'opacity-0 -translate-y-2': !showTooltip,
|
|
33
|
-
'opacity-100 translate-y-0': showTooltip
|
|
34
|
-
}
|
|
35
|
-
]"
|
|
36
|
-
>
|
|
37
|
-
{{ customTooltipText }}
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- Slot para contenido adicional personalizado -->
|
|
41
|
-
<slot></slot>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<script setup lang="ts">
|
|
46
|
-
import { ref } from 'vue';
|
|
47
|
-
|
|
48
|
-
interface Props {
|
|
49
|
-
icon: string;
|
|
50
|
-
alt?: string;
|
|
51
|
-
tooltip?: string;
|
|
52
|
-
badge?: number | null;
|
|
53
|
-
iconClass?: string | Record<string, boolean>;
|
|
54
|
-
customClass?: string | Record<string, boolean>;
|
|
55
|
-
tooltipClass?: string | Record<string, boolean>;
|
|
56
|
-
showCustomTooltip?: boolean;
|
|
57
|
-
customTooltipText?: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
withDefaults(defineProps<Props>(), {
|
|
61
|
-
alt: '',
|
|
62
|
-
tooltip: '',
|
|
63
|
-
badge: null,
|
|
64
|
-
iconClass: () => ({}),
|
|
65
|
-
customClass: '',
|
|
66
|
-
tooltipClass: '',
|
|
67
|
-
showCustomTooltip: false,
|
|
68
|
-
customTooltipText: '',
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const emit = defineEmits<{
|
|
72
|
-
click: [];
|
|
73
|
-
}>();
|
|
74
|
-
|
|
75
|
-
const showTooltip = ref(false);
|
|
76
|
-
|
|
77
|
-
const handleClick = () => {
|
|
78
|
-
emit('click');
|
|
79
|
-
};
|
|
80
|
-
</script>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
declare module "@vasakgroup/vue-libvasak" {
|
|
2
|
-
import { DefineComponent, App } from "vue";
|
|
3
|
-
|
|
4
|
-
/* Layout */
|
|
5
|
-
export interface WindowFrameProps {
|
|
6
|
-
title?: string;
|
|
7
|
-
image?: string;
|
|
8
|
-
class?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* Sidebar */
|
|
13
|
-
export interface SidebarItem {
|
|
14
|
-
id: string;
|
|
15
|
-
label: string;
|
|
16
|
-
/** Un nombre del tema de iconos del escritorio, no una ruta. */
|
|
17
|
-
icon?: string;
|
|
18
|
-
badge?: string | number;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface SidebarCategory {
|
|
23
|
-
id: string;
|
|
24
|
-
title: string;
|
|
25
|
-
items: SidebarItem[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface SideBarProps {
|
|
29
|
-
/** Sin `title` ni `subtitle` no se dibuja el área de título. */
|
|
30
|
-
title?: string;
|
|
31
|
-
subtitle?: string;
|
|
32
|
-
categories?: SidebarCategory[];
|
|
33
|
-
modelValue?: string;
|
|
34
|
-
collapsed?: boolean;
|
|
35
|
-
collapseLabel?: string;
|
|
36
|
-
expandLabel?: string;
|
|
37
|
-
class?: string;
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface SideButtonProps {
|
|
42
|
-
label: string;
|
|
43
|
-
/** Un nombre del tema de iconos, que se vuelve a resolver al cambiar de tema. */
|
|
44
|
-
icon?: string;
|
|
45
|
-
active?: boolean;
|
|
46
|
-
collapsed?: boolean;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
badge?: string | number;
|
|
49
|
-
class?: string;
|
|
50
|
-
[key: string]: any;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface SideGroupProps {
|
|
54
|
-
title: string;
|
|
55
|
-
collapsed?: boolean;
|
|
56
|
-
defaultOpen?: boolean;
|
|
57
|
-
[key: string]: any;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Controls */
|
|
61
|
-
export interface ActionButtonProps {
|
|
62
|
-
label: string;
|
|
63
|
-
disabled?: boolean;
|
|
64
|
-
variant?: "primary" | "secondary" | "danger";
|
|
65
|
-
loading?: boolean;
|
|
66
|
-
customClass?: string | Record<string, boolean>;
|
|
67
|
-
size?: "sm" | "md" | "lg";
|
|
68
|
-
fullWidth?: boolean;
|
|
69
|
-
iconSrc?: string;
|
|
70
|
-
iconAlt?: string;
|
|
71
|
-
iconRight?: boolean;
|
|
72
|
-
type?: "button" | "submit" | "reset";
|
|
73
|
-
stopPropagation?: boolean;
|
|
74
|
-
preventDefault?: boolean;
|
|
75
|
-
[key: string]: any;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface ToggleControlProps {
|
|
79
|
-
icon: string;
|
|
80
|
-
alt?: string;
|
|
81
|
-
tooltip?: string;
|
|
82
|
-
isActive?: boolean;
|
|
83
|
-
isLoading?: boolean;
|
|
84
|
-
iconClass?: Record<string, boolean>;
|
|
85
|
-
customClass?: Record<string, boolean>;
|
|
86
|
-
[key: string]: any;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/* Layout/Config */
|
|
90
|
-
export interface ConfigSectionProps {
|
|
91
|
-
title: string;
|
|
92
|
-
icon?: string;
|
|
93
|
-
customClass?: string | Record<string, boolean>;
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Cards */
|
|
98
|
-
export interface DeviceCardProps {
|
|
99
|
-
icon: string;
|
|
100
|
-
title: string;
|
|
101
|
-
subtitle?: string;
|
|
102
|
-
metadata?: string;
|
|
103
|
-
extraInfo?: string[];
|
|
104
|
-
isConnected?: boolean;
|
|
105
|
-
showActionButton?: boolean;
|
|
106
|
-
actionLabel?: string;
|
|
107
|
-
showStatusIndicator?: boolean;
|
|
108
|
-
customClass?: string;
|
|
109
|
-
clickable?: boolean;
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ListCardProps {
|
|
114
|
-
clickable?: boolean;
|
|
115
|
-
customClass?: string | Record<string, boolean>;
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/* Forms */
|
|
120
|
-
export interface FormGroupProps {
|
|
121
|
-
label: string;
|
|
122
|
-
htmlFor?: string;
|
|
123
|
-
customClass?: string | Record<string, boolean>;
|
|
124
|
-
labelClass?: string | Record<string, boolean>;
|
|
125
|
-
[key: string]: any;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface SliderControlProps {
|
|
129
|
-
icon: string;
|
|
130
|
-
alt?: string;
|
|
131
|
-
tooltip?: string;
|
|
132
|
-
modelValue: number;
|
|
133
|
-
min?: number;
|
|
134
|
-
max?: number;
|
|
135
|
-
showButton?: boolean;
|
|
136
|
-
iconClass?: string | Record<string, boolean>;
|
|
137
|
-
getPercentageClass?: (percentage: number) => string;
|
|
138
|
-
[key: string]: any;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface SwitchToggleProps {
|
|
142
|
-
isOn: boolean;
|
|
143
|
-
disabled?: boolean;
|
|
144
|
-
size?: "small" | "medium";
|
|
145
|
-
activeClass?: string;
|
|
146
|
-
inactiveClass?: string;
|
|
147
|
-
customClass?: string;
|
|
148
|
-
[key: string]: any;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Tray */
|
|
152
|
-
export interface TrayIconButtonProps {
|
|
153
|
-
icon: string;
|
|
154
|
-
alt?: string;
|
|
155
|
-
tooltip?: string;
|
|
156
|
-
badge?: number | null;
|
|
157
|
-
iconClass?: string | Record<string, boolean>;
|
|
158
|
-
customClass?: string | Record<string, boolean>;
|
|
159
|
-
tooltipClass?: string | Record<string, boolean>;
|
|
160
|
-
showCustomTooltip?: boolean;
|
|
161
|
-
customTooltipText?: string;
|
|
162
|
-
[key: string]: any;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/* Component exports */
|
|
166
|
-
export const WindowFrame: DefineComponent<WindowFrameProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
167
|
-
export const SideBar: DefineComponent<SideBarProps, any, any, {}, {}, {}, {}, { 'update:modelValue': (value: string) => void; 'update:collapsed': (value: boolean) => void; change: (value: string) => void }, string>;
|
|
168
|
-
export const SideButton: DefineComponent<SideButtonProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
169
|
-
export const SideGroup: DefineComponent<SideGroupProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
170
|
-
|
|
171
|
-
export const ActionButton: DefineComponent<ActionButtonProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
172
|
-
export const ToggleControl: DefineComponent<ToggleControlProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
173
|
-
export const ConfigSection: DefineComponent<ConfigSectionProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
174
|
-
|
|
175
|
-
export const DeviceCard: DefineComponent<DeviceCardProps, any, any, {}, {}, {}, {}, { action: () => void; click: () => void }, string>;
|
|
176
|
-
export const ListCard: DefineComponent<ListCardProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
177
|
-
|
|
178
|
-
export const FormGroup: DefineComponent<FormGroupProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
179
|
-
export const SliderControl: DefineComponent<SliderControlProps, any, any, {}, {}, {}, {}, { 'update:modelValue': (value: number) => void; buttonClick: () => void }, string>;
|
|
180
|
-
export const SwitchToggle: DefineComponent<SwitchToggleProps, any, any, {}, {}, {}, {}, { toggle: (value: boolean) => void }, string>;
|
|
181
|
-
|
|
182
|
-
export const TrayIconButton: DefineComponent<TrayIconButtonProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
183
|
-
|
|
184
|
-
// Plugin de Vue
|
|
185
|
-
export interface VueLibVasakPlugin {
|
|
186
|
-
install(app: App): void;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
declare const plugin: VueLibVasakPlugin;
|
|
190
|
-
export default plugin;
|
|
191
|
-
}
|
package/src/window/TopBar.vue
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref, Ref, onMounted } from "vue";
|
|
3
|
-
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
4
|
-
import { getIconSource } from "@vasakgroup/plugin-vicons";
|
|
5
|
-
|
|
6
|
-
const bar = ref(null);
|
|
7
|
-
const appWindow = getCurrentWindow();
|
|
8
|
-
const closeIcon: Ref<string> = ref("");
|
|
9
|
-
const minimizeIcon: Ref<string> = ref("");
|
|
10
|
-
const maximizeIcon: Ref<string> = ref("");
|
|
11
|
-
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
title: String,
|
|
14
|
-
image: String,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
onMounted(async () => {
|
|
18
|
-
closeIcon.value = await getIconSource("window-close");
|
|
19
|
-
minimizeIcon.value = await getIconSource("window-minimize");
|
|
20
|
-
maximizeIcon.value = await getIconSource("window-maximize");
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<template>
|
|
25
|
-
<div
|
|
26
|
-
data-tauri-drag-region
|
|
27
|
-
class="flex h-8 px-4 py-1 bg-primary dark:bg-primary-dark rounded-t-corner-window justify-between align-center"
|
|
28
|
-
ref="bar"
|
|
29
|
-
>
|
|
30
|
-
<div data-tauri-drag-region>
|
|
31
|
-
<img :src="props.image" data-tauri-drag-region class="h-6 w-auto" :alt="props.title" />
|
|
32
|
-
</div>
|
|
33
|
-
<div data-tauri-drag-region>{{ props.title }}</div>
|
|
34
|
-
<div data-tauri-drag-region>
|
|
35
|
-
<span class="win-button" @click="appWindow.minimize()">
|
|
36
|
-
<img :src="minimizeIcon" class="h-6 w-6 inline-block" alt="Minimize">
|
|
37
|
-
</span>
|
|
38
|
-
<span class="win-button" @click="appWindow.toggleMaximize()">
|
|
39
|
-
<img :src="maximizeIcon" class="h-6 w-6 inline-block" alt="Maximize">
|
|
40
|
-
</span>
|
|
41
|
-
<span class="win-button" @click="appWindow.close()">
|
|
42
|
-
<img :src="closeIcon" class="h-6 w-6 inline-block" alt="Close">
|
|
43
|
-
</span>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
/**
|
|
3
|
-
* El marco de una ventana: la barra superior y lo que va debajo.
|
|
4
|
-
*
|
|
5
|
-
* `defineProps` es una macro del compilador de componentes, no una función que
|
|
6
|
-
* se importe. Importarla desde `vue` choca con la que el compilador declara, y
|
|
7
|
-
* el typecheck lo decía —sólo que no había ninguno: un `declare module \'*\'`
|
|
8
|
-
* dejaba todos los imports en `any` y este archivo nunca se comprobó.
|
|
9
|
-
*/
|
|
10
|
-
import TopBar from './TopBar.vue';
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(defineProps<{ title?: string; image?: string }>(), {
|
|
13
|
-
title: 'Vasak',
|
|
14
|
-
image: '',
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<TopBar :title="props.title" :image="props.image" />
|
|
20
|
-
<slot />
|
|
21
|
-
</template>
|