+
+
+ 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}
-
-
- {/each}
-
-
-
- {
- addGlobalVariable();
- }}
- class="group-hover:border-pick cursor-pointer group-hover:bg-select-saturate-10 border-secondary transition-colors duration-300 w-full border-l-4 text-white pl-4 py-0.5"
- >
- Add global variable...
-
-
+ {/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");
+ }}
/>
-
-
{
- removeLocalVariable(i);
- }}
- class="flex group cursor-pointer"
- >
-
-
+ {
+ script.value = e.detail.script ?? "";
+ sendData();
+ }}
+ on:change={() => dispatch("sync")}
+ action={config}
+ value={script.value}
/>
-
-
-
-
- {/each}
-
+
-
+ {
+ removeLocalVariable(i);
+ }}
+ class="flex group cursor-pointer"
+ >
+
+
+
+
+
+
+ {/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 @@
};
-
-