@vasakgroup/vue-libvasak 0.0.1 → 0.0.2

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": "@vasakgroup/vue-libvasak",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Vue componenets for VSK Applications",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
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 SideRouterLink from "./sidebar/SideRouterLink.vue";
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 { SideA, SideBar, SideRouterLink, SideSection, WindowFrame };
5
+ export { SideBar, SideButton, WindowFrame };
@@ -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>
@@ -1,39 +1,48 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue';
3
-
4
- export default defineComponent({
5
- name: 'TopBar',
6
- props: {
7
- title: {
8
- type: String,
9
- default: 'Vasak'
10
- }
11
- },
12
- methods: {
13
- move() {
14
- (this as any).$vsk.startMove();
15
- },
16
- close() {
17
- (this as any).$vsk.exit();
18
- },
19
- minimize() {
20
- (this as any).$vsk.minimize();
21
- },
22
- toggleMaximize() {
23
- (this as any).$vsk.toggleMaximize();
24
- }
25
- },
26
- mounted() {
27
- (this.$refs.bar as any).addEventListener('mousedown', (e: any) => {
28
- this.move();
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></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 { defineComponent } from 'vue';
3
- import TopBar from './TopBar.vue';
1
+ <script lang="ts" setup>
2
+ import TopBar from "./TopBar.vue";
3
+ import { defineProps, ref, inject, onMounted, computed } from 'vue';
4
4
 
5
- export default defineComponent({
6
- name: 'WindowFrame',
7
- props: {
8
- title: {
9
- type: String,
10
- default: 'Vasak'
11
- }
12
- },
13
- methods: {
14
- rezise(dir: string) {
15
- (this as any).$vsk.startResize(dir);
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
- components: {
19
- TopBar
21
+ image: {
22
+ type: String,
23
+ default: "",
20
24
  },
21
- mounted() {
22
- (this.$refs.top as any).addEventListener('mousedown', (e: any) => {
23
- this.rezise('top');
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
- (this.$refs.bottom as any).addEventListener('mousedown', (e: any) => {
26
- this.rezise('bottom');
40
+ }
41
+ if (bottom.value) {
42
+ (bottom.value as HTMLElement).addEventListener("mousedown", (e: any) => {
43
+ resize("bottom");
27
44
  });
28
- (this.$refs.left as any).addEventListener('mousedown', (e: any) => {
29
- this.rezise('left');
45
+ }
46
+ if (left.value) {
47
+ (left.value as HTMLElement).addEventListener("mousedown", (e: any) => {
48
+ resize("left");
30
49
  });
31
- (this.$refs.right as any).addEventListener('mousedown', (e: any) => {
32
- this.rezise('right');
50
+ }
51
+ if (right.value) {
52
+ (right.value as HTMLElement).addEventListener("mousedown", (e: any) => {
53
+ resize("right");
33
54
  });
34
- (this.$refs.topleft as any).addEventListener('mousedown', (e: any) => {
35
- this.rezise('topleft');
55
+ }
56
+ if (topleft.value) {
57
+ (topleft.value as HTMLElement).addEventListener("mousedown", (e: any) => {
58
+ resize("topleft");
36
59
  });
37
- (this.$refs.bottomleft as any).addEventListener('mousedown', (e: any) => {
38
- this.rezise('bottomleft');
60
+ }
61
+ if (bottomleft.value) {
62
+ (bottomleft.value as HTMLElement).addEventListener("mousedown", (e: any) => {
63
+ resize("bottomleft");
39
64
  });
40
- (this.$refs.topright as any).addEventListener('mousedown', (e: any) => {
41
- this.rezise('topright');
65
+ }
66
+ if (topright.value) {
67
+ (topright.value as HTMLElement).addEventListener("mousedown", (e: any) => {
68
+ resize("topright");
42
69
  });
43
- (this.$refs.bottomright as any).addEventListener('mousedown', (e: any) => {
44
- this.rezise('bottomright');
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
- <div ref="top" class="win-edge win-edge-top"></div>
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>
@@ -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>
@@ -1,5 +0,0 @@
1
- <template>
2
- <ul class="nav nav-pill flex-column">
3
- <slot />
4
- </ul>
5
- </template>