@selvajs/compute 2.0.0-beta.5 → 2.1.0-beta.0

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 (40) hide show
  1. package/dist/{chunk-YNVXBKBY.cjs → chunk-6GCGLBJM.cjs} +2 -2
  2. package/dist/chunk-6GCGLBJM.cjs.map +1 -0
  3. package/dist/chunk-KAULD2XQ.cjs +2 -0
  4. package/dist/chunk-KAULD2XQ.cjs.map +1 -0
  5. package/dist/chunk-MA6YB3YZ.cjs.map +1 -1
  6. package/dist/{chunk-UQ3QRF72.js → chunk-QUD7W5K3.js} +2 -2
  7. package/dist/chunk-SP73WPYA.js +2 -0
  8. package/dist/chunk-SP73WPYA.js.map +1 -0
  9. package/dist/core.cjs.map +1 -1
  10. package/dist/grasshopper.cjs +1 -1
  11. package/dist/grasshopper.cjs.map +1 -1
  12. package/dist/grasshopper.d.cts +4 -3
  13. package/dist/grasshopper.d.ts +4 -3
  14. package/dist/grasshopper.js +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +2 -1
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.js +1 -1
  20. package/dist/{types-XCUrJGby.d.ts → types-B6KrSthC.d.ts} +89 -3
  21. package/dist/{types-CJ092lxB.d.cts → types-DgepKOuU.d.cts} +89 -3
  22. package/dist/visualization-5D5Y547Q.cjs +2 -0
  23. package/dist/visualization-5D5Y547Q.cjs.map +1 -0
  24. package/dist/visualization-JF4W754M.js +2 -0
  25. package/dist/visualization.cjs +1 -1
  26. package/dist/visualization.cjs.map +1 -1
  27. package/dist/visualization.d.cts +22 -7
  28. package/dist/visualization.d.ts +22 -7
  29. package/dist/visualization.js +1 -1
  30. package/package.json +133 -130
  31. package/dist/chunk-JFLD2UCY.cjs +0 -2
  32. package/dist/chunk-JFLD2UCY.cjs.map +0 -1
  33. package/dist/chunk-MKW2KTPT.js +0 -2
  34. package/dist/chunk-MKW2KTPT.js.map +0 -1
  35. package/dist/chunk-YNVXBKBY.cjs.map +0 -1
  36. package/dist/visualization-GU7JIB4V.cjs +0 -2
  37. package/dist/visualization-GU7JIB4V.cjs.map +0 -1
  38. package/dist/visualization-WIUVT2FZ.js +0 -2
  39. /package/dist/{chunk-UQ3QRF72.js.map → chunk-QUD7W5K3.js.map} +0 -0
  40. /package/dist/{visualization-WIUVT2FZ.js.map → visualization-JF4W754M.js.map} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { C as ComputeConfig, a as RhinoModelUnit } from './types-D1SkNje_.cjs';
2
+ import { RhinoModule } from 'rhino3dm';
2
3
 
