@selvajs/ui 6.6.0-beta.7 → 6.6.0-beta.8

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.
@@ -1,4 +1,4 @@
1
- import { downloadFileDataByRoot } from '@selvajs/compute/core';
1
+ import { decodeBase64ToBinary, downloadFileDataByRoot } from '@selvajs/compute/core';
2
2
  import { SvelteMap } from 'svelte/reactivity';
3
3
  import { APP_DEFAULTS } from '../constants';
4
4
  export const MIME_BY_EXT = {
@@ -20,17 +20,9 @@ export const MIME_BY_EXT = {
20
20
  function saveSingleFile(file) {
21
21
  const ext = (file.fileType ?? '').toLowerCase();
22
22
  const mime = MIME_BY_EXT[ext] ?? 'application/octet-stream';
23
- let blob;
24
- if (file.isBase64Encoded) {
25
- const binary = atob(file.data);
26
- const bytes = new Uint8Array(binary.length);
27
- for (let i = 0; i < binary.length; i++)
28
- bytes[i] = binary.charCodeAt(i);
29
- blob = new Blob([bytes], { type: mime });
30
- }
31
- else {
32
- blob = new Blob([file.data], { type: mime });
33
- }
23
+ const content = file.isBase64Encoded ? decodeBase64ToBinary(file.data) : file.data;
24
+ // decodeBase64ToBinary returns an ArrayBuffer-backed copy, never a SharedArrayBuffer view.
25
+ const blob = new Blob([content], { type: mime });
34
26
  const fullName = `${file.fileName}${file.fileType ?? ''}`;
35
27
  const a = document.createElement('a');
36
28
  a.href = URL.createObjectURL(blob);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/ui",
3
- "version": "6.6.0-beta.7",
3
+ "version": "6.6.0-beta.8",
4
4
  "description": "Shared UI components and utilities for Selva applications",
5
5
  "license": "MIT",
6
6
  "author": "VektorNode",
@@ -59,10 +59,10 @@
59
59
  "svelte": "^5",
60
60
  "tailwind-variants": "^3.3.1",
61
61
  "three": "^0.186.1",
62
- "@selvajs/compute": "^4.3.0-beta.1",
63
62
  "@selvajs/schemas": "^5.3.0-beta.0",
63
+ "@selvajs/compute": "^5.0.0-beta.2",
64
64
  "@selvajs/visualization": "^1.6.0-beta.0",
65
- "@selvajs/solve": "^1.3.0-beta.3"
65
+ "@selvajs/solve": "^2.0.0-beta.4"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "three": {
@@ -90,10 +90,10 @@
90
90
  "svelte": "5.57.1",
91
91
  "tailwind-variants": "^3.3.1",
92
92
  "vitest": "^5.0.2",
93
- "@selvajs/compute": "4.3.0-beta.1",
94
93
  "@selvajs/config": "0.0.4",
94
+ "@selvajs/solve": "2.0.0-beta.4",
95
95
  "@selvajs/visualization": "1.6.0-beta.0",
96
- "@selvajs/solve": "1.3.0-beta.3",
96
+ "@selvajs/compute": "5.0.0-beta.2",
97
97
  "@selvajs/schemas": "5.3.0-beta.0"
98
98
  },
99
99
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { downloadFileDataByRoot, type FileData } from '@selvajs/compute/core';
1
+ import { decodeBase64ToBinary, downloadFileDataByRoot, type FileData } from '@selvajs/compute/core';
2
2
  import { SvelteMap } from 'svelte/reactivity';
3
3
  import { APP_DEFAULTS } from '../constants';
4
4
 
@@ -23,15 +23,9 @@ function saveSingleFile(file: FileData): void {
23
23
  const ext = (file.fileType ?? '').toLowerCase();
24
24
  const mime = MIME_BY_EXT[ext] ?? 'application/octet-stream';
25
25
 
26
- let blob: Blob;
27
- if (file.isBase64Encoded) {
28
- const binary = atob(file.data);
29
- const bytes = new Uint8Array(binary.length);
30
- for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
31
- blob = new Blob([bytes], { type: mime });
32
- } else {
33
- blob = new Blob([file.data], { type: mime });
34
- }
26
+ const content = file.isBase64Encoded ? decodeBase64ToBinary(file.data) : file.data;
27
+ // decodeBase64ToBinary returns an ArrayBuffer-backed copy, never a SharedArrayBuffer view.
28
+ const blob = new Blob([content as BlobPart], { type: mime });
35
29
 
36
30
  const fullName = `${file.fileName}${file.fileType ?? ''}`;
37
31
  const a = document.createElement('a');