@m2c2kit/core 0.3.5 → 0.3.6

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/index.d.ts CHANGED
@@ -254,6 +254,7 @@ declare class ImageManager {
254
254
  * @returns A promise of type void
255
255
  */
256
256
  private renderBrowserImage;
257
+ private arrayBufferToBase64String;
257
258
  private inferImageSubtypeFromUrl;
258
259
  private convertRenderedDataUrlImageToCanvasKitImage;
259
260
  /**
package/dist/index.js CHANGED
@@ -5516,9 +5516,7 @@ class ImageManager {
5516
5516
  image.src = "data:image/svg+xml," + encodeURIComponent(browserImage.svgString);
5517
5517
  } else if (browserImage.url) {
5518
5518
  fetch(browserImage.url).then((response) => response.arrayBuffer()).then((data) => {
5519
- const base64String = btoa(
5520
- String.fromCharCode(...new Uint8Array(data))
5521
- );
5519
+ const base64String = this.arrayBufferToBase64String(data);
5522
5520
  const subtype = this.inferImageSubtypeFromUrl(browserImage.url);
5523
5521
  image.src = "data:image/" + subtype + ";base64," + base64String;
5524
5522
  });
@@ -5529,6 +5527,14 @@ class ImageManager {
5529
5527
  }
5530
5528
  });
5531
5529
  }
5530
+ arrayBufferToBase64String(buffer) {
5531
+ let binary = "";
5532
+ const bytes = new Uint8Array(buffer);
5533
+ for (let i = 0; i < bytes.byteLength; i++) {
5534
+ binary += String.fromCharCode(bytes[i]);
5535
+ }
5536
+ return window.btoa(binary);
5537
+ }
5532
5538
  inferImageSubtypeFromUrl(url) {
5533
5539
  var _a, _b;
5534
5540
  let subtype = "jpeg";
@@ -6632,7 +6638,7 @@ class Session {
6632
6638
  */
6633
6639
  constructor(options) {
6634
6640
  this.sessionDictionary = /* @__PURE__ */ new Map();
6635
- this.version = "0.3.5 (f42dc419)";
6641
+ this.version = "0.3.6 (73f07a35)";
6636
6642
  this.options = options;
6637
6643
  for (const activity of this.options.activities) {
6638
6644
  if (this.options.activities.filter((a) => a === activity).length > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m2c2kit/core",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "The m2c2kit core functionality",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "@rollup/plugin-commonjs": "24.1.0",
29
29
  "@rollup/plugin-node-resolve": "15.0.2",
30
30
  "@rollup/plugin-replace": "5.0.2",
31
- "@types/jest": "29.5.0",
31
+ "@types/jest": "29.5.1",
32
32
  "@types/jsdom": "21.1.1",
33
33
  "canvas": "2.11.2",
34
34
  "canvaskit-wasm": "0.38.0",