diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 64f7046..929be33 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,13 +8,13 @@ "name": "modalfilemanager", "version": "1.0.0", "dependencies": { - "svelte-color-picker": "^1.0.7", "svelte-icons": "^2.1.0" }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^2.0.2", "svelte": "^3.55.1", - "vite": "^4.1.1" + "svelte-awesome-color-picker": "^2.4.1", + "vite": "^4.1.2" } }, "node_modules/@esbuild/android-arm": { @@ -375,11 +375,6 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, - "node_modules/@polka/url": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz", - "integrity": "sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw==" - }, "node_modules/@sveltejs/vite-plugin-svelte": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.0.2.tgz", @@ -401,13 +396,11 @@ "vite": "^4.0.0" } }, - "node_modules/console-clear": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/console-clear/-/console-clear-1.1.1.tgz", - "integrity": "sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==", - "engines": { - "node": ">=4" - } + "node_modules/colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true }, "node_modules/debug": { "version": "4.3.4", @@ -492,14 +485,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "node_modules/get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==", - "engines": { - "node": ">=4" - } - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -533,14 +518,6 @@ "node": ">=6" } }, - "node_modules/local-access": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/local-access/-/local-access-1.1.0.tgz", - "integrity": "sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==", - "engines": { - "node": ">=6" - } - }, "node_modules/magic-string": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", @@ -553,25 +530,6 @@ "node": ">=12" } }, - "node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "engines": { - "node": ">=4" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -659,57 +617,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/sade": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", - "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", - "dependencies": { - "mri": "^1.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sirv": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-0.4.6.tgz", - "integrity": "sha512-rYpOXlNbpHiY4nVXxuDf4mXPvKz1reZGap/LkWp9TvcZ84qD/nPBjjH/6GZsgIjVMbOslnY8YYULAyP8jMn1GQ==", - "dependencies": { - "@polka/url": "^0.5.0", - "mime": "^2.3.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/sirv-cli": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/sirv-cli/-/sirv-cli-0.4.6.tgz", - "integrity": "sha512-/Vj85/kBvPL+n9ibgX6FicLE8VjidC1BhlX67PYPBfbBAphzR6i0k0HtU5c2arejfU3uzq8l3SYPCwl1x7z6Ww==", - "dependencies": { - "console-clear": "^1.1.0", - "get-port": "^3.2.0", - "kleur": "^3.0.0", - "local-access": "^1.0.1", - "sade": "^1.4.0", - "sirv": "^0.4.6", - "tinydate": "^1.0.0" - }, - "bin": { - "sirv": "index.js" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/sirv-cli/node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "engines": { - "node": ">=6" - } - }, "node_modules/source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", @@ -740,12 +647,13 @@ "node": ">= 8" } }, - "node_modules/svelte-color-picker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/svelte-color-picker/-/svelte-color-picker-1.0.7.tgz", - "integrity": "sha512-Xu5efoJKPEouO+rSLkbVR/0EI4ewzO2PgtapC7FdvPlYaCykdqm7YvsoTLaTSNdIljoBtHzNaYgtYxc/ThL5+w==", + "node_modules/svelte-awesome-color-picker": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/svelte-awesome-color-picker/-/svelte-awesome-color-picker-2.4.1.tgz", + "integrity": "sha512-IzICGgaMRMgyK4uukm27UdTFfN7s0QN3eoFyIGiXXY8FCPumS9T+vffVG4rNhiuUUP4ga5SoGUE+KXuNj5dsrw==", + "dev": true, "dependencies": { - "sirv-cli": "^0.4.4" + "colord": "^2.9.3" } }, "node_modules/svelte-hmr": { @@ -765,18 +673,10 @@ "resolved": "https://registry.npmjs.org/svelte-icons/-/svelte-icons-2.1.0.tgz", "integrity": "sha512-rHPQjweEc9fGSnvM0/4gA3pDHwyZyYsC5KhttCZRhSMJfLttJST5Uq0B16Czhw+HQ+HbSOk8kLigMlPs7gZtfg==" }, - "node_modules/tinydate": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.3.0.tgz", - "integrity": "sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==", - "engines": { - "node": ">=4" - } - }, "node_modules/vite": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.1.tgz", - "integrity": "sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.2.tgz", + "integrity": "sha512-MWDb9Rfy3DI8omDQySbMK93nQqStwbsQWejXRY2EBzEWKmLAXWb1mkI9Yw2IJrc+oCvPCI1Os5xSSIBYY6DEAw==", "dev": true, "dependencies": { "esbuild": "^0.16.14", @@ -998,11 +898,6 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, - "@polka/url": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz", - "integrity": "sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw==" - }, "@sveltejs/vite-plugin-svelte": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.0.2.tgz", @@ -1017,10 +912,11 @@ "vitefu": "^0.2.3" } }, - "console-clear": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/console-clear/-/console-clear-1.1.1.tgz", - "integrity": "sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==" + "colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true }, "debug": { "version": "4.3.4", @@ -1080,11 +976,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==" - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1109,11 +1000,6 @@ "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", "dev": true }, - "local-access": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/local-access/-/local-access-1.1.0.tgz", - "integrity": "sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==" - }, "magic-string": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", @@ -1123,16 +1009,6 @@ "@jridgewell/sourcemap-codec": "^1.4.13" } }, - "mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" - }, - "mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1188,44 +1064,6 @@ "fsevents": "~2.3.2" } }, - "sade": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", - "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", - "requires": { - "mri": "^1.1.0" - } - }, - "sirv": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-0.4.6.tgz", - "integrity": "sha512-rYpOXlNbpHiY4nVXxuDf4mXPvKz1reZGap/LkWp9TvcZ84qD/nPBjjH/6GZsgIjVMbOslnY8YYULAyP8jMn1GQ==", - "requires": { - "@polka/url": "^0.5.0", - "mime": "^2.3.1" - } - }, - "sirv-cli": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/sirv-cli/-/sirv-cli-0.4.6.tgz", - "integrity": "sha512-/Vj85/kBvPL+n9ibgX6FicLE8VjidC1BhlX67PYPBfbBAphzR6i0k0HtU5c2arejfU3uzq8l3SYPCwl1x7z6Ww==", - "requires": { - "console-clear": "^1.1.0", - "get-port": "^3.2.0", - "kleur": "^3.0.0", - "local-access": "^1.0.1", - "sade": "^1.4.0", - "sirv": "^0.4.6", - "tinydate": "^1.0.0" - }, - "dependencies": { - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==" - } - } - }, "source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", @@ -1244,12 +1082,13 @@ "integrity": "sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==", "dev": true }, - "svelte-color-picker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/svelte-color-picker/-/svelte-color-picker-1.0.7.tgz", - "integrity": "sha512-Xu5efoJKPEouO+rSLkbVR/0EI4ewzO2PgtapC7FdvPlYaCykdqm7YvsoTLaTSNdIljoBtHzNaYgtYxc/ThL5+w==", + "svelte-awesome-color-picker": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/svelte-awesome-color-picker/-/svelte-awesome-color-picker-2.4.1.tgz", + "integrity": "sha512-IzICGgaMRMgyK4uukm27UdTFfN7s0QN3eoFyIGiXXY8FCPumS9T+vffVG4rNhiuUUP4ga5SoGUE+KXuNj5dsrw==", + "dev": true, "requires": { - "sirv-cli": "^0.4.4" + "colord": "^2.9.3" } }, "svelte-hmr": { @@ -1264,15 +1103,10 @@ "resolved": "https://registry.npmjs.org/svelte-icons/-/svelte-icons-2.1.0.tgz", "integrity": "sha512-rHPQjweEc9fGSnvM0/4gA3pDHwyZyYsC5KhttCZRhSMJfLttJST5Uq0B16Czhw+HQ+HbSOk8kLigMlPs7gZtfg==" }, - "tinydate": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.3.0.tgz", - "integrity": "sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==" - }, "vite": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.1.tgz", - "integrity": "sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.2.tgz", + "integrity": "sha512-MWDb9Rfy3DI8omDQySbMK93nQqStwbsQWejXRY2EBzEWKmLAXWb1mkI9Yw2IJrc+oCvPCI1Os5xSSIBYY6DEAw==", "dev": true, "requires": { "esbuild": "^0.16.14", diff --git a/frontend/package.json b/frontend/package.json index 2855c12..44d7a94 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,10 +11,10 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^2.0.2", "svelte": "^3.55.1", - "vite": "^4.1.1" + "svelte-awesome-color-picker": "^2.4.1", + "vite": "^4.1.2" }, "dependencies": { - "svelte-color-picker": "^1.0.7", "svelte-icons": "^2.1.0" } } diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index 6271b11..51415fd 100755 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -e49f101dfddc3e941865472ae04a1614 \ No newline at end of file +e4cb4f5d19466c19874dafb9187e8509 \ No newline at end of file diff --git a/frontend/src/components/Env.svelte b/frontend/src/components/Env.svelte index ad47b68..343592b 100644 --- a/frontend/src/components/Env.svelte +++ b/frontend/src/components/Env.svelte @@ -14,22 +14,74 @@ }); function deleteCell(kv) { - delete $config.configuration.env[kv[0]]; + delete $config.env[kv[0]]; + $config = $config; + saveConfig(); } function saveCell(kv, e) { - $config.configuration.env[kv[0]] = e.detail.value; + $config.env[kv[0]] = e.detail.value; + $config = $config; + saveConfig(); } - function addKV(e) { - $config.configuration.env[KVname] = KVvalue; + async function saveConfig() { + if ($config !== null) { + // + // Save the important by cyclic structures. + // + let cpyOS = $config.OS; + let cpyExt = $config.extensions; + let cpyCmd = $config.commands; + + // + // Null them before trying to make a copy. + // + $config.OS = null; + $config.commands = null; + $config.extensions = null; + + // + // Make a copy. + // + let svConfig = JSON.parse(JSON.stringify($config)); + + // + // Restore the structures. + // + $config.OS = cpyOS; + $config.commands = cpyCmd; + $config.extensions = cpyExt; + + // + // Save the configuration. + // + const cfgFile = await $config.OS.appendPath( + $config.configDir, + "config.json" + ); + await $config.OS.writeFile(cfgFile, JSON.stringify(svConfig)); + } + } + + function addKV() { + $config.env[KVname] = KVvalue; addNew = false; + setFocus(true); KVname = ""; KVvalue = ""; + $config = $config; + saveConfig(); + } + + function setFocus(flag) { + dispatch("setKeyProcess", { + blur: flag, + }); } -{#if $config !== null && typeof $config.configuration.env !== "undefined"} +{#if $config !== null && typeof $config.env !== "undefined"} @@ -40,16 +92,19 @@ - {#each Object.entries($config.configuration.env) as kv} + {#each Object.entries($config.env) as kv} { + on:delete={() => { deleteCell(kv); }} on:save={(e) => { saveCell(kv, e); }} + on:setKeyProcess={(e) => { + setFocus(e.detail.blur); + }} /> {/each} {#if addNew} @@ -57,7 +112,14 @@ diff --git a/frontend/src/components/EnvTableRow.svelte b/frontend/src/components/EnvTableRow.svelte index 8045c1d..5f1a486 100644 --- a/frontend/src/components/EnvTableRow.svelte +++ b/frontend/src/components/EnvTableRow.svelte @@ -17,6 +17,7 @@ function saveInput() { value = inputValue; editValue = false; + setFocus(true); dispatch("save", { value: inputValue, }); @@ -25,6 +26,12 @@ function deleteCell() { dispatch("delete", {}); } + + function setFocus(flag) { + dispatch("setKeyProcess", { + blur: flag, + }); + } @@ -36,7 +43,14 @@ {#if editValue} - + { + setFocus(false); + }} + on:mouseleave={saveInput} + /> {:else} {/if} diff --git a/frontend/src/components/ExtensionPrefs.svelte b/frontend/src/components/ExtensionPrefs.svelte index dee96bb..0653ed3 100644 --- a/frontend/src/components/ExtensionPrefs.svelte +++ b/frontend/src/components/ExtensionPrefs.svelte @@ -338,7 +338,6 @@ return({{extName}}); on:mouseover={() => { setFocus(false); }} - on:focus={() => {}} on:mouseleave={() => { setFocus(true); }} diff --git a/frontend/src/components/FileManager.svelte b/frontend/src/components/FileManager.svelte index 1ed4d28..a4f3333 100644 --- a/frontend/src/components/FileManager.svelte +++ b/frontend/src/components/FileManager.svelte @@ -68,6 +68,7 @@ let selRegExpHist = null; onMount(async () => { + console.log("Initialize everything: ", commands); // // Initialize all the stores with minimal settings. // @@ -253,20 +254,19 @@ // // They don't have this file setup. TODO: Set it up or not? // + userEditor = null; } } // // Set the configuration store. // - $config = { - configDir: configDir, - OS: OS, - configuration: $config, - commands: commands, - extensions: extensions, - userEditor: userEditor, - }; + $config.configDir = configDir; + $config.OS = OS; + $config.commands = commands; + $config.extensions = extensions; + $config.userEditor = userEditor; + console.log("Setting the config: ", $config, commands); OS.setConfig($config); extensions.setConfig($config); @@ -279,10 +279,10 @@ // Setup emmiters from the go code. // var commandParse = RegExp("^([^(]*)\\(([^)]*)\\)"); - window.runtime.EventsOn("runCommands", (commands) => { - if (typeof commands === "string" && commands.length > 0) { - for (var i = 0; i < commands.length; i++) { - var parts = commands[i].match(commandParse); + window.runtime.EventsOn("runCommands", (cmds) => { + if (typeof cmds === "string" && cmds.length > 0) { + for (var i = 0; i < cmds.length; i++) { + var parts = cmds[i].match(commandParse); if (parts[2][0] == "'") { parts[2] = parts[2].slice(1, -1); } @@ -290,10 +290,10 @@ } } }); - var commands = await App.GetCommandLineCommands(); - if (commands !== null) { - for (var i = 0; i < commands.length; i++) { - var parts = commands[i].match(commandParse); + var cmds = await App.GetCommandLineCommands(); + if (cmds !== null) { + for (var i = 0; i < cmds.length; i++) { + var parts = cmds[i].match(commandParse); if (parts[2][0] == "'") { parts[2] = parts[2].slice(1, -1); } @@ -316,6 +316,8 @@ // $dirHistory.loadHistory(); + window.config = $config; // debugging + // // return a command to unsubscribe from everything. // @@ -2949,6 +2951,10 @@ createDefaultVisualMap(keyMapDir); createDefaultInsertMap(keyMapDir); } + + async function getOS() { + return OStype; + }
{ - if ($config !== null) { - const nfile = await $config.localFS.appendPath( - $config.configDir, - "config.json" - ); - await $config.localFS.writeFile( - nfile, - JSON.stringify(value.configuration) - ); - $config.localFS.setConfig(value.configuration); - } - return () => {}; }); @@ -34,19 +22,29 @@ }); function trashChanged(e) { - $config.configuration.useTrash = e.target.checked; + $config.useTrash = e.target.checked; + } + + function setFocus(flag) { + dispatch("setKeyProcess", { + blur: flag, + }); }
{#if $config !== null}

Environment for Launching Programs

- + { + setFocus(e.detail.blur); + }} + />

