numbl 0.4.12 → 0.4.14

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.
Files changed (37) hide show
  1. package/README.md +0 -4
  2. package/dist-browser/browser/index.d.ts +13 -4
  3. package/dist-browser/browser/protocol.d.ts +25 -1
  4. package/dist-browser/browser/session.d.ts +20 -10
  5. package/dist-browser/browser.js +26 -4
  6. package/dist-browser/numbl-core/fileIOAdapter.d.ts +4 -0
  7. package/dist-browser/numbl-core/native/lapack-bridge.d.ts +1 -1
  8. package/dist-browser/numbl-core/native/wasm-lapack-bridge.d.ts +114 -0
  9. package/dist-browser/numbl-core/native/wasm-lapack-browser.d.ts +34 -0
  10. package/dist-browser/numbl-core/runtime/datetime-format.d.ts +10 -0
  11. package/dist-browser/numbl-core/runtime/display.d.ts +5 -1
  12. package/dist-browser/numbl-core/runtime/index.d.ts +1 -1
  13. package/dist-browser/numbl-core/version.d.ts +1 -1
  14. package/dist-browser/vfs/BrowserFileIOAdapter.d.ts +1 -0
  15. package/dist-browser/workerErrorFormat.d.ts +7 -0
  16. package/dist-cli/cli.js +463 -135
  17. package/dist-graphics/graphics-lib.d.ts +1 -0
  18. package/dist-graphics/index.js +33 -0
  19. package/dist-lib/cli-fileio.d.ts +62 -0
  20. package/dist-lib/cli-scan.d.ts +6 -0
  21. package/dist-lib/cli-system.d.ts +13 -0
  22. package/dist-lib/lib.js +386 -73
  23. package/dist-lib/node.d.ts +30 -0
  24. package/dist-lib/node.js +829 -0
  25. package/dist-lib/numbl-core/fileIOAdapter.d.ts +4 -0
  26. package/dist-lib/numbl-core/native/lapack-bridge.d.ts +1 -1
  27. package/dist-lib/numbl-core/native/wasm-lapack-bridge.d.ts +114 -0
  28. package/dist-lib/numbl-core/native/wasm-lapack-browser.d.ts +34 -0
  29. package/dist-lib/numbl-core/runtime/datetime-format.d.ts +10 -0
  30. package/dist-lib/numbl-core/runtime/display.d.ts +5 -1
  31. package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
  32. package/dist-lib/numbl-core/version.d.ts +1 -1
  33. package/dist-lib/vfs/BrowserFileIOAdapter.d.ts +1 -0
  34. package/dist-site-viewer/assets/{index-CGE1_vZ-.js → index-CqtJ-i-7.js} +322 -322
  35. package/dist-site-viewer/assets/{numbl-worker-DddtCPW_.js → numbl-worker-B-MPuV6f.js} +133 -103
  36. package/dist-site-viewer/index.html +1 -1
  37. package/package.json +6 -2
@@ -11,6 +11,7 @@ export { FigureView } from "./graphics/FigureView.js";
11
11
  export { figuresReducer, initialFiguresState, } from "./graphics/figuresReducer.js";
12
12
  export type { FigureState, AxesState, FiguresState, FiguresAction, } from "./graphics/figuresReducer.js";
13
13
  export type * from "./graphics/types.js";
14
+ export { restoreNaNs } from "./graphics/restoreNaNs.js";
14
15
  export { exportFigureHdf5, downloadFigureHdf5, } from "./graphics/exportFigureHdf5.js";
15
16
  export { importFigureHdf5 } from "./graphics/importFigureHdf5.js";
16
17
  export { FIGURE_HDF5_VERSION } from "./graphics/figureHdf5Schema.js";
@@ -33866,6 +33866,38 @@ var figuresReducer = (state, action) => {
33866
33866
  }
33867
33867
  };
33868
33868
 
33869
+ // src/graphics/restoreNaNs.ts
33870
+ function restoreNullsToNaN(arr) {
33871
+ for (let i = 0; i < arr.length; i++) {
33872
+ if (arr[i] === null) arr[i] = NaN;
33873
+ }
33874
+ }
33875
+ function restoreNaNs(instr) {
33876
+ if (instr.type === "plot") {
33877
+ for (const t of instr.traces) {
33878
+ restoreNullsToNaN(t.x);
33879
+ restoreNullsToNaN(t.y);
33880
+ }
33881
+ } else if (instr.type === "plot3") {
33882
+ for (const t of instr.traces) {
33883
+ restoreNullsToNaN(t.x);
33884
+ restoreNullsToNaN(t.y);
33885
+ restoreNullsToNaN(t.z);
33886
+ }
33887
+ } else if (instr.type === "surf" || instr.type === "mesh") {
33888
+ restoreNullsToNaN(instr.trace.x);
33889
+ restoreNullsToNaN(instr.trace.y);
33890
+ restoreNullsToNaN(instr.trace.z);
33891
+ if (instr.trace.c) restoreNullsToNaN(instr.trace.c);
33892
+ } else if (instr.type === "imagesc") {
33893
+ restoreNullsToNaN(instr.trace.z);
33894
+ } else if (instr.type === "contour") {
33895
+ restoreNullsToNaN(instr.trace.x);
33896
+ restoreNullsToNaN(instr.trace.y);
33897
+ restoreNullsToNaN(instr.trace.z);
33898
+ }
33899
+ }
33900
+
33869
33901
  // src/graphics/figureHdf5Schema.ts
