numbl 0.4.3 → 0.4.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.
Files changed (29) hide show
  1. package/README.md +5 -1
  2. package/dist-cli/cli.js +10689 -8543
  3. package/dist-lib/graphics/figuresReducer.d.ts +14 -1
  4. package/dist-lib/graphics/types.d.ts +60 -0
  5. package/dist-lib/lib.js +24594 -22515
  6. package/dist-lib/numbl-core/executeCode.d.ts +10 -0
  7. package/dist-lib/numbl-core/executors/handleInline.d.ts +18 -2
  8. package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +16 -9
  9. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +7 -0
  10. package/dist-lib/numbl-core/jit/lowering/definiteAssign.d.ts +42 -0
  11. package/dist-lib/numbl-core/lexer/types.d.ts +62 -61
  12. package/dist-lib/numbl-core/native/ts-lapack-eig-complex.d.ts +32 -0
  13. package/dist-lib/numbl-core/runtime/plotBuiltinDispatch.d.ts +6 -0
  14. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +55 -2
  15. package/dist-lib/numbl-core/runtime/runtime.d.ts +25 -0
  16. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +6 -0
  17. package/dist-lib/numbl-core/runtime/struct-access.d.ts +4 -0
  18. package/dist-lib/numbl-core/runtime/uihtmlSession.d.ts +40 -0
  19. package/dist-lib/numbl-core/version.d.ts +1 -1
  20. package/dist-plot-viewer/assets/index-CPiPZdGN.js +4504 -0
  21. package/dist-plot-viewer/index.html +1 -1
  22. package/dist-site-viewer/assets/index-Y_Z9U6zO.js +4826 -0
  23. package/dist-site-viewer/assets/numbl-worker-CdHI6Ort.js +12088 -0
  24. package/dist-site-viewer/index.html +1 -1
  25. package/dist-site-viewer/numbl-embed.js +131 -18
  26. package/package.json +1 -1
  27. package/dist-plot-viewer/assets/index-ClpZQuMR.js +0 -4426
  28. package/dist-site-viewer/assets/index-CgKjTQT7.js +0 -4748
  29. package/dist-site-viewer/assets/numbl-worker-DarsHbBe.js +0 -11993