Other Configuration Items

- {#if $config.configuration.useTrash} + {#if $config.useTrash} import { onMount, createEventDispatcher } from "svelte"; import { theme } from "../stores/theme.js"; + import { config } from "../stores/config.js"; import GeneralPrefs from "./GeneralPrefs.svelte"; import ThemePrefs from "./ThemePrefs.svelte"; import ExtensionPrefs from "./ExtensionPrefs.svelte"; - import OS from "../modules/OS.js"; const dispatch = createEventDispatcher(); - let localFS; - let configDir; - let osNames = ["macOS", "linux", "windows"]; let showPanel = "general"; let vimInput = null; let keepBlur = true; let scrollDOM = null; - let timeOut; + let timeOut = null; + const timeOutValue = 500; onMount(async () => { - // - // Get the local file system utilities. - // - localFS = OS; - - // - // Initialize local. - // - localFS.init(); - // // Setup the configuration directory. // - configDir = await localFS.getConfigDir(); - if (!(await localFS.dirExists(configDir))) { - await localFS.makeDir(configDir); - await localFS.makeDir({ - dir: configDir, + if (!(await $config.OS.dirExists($config.configDir))) { + await $config.OS.makeDir($config.configDir); + await $config.OS.makeDir({ + dir: $config.configDir, name: "extensions", - fileSystem: localFS, + fileSystem: $config.OS, }); } // // keep the input focused. // - timeOut = setTimeout(focusInput, 1000); + timeOut = setTimeout(focusInput, timeOutValue); // // return a command to unsubscribe from everything. @@ -54,14 +41,11 @@ }; }); - function getOS() { - var result = osNames[0]; - - return result; - } - function switchView(view) { - if (view === "filemanager" || view === "preferences") { + // + // Only switch if going to the filemanager. + // + if (view === "filemanager") { dispatch("switchView", { view: view, }); @@ -85,7 +69,7 @@ if (vimInput !== null && keepBlur) { vimInput.focus(); } - timeOut = setTimeout(focusInput, 1000); + timeOut = setTimeout(focusInput, timeOutValue); } @@ -135,7 +119,7 @@ } }} /> -

Preferences

+

Modal File Manager: Preferences

    {#if showPanel === "general"}
  • { keepBlur = e.detail.blur; - if (keepBlur) timeOut = setTimeout(focusInput, 1000); + if (timeOut !== null) clearTimeout(timeOut); + if (keepBlur) timeOut = setTimeout(focusInput, timeOutValue); }} /> {:else if showPanel === "theme"} @@ -224,7 +209,8 @@ }} on:setKeyProcess={(e) => { keepBlur = e.detail.blur; - if (keepBlur) timeOut = setTimeout(focusInput, 1000); + if (timeOut !== null) clearTimeout(timeOut); + if (keepBlur) timeOut = setTimeout(focusInput, timeOutValue); }} /> {:else if showPanel === "extension"} @@ -237,7 +223,7 @@ }} on:setKeyProcess={(e) => { keepBlur = e.detail.blur; - if (keepBlur) timeOut = setTimeout(focusInput, 1000); + if (keepBlur) timeOut = setTimeout(focusInput, timeOutValue); }} /> {/if} diff --git a/frontend/src/components/ThemeItem.svelte b/frontend/src/components/ThemeItem.svelte index 90ab3e4..7d83760 100644 --- a/frontend/src/components/ThemeItem.svelte +++ b/frontend/src/components/ThemeItem.svelte @@ -1,7 +1,7 @@ @@ -70,6 +69,10 @@ bind:value on:blur={() => { changeStringValue(value); + setFocus(true); + }} + on:mouseover={() => { + setFocus(false); }} /> {:else} @@ -86,11 +89,14 @@
{#if changeColor}
- { - colorCallback(e.detail); + { + colorCallback(e.detail.hex); }} - startColor={value} + bind:hex + {label} + isOpen="true" + isPopup="false" />
diff --git a/frontend/src/components/ThemePrefs.svelte b/frontend/src/components/ThemePrefs.svelte index 01ef072..b53678d 100644 --- a/frontend/src/components/ThemePrefs.svelte +++ b/frontend/src/components/ThemePrefs.svelte @@ -15,13 +15,11 @@ let first = true; onMount(async () => { - $config = value; if (typeof $config.OS !== "undefined") { await loadThemeList(); } - return () => { - }; + return () => {}; }); afterUpdate(() => { @@ -34,12 +32,10 @@ }); async function loadThemeList() { - var themedir = await $config.OS.appendPath( - $config.configDir, - "themes" - ); + var themedir = await $config.OS.appendPath($config.configDir, "themes"); themeList = await $config.OS.getDirList(themedir); themeName = ""; + themeList = themeList; } function setFocus(flag) { @@ -54,10 +50,7 @@ } async function createTheme() { - var thmDir = await $config.OS.appendPath( - $config.configDir, - "themes" - ); + var thmDir = await $config.OS.appendPath($config.configDir, "themes"); thmDir = await $config.OS.appendPath(thmDir, themeName); if (!(await $config.OS.dirExists(thmDir))) { await $config.OS.createDir(thmDir); @@ -75,10 +68,7 @@ // // Add the needed fields to the package.json file for Modal File Manager. // - const pfile = await $config.OS.appendPath( - thmDir, - "package.json" - ); + const pfile = await $config.OS.appendPath(thmDir, "package.json"); var pkgConfig = JSON.parse(await $config.OS.readFile(pfile)); pkgConfig.mfmtheme = { name: themeName, @@ -115,26 +105,17 @@ } async function updateTheme(thm) { - var thmDir = await $config.OS.appendPath( - $config.configDir, - "themes" - ); + var thmDir = await $config.OS.appendPath($config.configDir, "themes"); thmDir = await $config.OS.appendPath(thmDir, thm.name); const pfile = await $config.OS.appendPath(thmDir, "package.json"); var pkgConfig = await $config.OS.readFile(pfile); pkgConfig = JSON.parse(pkgConfig); - var thmFile = await $config.OS.appendPath( - thmDir, - pkgConfig.mfmtheme.main - ); + var thmFile = await $config.OS.appendPath(thmDir, pkgConfig.mfmtheme.main); await $config.OS.writeFile(thmFile, JSON.stringify($theme)); } async function deleteTheme(thm) { - var thmDir = await $config.OS.appendPath( - $config.configDir, - "themes" - ); + var thmDir = await $config.OS.appendPath($config.configDir, "themes"); await $config.OS.deleteEntries( { dir: thmDir, @@ -159,18 +140,12 @@ } async function setTheme(thm) { - var thmDir = await $config.OS.appendPath( - $config.configDir, - "themes" - ); + var thmDir = await $config.OS.appendPath($config.configDir, "themes"); thmDir = await $config.OS.appendPath(thmDir, thm.name); const pfile = await $config.OS.appendPath(thmDir, "package.json"); var pkgConfig = await $config.OS.readFile(pfile); pkgConfig = JSON.parse(pkgConfig); - var thmFile = await $config.OS.appendPath( - thmDir, - pkgConfig.mfmtheme.main - ); + var thmFile = await $config.OS.appendPath(thmDir, pkgConfig.mfmtheme.main); $theme = await $config.OS.readFile(thmFile); $theme = JSON.parse($theme); } @@ -194,6 +169,9 @@ on:change={(e) => { changeValue(kv, e); }} + on:setKeyProcess={(e) => { + setFocus(e.detail.blur); + }} /> {/each} diff --git a/go.mod b/go.mod index 1ac78b3..2025351 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/wailsapp/mimetype v1.4.1 // indirect golang.org/x/crypto v0.1.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.1.0 // indirect - golang.org/x/sys v0.1.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/go.sum b/go.sum index 420a17f..452bd60 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -89,12 +89,12 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
- + { + setFocus(false); + }} + /> { + setFocus(false); + }} + on:mouseleave={addKV} />
{name}{value}