bfg-common 1.4.533 → 1.4.535

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 class="vmw-drawer-body__btn animation relative">
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 relative">
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
+ position: absolute;
274
+ top: 0;
275
+ left: 0;
276
+ right: 0;
277
+ bottom: 0;
278
+ opacity: 0;
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.535",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",