3
4
  /**
4
5
  * Grasshopper types
@@ -310,6 +311,70 @@ interface GrasshopperParsedIO {
310
311
  loadErrors?: string[];
311
312
  }
312
313
 
314
+ /**
315
+ * Non-mesh display items: curves, points, and later labels/icons.
316
+ *
317
+ * These ride as JSON inside a {@link DisplayBatch} alongside the binary mesh blob — they are a
318
+ * separate pipeline from the SLVA mesh path in `../webdisplay`. Curves arrive as Rhino-native JSON
319
+ * (decoded via rhino3dm and tessellated on the web); points arrive as raw `{X,Y,Z}` positions.
320
+ *
321
+ * The union is STRICT and discriminated on `kind`. The parser narrows on it and uses a
322
+ * `never`-exhaustiveness check, so adding a new kind is a compile error until it is handled.
323
+ */
324
+ /**
325
+ * Identity + tagging shared by every display thing — meshes (via an adapter over `MeshMetadata`)
326
+ * and items alike — so pick / filter / label code treats them uniformly. Deliberately excludes
327
+ * rendering concerns (color/material): those differ by kind and are not identity.
328
+ */
329
+ interface DisplayIdentity {
330
+ /** Stable pick key. Both meshes and items synthesize it as `${sourceComponentId}:${originalIndex}`. */
331
+ id: string;
332
+ /** Human label (e.g. "North wall"). Distinct from {@link id} — renaming must not change identity. */
333
+ name: string;
334
+ /** Layer path for grouping in the scene manager (e.g. "Structure/Walls"). */
335
+ layer: string;
336
+ /** Arbitrary key-value pairs from the GH Metadata input. */
337
+ metadata?: Record<string, string>;
338
+ }
339
+ /**
340
+ * Style fields every visible item can honour. Lines and points have no PBR (no metalness/roughness),
341
+ * so only color + opacity apply here; a future kind that needs richer material adds fields to its own
342
+ * variant rather than bloating this base.
343
+ */
344
+ interface DisplayItemBase extends DisplayIdentity {
345
+ /** Hex/rgb/named color string, parsed by `parseColor`. Falls back to a viewer default. */
346
+ color?: string;
347
+ /** Opacity 0–1. Omitted means fully opaque. */
348
+ opacity?: number;
349
+ }
350
+ /** A world position in Rhino's Z-up frame, in Rhino's `{X,Y,Z}` casing. Rotated to Three on parse. */
351
+ interface DisplayPosition {
352
+ X: number;
353
+ Y: number;
354
+ Z: number;
355
+ }
356
+ /**
357
+ * A curve shipped as Rhino-native JSON (`curve.ToNurbsCurve().ToJSON()`), decoded via rhino3dm and
358
+ * tessellated to a `THREE.Line` on the web.
359
+ */
360
+ interface DisplayCurve extends DisplayItemBase {
361
+ kind: 'curve';
362
+ /** Rhino CommonObject JSON for the curve. */
363
+ json: string;
364
+ }
365
+ /** A single point, shipped raw (no rhino3dm decode), rendered as one vertex of a `THREE.Points`. */
366
+ interface DisplayPoint extends DisplayItemBase {
367
+ kind: 'point';
368
+ /** World position in Rhino Z-up; the shared Rhino→Three transform is applied on parse. */
369
+ position: DisplayPosition;
370
+ }
371
+ /**
372
+ * One non-mesh display item. Meshes do NOT appear here — they ride the binary blob in `DisplayBatch`.
373
+ * New kinds (`label`, `icon`) extend this union and add a parser case; the parser's `never` guard
374
+ * forces them to be handled.
375
+ */
376
+ type DisplayItem = DisplayCurve | DisplayPoint;
377
+
313
378
  /**
314
379
  * Material properties for Three.js rendering.
315
380
  */
@@ -359,14 +424,18 @@ interface MaterialGroup {
359
424
  meshes: MeshMetadata[];
360
425
  }
361
426
  /**
362
- * Batched mesh data optimized for Three.js rendering.
427
+ * One Display component's payload, ready for Three.js rendering.
363
428
  *
364
429
  * `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
365
430
  * float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
366
431
  * The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
367
432
  * without changing this shape.
433
+ *
434
+ * Today this carries only meshes (the binary blob). It is named `DisplayBatch` rather than
435
+ * `MeshBatch` because it is the seam through which non-mesh display items (curves, points, and
436
+ * later labels/icons) also travel — those ride as JSON alongside the mesh blob, not inside it.
368
437
  */