33870
33902
  var FIGURE_HDF5_VERSION = 1;
33871
33903
  var GRID_FIELDS = {
@@ -35319,6 +35351,7 @@ export {
35319
35351
  initialFiguresState,
35320
35352
  loadFigureFromHash,
35321
35353
  numblStoreUploader,
35354
+ restoreNaNs,
35322
35355
  setFigureUploader,
35323
35356
  uploadFigureForViewer
35324
35357
  };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Node.js implementation of FileIOAdapter using synchronous fs operations.
3
+ */
4
+ import type { FileIOAdapter, WebOptions } from "./numbl-core/fileIOAdapter.js";
5
+ export declare class NodeFileIOAdapter implements FileIOAdapter {
6
+ private nextFid;
7
+ private openFiles;
8
+ fopen(filename: string, permission: string): number;
9
+ fclose(fidOrAll: number | "all"): number;
10
+ fgetl(fid: number): string | number;
11
+ fgets(fid: number): string | number;
12
+ fileread(filename: string): string;
13
+ feof(fid: number): number;
14
+ ferror(fid: number): string;
15
+ fwrite(fid: number, text: string): void;
16
+ freadBytes(fid: number, count: number): Uint8Array;
17
+ fwriteBytes(fid: number, data: Uint8Array): number;
18
+ fseek(fid: number, offset: number, origin: number): number;
19
+ ftell(fid: number): number;
20
+ scanDirectory(dirPath: string): import("./lib.js").WorkspaceFile[];
21
+ resolvePath(dirPath: string): string;
22
+ existsPath(path: string): "file" | "dir" | null;
23
+ mkdir(dirPath: string): boolean;
24
+ tempdir(): string;
25
+ userpath(): string;
26
+ websave(url: string, filename: string, options?: WebOptions): void;
27
+ webread(url: string, options?: WebOptions): string;
28
+ rmdir(dirPath: string, recursive: boolean): boolean;
29
+ movefile(source: string, destination: string, force: boolean): boolean;
30
+ copyfile(source: string, destination: string, force: boolean): boolean;
31
+ fileattrib(path: string): {
32
+ Name: string;
33
+ directory: boolean;
34
+ UserRead: boolean;
35
+ UserWrite: boolean;
36
+ UserExecute: boolean;
37
+ } | null;
38
+ deleteFile(pattern: string): void;
39
+ unzip(zipfilename: string, outputfolder: string): string[];
40
+ zip(zipfilename: string, filenames: string[], rootDir: string): string[];
41
+ listDir(dirPath: string): {
42
+ name: string;
43
+ folder: string;
44
+ bytes: number;
45
+ isdir: boolean;
46
+ mtimeMs: number;
47
+ }[];
48
+ private listDirGlob;
49
+ private listDirRecursive;
50
+ private getEntry;
51
+ /**
52
+ * Read one line from the file's buffer, refilling from the fd as needed.
53
+ *
54
+ * All reads are positional so `entry.pos` stays the single source of truth
55
+ * for the logical file position: the buffer always holds the bytes starting
56
+ * at `entry.pos`, and consuming a line advances `entry.pos` by its byte
57
+ * length. This keeps text I/O (fgetl/fgets) coherent with binary I/O and
58
+ * fscanf (freadBytes/fseek/ftell).
59
+ * @param keepNewline - if true, keep the trailing newline (fgets); if false, strip it (fgetl)
60
+ */
61
+ private readLine;
62
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared utility for scanning directories for .m/.numbl.js/.wasm workspace files.
3
+ * Extracted from cli.ts to avoid circular imports (cli-fileio → cli → main()).
4
+ */
5
+ import type { WorkspaceFile } from "./numbl-core/workspace/types.js";
6
+ export declare function scanMFiles(dirPath: string, excludeFile?: string): WorkspaceFile[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Node.js implementation of SystemAdapter using process.*.
3
+ */
4
+ import type { SystemAdapter } from "./numbl-core/systemAdapter.js";
5
+ export declare class NodeSystemAdapter implements SystemAdapter {
6
+ getEnv(name: string): string | undefined;
7
+ getAllEnv(): Record<string, string>;
8
+ setEnv(name: string, value: string): void;
9
+ cwd(): string;
10
+ chdir(dir: string): void;
11
+ platform(): string;
12
+ arch(): string;
13
+ }