@@ -1,4 +1,4 @@
1
- import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace, PlotInstruction } from "./types.js";
1
+ import type { PlotTrace, Plot3Trace, PatchTrace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace, PlotInstruction } from "./types.js";
2
2
  export type AxesState = {
3
3
  holdOn: boolean;
4
4
  traces: PlotTrace[];
@@ -19,6 +19,7 @@ export type AxesState = {
19
19
  quiver3Traces: Quiver3Trace[];
20
20
  areaTraces: PlotTrace[];
21
21
  areaBaseValue: number;
22
+ patchTraces: PatchTrace[];
22
23
  title?: string;
23
24
  xlabel?: string;
24
25
  ylabel?: string;
@@ -26,6 +27,9 @@ export type AxesState = {
26
27
  shading?: "faceted" | "flat" | "interp";
27
28
  legend?: string[];
28
29
  gridOn?: boolean;
30
+ /** Axes border. Undefined/true → full rectangle (numbl's default, matching
31
+ * MATLAB `box on`); false → only the left and bottom axis lines (`box off`). */
32
+ boxOn?: boolean;
29
33
  colorbar?: boolean;
30
34
  colorbarLocation?: string;
31
35
  colormap?: string;
@@ -58,6 +62,15 @@ export type FigureState = {
58
62
  axes: {
59
63
  [index: number]: AxesState;
60
64
  };
65
+ /** When set, this figure is an HTML UI component (MATLAB `uihtml`): the
66
+ * `html` string is rendered in an iframe instead of the axes/trace canvas.
67
+ * Takes precedence over `axes`. `data` is the JSON-encoded `Data` property
68
+ * (from `jsonencode`), pushed into the page's `htmlComponent`. */
69
+ uihtml?: {
70
+ id: string;
71
+ html: string;
72
+ data?: string;
73
+ };
61
74
  };
62
75
  export type FiguresState = {
63
76
  currentHandle: number;
@@ -19,6 +19,10 @@ export interface PlotTrace {
19
19
  markerEdgeColor?: [number, number, number];
20
20
  markerFaceColor?: [number, number, number];
21
21
  markerIndices?: number[];
22
+ /** Stable identity for a trace returned as a graphics handle (e.g. from
23
+ * `line`). Lets `set(h,'XData',...)` / `update_trace` find and mutate this
24
+ * exact trace in the renderer's accumulated state across `drawnow`. */
25
+ id?: number;
22
26
  }
23
27
  export interface Plot3Trace {
24
28
  x: number[];
@@ -32,6 +36,35 @@ export interface Plot3Trace {
32
36
  markerEdgeColor?: [number, number, number];
33
37
  markerFaceColor?: [number, number, number];
34
38
  markerIndices?: number[];
39
+ /** See PlotTrace.id. */
40
+ id?: number;
41
+ }
42
+ /** A patch object: one or more colored polygons sharing a single set of
43
+ * vertices. Mirrors MATLAB's Faces/Vertices model — `patch(X,Y,C)` and the
44
+ * name-value forms are all canonicalized to this shape at parse time. */
45
+ export interface PatchTrace {
46
+ /** Unique vertices: `vertices[k] = [x, y]` (2-D) or `[x, y, z]` (3-D). */
47
+ vertices: number[][];
48
+ /** Faces as 0-based vertex-index arrays — one polygon per face. */
49
+ faces: number[][];
50
+ /** Single RGB for all faces, a colormap keyword, or 'none'. */
51
+ faceColor?: [number, number, number] | "flat" | "interp" | "none";
52
+ /** Edge color (default black [0,0,0]). */
53
+ edgeColor?: [number, number, number] | "flat" | "interp" | "none";
54
+ /** Face transparency in [0,1]. */
55
+ faceAlpha?: number;
56
+ lineWidth?: number;
57
+ lineStyle?: string;
58
+ marker?: string;
59
+ markerFaceColor?: [number, number, number] | "flat" | "none";
60
+ /** Color data driving 'flat'/'interp': one entry per face (flat) or per
61
+ * vertex (interp). Each entry is a scalar (mapped through the colormap) or
62
+ * an RGB triplet. */
63
+ faceVertexCData?: (number | [number, number, number])[];
64
+ /** True when vertices carry a z-coordinate (3-D patch). */
65
+ is3D?: boolean;
66
+ /** See PlotTrace.id — lets `set(p,...)` live-update this patch. */
67
+ id?: number;
35
68
  }
36
69
  export interface SurfTrace {
37
70
  /** X coordinates: flat array of length rows*cols (column-major) */
@@ -228,12 +261,36 @@ export type AxisLimitSpec = [number | null, number | null] | "auto";
228
261
  export type PlotInstruction = {
229
262
  type: "set_figure_handle";
230
263
  handle: number;
264
+ } | {
265
+ /** An HTML UI component (MATLAB `uihtml`): renders self-contained HTML
266
+ * markup in an iframe, bypassing the axes/trace model. `html` is the
267
+ * full HTMLSource string; `id` is a stable per-component key. `data`, when
268
+ * present, is the `Data` property JSON-encoded (via `jsonencode`); the
269
+ * renderer parses it and pushes it to the page's `htmlComponent` so the
270
+ * `setup`/`"DataChanged"` bridge fires (MATLAB `h.Data` → JavaScript). */
271
+ type: "uihtml";
272
+ id: string;
273
+ html: string;
274
+ data?: string;
231
275
  } | {
232
276
  type: "plot";
233
277
  traces: PlotTrace[];
234
278
  } | {
235
279
  type: "plot3";
236
280
  traces: Plot3Trace[];
281
+ } | {
282
+ type: "line";
283
+ traces: PlotTrace[];
284
+ } | {
285
+ type: "line3";
286
+ traces: Plot3Trace[];
287
+ } | {
288
+ type: "patch";
289
+ trace: PatchTrace;
290
+ } | {
291
+ type: "update_trace";
292
+ id: number;
293
+ props: Record<string, unknown>;
237
294
  } | {
238
295
  type: "surf";
239
296
  trace: SurfTrace;
@@ -327,6 +384,9 @@ export type PlotInstruction = {
327
384
  } | {
328
385
  type: "set_grid";
329
386
  value: boolean;
387
+ } | {
388
+ type: "set_box";
389
+ value: boolean;
330
390
  } | {
331
391
  type: "set_colorbar";
332
392
  value: string;