369
- interface MeshBatch {
438
+ interface DisplayBatch {
370
439
  /** Array of unique materials */
371
440
  materials: SerializableMaterial[];
372
441
  /** Groups of meshes organized by material */
@@ -376,7 +445,19 @@ interface MeshBatch {
376
445
  /** InstanceGuid of the WebDisplay GH component that produced this batch.
377
446
  * Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
378
447
  sourceComponentId?: string;
448
+ /**
449
+ * Non-mesh display items (curves, points; later labels/icons) — see {@link DisplayItem}.
450
+ * Optional: omitted when there are none, so mesh-only batches are unchanged on the wire. These
451
+ * ride as JSON alongside the mesh blob and are parsed by the separate `display-items` path, not
452
+ * the SLVA mesh parser.
453
+ */
454
+ items?: DisplayItem[];
379
455
  }
456
+ /**
457
+ * @deprecated Renamed to {@link DisplayBatch} — the payload now carries more than meshes.
458
+ * This alias keeps existing imports compiling; remove it once consumers migrate.
459
+ */
460
+ type MeshBatch = DisplayBatch;
380
461
  /**
381
462
  * Options for parsing mesh batch data.
382
463
  */
@@ -398,8 +479,13 @@ interface MeshExtractionOptions {
398
479
  allowScaling?: boolean;
399
480
  /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
400
481
  allowAutoPosition?: boolean;
482
+ /**
483
+ * rhino3dm instance for decoding curve display items. selva-compute does not own the WASM
484
+ * instance; the host threads it in. Omit to skip curves (points still render).
485
+ */
486
+ rhino?: RhinoModule;
401
487
  /** Enable verbose logging. Defaults to false. */
402
488
  debug?: boolean;
403
489
  }
404
490
 
405
- export type { BooleanInputType as B, DataItem as D, FileInputType as F, GeometryInputType as G, InnerTreeData as I, MeshExtractionOptions as M, NumericInputType as N, OutputParamSchema as O, TextInputType as T, ValueListInputType as V, DataTree as a, DataTreeDefault as b, DataTreePath as c, DefaultValue as d, GrasshopperComputeConfig as e, GrasshopperComputeResponse as f, GrasshopperParsedIO as g, GrasshopperParsedIORaw as h, GrasshopperRequestSchema as i, InputParam as j, InputParamSchema as k, OutputType as l, MeshBatchParsingOptions as m, MeshBatch as n };
491
+ export type { BooleanInputType as B, DataItem as D, FileInputType as F, GeometryInputType as G, InnerTreeData as I, MeshExtractionOptions as M, NumericInputType as N, OutputParamSchema as O, TextInputType as T, ValueListInputType as V, DataTree as a, DataTreeDefault as b, DataTreePath as c, DefaultValue as d, GrasshopperComputeConfig as e, GrasshopperComputeResponse as f, GrasshopperParsedIO as g, GrasshopperParsedIORaw as h, GrasshopperRequestSchema as i, InputParam as j, InputParamSchema as k, OutputType as l, MeshBatchParsingOptions as m, DisplayBatch as n, DisplayItem as o, DisplayCurve as p, DisplayIdentity as q, DisplayItemBase as r, DisplayPoint as s, DisplayPosition as t, MeshBatch as u };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKAULD2XQcjs = require('./chunk-KAULD2XQ.cjs');require('./chunk-MA6YB3YZ.cjs');exports.BINARY_MESH_MAGIC = _chunkKAULD2XQcjs.h; exports.BINARY_MESH_VERSION = _chunkKAULD2XQcjs.i; exports.FLAG_FLOAT32 = _chunkKAULD2XQcjs.j; exports.Materials = _chunkKAULD2XQcjs.f; exports.SCALE_FACTORS = _chunkKAULD2XQcjs.o; exports.applyOffset = _chunkKAULD2XQcjs.d; exports.computeCombinedBoundingBox = _chunkKAULD2XQcjs.e; exports.getThreeMeshesFromComputeResponse = _chunkKAULD2XQcjs.p; exports.initThree = _chunkKAULD2XQcjs.a; exports.parseBinaryMeshBatch = _chunkKAULD2XQcjs.k; exports.parseColor = _chunkKAULD2XQcjs.c; exports.parseDisplayItems = _chunkKAULD2XQcjs.g; exports.parseMeshBatch = _chunkKAULD2XQcjs.l; exports.parseMeshBatchBlob = _chunkKAULD2XQcjs.n; exports.parseMeshBatchObject = _chunkKAULD2XQcjs.m; exports.updateScene = _chunkKAULD2XQcjs.b;
2
+ //# sourceMappingURL=visualization-5D5Y547Q.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["c:\\Users\\felix\\coding\\selva-compute\\dist\\visualization-5D5Y547Q.cjs"],"names":[],"mappings":"AAAA,iIAA4I,gCAA6B,kwBAA2W","file":"C:\\Users\\felix\\coding\\selva-compute\\dist\\visualization-5D5Y547Q.cjs"}
@@ -0,0 +1,2 @@
1
+ import{a as e,b as t,c as a,d as r,e as s,f as o,g as p,h as i,i as n,j as y,k as m,l,m as h,n as f,o as M,p as B}from"./chunk-SP73WPYA.js";import"./chunk-GTTKNF4G.js";export{i as BINARY_MESH_MAGIC,n as BINARY_MESH_VERSION,y as FLAG_FLOAT32,o as Materials,M as SCALE_FACTORS,r as applyOffset,s as computeCombinedBoundingBox,B as getThreeMeshesFromComputeResponse,e as initThree,m as parseBinaryMeshBatch,a as parseColor,p as parseDisplayItems,l as parseMeshBatch,f as parseMeshBatchBlob,h as parseMeshBatchObject,t as updateScene};
2
+ //# sourceMappingURL=visualization-JF4W754M.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJFLD2UCYcjs = require('./chunk-JFLD2UCY.cjs');require('./chunk-MA6YB3YZ.cjs');exports.Materials = _chunkJFLD2UCYcjs.f; exports.SCALE_FACTORS = _chunkJFLD2UCYcjs.n; exports.getThreeMeshesFromComputeResponse = _chunkJFLD2UCYcjs.o; exports.initThree = _chunkJFLD2UCYcjs.a; exports.parseMeshBatchBlob = _chunkJFLD2UCYcjs.m; exports.parseMeshBatchObject = _chunkJFLD2UCYcjs.l; exports.updateScene = _chunkJFLD2UCYcjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKAULD2XQcjs = require('./chunk-KAULD2XQ.cjs');require('./chunk-MA6YB3YZ.cjs');exports.Materials = _chunkKAULD2XQcjs.f; exports.SCALE_FACTORS = _chunkKAULD2XQcjs.o; exports.getThreeMeshesFromComputeResponse = _chunkKAULD2XQcjs.p; exports.initThree = _chunkKAULD2XQcjs.a; exports.parseDisplayItems = _chunkKAULD2XQcjs.g; exports.parseMeshBatchBlob = _chunkKAULD2XQcjs.n; exports.parseMeshBatchObject = _chunkKAULD2XQcjs.m; exports.updateScene = _chunkKAULD2XQcjs.b;
2
2
  //# sourceMappingURL=visualization.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAA6E,gCAA6B,gVAAmK","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization.cjs"}
1
+ {"version":3,"sources":["c:\\Users\\felix\\coding\\selva-compute\\dist\\visualization.cjs"],"names":[],"mappings":"AAAA,iIAAoF,gCAA6B,iYAA0L","file":"C:\\Users\\felix\\coding\\selva-compute\\dist\\visualization.cjs"}
@@ -1,6 +1,8 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as MeshBatch } from './types-CJ092lxB.cjs';
3
+ import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as DisplayBatch, o as DisplayItem } from './types-DgepKOuU.cjs';
4
+ export { p as DisplayCurve, q as DisplayIdentity, r as DisplayItemBase, s as DisplayPoint, t as DisplayPosition, u as MeshBatch } from './types-DgepKOuU.cjs';
5
+ import { RhinoModule } from 'rhino3dm';
4
6
  import './types-D1SkNje_.cjs';
