@vasakgroup/plugin-config-manager 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-js/index.cjs CHANGED
@@ -6,21 +6,21 @@ var vue = require('vue');
6
6
 
7
7
  async function writeConfig(value) {
8
8
  await core.invoke("plugin:config-manager|write_config", {
9
- payload: JSON.stringify(value), // Serializar VSKConfig y enviarlo como 'payload'
9
+ payload: JSON.stringify(value),
10
10
  });
11
11
  }
12
12
  async function setDarkMode(darkmode) {
13
13
  await core.invoke("plugin:config-manager|set_darkmode", { darkmode });
14
14
  }
15
15
  async function readConfig() {
16
- const jsonString = await core.invoke(// Esperar que invoke resuelva directamente con la cadena JSON
17
- "plugin:config-manager|read_config");
16
+ const jsonString = await core.invoke("plugin:config-manager|read_config");
18
17
  if (jsonString) {
19
18
  try {
20
- return JSON.parse(jsonString); // Parsear la cadena JSON
19
+ return JSON.parse(jsonString);
21
20
  }
22
21
  catch (error) {
23
- console.error("Failed to parse config JSON:", error, "Raw string:", jsonString);
22
+ console.error("Failed to parse config JSON:", error);
23
+ console.debug("Config JSON length:", jsonString.length);
24
24
  return null;
25
25
  }
26
26
  }
@@ -28,38 +28,35 @@ async function readConfig() {
28
28
  }
29
29
  let configStore = null;
30
30
  const useConfigStore = () => {
31
- if (!configStore) {
32
- configStore = pinia.defineStore("config", () => {
33
- const config = vue.ref(null);
34
- const loadConfig = async () => {
35
- config.value = await readConfig();
36
- setMode();
37
- setProperties();
38
- };
39
- const setMode = () => {
40
- if (config.value?.style?.darkmode) {
41
- document.documentElement.classList.add("dark");
31
+ configStore ??= pinia.defineStore("config", () => {
32
+ const config = vue.ref(null);
33
+ const loadConfig = async () => {
34
+ config.value = await readConfig();
35
+ setMode();
36
+ setProperties();
37
+ };
38
+ const setMode = () => {
39
+ if (config.value?.style?.darkmode) {
40
+ document.documentElement.classList.add("dark");
41
+ }
42
+ else {
43
+ document.documentElement.classList.remove("dark");
44
+ }
45
+ };
46
+ const setProperties = () => {
47
+ if (config.value?.style) {
48
+ const { primarycolor, radius } = config.value.style;
49
+ if (primarycolor && primarycolor.trim() !== "") {
50
+ document.documentElement.style.setProperty("--primary-color", primarycolor);
42
51
  }
43
- else {
44
- document.documentElement.classList.remove("dark");
45
- }
46
- };
47
- const setProperties = () => {
48
- if (config.value?.style) {
49
- const { primarycolor, radius } = config.value.style;
50
- // Manejar primarycolor
51
- if (primarycolor && primarycolor.trim() !== "") {
52
- document.documentElement.style.setProperty("--primary-color", primarycolor);
53
- }
54
- document.documentElement.style.setProperty("--border-radius", `${radius}px`);
55
- }
56
- };
57
- return {
58
- config,
59
- loadConfig
60
- };
61
- });
62
- }
52
+ document.documentElement.style.setProperty("--border-radius", `${radius}px`);
53
+ }
54
+ };
55
+ return {
56
+ config,
57
+ loadConfig,
58
+ };
59
+ });
63
60
  return configStore();
64
61
  };
65
62
 
@@ -7,8 +7,11 @@ export type VSKConfig = {
7
7
  primarycolor: string;
8
8
  radius: number;
9
9
  };
10
- info: {
11
- logo: string;
10
+ desktop: {
11
+ wallpaper: string[];
12
+ iconsize: number;
13
+ showfiles: boolean;
14
+ showhiddenfiles: boolean;
12
15
  };
13
16
  };
14
17
  export declare const useConfigStore: () => import("pinia").Store<"config", Pick<() => {
package/dist-js/index.js CHANGED
@@ -4,21 +4,21 @@ import { ref } from 'vue';
4
4
 
5
5
  async function writeConfig(value) {
6
6
  await invoke("plugin:config-manager|write_config", {
7
- payload: JSON.stringify(value), // Serializar VSKConfig y enviarlo como 'payload'
7
+ payload: JSON.stringify(value),
8
8
  });
9
9
  }
10
10
  async function setDarkMode(darkmode) {
11
11
  await invoke("plugin:config-manager|set_darkmode", { darkmode });
12
12
  }
13
13
  async function readConfig() {
14
- const jsonString = await invoke(// Esperar que invoke resuelva directamente con la cadena JSON
15
- "plugin:config-manager|read_config");
14
+ const jsonString = await invoke("plugin:config-manager|read_config");
16
15
  if (jsonString) {
17
16
  try {
18
- return JSON.parse(jsonString); // Parsear la cadena JSON
17
+ return JSON.parse(jsonString);
19
18
  }
20
19
  catch (error) {
21
- console.error("Failed to parse config JSON:", error, "Raw string:", jsonString);
20
+ console.error("Failed to parse config JSON:", error);
21
+ console.debug("Config JSON length:", jsonString.length);
22
22
  return null;
23
23
  }
24
24
  }
@@ -26,38 +26,35 @@ async function readConfig() {
26
26
  }
27
27
  let configStore = null;
28
28
  const useConfigStore = () => {
29
- if (!configStore) {
30
- configStore = defineStore("config", () => {
31
- const config = ref(null);
32
- const loadConfig = async () => {
33
- config.value = await readConfig();
34
- setMode();
35
- setProperties();
36
- };
37
- const setMode = () => {
38
- if (config.value?.style?.darkmode) {
39
- document.documentElement.classList.add("dark");
29
+ configStore ??= defineStore("config", () => {
30
+ const config = ref(null);
31
+ const loadConfig = async () => {
32
+ config.value = await readConfig();
33
+ setMode();
34
+ setProperties();
35
+ };
36
+ const setMode = () => {
37
+ if (config.value?.style?.darkmode) {
38
+ document.documentElement.classList.add("dark");
39
+ }
40
+ else {
41
+ document.documentElement.classList.remove("dark");
42
+ }
43
+ };
44
+ const setProperties = () => {
45
+ if (config.value?.style) {
46
+ const { primarycolor, radius } = config.value.style;
47
+ if (primarycolor && primarycolor.trim() !== "") {
48
+ document.documentElement.style.setProperty("--primary-color", primarycolor);
40
49
  }
41
- else {
42
- document.documentElement.classList.remove("dark");
43
- }
44
- };
45
- const setProperties = () => {
46
- if (config.value?.style) {
47
- const { primarycolor, radius } = config.value.style;
48
- // Manejar primarycolor
49
- if (primarycolor && primarycolor.trim() !== "") {
50
- document.documentElement.style.setProperty("--primary-color", primarycolor);
51
- }
52
- document.documentElement.style.setProperty("--border-radius", `${radius}px`);
53
- }
54
- };
55
- return {
56
- config,
57
- loadConfig
58
- };
59
- });
60
- }
50
+ document.documentElement.style.setProperty("--border-radius", `${radius}px`);
51
+ }
52
+ };
53
+ return {
54
+ config,
55
+ loadConfig,
56
+ };
57
+ });
61
58
  return configStore();
62
59
  };
63
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vasakgroup/plugin-config-manager",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "author": "Joaquin (Pato) Decima <jdecima@vasak.net.ar>",
5
5
  "description": "A tauri plugin for managing configuration in a Vue 3 application using Pinia.",
6
6
  "type": "module",
@@ -28,28 +28,28 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@rollup/plugin-typescript": "^12.3.0",
31
- "rollup": "^4.53.5",
31
+ "rollup": "^4.55.1",
32
32
  "typescript": "^5.9.3",
33
33
  "tslib": "^2.8.1"
34
34
  },
35
35
  "repository": {
36
- "url": "https://github.com/Vasak-OS/tauri-plugin-config-manager.git",
37
- "type": "git"
38
- },
39
- "license": "LGPL-3.0-or-later",
40
- "keywords": [
41
- "tauri",
42
- "plugin",
43
- "vue3",
44
- "pinia",
45
- "configuration",
46
- "settings",
47
- "management",
48
- "linux",
49
- "vasakos"
50
- ],
51
- "publishConfig": {
52
- "access": "public",
53
- "registry": "https://registry.npmjs.org/"
54
- }
36
+ "url": "https://github.com/Vasak-OS/tauri-plugin-config-manager.git",
37
+ "type": "git"
38
+ },
39
+ "license": "LGPL-3.0-or-later",
40
+ "keywords": [
41
+ "tauri",
42
+ "plugin",
43
+ "vue3",
44
+ "pinia",
45
+ "configuration",
46
+ "settings",
47
+ "management",
48
+ "linux",
49
+ "vasakos"
50
+ ],
51
+ "publishConfig": {
52
+ "access": "public",
53
+ "registry": "https://registry.npmjs.org/"
54
+ }
55
55
  }