@basthon/gui-base 0.36.4 → 0.36.5

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 CHANGED
@@ -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
@@ -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.4",
3
+ "version": "0.36.5",
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.4",
29
- "@basthon/kernel-loader": "^0.36.4",
28
+ "@basthon/kernel-base": "^0.36.5",
29
+ "@basthon/kernel-loader": "^0.36.5",
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": "edcb6d1d099440e2fadbeb12acf34b5cc77486a2"
43
+ "gitHead": "9d7e47b7e7fa8ba8cbaa4bcf77fe1f282fca79d0"
41
44
  }