5
7
 
6
8
  type CameraConfig = {
@@ -108,7 +110,7 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
108
110
  * @param controls - The OrbitControls object to update.
109
111
  * @param initialPositionSet - A boolean indicating whether the initial position of the camera and controls have been set.
110
112
  */
111
- declare function updateScene(scene: THREE.Scene, meshes: THREE.Mesh[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
113
+ declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
112
114
 
113
115
  declare const EMISSIVE_MATERIAL: THREE.MeshPhysicalMaterial;
114
116
  declare const METAL_MATERIAL: THREE.MeshPhysicalMaterial;
@@ -174,7 +176,7 @@ declare const SCALE_FACTORS: Record<string, number>;
174
176
  * });
175
177
  * ```
176
178
  */
177
- declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Mesh[]>;
179
+ declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
178
180
 
179
181
  /**
180
182
  * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
@@ -186,17 +188,17 @@ interface ParseTelemetry {
186
188
  perfStart?: number;
187
189
  }
188
190
  /**
189
- * Parses a MeshBatch object and creates Three.js meshes.
191
+ * Parses a DisplayBatch object and creates Three.js meshes from its mesh blob.
190
192
  *
191
193
  * The path is synchronous internally — `parseBinaryMeshBatch` does no IO, just typed-array views
192
194
  * over the blob. The function stays `async` so callers don't have to change shape if we move
193
195
  * parsing into a worker later.
194
196
  *
195
- * @param batch - MeshBatch object
197
+ * @param batch - DisplayBatch object
196
198
  * @param options - Rendering options
197
199
  * @returns Promise resolving to array of Three.js mesh objects
198
200
  */
199
- declare function parseMeshBatchObject(batch: MeshBatch, options?: MeshBatchParsingOptions & {
201
+ declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions & {
200
202
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
201
203
  scaleFactor?: number;
202
204
  },
@@ -219,4 +221,17 @@ declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: Me
219
221
  scaleFactor?: number;
220
222
  }): Promise<THREE.Mesh[]>;
221
223
 
222
- export { type CameraConfig, type ControlsConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshBatch, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
224
+ interface DisplayItemParseOptions {
225
+ /** rhino3dm instance for decoding curve JSON. Omit to skip curves (points still render). */
226
+ rhino?: RhinoModule;
227
+ /** Apply the Rhino Z-up → Three Y-up transform. Defaults to true (matches the mesh path). */
228
+ applyTransforms?: boolean;
229
+ }
230
+ /**
231
+ * Parse a batch's `items` into renderable THREE objects. Returns an empty array when there are no
232
+ * items. Unknown kinds are skipped with a warning (forward-compatible with future label/icon kinds
233
+ * a viewer hasn't taught itself to render yet).
234
+ */
235
+ declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
236
+
237
+ export { type CameraConfig, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
@@ -1,6 +1,8 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as MeshBatch } from './types-XCUrJGby.js';
3
+ import { f as GrasshopperComputeResponse, M as MeshExtractionOptions, m as MeshBatchParsingOptions, n as DisplayBatch, o as DisplayItem } from './types-B6KrSthC.js';
4
+ export { p as DisplayCurve, q as DisplayIdentity, r as DisplayItemBase, s as DisplayPoint, t as DisplayPosition, u as MeshBatch } from './types-B6KrSthC.js';
5
+ import { RhinoModule } from 'rhino3dm';
4
6
  import './types-D1SkNje_.js';
5
7
 
6
8
  type CameraConfig = {
@@ -108,7 +110,7 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
108
110
  * @param controls - The OrbitControls object to update.
109
111
  * @param initialPositionSet - A boolean indicating whether the initial position of the camera and controls have been set.
110
112
  */
111
- declare function updateScene(scene: THREE.Scene, meshes: THREE.Mesh[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
113
+ declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
112
114
 
113
115
  declare const EMISSIVE_MATERIAL: THREE.MeshPhysicalMaterial;
114
116
  declare const METAL_MATERIAL: THREE.MeshPhysicalMaterial;
@@ -174,7 +176,7 @@ declare const SCALE_FACTORS: Record<string, number>;
174
176
  * });
175
177
  * ```
176
178
  */
177
- declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Mesh[]>;
179
+ declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
178
180
 
179
181
  /**
180
182
  * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
@@ -186,17 +188,17 @@ interface ParseTelemetry {
186
188
  perfStart?: number;
187
189
  }
188
190
  /**
189
- * Parses a MeshBatch object and creates Three.js meshes.
191
+ * Parses a DisplayBatch object and creates Three.js meshes from its mesh blob.
190
192
  *
191
193
  * The path is synchronous internally — `parseBinaryMeshBatch` does no IO, just typed-array views
192
194
  * over the blob. The function stays `async` so callers don't have to change shape if we move
193
195
  * parsing into a worker later.
194
196
  *
195
- * @param batch - MeshBatch object
197
+ * @param batch - DisplayBatch object
196
198
  * @param options - Rendering options
197
199
  * @returns Promise resolving to array of Three.js mesh objects
198
200
  */
199
- declare function parseMeshBatchObject(batch: MeshBatch, options?: MeshBatchParsingOptions & {
201
+ declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions & {
200
202
  /** Scale factor to apply to meshes (e.g., for unit conversion) */
201
203
  scaleFactor?: number;
202
204
  },
@@ -219,4 +221,17 @@ declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: Me
219
221
  scaleFactor?: number;
220
222
  }): Promise<THREE.Mesh[]>;
221
223
 
222
- export { type CameraConfig, type ControlsConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshBatch, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
224
+ interface DisplayItemParseOptions {
225
+ /** rhino3dm instance for decoding curve JSON. Omit to skip curves (points still render). */
226
+ rhino?: RhinoModule;
227
+ /** Apply the Rhino Z-up → Three Y-up transform. Defaults to true (matches the mesh path). */
228
+ applyTransforms?: boolean;
229
+ }
230
+ /**
231
+ * Parse a batch's `items` into renderable THREE objects. Returns an empty array when there are no
232
+ * items. Unknown kinds are skipped with a warning (forward-compatible with future label/icon kinds
233
+ * a viewer hasn't taught itself to render yet).
234
+ */
235
+ declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
236
+
237
+ export { type CameraConfig, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, type EnvironmentConfig, type EventConfig, type FloorConfig, type LightingConfig, threeMaterials as Materials, MeshExtractionOptions, type RenderConfig, SCALE_FACTORS, type ThreeInitializerOptions, getThreeMeshesFromComputeResponse, initThree, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, updateScene };
@@ -1,2 +1,2 @@
1
- import{a as e,b as o,f as t,l as r,m as i,n,o as s}from"./chunk-MKW2KTPT.js";import"./chunk-GTTKNF4G.js";export{t as Materials,n as SCALE_FACTORS,s as getThreeMeshesFromComputeResponse,e as initThree,i as parseMeshBatchBlob,r as parseMeshBatchObject,o as updateScene};
1
+ import{a as e,b as t,f as i,g as s,m as o,n as a,o as r,p}from"./chunk-SP73WPYA.js";import"./chunk-GTTKNF4G.js";export{i as Materials,r as SCALE_FACTORS,p as getThreeMeshesFromComputeResponse,e as initThree,s as parseDisplayItems,a as parseMeshBatchBlob,o as parseMeshBatchObject,t as updateScene};
2
2
  //# sourceMappingURL=visualization.js.map
package/package.json CHANGED
@@ -1,131 +1,134 @@
1
1
  {
2
- "name": "@selvajs/compute",
3
- "version": "2.0.0-beta.5",
4
- "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
5
- "author": "VektorNode",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/VektorNode/selva-compute.git"
10
- },
11
- "type": "module",
12
- "keywords": [
13
- "compute",
14
- "rhino",
15
- "grasshopper",
16
- "geometry",
17
- "3d",
18
- "cad",
19
- "parametric",
20
- "modeling",
21
- "rhino3dm",
22
- "automation",
23
- "geometry-processing",
24
- "design",
25
- "cloud",
26
- "gh",
27
- "rhino.compute",
28
- "computational-design"
29
- ],
30
- "main": "./dist/index.cjs",
31
- "module": "./dist/index.js",
32
- "types": "./dist/index.d.ts",
33
- "exports": {
34
- ".": {
35
- "types": "./dist/index.d.ts",
36
- "import": "./dist/index.js",
37
- "require": "./dist/index.cjs"
38
- },
39
- "./grasshopper": {
40
- "types": "./dist/grasshopper.d.ts",
41
- "import": "./dist/grasshopper.js",
42
- "require": "./dist/grasshopper.cjs"
43
- },
44
- "./visualization": {
45
- "types": "./dist/visualization.d.ts",
46
- "import": "./dist/visualization.js",
47
- "require": "./dist/visualization.cjs"
48
- },
49
- "./core": {
50
- "types": "./dist/core.d.ts",
51
- "import": "./dist/core.js",
52
- "require": "./dist/core.cjs"
53
- }
54
- },
55
- "files": [
56
- "dist",
57
- "README.md",
58
- "LICENSE.md"
59
- ],
60
- "engines": {
61
- "node": ">=20.0.0"
62
- },
63
- "publishConfig": {
64
- "access": "public",
65
- "provenance": false
66
- },
67
- "sideEffects": false,
68
- "lint-staged": {
69
- "*.{ts,js,mjs,svelte,json,md}": "prettier --write",
70
- "*.{ts,js,mjs,svelte}": "eslint --fix"
71
- },
72
- "dependencies": {
73
- "fflate": "^0.8.2",
74
- "rhino3dm": "8.17.0"
75
- },
76
- "peerDependencies": {
77
- "three": ">=0.179.0"
78
- },
79
- "peerDependenciesMeta": {
80
- "three": {
81
- "optional": true
82
- }
83
- },
84
- "devDependencies": {
85
- "@changesets/cli": "^2.30.0",
86
- "@eslint/js": "^9.39.3",
87
- "@types/node": "^25.3.3",
88
- "@types/three": "^0.184.1",
89
- "@vitest/coverage-v8": "^3.2.4",
90
- "esbuild-plugin-file-path-extensions": "^2.1.4",
91
- "eslint": "^10.4.1",
92
- "eslint-config-prettier": "^10.1.8",
93
- "eslint-plugin-svelte": "^3.15.0",
94
- "globals": "^17.4.0",
95
- "husky": "^9.1.7",
96
- "lint-staged": "^17.0.7",
97
- "prettier": "^3.8.1",
98
- "prettier-plugin-svelte": "^4.1.0",
99
- "prettier-plugin-tailwindcss": "^0.8.0",
100
- "svelte": "^5.53.7",
101
- "three": "^0.184.0",
102
- "tsup": "^8.5.1",
103
- "typedoc": "^0.28.17",
104
- "typedoc-plugin-extras": "^4.0.1",
105
- "typedoc-plugin-markdown": "^4.10.0",
106
- "typedoc-plugin-missing-exports": "^4.1.2",
107
- "typescript": "^5.9.3",
108
- "typescript-eslint": "^8.56.1",
109
- "vite": "^8.0.8",
110
- "vitest": "^3.2.4"
111
- },
112
- "scripts": {
113
- "build": " pnpm type-check && pnpm clean && tsup",
114
- "dev": "tsup --watch",
115
- "example": "vite --config vite.config.ts",
116
- "clean": "node --input-type=module -e \"import fs from 'fs'; fs.rmSync('dist', { recursive: true, force: true })\"",
117
- "lint": "eslint .",
118
- "lint:fix": "eslint . --fix",
119
- "format": "prettier --write .",
120
- "format:check": "prettier --check .",
121
- "test": "vitest",
122
- "test:watch": "vitest watch",
123
- "contract:snapshot": "node scripts/fetch-server-contract.mjs",
124
- "contract:check": "node scripts/fetch-server-contract.mjs --check",
125
- "test:seams": "vitest run tests/contract",
126
- "test:seams:live": "RUN_LIVE_CONTRACT=1 vitest run tests/contract/server-contract.live.test.ts",
127
- "type-check": "tsc --noEmit",
128
- "build-docs": "typedoc",
129
- "release": "changeset publish"
130
- }
131
- }
2
+ "name": "@selvajs/compute",
3
+ "version": "2.1.0-beta.0",
4
+ "packageManager": "pnpm@10.18.0",
5
+ "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
6
+ "author": "VektorNode",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/VektorNode/selva-compute.git"
11
+ },
12
+ "type": "module",
13
+ "keywords": [
14
+ "compute",
15
+ "rhino",
16
+ "grasshopper",
17
+ "geometry",
18
+ "3d",
19
+ "cad",
20
+ "parametric",
21
+ "modeling",
22
+ "rhino3dm",
23
+ "automation",
24
+ "geometry-processing",
25
+ "design",
26
+ "cloud",
27
+ "gh",
28
+ "rhino.compute",
29
+ "computational-design"
30
+ ],
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js",
38
+ "require": "./dist/index.cjs"
39
+ },
40
+ "./grasshopper": {
41
+ "types": "./dist/grasshopper.d.ts",
42
+ "import": "./dist/grasshopper.js",
43
+ "require": "./dist/grasshopper.cjs"
44
+ },
45
+ "./visualization": {
46
+ "types": "./dist/visualization.d.ts",
47
+ "import": "./dist/visualization.js",
48
+ "require": "./dist/visualization.cjs"
49
+ },
50
+ "./core": {
51
+ "types": "./dist/core.d.ts",
52
+ "import": "./dist/core.js",
53
+ "require": "./dist/core.cjs"
54
+ }
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "README.md",
59
+ "LICENSE.md"
60
+ ],
61
+ "engines": {
62
+ "node": ">=20.0.0"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "provenance": false
67
+ },
68
+ "sideEffects": false,
69
+ "scripts": {
70
+ "build": " pnpm type-check && pnpm clean && tsup",
71
+ "dev": "tsup --watch",
72
+ "example": "vite --config vite.config.ts",
73
+ "clean": "node --input-type=module -e \"import fs from 'fs'; fs.rmSync('dist', { recursive: true, force: true })\"",
74
+ "lint": "eslint .",
75
+ "lint:fix": "eslint . --fix",
76
+ "format": "prettier --write .",
77
+ "format:check": "prettier --check .",
78
+ "test": "vitest",
79
+ "test:watch": "vitest watch",
80
+ "contract:snapshot": "node scripts/fetch-server-contract.mjs",
81
+ "contract:check": "node scripts/fetch-server-contract.mjs --check",
82
+ "test:seams": "vitest run tests/contract",
83
+ "test:seams:live": "RUN_LIVE_CONTRACT=1 vitest run tests/contract/server-contract.live.test.ts",
84
+ "type-check": "tsc --noEmit",
85
+ "build-docs": "typedoc",
86
+ "prepublishOnly": "pnpm build",
87
+ "release": "changeset publish",
88
+ "prepare": "husky"
89
+ },
90
+ "lint-staged": {
91
+ "*.{ts,js,mjs,svelte,json,md}": "prettier --write",
92
+ "*.{ts,js,mjs,svelte}": "eslint --fix"
93
+ },
94
+ "dependencies": {
95
+ "fflate": "^0.8.2",
96
+ "rhino3dm": "8.17.0"
97
+ },
98
+ "peerDependencies": {
99
+ "three": ">=0.179.0"
100
+ },
101
+ "peerDependenciesMeta": {
102
+ "three": {
103
+ "optional": true
104
+ }
105
+ },
106
+ "devDependencies": {
107
+ "@changesets/cli": "^2.30.0",
108
+ "@eslint/js": "^9.39.3",
109
+ "@types/node": "^25.3.3",
110
+ "@types/three": "^0.184.1",
111
+ "@vitest/coverage-v8": "^3.2.4",
112
+ "esbuild-plugin-file-path-extensions": "^2.1.4",
113
+ "eslint": "^10.4.1",
114
+ "eslint-config-prettier": "^10.1.8",
115
+ "eslint-plugin-svelte": "^3.15.0",
116
+ "globals": "^17.4.0",
117
+ "husky": "^9.1.7",
118
+ "lint-staged": "^17.0.7",
119
+ "prettier": "^3.8.1",
120
+ "prettier-plugin-svelte": "^4.1.0",
121
+ "prettier-plugin-tailwindcss": "^0.8.0",
122
+ "svelte": "^5.53.7",
123
+ "three": "^0.184.0",
124
+ "tsup": "^8.5.1",
125
+ "typedoc": "^0.28.17",
126
+ "typedoc-plugin-extras": "^4.0.1",
127
+ "typedoc-plugin-markdown": "^4.10.0",
128
+ "typedoc-plugin-missing-exports": "^4.1.2",
129
+ "typescript": "^5.9.3",
130
+ "typescript-eslint": "^8.56.1",
131
+ "vite": "^8.0.8",
132
+ "vitest": "^3.2.4"
133
+ }
134
+ }