@vasakgroup/vue-libvasak 0.0.1 → 0.0.3
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 +1 -1
- package/src/.d.ts +1 -0
- package/src/index.ts +2 -4
- package/src/sidebar/SideBar.vue +2 -22
- package/src/sidebar/SideButton.vue +20 -0
- package/src/window/TopBar.vue +44 -30
- package/src/window/WindowFrame.vue +73 -44
- package/src/sidebar/SideA.vue +0 -30
- package/src/sidebar/SideRouterLink.vue +0 -34
- package/src/sidebar/SideSection.vue +0 -5
package/package.json
CHANGED
package/src/.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*';
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import SideA from "./sidebar/SideA.vue";
|
|
2
1
|
import SideBar from "./sidebar/SideBar.vue";
|
|
3
|
-
import
|
|
4
|
-
import SideSection from "./sidebar/SideSection.vue";
|
|
2
|
+
import SideButton from "./sidebar/SideButton.vue";
|
|
5
3
|
import WindowFrame from "./window/WindowFrame.vue";
|
|
6
4
|
|
|
7
|
-
export {
|
|
5
|
+
export { SideBar, SideButton, WindowFrame };
|
package/src/sidebar/SideBar.vue
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue";
|
|
3
|
-
|
|
4
|
-
export default defineComponent({
|
|
5
|
-
name: "SideBar",
|
|
6
|
-
props: {
|
|
7
|
-
title: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: "Vasak",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
</script>
|
|
1
|
+
<script lang="ts" setup></script>
|
|
14
2
|
|
|
15
3
|
<template>
|
|
16
|
-
<div
|
|
17
|
-
class="sidebar col-auto p-2 col-md-4 col-xl-3 col-xxl-2 d-flex flex-column justify-content-between"
|
|
18
|
-
>
|
|
19
|
-
<a
|
|
20
|
-
href="#"
|
|
21
|
-
class="d-flex text-decoration-none align-items-center text-center"
|
|
22
|
-
>
|
|
23
|
-
<span class="fs-4 d-none d-sm-inline">{{ title }}</span>
|
|
24
|
-
</a>
|
|
4
|
+
<div class="sidebar">
|
|
25
5
|
<slot />
|
|
26
6
|
</div>
|
|
27
7
|
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: "Link",
|
|
8
|
+
},
|
|
9
|
+
image: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<a href="#" class="sidebar-button">
|
|
18
|
+
<img :src="image" class="img-fluid" />
|
|
19
|
+
</a>
|
|
20
|
+
</template>
|
package/src/window/TopBar.vue
CHANGED
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { defineProps, inject, onMounted, ref, computed } from "vue";
|
|
3
|
+
|
|
4
|
+
const $vsk: any = inject("vsk");
|
|
5
|
+
const bar = ref(null);
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
title: String,
|
|
9
|
+
image: String,
|
|
10
|
+
customColor: String,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const move = () => {
|
|
14
|
+
$vsk.startMove();
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const close = () => {
|
|
18
|
+
$vsk.exit();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const minimize = () => {
|
|
22
|
+
$vsk.minimize();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const toggleMaximize = () => {
|
|
26
|
+
$vsk.toggleMaximize();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const isCustom = computed(() => {
|
|
30
|
+
console.log('customColor', props.customColor);
|
|
31
|
+
return props.customColor ? `custom`: '';
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
onMounted(() => {
|
|
35
|
+
if (bar.value) {
|
|
36
|
+
(bar.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
37
|
+
move();
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
});
|
|
32
41
|
</script>
|
|
33
42
|
|
|
34
43
|
<template>
|
|
35
|
-
<div class="window-topbar" ref="bar" @click="move()">
|
|
36
|
-
<div
|
|
44
|
+
<div class="window-topbar" :class="isCustom" ref="bar" @click="move()">
|
|
45
|
+
<div><img :src="image" class="img-fluid win-icon" /></div>
|
|
37
46
|
<div>{{ title }}</div>
|
|
38
47
|
<div>
|
|
39
48
|
<a class="win-button" href="#" @click="minimize()">_</a>
|
|
@@ -43,3 +52,8 @@ export default defineComponent({
|
|
|
43
52
|
</div>
|
|
44
53
|
</template>
|
|
45
54
|
|
|
55
|
+
<style scoped>
|
|
56
|
+
.custom{
|
|
57
|
+
background-color: v-bind(props.customColor);
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -1,63 +1,92 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import TopBar from "./TopBar.vue";
|
|
3
|
+
import { defineProps, ref, inject, onMounted, computed } from 'vue';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
const $vsk: any = inject("vsk");
|
|
6
|
+
|
|
7
|
+
const top = ref(null);
|
|
8
|
+
const left = ref(null);
|
|
9
|
+
const right = ref(null);
|
|
10
|
+
const bottom = ref(null);
|
|
11
|
+
const topleft = ref(null);
|
|
12
|
+
const bottomleft = ref(null);
|
|
13
|
+
const topright = ref(null);
|
|
14
|
+
const bottomright = ref(null);
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "Vasak",
|
|
17
20
|
},
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
image: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "",
|
|
20
24
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
customColor: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: null,
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const resize = (dir: string) => {
|
|
32
|
+
$vsk.startResize(dir);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
if (top.value) {
|
|
37
|
+
(top.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
38
|
+
resize("top");
|
|
24
39
|
});
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
}
|
|
41
|
+
if (bottom.value) {
|
|
42
|
+
(bottom.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
43
|
+
resize("bottom");
|
|
27
44
|
});
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
}
|
|
46
|
+
if (left.value) {
|
|
47
|
+
(left.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
48
|
+
resize("left");
|
|
30
49
|
});
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
}
|
|
51
|
+
if (right.value) {
|
|
52
|
+
(right.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
53
|
+
resize("right");
|
|
33
54
|
});
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
}
|
|
56
|
+
if (topleft.value) {
|
|
57
|
+
(topleft.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
58
|
+
resize("topleft");
|
|
36
59
|
});
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
}
|
|
61
|
+
if (bottomleft.value) {
|
|
62
|
+
(bottomleft.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
63
|
+
resize("bottomleft");
|
|
39
64
|
});
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
}
|
|
66
|
+
if (topright.value) {
|
|
67
|
+
(topright.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
68
|
+
resize("topright");
|
|
42
69
|
});
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
}
|
|
71
|
+
if (bottomright.value) {
|
|
72
|
+
(bottomright.value as HTMLElement).addEventListener("mousedown", (e: any) => {
|
|
73
|
+
resize("bottomright");
|
|
45
74
|
});
|
|
46
|
-
}
|
|
75
|
+
}
|
|
47
76
|
});
|
|
48
77
|
</script>
|
|
49
78
|
|
|
50
79
|
<template>
|
|
51
|
-
<
|
|
52
|
-
<div ref="left" class="win-edge win-edge-left"></div>
|
|
53
|
-
<div ref="right" class="win-edge win-edge-right"></div>
|
|
54
|
-
<div ref="bottom" class="win-edge win-edge-bottom"></div>
|
|
55
|
-
<div ref="topleft" class="win-edge win-edge-topleft"></div>
|
|
56
|
-
<div ref="bottomleft" class="win-edge win-edge-bottomleft"></div>
|
|
57
|
-
<div ref="topright" class="win-edge win-edge-topright"></div>
|
|
58
|
-
<div ref="bottomright" class="win-edge win-edge-bottomright"></div>
|
|
59
|
-
<TopBar :title="title" />
|
|
80
|
+
<TopBar :title :image :customColor />
|
|
60
81
|
<div class="window">
|
|
61
82
|
<slot />
|
|
83
|
+
<div ref="top" class="win-edge win-edge-top"></div>
|
|
84
|
+
<div ref="left" class="win-edge win-edge-left"></div>
|
|
85
|
+
<div ref="right" class="win-edge win-edge-right"></div>
|
|
86
|
+
<div ref="bottom" class="win-edge win-edge-bottom"></div>
|
|
87
|
+
<div ref="topleft" class="win-edge win-edge-topleft"></div>
|
|
88
|
+
<div ref="bottomleft" class="win-edge win-edge-bottomleft"></div>
|
|
89
|
+
<div ref="topright" class="win-edge win-edge-topright"></div>
|
|
90
|
+
<div ref="bottomright" class="win-edge win-edge-bottomright"></div>
|
|
62
91
|
</div>
|
|
63
92
|
</template>
|
package/src/sidebar/SideA.vue
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue";
|
|
3
|
-
|
|
4
|
-
export default defineComponent({
|
|
5
|
-
name: "SideBar",
|
|
6
|
-
props: {
|
|
7
|
-
title: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: "Link",
|
|
10
|
-
},
|
|
11
|
-
image: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: "",
|
|
14
|
-
},
|
|
15
|
-
url: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: "",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<li class="nav-item py-2 py-sm-0">
|
|
25
|
-
<a :href="url" class="nav-link">
|
|
26
|
-
<span class="fs-5"><img :src="image" class="img-fluid" /></span>
|
|
27
|
-
<span class="fs-4 ms-4 d-none d-sm-inline">{{ title }}</span>
|
|
28
|
-
</a>
|
|
29
|
-
</li>
|
|
30
|
-
</template>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue";
|
|
3
|
-
import { RouterLink } from "vue-router";
|
|
4
|
-
|
|
5
|
-
export default defineComponent({
|
|
6
|
-
name: "SideBar",
|
|
7
|
-
props: {
|
|
8
|
-
title: {
|
|
9
|
-
type: String,
|
|
10
|
-
default: "Link",
|
|
11
|
-
},
|
|
12
|
-
image: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: "",
|
|
15
|
-
},
|
|
16
|
-
url: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: "",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
components: {
|
|
22
|
-
RouterLink,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<li class="nav-item py-2 py-sm-0">
|
|
29
|
-
<RouterLink :to="url" class="nav-link">
|
|
30
|
-
<span class="fs-5"><img :src="image" class="img-fluid" /></span>
|
|
31
|
-
<span class="fs-4 ms-4 d-none d-sm-inline">{{ title }}</span>
|
|
32
|
-
</RouterLink>
|
|
33
|
-
</li>
|
|
34
|
-
</template>
|