@basthon/gui-base 0.36.3 → 0.36.7
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/lib/main.d.ts +9 -1
- package/lib/main.js +21 -3
- package/package.json +7 -4
package/lib/main.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare class GUIBase {
|
|
|
32
32
|
/**
|
|
33
33
|
* Notify the user with an error.
|
|
34
34
|
*/
|
|
35
|
-
error(message: string): void;
|
|
35
|
+
error(title: string, message: string): void;
|
|
36
36
|
/**
|
|
37
37
|
* Ask the user to confirm or cancel.
|
|
38
38
|
*/
|
|
@@ -104,4 +104,12 @@ export declare class GUIBase {
|
|
|
104
104
|
* Binding to kernel's XHR.
|
|
105
105
|
*/
|
|
106
106
|
static xhr(params: any): Promise<unknown>;
|
|
107
|
+
/**
|
|
108
|
+
* Compress a string to another string (URL safe).
|
|
109
|
+
*/
|
|
110
|
+
deflate(content: string): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Reverse version of deflate.
|
|
113
|
+
*/
|
|
114
|
+
inflate(content: string): Promise<string>;
|
|
107
115
|
}
|
package/lib/main.js
CHANGED
|
@@ -37,7 +37,7 @@ export class GUIBase {
|
|
|
37
37
|
/**
|
|
38
38
|
* Notify the user with an error.
|
|
39
39
|
*/
|
|
40
|
-
error(message) { }
|
|
40
|
+
error(title, message) { }
|
|
41
41
|
/**
|
|
42
42
|
* Ask the user to confirm or cancel.
|
|
43
43
|
*/
|
|
@@ -58,7 +58,7 @@ export class GUIBase {
|
|
|
58
58
|
if (message == null)
|
|
59
59
|
message = error.toString();
|
|
60
60
|
message = message.split('\n').join('<br>');
|
|
61
|
-
this.error(`Erreur : ${message}`);
|
|
61
|
+
this.error("Erreur", `Erreur : ${message}`);
|
|
62
62
|
// In case of error, force loader hiding.
|
|
63
63
|
try {
|
|
64
64
|
this._loader.hideLoader();
|
|
@@ -138,7 +138,7 @@ export class GUIBase {
|
|
|
138
138
|
reader.onload = async (event) => {
|
|
139
139
|
var _a, _b;
|
|
140
140
|
(_a = this.kernel) === null || _a === void 0 ? void 0 : _a.putRessource(file.name, reader.result);
|
|
141
|
-
this.info("Fichier utilisable depuis
|
|
141
|
+
this.info("Fichier utilisable depuis ${this.kernel?.languageName()", `${file.name} est maintenant utilisable depuis ${(_b = this.kernel) === null || _b === void 0 ? void 0 : _b.languageName()}`);
|
|
142
142
|
resolve();
|
|
143
143
|
};
|
|
144
144
|
reader.onerror = reject;
|
|
@@ -218,6 +218,24 @@ export class GUIBase {
|
|
|
218
218
|
static async xhr(params) {
|
|
219
219
|
return await KernelBase.xhr(params);
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Compress a string to another string (URL safe).
|
|
223
|
+
*/
|
|
224
|
+
async deflate(content) {
|
|
225
|
+
// dynamic import for webpack
|
|
226
|
+
const pako = await import("pako");
|
|
227
|
+
const { Base64 } = await import("js-base64");
|
|
228
|
+
return Base64.fromUint8Array(pako.deflate(content), true);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Reverse version of deflate.
|
|
232
|
+
*/
|
|
233
|
+
async inflate(content) {
|
|
234
|
+
// dynamic import for webpack
|
|
235
|
+
const pako = await import("pako");
|
|
236
|
+
const { Base64 } = await import("js-base64");
|
|
237
|
+
return pako.inflate(Base64.toUint8Array(content), { to: 'string' });
|
|
238
|
+
}
|
|
221
239
|
}
|
|
222
240
|
/**
|
|
223
241
|
* Copy a text to clipboard.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/gui-base",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.7",
|
|
4
4
|
"description": "Basthon - Base GUI",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
"clean": "rm -rf lib/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@basthon/kernel-base": "^0.36.
|
|
29
|
-
"@basthon/kernel-loader": "^0.36.
|
|
28
|
+
"@basthon/kernel-base": "^0.36.7",
|
|
29
|
+
"@basthon/kernel-loader": "^0.36.7",
|
|
30
|
+
"js-base64": "^3.7.2",
|
|
31
|
+
"pako": "^2.0.4",
|
|
30
32
|
"promise-delegate": "^1.0.1"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
35
|
+
"@types/pako": "^1.0.2",
|
|
33
36
|
"gulp": "^4.0.2",
|
|
34
37
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
35
38
|
"typescript": "~4.4.4"
|
|
@@ -37,5 +40,5 @@
|
|
|
37
40
|
"publishConfig": {
|
|
38
41
|
"access": "public"
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ac135f7d63e88c0830dbf557f70d2912bc3fd488"
|
|
41
44
|
}
|