Date: Tue, 25 Oct 2022 13:20:33 +0200
Subject: [PATCH 0670/1472] ui: add virtual keyboard for keyboard-less desktop
clients
---
resources/docs/docs/client-options.md | 2 +-
resources/docs/docs/user-interface/client.md | 1 +
src/client/globals.js | 2 +
src/client/locales/en.js | 20 ++
src/client/locales/fr.js | 20 ++
src/client/locales/index.js | 7 +-
src/client/ui/init.js | 1 +
src/client/ui/main-menu.js | 10 +
src/client/ui/ui-keyboard.js | 242 +++++++++++++++++++
src/client/widgets/basics/input.js | 1 +
src/html/client.html | 3 +-
src/scss/ui.scss | 1 +
src/scss/ui/keyboard.scss | 81 +++++++
13 files changed, 387 insertions(+), 4 deletions(-)
create mode 100644 src/client/ui/ui-keyboard.js
create mode 100644 src/scss/ui/keyboard.scss
diff --git a/resources/docs/docs/client-options.md b/resources/docs/docs/client-options.md
index 17fbae66..6bf42f81 100644
--- a/resources/docs/docs/client-options.md
+++ b/resources/docs/docs/client-options.md
@@ -16,7 +16,7 @@ Client options can be set either with the server's `--client-options` option, or
| noFocus | 1 / 0 | 0 | (built-in client only) prevent the client window from taking focus unless a text input or a dropdown is clicked |
| clientSync | 1 / 0 | 1 | set to 0 to prevent the client from syncing with other clients |
| altTraversing | 1 / 0 | 0 | set to 1 to enable an alternative traversing behavior for toggle buttons (traversing gestures on toggle buttons will change their values in only one way depending on the first touched button's state) |
-
+| virtualKeyboard | 1 / 0 | 0 | (desktop only) set to 1 to enable the virtual keyboard by default |
Example:
diff --git a/resources/docs/docs/user-interface/client.md b/resources/docs/docs/user-interface/client.md
index b43b31c9..6bafcd5b 100644
--- a/resources/docs/docs/user-interface/client.md
+++ b/resources/docs/docs/user-interface/client.md
@@ -28,6 +28,7 @@
- Console
- Enable: toggle console's state
- Clear console: remove logged messages from the console
+- Virtual keyboard: (desktop only) toggle virtual keyboard (displayed only when a text input is in focus)
- Fullscreen: toggle fullscreen
- Prevent sleep (mobile only): attempt to prevent device from going to sleep when idle
diff --git a/src/client/globals.js b/src/client/globals.js
index 70a33037..1245ec57 100644
--- a/src/client/globals.js
+++ b/src/client/globals.js
@@ -32,6 +32,8 @@ window.CLIENT_SYNC = parseInt(ENV.clientSync) !== 0
window.TOGGLE_ALT_TRAVERSING = !!ENV.altTraversing
+window.VIRTUAL_KEYBOARD = !!ENV.virtualKeyboard && !navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)
+
window.JSON.parseFlex = require('json5').parse
diff --git a/src/client/locales/en.js b/src/client/locales/en.js
index bb67ff3d..af0822d4 100644
--- a/src/client/locales/en.js
+++ b/src/client/locales/en.js
@@ -53,6 +53,26 @@ module.exports = {
file_import: 'Import',
file_export: 'Export',
+ // keyboard
+ keyboard: 'Virtual keyboard',
+ keyboard_layout: {
+ default: [
+ '{esc} ` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
+ '{tab} q w e r t y u i o p [ ] \\',
+ '{lock} a s d f g h j k l ; \' {enter}',
+ '{shift} z x c v b n m , . / {shift}',
+ '{space}'
+ ],
+ shift: [
+ '{esc} ~ ! @ # $ % ^ & * ( ) _ + {bksp}',
+ '{tab} Q W E R T Y U I O P { } |',
+ '{lock} A S D F G H J K L : " {enter}',
+ '{shift} Z X C V B N M < > ? {shift}',
+ '{space}'
+ ]
+ },
+ keyboard_escape: 'Esc',
+
// fragment mode
fragment_mode: 'Fragment mode',
fragment_mode_warning: 'Fragment mode enabled',
diff --git a/src/client/locales/fr.js b/src/client/locales/fr.js
index d7ad04d1..16c95b25 100644
--- a/src/client/locales/fr.js
+++ b/src/client/locales/fr.js
@@ -52,6 +52,26 @@ module.exports = {
file_import: 'Importer',
file_export: 'Exporter',
+ // keyboard
+ keyboard: 'Clavier virtuel',
+ keyboard_layout: {
+ default: [
+ '{esc} \u00B2 & \u00E9 \" \' ( - \u00E8 _ \u00E7 \u00E0 ) = {bksp}',
+ '{tab} a z e r t y u i o p ^ $',
+ '{lock} q s d f g h j k l m \u00F9 * {enter}',
+ '{shift} < w x c v b n , ; : ! {shift}',
+ '{space}',
+ ],
+ shift: [
+ '{esc} ` 1 2 3 4 5 6 7 8 9 0 \u00B0 + {bksp}',
+ '{tab} A Z E R T Y U I O P \u00A8 \u00A3',
+ '{lock} Q S D F G H J K L M % \u00B5 {enter}',
+ '{shift} > W X C V B N ? . / \u00A7 {shift}',
+ '{space}'
+ ]
+ },
+ keyboard_escape: 'Échap',
+
// fullscreen
fullscreen: 'Plein écran',
fs_unnavailable: 'Plein écran indisponible',
diff --git a/src/client/locales/index.js b/src/client/locales/index.js
index 5fccd784..858af8fa 100644
--- a/src/client/locales/index.js
+++ b/src/client/locales/index.js
@@ -1,7 +1,10 @@
var locales = {
- debug: {/* empty */},
en: require('./en'),
- fr: require('./fr')
+ fr: require('./fr'),
+ debug: {
+ /* empty */
+ keyboard_layout: require('./en').keyboard_layout
+ }
}
var lang = locales[LANG] ? LANG : 'en'
diff --git a/src/client/ui/init.js b/src/client/ui/init.js
index a93d9d2f..22915c81 100644
--- a/src/client/ui/init.js
+++ b/src/client/ui/init.js
@@ -5,3 +5,4 @@ require('./notifications')
require('./ui-workspace')
require('./main-menu')
require('./ui-console')
+require('./ui-keyboard')
diff --git a/src/client/ui/main-menu.js b/src/client/ui/main-menu.js
index eb9277d9..a1b46180 100644
--- a/src/client/ui/main-menu.js
+++ b/src/client/ui/main-menu.js
@@ -231,6 +231,16 @@ if (navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)) {
}
})
+} else {
+
+ menuEntries.push({
+ label: locales('keyboard'),
+ class: ()=>{return 'toggle ' + (VIRTUAL_KEYBOARD ? 'on' : 'off')},
+ action: ()=>{
+ VIRTUAL_KEYBOARD = !VIRTUAL_KEYBOARD
+ }
+ })
+
}
diff --git a/src/client/ui/ui-keyboard.js b/src/client/ui/ui-keyboard.js
new file mode 100644
index 00000000..e7664bbd
--- /dev/null
+++ b/src/client/ui/ui-keyboard.js
@@ -0,0 +1,242 @@
+var UiWidget = require('./ui-widget'),
+ {icon} = require('./utils'),
+ locales = require('../locales'),
+ layout = locales('keyboard_layout'),
+ html = require('nanohtml'),
+ raw = require('nanohtml/raw')
+
+const numericLayout = [
+ '{sep} 7 8 9',
+ '{sep} 6 7 8',
+ '{sep} 1 2 3',
+ '{sep} 0 . {enter}'
+]
+const keysDisplay = {
+ '{esc}': locales('keyboard_escape'),
+ '{bksp}': icon('delete-left'),
+ '{enter}': icon('arrow-turn-down.rotate-90'),
+ '{enter}': icon('arrow-turn-down.rotate-90'),
+ '{lock}': icon('arrow-up-from-bracket'),
+ '{shift}': icon('arrow-up'),
+ '{shift}': icon('arrow-up'),
+ '{tab}': icon('arrow-right-arrow-left'),
+ '{space}': ' ',
+}
+
+class OscKeybard extends UiWidget {
+
+ constructor(options) {
+
+ super(options)
+
+ this.keys = {}
+ this.pressedKeys = {}
+ this.lock = false
+ this.shift = false
+ this.input = null
+ this.value = null
+
+
+ for (var k in layout) {
+ layout[k] = layout[k].map((r, i)=>(r + ' ' + (numericLayout[i]||'')).trim().split(' '))
+ }
+
+ var keyId = 0
+
+ for (var i = 0; i < layout.default.length; i++) {
+ var rowData = layout.default[i],
+ row = html``
+
+ for (var j = 0; j < rowData.length; j++) {
+ var keyData = rowData[j],
+ shiftData = layout.shift[i][j],
+ key = html`
+
+ ${raw(keysDisplay[keyData] || keyData)}
+ ${raw(keysDisplay[shiftData] || shiftData)}
+
`
+
+ keyId++
+ this.keys[keyId] = key
+ key.appendChild = keysDisplay[keyData] || keyData
+
+ key.classList.add(keyData.replace('{', '').replace('}', ''))
+
+ key.setAttribute('data-id', keyId)
+ key.setAttribute('data-key', keyData)
+ key.setAttribute('data-shift', shiftData)
+
+ row.appendChild(key)
+ }
+ this.container.appendChild(row)
+ }
+
+ this.container.addEventListener('mousedown', (e)=>{
+ // prevent keyboard from stealing focus from input
+ e.preventDefault()
+ },{capture:true})
+
+
+ this.on('draginit', (e)=>{
+
+ if (this.pressedKeys[e.pointerId]) return
+
+ var keyId = e.target.getAttribute('data-id')
+
+ if (keyId === null) return
+
+ var key = this.keys[keyId]
+
+ if (key.getAttribute('data-key') === '{lock}') {
+ this.lock = !this.lock
+ key.classList.toggle('active', this.lock)
+ } else {
+ key.classList.add('active')
+ this.pressedKeys[e.pointerId] = key
+ }
+
+ this.checkShift()
+
+ this.keyDown(key.getAttribute(this.shift !== this.lock ? 'data-shift' : 'data-key'))
+
+ }, {element: this.container, multitouch: true})
+
+ this.on('dragend', (e)=>{
+
+ if (!this.pressedKeys[e.pointerId]) return
+
+ var key = this.pressedKeys[e.pointerId],
+ keyData = key.getAttribute('data-key')
+
+ key.classList.remove('active')
+
+ if (keyData === '{lock}') return
+
+ delete this.pressedKeys[e.pointerId]
+
+ this.checkShift()
+
+ this.keyUp(key.getAttribute(this.shift != this.lock ? 'data-shift' : 'data-key'))
+
+
+ }, {element: this.container, multitouch: true})
+
+
+ document.addEventListener('focus', (e)=>{
+ if (!VIRTUAL_KEYBOARD) return
+ // show keyboard when entering input focus
+ if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') {
+ this.show()
+ this.input = e.target
+ this.value = this.input.value
+ this.input.scrollIntoView()
+ }
+ }, {capture: true})
+
+
+ document.addEventListener('blur', (e)=>{
+ // hide keyboard when leaving input focus
+ if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') {
+ this.hide()
+ this.input = null
+ this.value = null
+
+ }
+ }, {capture: true})
+
+ }
+
+ keyDown(key) {
+
+ if (!this.input) return
+
+ var startPos = this.input.selectionStart,
+ endPos = this.input.selectionEnd,
+ editLength, str
+
+ switch (key) {
+ case '{lock}':
+ case '{shift}':
+ return
+ case '{esc}':
+ this.input.value = this.value
+ this.input.blur()
+ return
+ case '{enter}':
+ if (this.shift) {
+ str = '\n'
+ editLength = 1
+ break
+ } else {
+ this.input.dispatchEvent(new KeyboardEvent('keydown', {keyCode: 13}))
+ if (this.input) DOM.dispatchEvent(this.input, 'change')
+ return
+ }
+ case '{bksp}':
+ this.input.dispatchEvent(new KeyboardEvent('keydown', {keyCode: 8}))
+ this.input.value = this.input.value.substring(0, startPos - 1)
+ + this.input.value.substring(endPos, this.input.value.length)
+ editLength = -1
+ break
+ case '{tab}':
+ str = ' '
+ break
+ case '{space}':
+ str = ' '
+ break
+ default:
+ str = key
+ break
+ }
+
+ if (str !== undefined) {
+
+ this.input.value = this.input.value.substring(0, startPos)
+ + str
+ + this.input.value.substring(endPos, this.input.value.length)
+
+ if (editLength === undefined) editLength = str.length
+
+ }
+
+ this.input.selectionStart = startPos + editLength
+ this.input.selectionEnd = startPos + editLength
+ DOM.dispatchEvent(this.input, 'input')
+ DOM.dispatchEvent(this.input, 'keydown')
+ // this.input.dispatchEvent(new KeyboardEvent('keydown'))
+
+ }
+
+ keyUp(key) {
+
+ }
+
+ checkShift() {
+
+ var shift = false
+ for (var k in this.pressedKeys) {
+ var dataKey = this.pressedKeys[k].getAttribute('data-key')
+ if (dataKey === '{shift}') {
+ shift = true
+ }
+ }
+ this.shift = shift
+ this.container.classList.toggle('shift', this.lock !== this.shift)
+
+ }
+
+ show(){
+ this.container.style.display = 'flex'
+ DOM.dispatchEvent(window, 'resize')
+ }
+
+ hide(){
+ this.container.style.display = 'none'
+ DOM.dispatchEvent(window, 'resize')
+ }
+}
+
+const k = new OscKeybard({element: DOM.get('osc-keyboard')[0]})
+
+
+module.exports = k
diff --git a/src/client/widgets/basics/input.js b/src/client/widgets/basics/input.js
index 9063d19a..a58a9394 100644
--- a/src/client/widgets/basics/input.js
+++ b/src/client/widgets/basics/input.js
@@ -178,6 +178,7 @@ class Input extends Canvas {
if (this.value === '' || this.value === null) this.value = this.getProp('default')
this.stringValue = this.getStringValue(this.value)
+
this.batchDraw()
if (options.send && !options.fromSync) this.sendValue()
diff --git a/src/html/client.html b/src/html/client.html
index d678dd03..cdcde507 100644
--- a/src/html/client.html
+++ b/src/html/client.html
@@ -53,7 +53,8 @@
-
+
+
diff --git a/src/scss/ui.scss b/src/scss/ui.scss
index 357868a7..107ca9d5 100644
--- a/src/scss/ui.scss
+++ b/src/scss/ui.scss
@@ -14,3 +14,4 @@
@import 'ui/loading';
@import 'ui/toolbar';
@import 'ui/launcher';
+@import 'ui/keyboard';
diff --git a/src/scss/ui/keyboard.scss b/src/scss/ui/keyboard.scss
new file mode 100644
index 00000000..c9c5286e
--- /dev/null
+++ b/src/scss/ui/keyboard.scss
@@ -0,0 +1,81 @@
+@import '../../../node_modules/simple-keyboard/build/css/index';
+
+osc-keyboard {
+ --spacing: 4rem;
+ height:33%;
+ z-index: 100;
+ position: relative;
+ display: none;
+ flex-direction: column;
+ padding: calc(var(--spacing) / 2);
+
+ background: var(--color-ui-foreground);
+ border-top: 1rem solid var(--color-ui-background);
+
+ .row {
+ flex-direction: row;
+ display: flex;
+ flex: 1;
+ }
+ .key {
+ background: var(--color-ui-button);
+ border-color: var(--color-ui-background);
+ border-radius: 4rem;
+ border-bottom: 1rem solid var(--color-ui-background);
+ flex: 1;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ margin: calc(var(--spacing) / 2);
+ span {
+ pointer-events: none;
+ align-items: center;
+ justify-content: center;
+ &.display-default {
+ display: flex;
+ }
+ &.display-shift {
+ display: none;
+ }
+ }
+
+ &.active {
+ background: var(--color-ui-background);
+ }
+ }
+
+
+ .tab, .shift {
+ flex: 1.5;
+ }
+
+ .enter, .right-shift, .lock, .bksp {
+ flex: 2;
+ }
+
+ .sep {
+ width:0;
+ visibility: hidden;
+ flex-shrink: 0;
+ flex-grow: 0;
+ margin-right: var(--spacing);
+ margin-left: var(--spacing);
+ }
+ .sep ~ .key {
+ flex-shrink: 0;
+ flex-grow: 0;
+ min-width: 5%;
+ }
+
+ &.shift {
+ .key {
+ .display-shift {
+ display: flex;
+ }
+ .display-default {
+ display: none;
+ }
+ }
+ }
+
+}
From 3022ee4703647d1161f09a5effc23f15f46674ab Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 16:58:23 +0200
Subject: [PATCH 0671/1472] ui: flat keyboard; disabled except on desktop
---
src/client/globals.js | 2 +-
src/client/ui/init.js | 5 ++++-
src/client/ui/ui-keyboard.js | 5 +----
src/client/ui/zoom.js | 13 +++++++++----
src/scss/ui/keyboard.scss | 16 +++++-----------
5 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/src/client/globals.js b/src/client/globals.js
index 1245ec57..e204fb1f 100644
--- a/src/client/globals.js
+++ b/src/client/globals.js
@@ -32,7 +32,7 @@ window.CLIENT_SYNC = parseInt(ENV.clientSync) !== 0
window.TOGGLE_ALT_TRAVERSING = !!ENV.altTraversing
-window.VIRTUAL_KEYBOARD = !!ENV.virtualKeyboard && !navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)
+window.VIRTUAL_KEYBOARD = !!ENV.virtualKeyboard
window.JSON.parseFlex = require('json5').parse
diff --git a/src/client/ui/init.js b/src/client/ui/init.js
index 22915c81..73a292e2 100644
--- a/src/client/ui/init.js
+++ b/src/client/ui/init.js
@@ -5,4 +5,7 @@ require('./notifications')
require('./ui-workspace')
require('./main-menu')
require('./ui-console')
-require('./ui-keyboard')
+
+if (!navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)) {
+ require('./ui-keyboard')
+}
diff --git a/src/client/ui/ui-keyboard.js b/src/client/ui/ui-keyboard.js
index e7664bbd..2ec4d3d8 100644
--- a/src/client/ui/ui-keyboard.js
+++ b/src/client/ui/ui-keyboard.js
@@ -236,7 +236,4 @@ class OscKeybard extends UiWidget {
}
}
-const k = new OscKeybard({element: DOM.get('osc-keyboard')[0]})
-
-
-module.exports = k
+module.exports = new OscKeybard({element: DOM.get('osc-keyboard')[0]})
diff --git a/src/client/ui/zoom.js b/src/client/ui/zoom.js
index 0d723ce0..ecd7db08 100644
--- a/src/client/ui/zoom.js
+++ b/src/client/ui/zoom.js
@@ -40,14 +40,19 @@ document.addEventListener('mousemove', function(event) {
}
}, {passive: false})
+
+var container = DOM.get('#osc-container')[0]
function applylocalZoom() {
if (localZoom === 1) {
- document.body.style.transformOrigin = ''
- document.body.style.transform = ''
+ container.style.transformOrigin = ''
+ container.parentNode.style.overflow = ''
+ container.style.transform = ''
} else {
- document.body.style.transformOrigin = `${mousePos[0]}% ${mousePos[1]}%`
+ // container.style.transformOrigin = `${mousePos[0]}% ${mousePos[1]}%`
+ container.parentNode.style.overflow = 'auto'
+ container.style.transformOrigin = '0 0'
requestAnimationFrame(()=>{
- document.body.style.transform = `scale(${localZoom})`
+ container.style.transform = `scale(${localZoom})`
})
}
}
diff --git a/src/scss/ui/keyboard.scss b/src/scss/ui/keyboard.scss
index c9c5286e..7a5645aa 100644
--- a/src/scss/ui/keyboard.scss
+++ b/src/scss/ui/keyboard.scss
@@ -1,7 +1,7 @@
@import '../../../node_modules/simple-keyboard/build/css/index';
osc-keyboard {
- --spacing: 4rem;
+ --spacing: 1rem;
height:33%;
z-index: 100;
position: relative;
@@ -9,8 +9,8 @@ osc-keyboard {
flex-direction: column;
padding: calc(var(--spacing) / 2);
- background: var(--color-ui-foreground);
- border-top: 1rem solid var(--color-ui-background);
+ background: var(--color-ui-background);
+ // border-top: 1rem solid var(--color-ui-background);
.row {
flex-direction: row;
@@ -20,8 +20,6 @@ osc-keyboard {
.key {
background: var(--color-ui-button);
border-color: var(--color-ui-background);
- border-radius: 4rem;
- border-bottom: 1rem solid var(--color-ui-background);
flex: 1;
display: inline-flex;
align-items: center;
@@ -54,17 +52,13 @@ osc-keyboard {
}
.sep {
- width:0;
- visibility: hidden;
- flex-shrink: 0;
- flex-grow: 0;
- margin-right: var(--spacing);
- margin-left: var(--spacing);
+ display: none;
}
.sep ~ .key {
flex-shrink: 0;
flex-grow: 0;
min-width: 5%;
+ opacity: 0.9;
}
&.shift {
From a19a6ac22d9ad7372057c28a8e49ffac45ee4024 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:12:19 +0200
Subject: [PATCH 0672/1472] editor: add keyboard shortcut "h" to hide selection
and widget drag / resize handles while pressed
---
CHANGELOG.md | 3 ++
resources/docs/docs/user-interface/editor.md | 2 ++
src/client/editor/index.js | 32 +++++++++++++++++---
src/scss/ui/selectarea.scss | 12 ++++++++
4 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3881532..50858d61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## 1.18.4
+- editor
+ - add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed
+
- widgets
- input: add `maxLength` property
diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md
index a4c2fdec..acaa55c3 100644
--- a/resources/docs/docs/user-interface/editor.md
+++ b/resources/docs/docs/user-interface/editor.md
@@ -107,6 +107,7 @@ Multiple widgets can be edited at once.
| ++"Page Down"++ | Bring selected widget closer |
| ++"End"++ | Bring selected widget to front |
| ++"F2"++ | Bring "label" property input into view if selected widget has one |
+ | ++h++ | Hide selection area and widget resize / drag handles while pressed |
=== "Mac"
@@ -144,3 +145,4 @@ Multiple widgets can be edited at once.
| ++"Page Down"++ | Bring selected widget closer |
| ++"End"++ | Bring selected widget to front |
| ++"F2"++ | Bring "label" property input into view if selected widget has one |
+ | ++h++ | Hide selection area and widget resize / drag handles while pressed |
diff --git a/src/client/editor/index.js b/src/client/editor/index.js
index e0fc2f5d..de67c048 100644
--- a/src/client/editor/index.js
+++ b/src/client/editor/index.js
@@ -210,13 +210,17 @@ class Editor {
'home',
'end',
't',
- 'f2'
+ 'f2',
+ 'h'
]
for (let c of combos) {
keyboardJS.bind(c, (e)=>{
e.catchedByEditor = true
- this.handleKeyboard(c, e)
+ this.handleKeydown(c, e)
+ }, (e)=>{
+ e.catchedByEditor = true
+ this.handleKeyup(c, e)
})
}
@@ -267,7 +271,7 @@ class Editor {
}
- handleKeyboard(combo, e){
+ handleKeydown(combo, e){
if (
this.inspector.helpModalOpened ||
@@ -464,13 +468,33 @@ class Editor {
input.scrollIntoView({block: 'center'})
}
break
-
+ case 'h':
+ document.body.classList.add('editor-hide-selection')
+ break
}
}
+ handleKeyup(combo, e){
+
+ if (
+ this.inspector.helpModalOpened ||
+ e && e.target && e.target.tagName.match(/INPUT|TEXTAREA|SELECT/)
+ ) return
+
+ if (e) e.preventDefault()
+
+ switch (combo) {
+
+ case 'h':
+ document.body.classList.remove('editor-hide-selection')
+ break
+
+ }
+ }
+
toggleGrid() {
this.grid = !this.grid
diff --git a/src/scss/ui/selectarea.scss b/src/scss/ui/selectarea.scss
index 721a3763..7d5f0ea6 100644
--- a/src/scss/ui/selectarea.scss
+++ b/src/scss/ui/selectarea.scss
@@ -58,3 +58,15 @@
from {--color-accent: var(--color-warning)}
to {--color-accent: transparent}
}
+
+
+.editor-hide-selection {
+ #drag-resize {
+ display: none;
+ }
+ .widget.editing:after,
+ .tablink.editing:after,
+ .modal-container.editing > .popup > .popup-wrapper:after {
+ display: none;
+ }
+}
From 903eb823242771ed6e5a1d1811cfad6d9bbf2c11 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:14:14 +0200
Subject: [PATCH 0673/1472] log update
---
CHANGELOG.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 50858d61..c247d971 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,11 +3,14 @@
## 1.18.4
- editor
- - add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed
+ - add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed
- widgets
- input: add `maxLength` property
+- ui
+ - add a virtual onscreen keyboard for desktop clients
+
## 1.18.3
- bug fixes
From 0716eae53c15147e132abfa6bb3f1e763c094d2a Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:18:49 +0200
Subject: [PATCH 0674/1472] wip: static, widget-only local zoom
---
src/client/ui/zoom.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/client/ui/zoom.js b/src/client/ui/zoom.js
index ecd7db08..c43a7bb9 100644
--- a/src/client/ui/zoom.js
+++ b/src/client/ui/zoom.js
@@ -30,15 +30,15 @@ document.addEventListener('wheel', function(event) {
}
}, {passive: false})
-document.addEventListener('mousemove', function(event) {
- mousePos = [
- event.pageX / window.innerWidth * 100,
- event.pageY / window.innerHeight * 100
- ]
- if (localZoom !== 1) {
- applylocalZoom()
- }
-}, {passive: false})
+// document.addEventListener('mousemove', function(event) {
+// mousePos = [
+// event.pageX / window.innerWidth * 100,
+// event.pageY / window.innerHeight * 100
+// ]
+// if (localZoom !== 1) {
+// applylocalZoom()
+// }
+// }, {passive: false})
var container = DOM.get('#osc-container')[0]
From 4b24c9ba8d3c72fb83673bf316388db5c62f25d9 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:19:29 +0200
Subject: [PATCH 0675/1472] misc: dedupe keys
---
src/client/ui/ui-keyboard.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/client/ui/ui-keyboard.js b/src/client/ui/ui-keyboard.js
index 2ec4d3d8..ffadeafb 100644
--- a/src/client/ui/ui-keyboard.js
+++ b/src/client/ui/ui-keyboard.js
@@ -15,10 +15,8 @@ const keysDisplay = {
'{esc}': locales('keyboard_escape'),
'{bksp}': icon('delete-left'),
'{enter}': icon('arrow-turn-down.rotate-90'),
- '{enter}': icon('arrow-turn-down.rotate-90'),
'{lock}': icon('arrow-up-from-bracket'),
'{shift}': icon('arrow-up'),
- '{shift}': icon('arrow-up'),
'{tab}': icon('arrow-right-arrow-left'),
'{space}': ' ',
}
From 13a2d125cf992ac76138363e11f1a5c18fcce7c4 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:26:23 +0200
Subject: [PATCH 0676/1472] wip: lint
---
src/client/ui/zoom.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/client/ui/zoom.js b/src/client/ui/zoom.js
index c43a7bb9..ca089b68 100644
--- a/src/client/ui/zoom.js
+++ b/src/client/ui/zoom.js
@@ -2,8 +2,8 @@
var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey'
-var localZoom = 1,
- mousePos = [0, 0]
+var localZoom = 1//,
+// mousePos = [0, 0]
document.addEventListener('wheel', function(event) {
if (event.ctrlKey) event.preventDefault()
From 4868ef77d9c1c46e72f45cdba2e88edda975b50a Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Tue, 25 Oct 2022 18:44:48 +0200
Subject: [PATCH 0677/1472] misc: clean unused dep
---
src/scss/ui/keyboard.scss | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/scss/ui/keyboard.scss b/src/scss/ui/keyboard.scss
index 7a5645aa..46e267ff 100644
--- a/src/scss/ui/keyboard.scss
+++ b/src/scss/ui/keyboard.scss
@@ -1,5 +1,3 @@
-@import '../../../node_modules/simple-keyboard/build/css/index';
-
osc-keyboard {
--spacing: 1rem;
height:33%;
From d68c0f6c0ab9ee4ec20ab18853c85d2d8e401a1a Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Wed, 26 Oct 2022 10:31:45 +0200
Subject: [PATCH 0678/1472] widgets: folder container
---
src/client/ui/ui-dragresize.js | 10 +++-
src/client/ui/ui-tree.js | 5 +-
src/client/widgets/containers/folder.js | 61 +++++++++++++++++++++++++
src/client/widgets/index.js | 3 +-
src/scss/widgets/containers.scss | 22 ++++++++-
5 files changed, 94 insertions(+), 7 deletions(-)
create mode 100644 src/client/widgets/containers/folder.js
diff --git a/src/client/ui/ui-dragresize.js b/src/client/ui/ui-dragresize.js
index 4ebea2dd..6587b834 100644
--- a/src/client/ui/ui-dragresize.js
+++ b/src/client/ui/ui-dragresize.js
@@ -2,7 +2,7 @@ var UiWidget = require('./ui-widget'),
keyboardJS = require('keyboardjs/dist/keyboard.min.js'),
html = require('nanohtml'),
fastdom = require('fastdom'),
- Tab, Root
+ Tab, Root, Folder
class UiDragResize extends UiWidget {
@@ -10,6 +10,7 @@ class UiDragResize extends UiWidget {
Tab = require('../widgets/containers/tab')
Root = require('../widgets/containers/root')
+ Folder = require('../widgets/containers/folder')
super(options)
@@ -144,7 +145,12 @@ class UiDragResize extends UiWidget {
this.clear()
- this.widgets = widgets.slice().filter(w=>w.getProp('visible') && !(w instanceof Tab) && !(w instanceof Root))
+ this.widgets = widgets.slice().filter(
+ w=>w.getProp('visible') &&
+ !(w instanceof Tab) &&
+ !(w instanceof Root) &&
+ !(w instanceof Folder)
+ )
if (!this.widgets.length) return
diff --git a/src/client/ui/ui-tree.js b/src/client/ui/ui-tree.js
index fbd279fa..b5e1e18b 100644
--- a/src/client/ui/ui-tree.js
+++ b/src/client/ui/ui-tree.js
@@ -12,11 +12,12 @@ var UiWidget = require('./ui-widget'),
var widgetIcons = {
root: 'bookmark',
tab: 'window-maximize',
+ folder: 'folder',
menu: 'list',
dropdown: 'list',
switch: 'list',
input: 'i-cursor',
- file: 'folder-open',
+ file: 'file-import',
modal: 'window-restore',
clone: 'cube',
fragment: 'cube',
@@ -27,7 +28,7 @@ var widgetIcons = {
var categoryIcons = {
'Basics': 'toggle-on',
- 'Containers': 'th-large',
+ 'Containers': 'table-list',
'Frames': 'images',
'Graphs': 'chart-area',
'Indicators': 'info-circle',
diff --git a/src/client/widgets/containers/folder.js b/src/client/widgets/containers/folder.js
new file mode 100644
index 00000000..5391ec3c
--- /dev/null
+++ b/src/client/widgets/containers/folder.js
@@ -0,0 +1,61 @@
+var Panel = require('./panel'),
+ StaticProperties = require('../mixins/static_properties')
+
+class Folder extends Panel {
+
+ static description() {
+
+ return 'Generic matrix for creating rows/columns of widgets.'
+
+ }
+
+ static defaults() {
+
+ var defaults = super.defaults().extend({
+ class_specific: {
+ traversing: null
+ },
+ style: {
+
+ },
+ geometry: null,
+ osc: null,
+ scripting: null,
+ value: null,
+ children: {
+ widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'},
+ }
+ })
+
+ defaults.style = {
+ colorText: defaults.style.colorText,
+ colorWidget: defaults.style.colorWidget,
+ css: defaults.style.css,
+ }
+
+ return defaults
+
+ }
+
+ constructor(options) {
+
+ super(options)
+
+ }
+
+ getProp(propName) {
+
+ if (propName === 'layout') {
+ return this.parent.getProp('layout')
+ } else {
+ return super.getProp(propName)
+ }
+
+ }
+
+
+}
+
+
+
+module.exports = Folder
diff --git a/src/client/widgets/index.js b/src/client/widgets/index.js
index d7588a2f..38d3bc28 100644
--- a/src/client/widgets/index.js
+++ b/src/client/widgets/index.js
@@ -11,6 +11,7 @@ module.exports.widgets = {
// containers
panel: require('./containers/panel'),
+ folder: require('./containers/folder'),
root: require('./containers/root'),
tab: require('./containers/tab'),
modal: require('./containers/modal'),
@@ -56,7 +57,7 @@ module.exports.widgets = {
module.exports.categories = {
'Basics':['button', 'switch', 'dropdown', 'menu', 'input', 'textarea', 'file'],
- 'Containers':['panel', 'modal', 'clone', 'fragment', 'matrix', 'keyboard', 'patchbay'],
+ 'Containers':['panel', 'modal', 'clone', 'fragment', 'matrix', 'keyboard', 'patchbay', 'folder'],
'Frames':['frame', 'svg', 'html', 'image'],
'Graphs':['plot','eq','visualizer'],
'Indicators':['led', 'text'],
diff --git a/src/scss/widgets/containers.scss b/src/scss/widgets/containers.scss
index d6d02c19..1e5f64e1 100644
--- a/src/scss/widgets/containers.scss
+++ b/src/scss/widgets/containers.scss
@@ -73,7 +73,8 @@
max-width: 100%;
}
- &.layout-vertical > inner {
+ &.layout-vertical > inner,
+ &.layout-vertical .folder-container > inner {
display: flex;
flex-direction: column;
align-items: stretch;
@@ -94,7 +95,8 @@
max-height: 100%;
}
- &.layout-grid > inner {
+ &.layout-grid > inner,
+ &.layout-grid .folder-container > inner {
display: grid;
> .widget {
top:auto!important;
@@ -201,6 +203,22 @@
}
+.folder-container {
+ display: contents;
+ overflow: visible;
+ contain: unset;
+ min-width: 0;
+ width: 0;
+ min-height: 0;
+ height: 0;
+ padding: 0;
+ margin: 0;
+ > inner {
+ display: contents!important;
+ padding: 0;
+ }
+}
+
.root-container {
@extend .widget-panel-base;
From 5ba7de9861317b40cccb0d3fe07487fd20a5732f Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Wed, 26 Oct 2022 10:34:18 +0200
Subject: [PATCH 0679/1472] file widget: avoid error with non-string values
---
src/client/widgets/basics/file.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/client/widgets/basics/file.js b/src/client/widgets/basics/file.js
index 2381b5b2..39e44296 100644
--- a/src/client/widgets/basics/file.js
+++ b/src/client/widgets/basics/file.js
@@ -69,8 +69,8 @@ module.exports = class File extends Widget {
this.value = v
- var sep = v[0] === '/' ? '/' : '\\'
- if (this.getProp('hidePath')) {
+ if (this.getProp('hidePath') && typeof v === 'string') {
+ var sep = v[0] === '/' ? '/' : '\\'
if (v[v.length - 1] === sep) {
this.text.textContent = v.substr(0, v.length - 1).split(sep).pop() + sep
} else {
From 55afba8178ee72281a9ecc7487c21cc1d65830d9 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Wed, 26 Oct 2022 10:36:24 +0200
Subject: [PATCH 0680/1472] log:update
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c247d971..55458cb5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
- add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed
- widgets
+ - add folder widget (flat container that doesn't affect layout)
- input: add `maxLength` property
- ui
From 757dd230636fdb78c4a81f95122b987d8dbea410 Mon Sep 17 00:00:00 2001
From: jean-emmanuel
Date: Wed, 26 Oct 2022 10:38:09 +0200
Subject: [PATCH 0681/1472] folder: proper description
---
src/client/widgets/containers/folder.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/client/widgets/containers/folder.js b/src/client/widgets/containers/folder.js
index 5391ec3c..0ef6adb4 100644
--- a/src/client/widgets/containers/folder.js
+++ b/src/client/widgets/containers/folder.js
@@ -5,7 +5,7 @@ class Folder extends Panel {
static description() {
- return 'Generic matrix for creating rows/columns of widgets.'
+ return 'Flat container that doesn\'t affect layout. Mostly useful for grouping widgets in the tree.'
}
From d7bdb092c217bd396069916b296c17537e5ddea4 Mon Sep 17 00:00:00 2001
From: jean-emmanuel