bfg-common 1.4.533 → 1.4.534

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.
@@ -1,294 +1,299 @@
1
- <template>
2
- <div
3
- :class="['vmw-drawer animation', { show: isShow }]"
4
- data-id="spice-console-drawer"
5
- @click.capture="onInputManagerFocus"
6
- >
7
- <div
8
- v-if="!isShow"
9
- ref="grab"
10
- data-id="spice-console-drawer-toggle"
11
- class="vmw-drawer__open"
12
- :style="`top: ${y}px;`"
13
- @click="toggleDrawer"
14
- >
15
- <atoms-the-icon name="arrow" class="vmw-drawer__open-icon" />
16
- <atoms-the-icon2 name="drag" class="vmw-drawer__drag-icon" />
17
- </div>
18
-
19
- <div class="vmw-drawer-header">
20
- <h3>{{ localization.common.consolePanel }}</h3>
21
- <atoms-the-icon
22
- class="vmw-drawer-header__close"
23
- data-id="spice-console-drawer-toggle-icon"
24
- name="close"
25
- @click="toggleDrawer"
26
- />
27
- </div>
28
-
29
- <div class="vmw-drawer-body">
30
- <button
31
- class="vmw-drawer-body__btn animation toggle-fullscreen"
32
- data-id="spice-console-drawer-toggle-fullscreen"
33
- @click="emits('toggle-fullscreen')"
34
- >
35
- {{ localization.common.toggleFullscreenMode }}
36
- </button>
37
- <button
38
- class="vmw-drawer-body__btn animation toggle-fullscreen"
39
- @click="emits('send-alt-command')"
40
- >
41
- {{ localization.common.sendAltCommand }}
42
- </button>
43
- <label class="vmw-drawer-body__btn animation toggle-fullscreen">
44
- {{ localization.remoteConsole.uploadFolder }}
45
- <input
46
- type="file"
47
- webkitdirectory
48
- directory
49
- multiple
50
- />
51
- </label>
52
- <label class="vmw-drawer-body__btn animation toggle-fullscreen">
53
- {{ localization.remoteConsole.uploadFiles }}
54
- <input
55
- type="file"
56
- multiple
57
- />
58
- </label>
59
-
60
- <select
61
- v-model="codec"
62
- @mouseenter="hover = true"
63
- @mouseleave="hover = false"
64
- @change="onChangeCodec"
65
- >
66
- <option :value="1">MJPEG</option>
67
- <option :value="2">VP8</option>
68
- <option :value="3">H264</option>
69
- <option :value="4" disabled>VP9</option>
70
- <option :value="5">H265</option>
71
- </select>
72
-
73
- <hr />
74
- <button
75
- class="vmw-drawer-body__btn animation show-keyboard"
76
- @click="onToggleKeyboard"
77
- >
78
- {{ showOrHideKeyboard }}
79
- </button>
80
- </div>
81
-
82
- <div class="vmw-drawer-footer">
83
- <div class="size-info">
84
- <p class="size-info-text">View size: {{ viewSize }}</p>
85
- <p class="size-info-text">Canvas size: {{ canvasSize }}</p>
86
- </div>
87
- <div id="debug-stream"></div>
88
- </div>
89
- <div v-if="isKeyboardShown">
90
- <common-spice-console-keyboard />
91
- </div>
92
- </div>
93
- </template>
94
- <script setup lang="ts">
95
- import { useDraggable } from '@vueuse/core'
96
- import type { UI_I_Localization } from '~/lib/models/interfaces'
97
- import type { UI_T_CODEC } from '~/components/common/spiceConsole/lib/models/types'
98
-
99
- const emits = defineEmits<{
100
- (event: 'toggle-fullscreen'): void
101
- (event: 'send-alt-command'): void
102
- }>()
103
-
104
- const codec = ref<UI_T_CODEC>(1)
105
- const onChangeCodec = (): void => {
106
- // @ts-ignore
107
- if (!window.app) return
108
- // @ts-ignore
109
- const channels = window.app.spiceConnection.channels
110
- for (let i in channels) {
111
- const channel = channels[i]
112
- if (channel.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
113
- channel.changeCodec(codec.value)
114
- }
115
- }
116
- document.getElementById('inputmanager')?.focus()
117
- }
118
-
119
- const isKeyboardShown = ref<boolean>(false)
120
- const onToggleKeyboard = (): void => {
121
- isKeyboardShown.value = !isKeyboardShown.value
122
- }
123
-
124
- const isShow = ref<boolean>(false)
125
- const grab = ref<HTMLDivElement | null>(null)
126
- const localization = computed<UI_I_Localization>(() => useLocal())
127
- const initialTop = window.innerHeight / 2 - 15
128
- const { y } = useDraggable(grab, {
129
- initialValue: { x: -30, y: initialTop },
130
- })
131
-
132
- const showOrHideKeyboard = computed<string>(() =>
133
- isKeyboardShown.value
134
- ? localization.value.common.hideKeyboard
135
- : localization.value.common.showKeyboard
136
- )
137
-
138
- watch(y, () => {
139
- isDrag = true
140
- })
141
-
142
- let isDrag = false
143
- const toggleDrawer = () => {
144
- if (isDrag) {
145
- isDrag = false
146
- return
147
- }
148
- isShow.value = !isShow.value
149
- }
150
-
151
- const hover = ref<boolean>(false)
152
- const onInputManagerFocus = (): void => {
153
- if (hover.value) return
154
- document.getElementById('inputmanager')?.focus()
155
- }
156
-
157
- const viewSize = ref<string>('0 x 0')
158
- const canvasSize = ref<string>('0 x 0')
159
- const displaySizeInfo = (): void => {
160
- const layout = document.getElementById('eventLayer')
161
- viewSize.value = `${window.innerWidth}px x ${window.innerHeight}px`
162
- if (layout) {
163
- canvasSize.value = `${layout.width || 0}px x ${layout.height || 0}px`
164
- }
165
-
166
- requestAnimationFrame(displaySizeInfo)
167
- }
168
- displaySizeInfo()
169
- </script>
170
- <style lang="scss" scoped>
171
- .vmw-drawer {
172
- background-color: #314351;
173
- position: absolute;
174
- top: 0;
175
- right: -300px;
176
- width: 300px;
177
- height: 100vh;
178
- padding: 20px;
179
-
180
- &.show {
181
- right: 0;
182
-
183
- .vmw-drawer__open {
184
- z-index: -1;
185
- }
186
- }
187
-
188
- &__open {
189
- width: 65px;
190
- height: 40px;
191
- background-color: #314351;
192
- position: absolute;
193
- left: -30px;
194
- cursor: pointer;
195
- border-top-left-radius: 20px;
196
- border-bottom-left-radius: 20px;
197
- box-shadow: 0 0 15px 5px #31435169;
198
- transition: left 0.5s;
199
- user-select: none;
200
-
201
- &.moving {
202
- cursor: grabbing;
203
- }
204
-
205
- &:hover {
206
- left: -60px;
207
- }
208
-
209
- & .vmw-drawer__open-icon {
210
- fill: #ffffff;
211
- transform: rotate(-90deg);
212
- width: 30px;
213
- height: 40px;
214
- z-index: 2222222222222222;
215
- }
216
-
217
- & .vmw-drawer__drag-icon {
218
- fill: #ffffff;
219
- width: 40px;
220
- position: absolute;
221
- left: 21px;
222
- z-index: 1;
223
- cursor: grabbing;
224
- }
225
- }
226
-
227
- .vmw-drawer-header {
228
- & h3 {
229
- color: #fff;
230
- font-weight: bold;
231
- font-size: 20px;
232
- text-align: center;
233
- }
234
-
235
- &__close {
236
- width: 30px;
237
- fill: #fff;
238
- position: absolute;
239
- right: 10px;
240
- top: 10px;
241
- cursor: pointer;
242
- }
243
- }
244
-
245
- .vmw-drawer-body {
246
- margin-top: 50px;
247
-
248
- & select,
249
- &__btn {
250
- display: block;
251
- width: 100%;
252
- color: #fff;
253
- cursor: pointer;
254
- font-size: 15px;
255
- border: 1px solid #fff;
256
- padding: 5px;
257
- border-radius: 5px;
258
- text-align: center;
259
- margin-bottom: 20px;
260
- background-color: transparent;
261
-
262
- &:not(.disable):hover {
263
- background-color: #ffffff;
264
- color: #314351;
265
- }
266
-
267
- &.disable {
268
- opacity: 0.5;
269
- cursor: not-allowed;
270
- }
271
-
272
- input[type="file"] {
273
- display: none;
274
- }
275
- }
276
-
277
- & > hr {
278
- margin-bottom: 20px;
279
- border-color: #ffffff40;
280
- box-shadow: 0 0 20px 0.5px #ffffff2e;
281
- }
282
- }
283
-
284
- .vmw-drawer-footer {
285
- .size-info {
286
- margin-bottom: 10px;
287
-
288
- .size-info-text {
289
- color: #ffffff;
290
- }
291
- }
292
- }
293
- }
294
- </style>
1
+ <template>
2
+ <div
3
+ :class="['vmw-drawer animation', { show: isShow }]"
4
+ data-id="spice-console-drawer"
5
+ @click.capture="onInputManagerFocus"
6
+ >
7
+ <div
8
+ v-if="!isShow"
9
+ ref="grab"
10
+ data-id="spice-console-drawer-toggle"
11
+ class="vmw-drawer__open"
12
+ :style="`top: ${y}px;`"
13
+ @click="toggleDrawer"
14
+ >
15
+ <atoms-the-icon name="arrow" class="vmw-drawer__open-icon" />
16
+ <atoms-the-icon2 name="drag" class="vmw-drawer__drag-icon" />
17
+ </div>
18
+
19
+ <div class="vmw-drawer-header">
20
+ <h3>{{ localization.common.consolePanel }}</h3>
21
+ <atoms-the-icon
22
+ class="vmw-drawer-header__close"
23
+ data-id="spice-console-drawer-toggle-icon"
24
+ name="close"
25
+ @click="toggleDrawer"
26
+ />
27
+ </div>
28
+
29
+ <div class="vmw-drawer-body">
30
+ <button
31
+ class="vmw-drawer-body__btn animation toggle-fullscreen"
32
+ data-id="spice-console-drawer-toggle-fullscreen"
33
+ @click="emits('toggle-fullscreen')"
34
+ >
35
+ {{ localization.common.toggleFullscreenMode }}
36
+ </button>
37
+ <button
38
+ class="vmw-drawer-body__btn animation toggle-fullscreen"
39
+ @click="emits('send-alt-command')"
40
+ >
41
+ {{ localization.common.sendAltCommand }}
42
+ </button>
43
+ <label
44
+ for="upload-folder"
45
+ class="vmw-drawer-body__btn animation toggle-fullscreen"
46
+ >
47
+ {{ localization.remoteConsole.uploadFolder }}
48
+ </label>
49
+ <input
50
+ id="upload-folder"
51
+ type="file"
52
+ webkitdirectory
53
+ directory
54
+ multiple
55
+ />
56
+
57
+ <label
58
+ for="upload-files"
59
+ class="vmw-drawer-body__btn animation toggle-fullscreen"
60
+ >
61
+ {{ localization.remoteConsole.uploadFiles }}
62
+ </label>
63
+ <input id="upload-files" type="file" multiple />
64
+
65
+ <select
66
+ v-model="codec"
67
+ @mouseenter="hover = true"
68
+ @mouseleave="hover = false"
69
+ @change="onChangeCodec"
70
+ >
71
+ <option :value="1">MJPEG</option>
72
+ <option :value="2">VP8</option>
73
+ <option :value="3">H264</option>
74
+ <option :value="4" disabled>VP9</option>
75
+ <option :value="5">H265</option>
76
+ </select>
77
+
78
+ <hr />
79
+ <button
80
+ class="vmw-drawer-body__btn animation show-keyboard"
81
+ @click="onToggleKeyboard"
82
+ >
83
+ {{ showOrHideKeyboard }}
84
+ </button>
85
+ </div>
86
+
87
+ <div class="vmw-drawer-footer">
88
+ <div class="size-info">
89
+ <p class="size-info-text">View size: {{ viewSize }}</p>
90
+ <p class="size-info-text">Canvas size: {{ canvasSize }}</p>
91
+ </div>
92
+ <div id="debug-stream"></div>
93
+ </div>
94
+ <div v-if="isKeyboardShown">
95
+ <common-spice-console-keyboard />
96
+ </div>
97
+ </div>
98
+ </template>
99
+ <script setup lang="ts">
100
+ import { useDraggable } from '@vueuse/core'
101
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
102
+ import type { UI_T_CODEC } from '~/components/common/spiceConsole/lib/models/types'
103
+
104
+ const emits = defineEmits<{
105
+ (event: 'toggle-fullscreen'): void
106
+ (event: 'send-alt-command'): void
107
+ }>()
108
+
109
+ const codec = ref<UI_T_CODEC>(1)
110
+ const onChangeCodec = (): void => {
111
+ // @ts-ignore
112
+ if (!window.app) return
113
+ // @ts-ignore
114
+ const channels = window.app.spiceConnection.channels
115
+ for (let i in channels) {
116
+ const channel = channels[i]
117
+ if (channel.channel === wdi.SpiceVars.SPICE_CHANNEL_DISPLAY) {
118
+ channel.changeCodec(codec.value)
119
+ }
120
+ }
121
+ document.getElementById('inputmanager')?.focus()
122
+ }
123
+
124
+ const isKeyboardShown = ref<boolean>(false)
125
+ const onToggleKeyboard = (): void => {
126
+ isKeyboardShown.value = !isKeyboardShown.value
127
+ }
128
+
129
+ const isShow = ref<boolean>(false)
130
+ const grab = ref<HTMLDivElement | null>(null)
131
+ const localization = computed<UI_I_Localization>(() => useLocal())
132
+ const initialTop = window.innerHeight / 2 - 15
133
+ const { y } = useDraggable(grab, {
134
+ initialValue: { x: -30, y: initialTop },
135
+ })
136
+
137
+ const showOrHideKeyboard = computed<string>(() =>
138
+ isKeyboardShown.value
139
+ ? localization.value.common.hideKeyboard
140
+ : localization.value.common.showKeyboard
141
+ )
142
+
143
+ watch(y, () => {
144
+ isDrag = true
145
+ })
146
+
147
+ let isDrag = false
148
+ const toggleDrawer = () => {
149
+ if (isDrag) {
150
+ isDrag = false
151
+ return
152
+ }
153
+ isShow.value = !isShow.value
154
+ }
155
+
156
+ const hover = ref<boolean>(false)
157
+ const onInputManagerFocus = (): void => {
158
+ if (hover.value) return
159
+ document.getElementById('inputmanager')?.focus()
160
+ }
161
+
162
+ const viewSize = ref<string>('0 x 0')
163
+ const canvasSize = ref<string>('0 x 0')
164
+ const displaySizeInfo = (): void => {
165
+ const layout = document.getElementById('eventLayer')
166
+ viewSize.value = `${window.innerWidth}px x ${window.innerHeight}px`
167
+ if (layout) {
168
+ canvasSize.value = `${layout.width || 0}px x ${layout.height || 0}px`
169
+ }
170
+
171
+ requestAnimationFrame(displaySizeInfo)
172
+ }
173
+ displaySizeInfo()
174
+ </script>
175
+ <style lang="scss" scoped>
176
+ .vmw-drawer {
177
+ background-color: #314351;
178
+ position: absolute;
179
+ top: 0;
180
+ right: -300px;
181
+ width: 300px;
182
+ height: 100vh;
183
+ padding: 20px;
184
+
185
+ &.show {
186
+ right: 0;
187
+
188
+ .vmw-drawer__open {
189
+ z-index: -1;
190
+ }
191
+ }
192
+
193
+ &__open {
194
+ width: 65px;
195
+ height: 40px;
196
+ background-color: #314351;
197
+ position: absolute;
198
+ left: -30px;
199
+ cursor: pointer;
200
+ border-top-left-radius: 20px;
201
+ border-bottom-left-radius: 20px;
202
+ box-shadow: 0 0 15px 5px #31435169;
203
+ transition: left 0.5s;
204
+ user-select: none;
205
+
206
+ &.moving {
207
+ cursor: grabbing;
208
+ }
209
+
210
+ &:hover {
211
+ left: -60px;
212
+ }
213
+
214
+ & .vmw-drawer__open-icon {
215
+ fill: #ffffff;
216
+ transform: rotate(-90deg);
217
+ width: 30px;
218
+ height: 40px;
219
+ z-index: 2222222222222222;
220
+ }
221
+
222
+ & .vmw-drawer__drag-icon {
223
+ fill: #ffffff;
224
+ width: 40px;
225
+ position: absolute;
226
+ left: 21px;
227
+ z-index: 1;
228
+ cursor: grabbing;
229
+ }
230
+ }
231
+
232
+ .vmw-drawer-header {
233
+ & h3 {
234
+ color: #fff;
235
+ font-weight: bold;
236
+ font-size: 20px;
237
+ text-align: center;
238
+ }
239
+
240
+ &__close {
241
+ width: 30px;
242
+ fill: #fff;
243
+ position: absolute;
244
+ right: 10px;
245
+ top: 10px;
246
+ cursor: pointer;
247
+ }
248
+ }
249
+
250
+ .vmw-drawer-body {
251
+ margin-top: 50px;
252
+
253
+ & select,
254
+ &__btn {
255
+ display: block;
256
+ width: 100%;
257
+ color: #fff;
258
+ cursor: pointer;
259
+ font-size: 15px;
260
+ border: 1px solid #fff;
261
+ padding: 5px;
262
+ border-radius: 5px;
263
+ text-align: center;
264
+ margin-bottom: 20px;
265
+ background-color: transparent;
266
+
267
+ &:not(.disable):hover {
268
+ background-color: #ffffff;
269
+ color: #314351;
270
+ }
271
+
272
+ &.disable {
273
+ opacity: 0.5;
274
+ cursor: not-allowed;
275
+ }
276
+
277
+ input[type='file'] {
278
+ display: none;
279
+ }
280
+ }
281
+
282
+ & > hr {
283
+ margin-bottom: 20px;
284
+ border-color: #ffffff40;
285
+ box-shadow: 0 0 20px 0.5px #ffffff2e;
286
+ }
287
+ }
288
+
289
+ .vmw-drawer-footer {
290
+ .size-info {
291
+ margin-bottom: 10px;
292
+
293
+ .size-info-text {
294
+ color: #ffffff;
295
+ }
296
+ }
297
+ }
298
+ }
299
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.533",
4
+ "version": "1.4.534",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",