@xwiki/cristal-electron-settings-main 1.2.0 → 1.4.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/package.json +9 -6
- package/dist/defaultSettings.json.d.ts +0 -47
- package/dist/index.d.cts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.es.js +0 -51
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/dist/storage.d.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-electron-settings-main",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://jira.xwiki.org/projects/CRISTAL/"
|
|
14
14
|
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=24.0.0"
|
|
17
|
+
},
|
|
15
18
|
"type": "module",
|
|
16
19
|
"exports": {
|
|
17
20
|
".": {
|
|
@@ -28,17 +31,17 @@
|
|
|
28
31
|
"main": "./dist/index.es.js",
|
|
29
32
|
"types": "./dist/index.d.ts",
|
|
30
33
|
"dependencies": {
|
|
31
|
-
"@xwiki/platform-configuration-api": "18.
|
|
34
|
+
"@xwiki/platform-configuration-api": "18.4.0",
|
|
32
35
|
"electron-store": "11.0.2",
|
|
33
|
-
"@xwiki/cristal-settings-api": "1.
|
|
36
|
+
"@xwiki/cristal-settings-api": "1.4.0"
|
|
34
37
|
},
|
|
35
38
|
"peerDependencies": {
|
|
36
|
-
"electron": "
|
|
39
|
+
"electron": "41.1.0"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"typescript": "5.9.3",
|
|
40
|
-
"vite": "7.3.
|
|
41
|
-
"@xwiki/cristal-dev-config": "1.
|
|
43
|
+
"vite": "7.3.2",
|
|
44
|
+
"@xwiki/cristal-dev-config": "1.4.0"
|
|
42
45
|
},
|
|
43
46
|
"scripts": {
|
|
44
47
|
"api-extractor:local": "api-extractor run --local",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
"configuration": {
|
|
3
|
-
"FileSystem": {
|
|
4
|
-
"name": "FileSystem",
|
|
5
|
-
"configType": "FileSystem",
|
|
6
|
-
"serverRendering": false,
|
|
7
|
-
"offline": false,
|
|
8
|
-
"designSystem": "vuetify",
|
|
9
|
-
"editor": "blocknote"
|
|
10
|
-
},
|
|
11
|
-
"FileSystemSL": {
|
|
12
|
-
"name": "FileSystemSL",
|
|
13
|
-
"configType": "FileSystem",
|
|
14
|
-
"serverRendering": false,
|
|
15
|
-
"offline": false,
|
|
16
|
-
"designSystem": "shoelace",
|
|
17
|
-
"editor": "blocknote"
|
|
18
|
-
},
|
|
19
|
-
"XWiki": {
|
|
20
|
-
"name": "XWiki",
|
|
21
|
-
"configType": "XWiki",
|
|
22
|
-
"serverRendering": false,
|
|
23
|
-
"offline": false,
|
|
24
|
-
"baseURL": "https://cristal-backend.demo.xwiki.com/xwiki",
|
|
25
|
-
"baseRestURL": "/rest/cristal/page?media=json",
|
|
26
|
-
"homePage": "Main.WebHome",
|
|
27
|
-
"designSystem": "vuetify",
|
|
28
|
-
"editor": "blocknote",
|
|
29
|
-
"realtimeURL": "https://cristal.demo.xwiki.com:8093/collaboration"
|
|
30
|
-
},
|
|
31
|
-
"XWikiSL": {
|
|
32
|
-
"name": "XWikiSL",
|
|
33
|
-
"configType": "XWiki",
|
|
34
|
-
"serverRendering": false,
|
|
35
|
-
"offline": false,
|
|
36
|
-
"baseURL": "https://cristal-backend.demo.xwiki.com/xwiki",
|
|
37
|
-
"baseRestURL": "/rest/cristal/page?media=json",
|
|
38
|
-
"homePage": "Main.WebHome",
|
|
39
|
-
"designSystem": "shoelace",
|
|
40
|
-
"editor": "blocknote",
|
|
41
|
-
"realtimeURL": "https://cristal.demo.xwiki.com:8093/collaboration"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
;
|
|
46
|
-
|
|
47
|
-
export default _default;
|
package/dist/index.d.cts
DELETED
package/dist/index.d.ts
DELETED
package/dist/index.es.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import a from "electron-store";
|
|
2
|
-
import { ipcMain as t } from "electron";
|
|
3
|
-
const r = { FileSystem: { name: "FileSystem", configType: "FileSystem", serverRendering: !1, offline: !1, designSystem: "vuetify", editor: "blocknote" }, FileSystemSL: { name: "FileSystemSL", configType: "FileSystem", serverRendering: !1, offline: !1, designSystem: "shoelace", editor: "blocknote" }, XWiki: { name: "XWiki", configType: "XWiki", serverRendering: !1, offline: !1, baseURL: "https://cristal-backend.demo.xwiki.com/xwiki", baseRestURL: "/rest/cristal/page?media=json", homePage: "Main.WebHome", designSystem: "vuetify", editor: "blocknote", realtimeURL: "https://cristal.demo.xwiki.com:8093/collaboration" }, XWikiSL: { name: "XWikiSL", configType: "XWiki", serverRendering: !1, offline: !1, baseURL: "https://cristal-backend.demo.xwiki.com/xwiki", baseRestURL: "/rest/cristal/page?media=json", homePage: "Main.WebHome", designSystem: "shoelace", editor: "blocknote", realtimeURL: "https://cristal.demo.xwiki.com:8093/collaboration" } }, c = {
|
|
4
|
-
configuration: r
|
|
5
|
-
}, l = "configuration", n = "_raw", f = {
|
|
6
|
-
_raw: {
|
|
7
|
-
type: "string"
|
|
8
|
-
},
|
|
9
|
-
configuration: {
|
|
10
|
-
type: "object"
|
|
11
|
-
}
|
|
12
|
-
}, i = new a({
|
|
13
|
-
name: "settings",
|
|
14
|
-
// Here, we want to keep in the store the raw string representation of the
|
|
15
|
-
// file, since it should be parsed and serialized by the SettingsManager
|
|
16
|
-
// service. We still include the deserialized object in case we want to check
|
|
17
|
-
// some settings values on Electron's main process.
|
|
18
|
-
serialize: (e) => e._raw,
|
|
19
|
-
deserialize: (e) => ({ _raw: e, ...JSON.parse(e) }),
|
|
20
|
-
schema: f
|
|
21
|
-
});
|
|
22
|
-
function s(e) {
|
|
23
|
-
i.set(n, e);
|
|
24
|
-
}
|
|
25
|
-
function g() {
|
|
26
|
-
return i.size < 2 && s(JSON.stringify(c, null, 2)), i.get(n);
|
|
27
|
-
}
|
|
28
|
-
function k() {
|
|
29
|
-
return i.get(l);
|
|
30
|
-
}
|
|
31
|
-
function m(e) {
|
|
32
|
-
s(e);
|
|
33
|
-
}
|
|
34
|
-
function d() {
|
|
35
|
-
return g();
|
|
36
|
-
}
|
|
37
|
-
function u() {
|
|
38
|
-
t.handle(
|
|
39
|
-
"settings:save",
|
|
40
|
-
async (e, {
|
|
41
|
-
settings: o
|
|
42
|
-
}) => {
|
|
43
|
-
m(o);
|
|
44
|
-
}
|
|
45
|
-
), t.handle("settings:load", async () => d());
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
k as getConfigurations,
|
|
49
|
-
u as load
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/storage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport defaultSettings from \"./defaultSettings.json\";\nimport Store from \"electron-store\";\nimport type { Configurations } from \"@xwiki/platform-configuration-api\";\n\nconst configurationKey = \"configuration\";\nconst settingsKey = \"_raw\";\n\nconst schema = {\n _raw: {\n type: \"string\",\n },\n configuration: {\n type: \"object\",\n },\n};\n\ntype StoreType = {\n _raw: string;\n configuration: object;\n};\n\nconst storeInstance: Store<StoreType> = new Store<StoreType>({\n name: \"settings\",\n // Here, we want to keep in the store the raw string representation of the\n // file, since it should be parsed and serialized by the SettingsManager\n // service. We still include the deserialized object in case we want to check\n // some settings values on Electron's main process.\n serialize: (value: Record<string, unknown>) => value._raw as string,\n deserialize: (value: string) => ({ _raw: value, ...JSON.parse(value) }),\n schema,\n});\n\nfunction setSettings(value: string): void {\n storeInstance.set(settingsKey, value);\n}\n\nfunction getSettings(): string {\n if (storeInstance.size < 2) {\n setSettings(JSON.stringify(defaultSettings, null, 2));\n }\n return storeInstance.get(settingsKey);\n}\n\nfunction deleteSettings(): void {\n storeInstance.delete(settingsKey);\n}\n\n/**\n * @since 0.18\n * @beta\n */\nfunction getConfigurations(): Configurations {\n return storeInstance.get(configurationKey) as Configurations;\n}\n\nexport { deleteSettings, getConfigurations, getSettings, setSettings };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { getConfigurations, getSettings, setSettings } from \"./storage\";\nimport { ipcMain } from \"electron\";\n\nfunction saveSettings(settings: string): void {\n setSettings(settings);\n}\n\nfunction loadSettings(): string {\n return getSettings();\n}\n\n/**\n * @since 0.18\n * @beta\n */\nfunction load(): void {\n ipcMain.handle(\n \"settings:save\",\n async (\n _event,\n {\n settings,\n }: {\n settings: string;\n },\n ): Promise<void> => {\n saveSettings(settings);\n },\n );\n\n ipcMain.handle(\"settings:load\", async (): Promise<string> => {\n return loadSettings();\n });\n}\n\nexport { getConfigurations, load };\n"],"names":["configurationKey","settingsKey","schema","storeInstance","Store","value","setSettings","getSettings","defaultSettings","getConfigurations","saveSettings","settings","loadSettings","load","ipcMain","_event"],"mappings":";;;;GAwBMA,IAAmB,iBACnBC,IAAc,QAEdC,IAAS;AAAA,EACb,MAAM;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER,eAAe;AAAA,IACb,MAAM;AAAA,EAAA;AAEV,GAOMC,IAAkC,IAAIC,EAAiB;AAAA,EAC3D,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,WAAW,CAACC,MAAmCA,EAAM;AAAA,EACrD,aAAa,CAACA,OAAmB,EAAE,MAAMA,GAAO,GAAG,KAAK,MAAMA,CAAK;EACnE,QAAAH;AACF,CAAC;AAED,SAASI,EAAYD,GAAqB;AACxC,EAAAF,EAAc,IAAIF,GAAaI,CAAK;AACtC;AAEA,SAASE,IAAsB;AAC7B,SAAIJ,EAAc,OAAO,KACvBG,EAAY,KAAK,UAAUE,GAAiB,MAAM,CAAC,CAAC,GAE/CL,EAAc,IAAIF,CAAW;AACtC;AAUA,SAASQ,IAAoC;AAC3C,SAAON,EAAc,IAAIH,CAAgB;AAC3C;AClDA,SAASU,EAAaC,GAAwB;AAC5C,EAAAL,EAAYK,CAAQ;AACtB;AAEA,SAASC,IAAuB;AAC9B,SAAOL,EAAA;AACT;AAMA,SAASM,IAAa;AACpB,EAAAC,EAAQ;AAAA,IACN;AAAA,IACA,OACEC,GACA;AAAA,MACE,UAAAJ;AAAA,IAAA,MAIgB;AAClB,MAAAD,EAAaC,CAAQ;AAAA,IACvB;AAAA,EAAA,GAGFG,EAAQ,OAAO,iBAAiB,YACvBF,EAAA,CACR;AACH;"}
|
package/dist/index.umd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("electron-store"),require("electron")):typeof define=="function"&&define.amd?define(["exports","electron-store","electron"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["cristal_settings-main"]={},e.Store,e.electron))})(this,(function(e,t,s){"use strict";const r={configuration:{FileSystem:{name:"FileSystem",configType:"FileSystem",serverRendering:!1,offline:!1,designSystem:"vuetify",editor:"blocknote"},FileSystemSL:{name:"FileSystemSL",configType:"FileSystem",serverRendering:!1,offline:!1,designSystem:"shoelace",editor:"blocknote"},XWiki:{name:"XWiki",configType:"XWiki",serverRendering:!1,offline:!1,baseURL:"https://cristal-backend.demo.xwiki.com/xwiki",baseRestURL:"/rest/cristal/page?media=json",homePage:"Main.WebHome",designSystem:"vuetify",editor:"blocknote",realtimeURL:"https://cristal.demo.xwiki.com:8093/collaboration"},XWikiSL:{name:"XWikiSL",configType:"XWiki",serverRendering:!1,offline:!1,baseURL:"https://cristal-backend.demo.xwiki.com/xwiki",baseRestURL:"/rest/cristal/page?media=json",homePage:"Main.WebHome",designSystem:"shoelace",editor:"blocknote",realtimeURL:"https://cristal.demo.xwiki.com:8093/collaboration"}}},c="configuration",o="_raw",l={_raw:{type:"string"},configuration:{type:"object"}},n=new t({name:"settings",serialize:i=>i._raw,deserialize:i=>({_raw:i,...JSON.parse(i)}),schema:l});function a(i){n.set(o,i)}function f(){return n.size<2&&a(JSON.stringify(r,null,2)),n.get(o)}function g(){return n.get(c)}function d(i){a(i)}function m(){return f()}function u(){s.ipcMain.handle("settings:save",async(i,{settings:y})=>{d(y)}),s.ipcMain.handle("settings:load",async()=>m())}e.getConfigurations=g,e.load=u,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/storage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport defaultSettings from \"./defaultSettings.json\";\nimport Store from \"electron-store\";\nimport type { Configurations } from \"@xwiki/platform-configuration-api\";\n\nconst configurationKey = \"configuration\";\nconst settingsKey = \"_raw\";\n\nconst schema = {\n _raw: {\n type: \"string\",\n },\n configuration: {\n type: \"object\",\n },\n};\n\ntype StoreType = {\n _raw: string;\n configuration: object;\n};\n\nconst storeInstance: Store<StoreType> = new Store<StoreType>({\n name: \"settings\",\n // Here, we want to keep in the store the raw string representation of the\n // file, since it should be parsed and serialized by the SettingsManager\n // service. We still include the deserialized object in case we want to check\n // some settings values on Electron's main process.\n serialize: (value: Record<string, unknown>) => value._raw as string,\n deserialize: (value: string) => ({ _raw: value, ...JSON.parse(value) }),\n schema,\n});\n\nfunction setSettings(value: string): void {\n storeInstance.set(settingsKey, value);\n}\n\nfunction getSettings(): string {\n if (storeInstance.size < 2) {\n setSettings(JSON.stringify(defaultSettings, null, 2));\n }\n return storeInstance.get(settingsKey);\n}\n\nfunction deleteSettings(): void {\n storeInstance.delete(settingsKey);\n}\n\n/**\n * @since 0.18\n * @beta\n */\nfunction getConfigurations(): Configurations {\n return storeInstance.get(configurationKey) as Configurations;\n}\n\nexport { deleteSettings, getConfigurations, getSettings, setSettings };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { getConfigurations, getSettings, setSettings } from \"./storage\";\nimport { ipcMain } from \"electron\";\n\nfunction saveSettings(settings: string): void {\n setSettings(settings);\n}\n\nfunction loadSettings(): string {\n return getSettings();\n}\n\n/**\n * @since 0.18\n * @beta\n */\nfunction load(): void {\n ipcMain.handle(\n \"settings:save\",\n async (\n _event,\n {\n settings,\n }: {\n settings: string;\n },\n ): Promise<void> => {\n saveSettings(settings);\n },\n );\n\n ipcMain.handle(\"settings:load\", async (): Promise<string> => {\n return loadSettings();\n });\n}\n\nexport { getConfigurations, load };\n"],"names":["configurationKey","settingsKey","schema","storeInstance","Store","value","setSettings","getSettings","defaultSettings","getConfigurations","saveSettings","settings","loadSettings","load","ipcMain","_event"],"mappings":"0sCAwBMA,EAAmB,gBACnBC,EAAc,OAEdC,EAAS,CACb,KAAM,CACJ,KAAM,QAAA,EAER,cAAe,CACb,KAAM,QAAA,CAEV,EAOMC,EAAkC,IAAIC,EAAiB,CAC3D,KAAM,WAKN,UAAYC,GAAmCA,EAAM,KACrD,YAAcA,IAAmB,CAAE,KAAMA,EAAO,GAAG,KAAK,MAAMA,CAAK,IACnE,OAAAH,CACF,CAAC,EAED,SAASI,EAAYD,EAAqB,CACxCF,EAAc,IAAIF,EAAaI,CAAK,CACtC,CAEA,SAASE,GAAsB,CAC7B,OAAIJ,EAAc,KAAO,GACvBG,EAAY,KAAK,UAAUE,EAAiB,KAAM,CAAC,CAAC,EAE/CL,EAAc,IAAIF,CAAW,CACtC,CAUA,SAASQ,GAAoC,CAC3C,OAAON,EAAc,IAAIH,CAAgB,CAC3C,CClDA,SAASU,EAAaC,EAAwB,CAC5CL,EAAYK,CAAQ,CACtB,CAEA,SAASC,GAAuB,CAC9B,OAAOL,EAAA,CACT,CAMA,SAASM,GAAa,CACpBC,EAAAA,QAAQ,OACN,gBACA,MACEC,EACA,CACE,SAAAJ,CAAA,IAIgB,CAClBD,EAAaC,CAAQ,CACvB,CAAA,EAGFG,UAAQ,OAAO,gBAAiB,SACvBF,EAAA,CACR,CACH"}
|
package/dist/storage.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Configurations } from '@xwiki/platform-configuration-api';
|
|
2
|
-
declare function setSettings(value: string): void;
|
|
3
|
-
declare function getSettings(): string;
|
|
4
|
-
declare function deleteSettings(): void;
|
|
5
|
-
/**
|
|
6
|
-
* @since 0.18
|
|
7
|
-
* @beta
|
|
8
|
-
*/
|
|
9
|
-
declare function getConfigurations(): Configurations;
|
|
10
|
-
export { deleteSettings, getConfigurations, getSettings, setSettings };
|