From 3fa0a792761fee17225c5dec723218b35f26749b Mon Sep 17 00:00:00 2001 From: elsoazemelet Date: Thu, 26 Oct 2023 16:20:41 +0200 Subject: [PATCH] Fixed PR issues --- .../config-blocks/LedAnimationStart.svelte | 20 --------- .../config-blocks/LedAnimationStop.svelte | 20 --------- src/renderer/config-blocks/LedColor.svelte | 22 ---------- src/renderer/config-blocks/LedPhase.svelte | 14 ------- .../config-blocks/MidiFourteenBit.svelte | 22 +--------- src/renderer/config-blocks/MouseButton.svelte | 21 +--------- src/renderer/config-blocks/MouseMove.svelte | 14 ------- .../config-blocks/SettingsButton.svelte | 30 ++----------- .../config-blocks/SettingsEncoder.svelte | 35 ++++------------ .../config-blocks/SettingsPotmeter.svelte | 35 ++++------------ src/renderer/config-blocks/TimerSource.svelte | 14 ------- src/renderer/config-blocks/TimerStart.svelte | 28 ++----------- src/renderer/config-blocks/TimerStop.svelte | 42 ++----------------- .../headers/ForLoopHeader.svelte | 21 +--------- .../configuration/components/Options.svelte | 2 + .../main/user-interface/AtomicInput.svelte | 26 ++++++------ 16 files changed, 46 insertions(+), 320 deletions(-) diff --git a/src/renderer/config-blocks/LedAnimationStart.svelte b/src/renderer/config-blocks/LedAnimationStart.svelte index 691f56e2e..c37b34d5e 100644 --- a/src/renderer/config-blocks/LedAnimationStart.svelte +++ b/src/renderer/config-blocks/LedAnimationStart.svelte @@ -157,26 +157,6 @@ suggestions = _suggestions; }); - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - if (index < 2) { - suggestionPlaceMove = true; - } else { - suggestionPlaceMove = false; - } - - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - let suggestionElement1 = undefined; let suggestionElement2 = undefined; diff --git a/src/renderer/config-blocks/LedAnimationStop.svelte b/src/renderer/config-blocks/LedAnimationStop.svelte index 16c6e2077..090a4ae8d 100644 --- a/src/renderer/config-blocks/LedAnimationStop.svelte +++ b/src/renderer/config-blocks/LedAnimationStop.svelte @@ -157,26 +157,6 @@ suggestions = _suggestions; }); - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - if (index < 2) { - suggestionPlaceMove = true; - } else { - suggestionPlaceMove = false; - } - - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - let suggestionElement = undefined; let focusedInputIndex = null; diff --git a/src/renderer/config-blocks/LedColor.svelte b/src/renderer/config-blocks/LedColor.svelte index 917849c12..7f2cc5302 100644 --- a/src/renderer/config-blocks/LedColor.svelte +++ b/src/renderer/config-blocks/LedColor.svelte @@ -180,28 +180,6 @@ A -> B : AB-First step updatePicker(); }); - let suggestionPlaceMove = false; - - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - if (index < 2) { - suggestionPlaceMove = true; - } else { - suggestionPlaceMove = false; - } - - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - /* accepts parameters * h Object = {h:x, s:y, v:z} * OR diff --git a/src/renderer/config-blocks/LedPhase.svelte b/src/renderer/config-blocks/LedPhase.svelte index 7204d1a4c..3eac82ed8 100644 --- a/src/renderer/config-blocks/LedPhase.svelte +++ b/src/renderer/config-blocks/LedPhase.svelte @@ -140,20 +140,6 @@ suggestions = _suggestions; }); - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - let suggestionElement = undefined; let focusedInputIndex = null; diff --git a/src/renderer/config-blocks/MidiFourteenBit.svelte b/src/renderer/config-blocks/MidiFourteenBit.svelte index 85865adc2..e3dd54dcb 100644 --- a/src/renderer/config-blocks/MidiFourteenBit.svelte +++ b/src/renderer/config-blocks/MidiFourteenBit.svelte @@ -681,26 +681,10 @@ renderSuggestions(); } - let ready = false; onMount(() => { renderSuggestions(); - ready = true; }); - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - const tabs = [ { name: "MIDI", component: "Midi" }, { name: "14 bit MIDI", component: "MidiFourteenBit" }, @@ -751,6 +735,7 @@ inputValue={script} suggestions={suggestions[i]} validator={validators[i]} + suggestionTarget={suggestionElement} on:focus={() => handleInputFocus(i)} on:validator={(e) => { const data = e.detail; @@ -766,12 +751,7 @@ { - scriptSegments[e.detail.index] = e.detail.value; - sendData(e.detail.value, e.detail.index); - }} /> { - sendData(e); - }} /> diff --git a/src/renderer/config-blocks/MouseMove.svelte b/src/renderer/config-blocks/MouseMove.svelte index 623699516..91421c6ab 100644 --- a/src/renderer/config-blocks/MouseMove.svelte +++ b/src/renderer/config-blocks/MouseMove.svelte @@ -105,20 +105,6 @@ suggestions = _suggestions; }); - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - let suggestionElement = undefined; let focusedInputIndex = null; diff --git a/src/renderer/config-blocks/SettingsButton.svelte b/src/renderer/config-blocks/SettingsButton.svelte index 1d7887c0c..2729d9878 100644 --- a/src/renderer/config-blocks/SettingsButton.svelte +++ b/src/renderer/config-blocks/SettingsButton.svelte @@ -60,22 +60,8 @@ sendData(scriptValue); } - function sendData(e) { - dispatch("output", { short: `sbc`, script: `self:bmo(${e})` }); - } - - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); + function sendData(value) { + dispatch("output", { short: `sbc`, script: `self:bmo(${value})` }); } const suggestions = [ @@ -89,15 +75,9 @@ let suggestionElement = undefined; - let focusedInputIndex = null; - function handleInputFocus(index) { - focusedInputIndex = index; - } - function handleSuggestionSelected(e) { const { value } = e.detail; - scriptSegments[focusedInputIndex] = value; - sendData(value, focusedInputIndex); + scriptValue = value; } @@ -110,7 +90,6 @@ inputValue={scriptValue} suggestions={suggestions[0]} suggestionTarget={suggestionElement} - on:focus={() => handleInputFocus()} on:change={(e) => { scriptValue = e.detail; }} @@ -127,8 +106,5 @@ { - scriptValue = e.detail.value; - }} /> diff --git a/src/renderer/config-blocks/SettingsEncoder.svelte b/src/renderer/config-blocks/SettingsEncoder.svelte index 68d545ab1..1b904999b 100644 --- a/src/renderer/config-blocks/SettingsEncoder.svelte +++ b/src/renderer/config-blocks/SettingsEncoder.svelte @@ -78,20 +78,6 @@ }); } - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - const suggestions = [ [ { value: "0", info: "Absolute" }, @@ -115,8 +101,12 @@ function handleSuggestionSelected(e) { const { value } = e.detail; - scriptSegments[focusedInputIndex] = value; - sendData(value, focusedInputIndex); + if (focusedInputIndex == 1) { + ev0 = value; + } + if (focusedInputIndex == 0) { + emo = value; + } } @@ -133,7 +123,8 @@ validator={(e) => { return new Validator(e).NotEmpty().Result(); }} - on:focus={() => handleInputFocus()} + suggestionTarget={suggestionElement} + on:focus={() => handleInputFocus(0)} on:change={(e) => { emo = e.detail; }} @@ -155,7 +146,7 @@ return new Validator(e).NotEmpty().Result(); }} suggestionTarget={suggestionElement} - on:focus={() => handleInputFocus()} + on:focus={() => handleInputFocus(1)} on:change={(e) => { ev0 = e.detail; }} @@ -171,13 +162,5 @@ { - if (focusedInput == 1) { - ev0 = e.detail.value; - } - if (focusedInput == 0) { - emo = e.detail.value; - } - }} /> diff --git a/src/renderer/config-blocks/SettingsPotmeter.svelte b/src/renderer/config-blocks/SettingsPotmeter.svelte index e7151f0ea..dc248be2e 100644 --- a/src/renderer/config-blocks/SettingsPotmeter.svelte +++ b/src/renderer/config-blocks/SettingsPotmeter.svelte @@ -67,20 +67,6 @@ }); } - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - const suggestions = [ [ { value: "7", info: "7 bit (default)" }, @@ -106,8 +92,12 @@ function handleSuggestionSelected(e) { const { value } = e.detail; - scriptSegments[focusedInputIndex] = value; - sendData(value, focusedInputIndex); + if (focusedInputIndex == 1) { + pma = value; + } + if (focusedInputIndex == 0) { + pmo = value; + } } @@ -124,7 +114,8 @@ validator={(e) => { return new Validator(e).NotEmpty().Result(); }} - on:focus={() => handleInputFocus()} + suggestionTarget={suggestionElement} + on:focus={() => handleInputFocus(0)} on:change={(e) => { pmo = e.detail; }} @@ -146,7 +137,7 @@ return new Validator(e).NotEmpty().Result(); }} suggestionTarget={suggestionElement} - on:focus={() => handleInputFocus()} + on:focus={() => handleInputFocus(1)} on:change={(e) => { pma = e.detail; }} @@ -162,13 +153,5 @@ { - if (focusedInput == 1) { - pma = e.detail.value; - } - if (focusedInput == 0) { - pmo = e.detail.value; - } - }} /> diff --git a/src/renderer/config-blocks/TimerSource.svelte b/src/renderer/config-blocks/TimerSource.svelte index 3f5811341..2a9994990 100644 --- a/src/renderer/config-blocks/TimerSource.svelte +++ b/src/renderer/config-blocks/TimerSource.svelte @@ -78,20 +78,6 @@ dispatch("output", { short: config.short, script: script }); } - let showSuggestions = false; - let focusedInput = undefined; - let focusGroup = []; - - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - showSuggestions = focusGroup.includes(true); - } - let _suggestions = [ [], [ diff --git a/src/renderer/config-blocks/TimerStart.svelte b/src/renderer/config-blocks/TimerStart.svelte index 9f469dffa..d5eccb5b9 100644 --- a/src/renderer/config-blocks/TimerStart.svelte +++ b/src/renderer/config-blocks/TimerStart.svelte @@ -32,7 +32,7 @@ @@ -126,7 +94,6 @@ inputValue={scriptValue} suggestions={suggestions[0]} suggestionTarget={suggestionElement} - on:focus={() => handleInputFocus()} on:change={(e) => { scriptValue = e.detail; }} @@ -143,8 +110,5 @@ { - scriptValue = e.detail.value; - }} /> diff --git a/src/renderer/config-blocks/headers/ForLoopHeader.svelte b/src/renderer/config-blocks/headers/ForLoopHeader.svelte index b50c59b49..5351039e9 100644 --- a/src/renderer/config-blocks/headers/ForLoopHeader.svelte +++ b/src/renderer/config-blocks/headers/ForLoopHeader.svelte @@ -7,15 +7,11 @@ import { Validator } from "../_validators"; import AtomicInput from "../../main/user-interface/AtomicInput.svelte"; import SendFeedback from "../../main/user-interface/SendFeedback.svelte"; - import { localDefinitions } from "../../runtime/runtime.store"; export let index; export let access_tree; export let config = undefined; - let focusedInput = undefined; - let focusGroup = []; - let data = [ { value: "i", @@ -51,15 +47,6 @@ }, ]; - function onActiveFocus(event, index) { - focusGroup[index] = event.detail.focus; - focusedInput = index; - } - - function onLooseFocus(event, index) { - focusGroup[index] = event.detail.focus; - } - const dispatch = createEventDispatcher(); let displayValue = "?"; @@ -96,7 +83,7 @@ }); } - function handleInputFieldChange(event, index) { + function handleInputFieldChange(e, i) { const shortData = data.map((e) => stringManipulation.shortify(e.value)); const segments = [shortData[0] + "=" + shortData[1], ...shortData.slice(2)]; dispatch("output", { @@ -153,12 +140,6 @@ const data = e.detail; dispatch("validator", data); }} - on:active-focus={(e) => { - onActiveFocus(e, i); - }} - on:loose-focus={(e) => { - onLooseFocus(e, i); - }} on:change={(e) => handleInputFieldChange(e, i)} /> {/each} diff --git a/src/renderer/main/panels/configuration/components/Options.svelte b/src/renderer/main/panels/configuration/components/Options.svelte index d95f1aeff..e0aea1882 100644 --- a/src/renderer/main/panels/configuration/components/Options.svelte +++ b/src/renderer/main/panels/configuration/components/Options.svelte @@ -18,6 +18,8 @@ index: index, }); } + + $: console.log(disabled); { - handleInputvaluechange(inputValue); - }); + $: handleInputValueChange(inputValue); function handleValidation() { isError = !validator(text); @@ -55,21 +53,23 @@ if (input) { input = false; const short = stringManipulation.shortify(inputValue); - console.log(short); dispatch("change", short); } } function handleFocus(e) { - suggestionTarget.dispatchEvent(new CustomEvent("focus")); dispatch("focus", this); - const event = new CustomEvent("display", { - detail: { - data: suggestions, - }, - }); + if (typeof suggestionTarget !== "undefined") { + suggestionTarget.dispatchEvent(new CustomEvent("focus")); + + const event = new CustomEvent("display", { + detail: { + data: suggestions, + }, + }); - suggestionTarget.dispatchEvent(event); + suggestionTarget.dispatchEvent(event); + } } let input = false;