diff --git a/src/renderer/config-blocks/VarGlobal.svelte b/src/renderer/config-blocks/VarGlobal.svelte index 1f05e066..281aaf66 100644 --- a/src/renderer/config-blocks/VarGlobal.svelte +++ b/src/renderer/config-blocks/VarGlobal.svelte @@ -22,114 +22,51 @@ }; - - - - -
- {#if variableNameError} -
Variable name error!
- {/if} - {#if error_messsage !== ""} -
{error_messsage}
- {/if} - {#key commitState} -
+
+
+ Global Variables: + Error: {errorText} - {commitState ? "Unsaved changes!" : "Synced with Grid!"} -
- {/key} - {#if parenthesisError} -
Parenthesis must be closed!
- {/if} - -
- -
- {#each scriptSegments as script, i (i)} -
-
- + +
+ {#each scriptSegments as script, i} +
+ { + return new Validator(e).NotEmpty().Result(); + }} + on:validator={(e) => { + const data = e.detail; + dispatch("validator", data); + }} on:input={(e) => { - saveChangesOnInput(e.target.value, i, "variable"); + sendData(); + }} + on:change={() => { + dispatch("sync"); }} /> -
-
-
- {#key rerenderList} - { - saveChangesOnInput(e.detail.script, i, "value"); - }} - action={config} - {sidebarWidth} - value={script.value} - /> - {/key} -
-
-
- {#if i !== 0} - - {:else} - - {/if} + + + +
-
- {/each} -
- -
- -
+ {/each} +
- - +
+ +
- + +
+ diff --git a/src/renderer/config-blocks/VarLocals.svelte b/src/renderer/config-blocks/VarLocals.svelte index e4a82674..741ede1a 100644 --- a/src/renderer/config-blocks/VarLocals.svelte +++ b/src/renderer/config-blocks/VarLocals.svelte @@ -39,6 +39,7 @@ type ScriptSegment = Grid.VariableBlock.ScriptSegment; let scriptSegments: ScriptSegment[]; + let errorText = ""; $: handleConfigChange($config); @@ -62,9 +63,13 @@ sendData(); } - let errorText = ""; + function humanizeLocals(segments: ScriptSegment[]): ScriptSegment[] { + return segments.map((elem) => { + elem.value = GridScript.humanize(elem.value); + return elem; + }); + } - // Commit button function sendData() { const script = localArrayToScript(scriptSegments); updateErrorText(); @@ -84,13 +89,6 @@ return script; } - function humanizeLocals(segments: ScriptSegment[]): ScriptSegment[] { - return segments.map((elem) => { - elem.value = GridScript.humanize(elem.value); - return elem; - }); - } - function localsToConfig(script: string): ScriptSegment[] { if (parenthesis(script)) { // this had to be moved out of locals function, as array refresh was killed by $ with scriptSegments.. @@ -130,79 +128,80 @@ } - -
- Local Variables: - Error: {errorText} -
- -
- {#each scriptSegments as script, i} -
- { - return new Validator(e).NotEmpty().Result(); - }} - on:validator={(e) => { - const data = e.detail; - dispatch("validator", data); - }} - on:input={(e) => { - sendData(); - }} - on:change={() => { - dispatch("sync"); - }} - /> - -
- +
+
+ Local Variables: + Error: {errorText} +
+ +
+ {#each scriptSegments as script, i} +
+ { + return new Validator(e).NotEmpty().Result(); + }} + on:validator={(e) => { + const data = e.detail; + dispatch("validator", data); + }} on:input={(e) => { - script.value = e.detail.script ?? ""; sendData(); }} - on:change={() => dispatch("sync")} - action={config} - value={script.value} + on:change={() => { + dispatch("sync"); + }} /> -
- -
- {/each} -
+
- + +
+ {/each} +
+ +
+ +
- -
+ +
+ diff --git a/src/renderer/config-blocks/VarSelf.svelte b/src/renderer/config-blocks/VarSelf.svelte index 04f20072..f9926482 100644 --- a/src/renderer/config-blocks/VarSelf.svelte +++ b/src/renderer/config-blocks/VarSelf.svelte @@ -22,115 +22,61 @@ }; - - - - -
- {#if variableNameError} -
Variable name error!
- {/if} - {#if error_messsage !== ""} -
{error_messsage}
- {/if} - {#key commitState} -
+
+
+ Self Variables: + Error: {errorText} - {commitState ? "Unsaved changes!" : "Synced with Grid!"} -
- {/key} - {#if parenthesisError} -
Parenthesis must be closed!
- {/if} - -
- -
- {#each scriptSegments as script, i (i)} -
-
- + +
+ {#each scriptSegments as script, i} +
+ { + return new Validator(e).NotEmpty().Result(); + }} + on:validator={(e) => { + const data = e.detail; + dispatch("validator", data); + }} on:input={(e) => { - saveChangesOnInput(e.target.value, i, "variable"); + sendData(); + }} + on:change={() => { + dispatch("sync"); }} /> -
-
-
- {#key rerenderList} - { - saveChangesOnInput(e.detail.script, i, "value"); - }} - action={config} - {sidebarWidth} - value={script.value} - /> - {/key} -
-
-
- {#if i !== 0} - - {:else} - - {/if} + + + +
-
- {/each} -
+ {/each} +
-
- -
+
+ +
- - - - + +
+