@xwiki/cristal-settings-browser 1.4.0 → 1.6.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/api-extractor.json +1 -1
- package/dist/defaultSettingsStorage.d.ts +12 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.es.js +32 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +9 -7
- package/tsconfig.json +1 -1
package/api-extractor.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SettingsManager, SettingsStorage } from '@xwiki/cristal-settings-api';
|
|
2
|
+
/**
|
|
3
|
+
* Default implementation for {@link SettingsStorage}.
|
|
4
|
+
* It stores and retrieves settings as JSON from the browser's local storage.
|
|
5
|
+
* @since 0.18
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare class DefaultSettingsStorage implements SettingsStorage {
|
|
9
|
+
private readonly localStorageSettingsKey;
|
|
10
|
+
save(settingsManager: SettingsManager): Promise<void>;
|
|
11
|
+
load(settingsManager: SettingsManager): Promise<void>;
|
|
12
|
+
}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { injectable as g } from "inversify";
|
|
2
|
+
var i = Object.getOwnPropertyDescriptor, S = (t, e, l, r) => {
|
|
3
|
+
for (var o = r > 1 ? void 0 : r ? i(e, l) : e, a = t.length - 1, s; a >= 0; a--)
|
|
4
|
+
(s = t[a]) && (o = s(o) || o);
|
|
5
|
+
return o;
|
|
6
|
+
};
|
|
7
|
+
let n = class {
|
|
8
|
+
localStorageSettingsKey = "settings";
|
|
9
|
+
async save(t) {
|
|
10
|
+
window.localStorage.setItem(
|
|
11
|
+
this.localStorageSettingsKey,
|
|
12
|
+
t.toJSON()
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
async load(t) {
|
|
16
|
+
t.fromJSON(
|
|
17
|
+
window.localStorage.getItem(this.localStorageSettingsKey) ?? "[]"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
n = S([
|
|
22
|
+
g()
|
|
23
|
+
], n);
|
|
24
|
+
class p {
|
|
25
|
+
constructor(e) {
|
|
26
|
+
e.bind("SettingsStorage").to(n).inSingletonScope();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
p as ComponentInit
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/defaultSettingsStorage.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 { injectable } from \"inversify\";\nimport type {\n SettingsManager,\n SettingsStorage,\n} from \"@xwiki/cristal-settings-api\";\n\n/**\n * Default implementation for {@link SettingsStorage}.\n * It stores and retrieves settings as JSON from the browser's local storage.\n * @since 0.18\n * @beta\n */\n@injectable()\nexport class DefaultSettingsStorage implements SettingsStorage {\n private readonly localStorageSettingsKey = \"settings\";\n\n async save(settingsManager: SettingsManager): Promise<void> {\n window.localStorage.setItem(\n this.localStorageSettingsKey,\n settingsManager.toJSON(),\n );\n }\n\n async load(settingsManager: SettingsManager): Promise<void> {\n settingsManager.fromJSON(\n window.localStorage.getItem(this.localStorageSettingsKey) ?? \"[]\",\n );\n }\n}\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 { DefaultSettingsStorage } from \"./defaultSettingsStorage\";\nimport { Container } from \"inversify\";\nimport type { SettingsStorage } from \"@xwiki/cristal-settings-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<SettingsStorage>(\"SettingsStorage\")\n .to(DefaultSettingsStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DefaultSettingsStorage","settingsManager","__decorateClass","injectable","ComponentInit","container"],"mappings":";;;;;;AAiCO,IAAMA,IAAN,MAAwD;AAAA,EAC5C,0BAA0B;AAAA,EAE3C,MAAM,KAAKC,GAAiD;AAC1D,WAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAgB,OAAA;AAAA,IAAO;AAAA,EAE3B;AAAA,EAEA,MAAM,KAAKA,GAAiD;AAC1D,IAAAA,EAAgB;AAAA,MACd,OAAO,aAAa,QAAQ,KAAK,uBAAuB,KAAK;AAAA,IAAA;AAAA,EAEjE;AACF;AAfaD,IAANE,EAAA;AAAA,EADNC,EAAA;AAAW,GACCH,CAAA;ACNN,MAAMI,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAAsB,iBAAiB,EACvC,GAAGL,CAAsB,EACzB,iBAAA;AAAA,EACL;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("inversify")):typeof define=="function"&&define.amd?define(["exports","inversify"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e["cristal_settings-browser"]={},e.inversify))})(this,(function(e,n){"use strict";var c=Object.getOwnPropertyDescriptor,f=(t,o,S,a)=>{for(var i=a>1?void 0:a?c(o,S):o,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=l(i)||i);return i};let s=class{localStorageSettingsKey="settings";async save(t){window.localStorage.setItem(this.localStorageSettingsKey,t.toJSON())}async load(t){t.fromJSON(window.localStorage.getItem(this.localStorageSettingsKey)??"[]")}};s=f([n.injectable()],s);class g{constructor(o){o.bind("SettingsStorage").to(s).inSingletonScope()}}e.ComponentInit=g,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/defaultSettingsStorage.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 { injectable } from \"inversify\";\nimport type {\n SettingsManager,\n SettingsStorage,\n} from \"@xwiki/cristal-settings-api\";\n\n/**\n * Default implementation for {@link SettingsStorage}.\n * It stores and retrieves settings as JSON from the browser's local storage.\n * @since 0.18\n * @beta\n */\n@injectable()\nexport class DefaultSettingsStorage implements SettingsStorage {\n private readonly localStorageSettingsKey = \"settings\";\n\n async save(settingsManager: SettingsManager): Promise<void> {\n window.localStorage.setItem(\n this.localStorageSettingsKey,\n settingsManager.toJSON(),\n );\n }\n\n async load(settingsManager: SettingsManager): Promise<void> {\n settingsManager.fromJSON(\n window.localStorage.getItem(this.localStorageSettingsKey) ?? \"[]\",\n );\n }\n}\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 { DefaultSettingsStorage } from \"./defaultSettingsStorage\";\nimport { Container } from \"inversify\";\nimport type { SettingsStorage } from \"@xwiki/cristal-settings-api\";\n\n/**\n * @beta\n */\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<SettingsStorage>(\"SettingsStorage\")\n .to(DefaultSettingsStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DefaultSettingsStorage","settingsManager","__decorateClass","injectable","ComponentInit","container"],"mappings":"+aAiCO,IAAMA,EAAN,KAAwD,CAC5C,wBAA0B,WAE3C,MAAM,KAAKC,EAAiD,CAC1D,OAAO,aAAa,QAClB,KAAK,wBACLA,EAAgB,OAAA,CAAO,CAE3B,CAEA,MAAM,KAAKA,EAAiD,CAC1DA,EAAgB,SACd,OAAO,aAAa,QAAQ,KAAK,uBAAuB,GAAK,IAAA,CAEjE,CACF,EAfaD,EAANE,EAAA,CADNC,EAAAA,WAAA,CAAW,EACCH,CAAA,ECNN,MAAMI,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAAsB,iBAAiB,EACvC,GAAGL,CAAsB,EACzB,iBAAA,CACL,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-settings-browser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -28,18 +28,20 @@
|
|
|
28
28
|
"main": "./dist/index.es.js",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@xwiki/platform-api": "18.
|
|
32
|
-
"@xwiki/cristal-settings-api": "1.
|
|
31
|
+
"@xwiki/platform-api": "18.6.0",
|
|
32
|
+
"@xwiki/cristal-settings-api": "1.6.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"inversify": "8.x"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@xwiki/platform-dsapi": "18.
|
|
39
|
-
"
|
|
38
|
+
"@xwiki/platform-dsapi": "18.6.0",
|
|
39
|
+
"@xwiki/platform-tool-apiextractorconfig": "18.6.0",
|
|
40
|
+
"@xwiki/platform-tool-tsconfig": "18.6.0",
|
|
41
|
+
"inversify": "8.1.1",
|
|
40
42
|
"typescript": "5.9.3",
|
|
41
|
-
"vite": "7.3.
|
|
42
|
-
"@xwiki/cristal-dev-config": "1.
|
|
43
|
+
"vite": "7.3.5",
|
|
44
|
+
"@xwiki/cristal-dev-config": "1.6.0"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
45
47
|
"api-extractor:local": "api-extractor run --local",
|