@selvajs/compute 3.1.0-beta.13 → 3.1.0-beta.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 (35) hide show
  1. package/dist/{chunk-6R4EL3ZJ.cjs → chunk-25TNL6LY.cjs} +2 -2
  2. package/dist/{chunk-6R4EL3ZJ.cjs.map → chunk-25TNL6LY.cjs.map} +1 -1
  3. package/dist/chunk-3QSC23Y2.cjs +120 -0
  4. package/dist/chunk-3QSC23Y2.cjs.map +1 -0
  5. package/dist/{chunk-6TMSTNHN.js → chunk-J4NKIVF3.js} +2 -2
  6. package/dist/chunk-KJVV3L5H.js +120 -0
  7. package/dist/chunk-KJVV3L5H.js.map +1 -0
  8. package/dist/grasshopper.cjs +1 -1
  9. package/dist/grasshopper.d.cts +2 -2
  10. package/dist/grasshopper.d.ts +2 -2
  11. package/dist/grasshopper.js +1 -1
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.cts +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/{types-Dtok-mVq.d.ts → types-4FMvnx2j.d.ts} +14 -1
  17. package/dist/{types-C8XWc4Ab.d.cts → types-BpOl6U02.d.cts} +14 -1
  18. package/dist/visualization-2TKA3LVK.cjs +2 -0
  19. package/dist/visualization-2TKA3LVK.cjs.map +1 -0
  20. package/dist/visualization-XWX3PR4N.js +2 -0
  21. package/dist/visualization.cjs +1 -1
  22. package/dist/visualization.cjs.map +1 -1
  23. package/dist/visualization.d.cts +100 -9
  24. package/dist/visualization.d.ts +100 -9
  25. package/dist/visualization.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunk-GLOTP5TC.cjs +0 -120
  28. package/dist/chunk-GLOTP5TC.cjs.map +0 -1
  29. package/dist/chunk-NVMSD4CC.js +0 -120
  30. package/dist/chunk-NVMSD4CC.js.map +0 -1
  31. package/dist/visualization-BIHTM2KJ.js +0 -2
  32. package/dist/visualization-FLDYIZ3F.cjs +0 -2
  33. package/dist/visualization-FLDYIZ3F.cjs.map +0 -1
  34. /package/dist/{chunk-6TMSTNHN.js.map → chunk-J4NKIVF3.js.map} +0 -0
  35. /package/dist/{visualization-BIHTM2KJ.js.map → visualization-XWX3PR4N.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6R4EL3ZJcjs = require('./chunk-6R4EL3ZJ.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.GrasshopperClient = _chunk6R4EL3ZJcjs.g; exports.GrasshopperResponseProcessor = _chunk6R4EL3ZJcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk6R4EL3ZJcjs.f; exports.TreeBuilder = _chunk6R4EL3ZJcjs.m; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk6R4EL3ZJcjs.k; exports.fetchParsedDefinitionIO = _chunk6R4EL3ZJcjs.l; exports.hashDefinition = _chunk6R4EL3ZJcjs.e; exports.hashSolveInput = _chunk6R4EL3ZJcjs.d; exports.isDefinitionRef = _chunk6R4EL3ZJcjs.a; exports.processInput = _chunk6R4EL3ZJcjs.i; exports.processInputs = _chunk6R4EL3ZJcjs.j; exports.solveGrasshopperDefinition = _chunk6R4EL3ZJcjs.b; exports.stableStringify = _chunk6R4EL3ZJcjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk25TNL6LYcjs = require('./chunk-25TNL6LY.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.GrasshopperClient = _chunk25TNL6LYcjs.g; exports.GrasshopperResponseProcessor = _chunk25TNL6LYcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk25TNL6LYcjs.f; exports.TreeBuilder = _chunk25TNL6LYcjs.m; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk25TNL6LYcjs.k; exports.fetchParsedDefinitionIO = _chunk25TNL6LYcjs.l; exports.hashDefinition = _chunk25TNL6LYcjs.e; exports.hashSolveInput = _chunk25TNL6LYcjs.d; exports.isDefinitionRef = _chunk25TNL6LYcjs.a; exports.processInput = _chunk25TNL6LYcjs.i; exports.processInputs = _chunk25TNL6LYcjs.j; exports.solveGrasshopperDefinition = _chunk25TNL6LYcjs.b; exports.stableStringify = _chunk25TNL6LYcjs.c;
2
2
  //# sourceMappingURL=grasshopper.cjs.map
@@ -2,8 +2,8 @@ import { R as RhinoComputeError, C as ComputeServerStats, F as FileBaseInfo } fr
2
2
  export { b as FileData, P as ProcessedFile, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.cjs';
3
3
  import { R as RetryPolicy, C as ComputeConfig } from './types-BGhtYxZ-.cjs';
4
4
  export { a as RhinoModelUnit } from './types-BGhtYxZ-.cjs';
5
- import { f as GrasshopperComputeResponse, a as DataTree, e as GrasshopperComputeConfig, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, m as MeshExtractionOptions, k as InputParamSchema, j as InputParam, b as DataTreeDefault, c as DataTreePath } from './types-C8XWc4Ab.cjs';
6
- export { B as BooleanInputType, D as DataItem, d as DefaultValue, F as FileInputType, G as GeometryInputType, i as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-C8XWc4Ab.cjs';
5
+ import { f as GrasshopperComputeResponse, a as DataTree, e as GrasshopperComputeConfig, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, m as MeshExtractionOptions, k as InputParamSchema, j as InputParam, b as DataTreeDefault, c as DataTreePath } from './types-BpOl6U02.cjs';
6
+ export { B as BooleanInputType, D as DataItem, d as DefaultValue, F as FileInputType, G as GeometryInputType, i as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-BpOl6U02.cjs';
7
7
  import * as THREE from 'three';
8
8
  import 'rhino3dm';
9
9
 
@@ -2,8 +2,8 @@ import { R as RhinoComputeError, C as ComputeServerStats, F as FileBaseInfo } fr
2
2
  export { b as FileData, P as ProcessedFile, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.js';
3
3
  import { R as RetryPolicy, C as ComputeConfig } from './types-BGhtYxZ-.js';
4
4
  export { a as RhinoModelUnit } from './types-BGhtYxZ-.js';
5
- import { f as GrasshopperComputeResponse, a as DataTree, e as GrasshopperComputeConfig, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, m as MeshExtractionOptions, k as InputParamSchema, j as InputParam, b as DataTreeDefault, c as DataTreePath } from './types-Dtok-mVq.js';
6
- export { B as BooleanInputType, D as DataItem, d as DefaultValue, F as FileInputType, G as GeometryInputType, i as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-Dtok-mVq.js';
5
+ import { f as GrasshopperComputeResponse, a as DataTree, e as GrasshopperComputeConfig, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, m as MeshExtractionOptions, k as InputParamSchema, j as InputParam, b as DataTreeDefault, c as DataTreePath } from './types-4FMvnx2j.js';
6
+ export { B as BooleanInputType, D as DataItem, d as DefaultValue, F as FileInputType, G as GeometryInputType, i as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-4FMvnx2j.js';
7
7
  import * as THREE from 'three';
8
8
  import 'rhino3dm';
9
9
 
@@ -1,2 +1,2 @@
1
- import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p}from"./chunk-6TMSTNHN.js";import{d as a,u as b,v as c}from"./chunk-Y3M7P3BW.js";export{j as GrasshopperClient,k as GrasshopperResponseProcessor,a as RhinoComputeError,i as SolveScheduler,p as TreeBuilder,c as downloadFileData,b as extractFilesFromComputeResponse,n as fetchDefinitionIO,o as fetchParsedDefinitionIO,h as hashDefinition,g as hashSolveInput,d as isDefinitionRef,l as processInput,m as processInputs,e as solveGrasshopperDefinition,f as stableStringify};
1
+ import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p}from"./chunk-J4NKIVF3.js";import{d as a,u as b,v as c}from"./chunk-Y3M7P3BW.js";export{j as GrasshopperClient,k as GrasshopperResponseProcessor,a as RhinoComputeError,i as SolveScheduler,p as TreeBuilder,c as downloadFileData,b as extractFilesFromComputeResponse,n as fetchDefinitionIO,o as fetchParsedDefinitionIO,h as hashDefinition,g as hashSolveInput,d as isDefinitionRef,l as processInput,m as processInputs,e as solveGrasshopperDefinition,f as stableStringify};
2
2
  //# sourceMappingURL=grasshopper.js.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6R4EL3ZJcjs = require('./chunk-6R4EL3ZJ.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.ComputeServerStats = _chunkH3FZW6OXcjs.p; exports.ErrorCodes = _chunkH3FZW6OXcjs.c; exports.GrasshopperClient = _chunk6R4EL3ZJcjs.g; exports.GrasshopperResponseProcessor = _chunk6R4EL3ZJcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk6R4EL3ZJcjs.f; exports.TreeBuilder = _chunk6R4EL3ZJcjs.m; exports.camelcaseKeys = _chunkH3FZW6OXcjs.r; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.enableDebugLogging = _chunkH3FZW6OXcjs.g; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk6R4EL3ZJcjs.k; exports.fetchParsedDefinitionIO = _chunk6R4EL3ZJcjs.l; exports.fetchRhinoCompute = _chunkH3FZW6OXcjs.n; exports.getLogger = _chunkH3FZW6OXcjs.e; exports.getResponseWireSize = _chunkH3FZW6OXcjs.m; exports.hashDefinition = _chunk6R4EL3ZJcjs.e; exports.hashSolveInput = _chunk6R4EL3ZJcjs.d; exports.isDefinitionRef = _chunk6R4EL3ZJcjs.a; exports.processInput = _chunk6R4EL3ZJcjs.i; exports.processInputs = _chunk6R4EL3ZJcjs.j; exports.setLogger = _chunkH3FZW6OXcjs.f; exports.setResponseWireSize = _chunkH3FZW6OXcjs.l; exports.solveGrasshopperDefinition = _chunk6R4EL3ZJcjs.b; exports.stableStringify = _chunk6R4EL3ZJcjs.c; exports.toCamelCase = _chunkH3FZW6OXcjs.q;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk25TNL6LYcjs = require('./chunk-25TNL6LY.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.ComputeServerStats = _chunkH3FZW6OXcjs.p; exports.ErrorCodes = _chunkH3FZW6OXcjs.c; exports.GrasshopperClient = _chunk25TNL6LYcjs.g; exports.GrasshopperResponseProcessor = _chunk25TNL6LYcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk25TNL6LYcjs.f; exports.TreeBuilder = _chunk25TNL6LYcjs.m; exports.camelcaseKeys = _chunkH3FZW6OXcjs.r; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.enableDebugLogging = _chunkH3FZW6OXcjs.g; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk25TNL6LYcjs.k; exports.fetchParsedDefinitionIO = _chunk25TNL6LYcjs.l; exports.fetchRhinoCompute = _chunkH3FZW6OXcjs.n; exports.getLogger = _chunkH3FZW6OXcjs.e; exports.getResponseWireSize = _chunkH3FZW6OXcjs.m; exports.hashDefinition = _chunk25TNL6LYcjs.e; exports.hashSolveInput = _chunk25TNL6LYcjs.d; exports.isDefinitionRef = _chunk25TNL6LYcjs.a; exports.processInput = _chunk25TNL6LYcjs.i; exports.processInputs = _chunk25TNL6LYcjs.j; exports.setLogger = _chunkH3FZW6OXcjs.f; exports.setResponseWireSize = _chunkH3FZW6OXcjs.l; exports.solveGrasshopperDefinition = _chunk25TNL6LYcjs.b; exports.stableStringify = _chunk25TNL6LYcjs.c; exports.toCamelCase = _chunkH3FZW6OXcjs.q;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -2,6 +2,6 @@ export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger
2
2
  export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.cjs';
3
3
  export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-BGhtYxZ-.cjs';
4
4
  export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.cjs';
5
- export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-C8XWc4Ab.cjs';
5
+ export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-BpOl6U02.cjs';
6
6
  import 'three';
7
7
  import 'rhino3dm';
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger
2
2
  export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.js';
3
3
  export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-BGhtYxZ-.js';
4
4
  export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.js';
5
- export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-Dtok-mVq.js';
5
+ export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-4FMvnx2j.js';
6
6
  import 'three';
7
7
  import 'rhino3dm';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as h,b as i,c as j,d as k,e as l,f as n,g as q,h as s,i as u,j as v,k as w,l as y,m as z}from"./chunk-6TMSTNHN.js";import{c as o,d as r,e,f,g as m,l as p,m as t,n as x,p as a,q as b,r as c,u as d,v as g}from"./chunk-Y3M7P3BW.js";export{a as ComputeServerStats,o as ErrorCodes,q as GrasshopperClient,s as GrasshopperResponseProcessor,r as RhinoComputeError,n as SolveScheduler,z as TreeBuilder,c as camelcaseKeys,g as downloadFileData,m as enableDebugLogging,d as extractFilesFromComputeResponse,w as fetchDefinitionIO,y as fetchParsedDefinitionIO,x as fetchRhinoCompute,e as getLogger,t as getResponseWireSize,l as hashDefinition,k as hashSolveInput,h as isDefinitionRef,u as processInput,v as processInputs,f as setLogger,p as setResponseWireSize,i as solveGrasshopperDefinition,j as stableStringify,b as toCamelCase};
1
+ import{a as h,b as i,c as j,d as k,e as l,f as n,g as q,h as s,i as u,j as v,k as w,l as y,m as z}from"./chunk-J4NKIVF3.js";import{c as o,d as r,e,f,g as m,l as p,m as t,n as x,p as a,q as b,r as c,u as d,v as g}from"./chunk-Y3M7P3BW.js";export{a as ComputeServerStats,o as ErrorCodes,q as GrasshopperClient,s as GrasshopperResponseProcessor,r as RhinoComputeError,n as SolveScheduler,z as TreeBuilder,c as camelcaseKeys,g as downloadFileData,m as enableDebugLogging,d as extractFilesFromComputeResponse,w as fetchDefinitionIO,y as fetchParsedDefinitionIO,x as fetchRhinoCompute,e as getLogger,t as getResponseWireSize,l as hashDefinition,k as hashSolveInput,h as isDefinitionRef,u as processInput,v as processInputs,f as setLogger,p as setResponseWireSize,i as solveGrasshopperDefinition,j as stableStringify,b as toCamelCase};
2
2
  //# sourceMappingURL=index.js.map
@@ -529,8 +529,21 @@ interface MeshExtractionOptions {
529
529
  parsing?: MeshBatchParsingOptions;
530
530
  /** Apply scaling based on model units. Defaults to true. */
531
531
  allowScaling?: boolean;
532
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
532
+ /**
533
+ * Drop geometry so its lowest point sits on the ground plane. **Defaults to `false`** — content
534
+ * renders at its true Rhino coordinates, so the viewer matches the Grasshopper definition.
535
+ *
536
+ * Set `true` to always seat the model on the grid regardless of where it sits in Rhino. Note
537
+ * this shifts objects, so anything read back out of the scene (bounds, measured or picked
538
+ * positions) no longer corresponds to the model's Rhino coordinates.
539
+ */
533
540
  allowAutoPosition?: boolean;
541
+ /**
542
+ * The scene's up axis, used by the `allowAutoPosition` grounding to decide which component to
543
+ * drop to zero. Defaults to `'z'` — the frame Rhino geometry arrives in. Only set this if the
544
+ * viewer is configured with a non-default `sceneUp`.
545
+ */
546
+ groundAxis?: 'x' | 'y' | 'z';
534
547
  /**
535
548
  * rhino3dm instance for decoding curve display items. selva-compute does not own the WASM
536
549
  * instance; the host threads it in. Omit to skip curves (points still render).
@@ -529,8 +529,21 @@ interface MeshExtractionOptions {
529
529
  parsing?: MeshBatchParsingOptions;
530
530
  /** Apply scaling based on model units. Defaults to true. */
531
531
  allowScaling?: boolean;
532
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
532
+ /**
533
+ * Drop geometry so its lowest point sits on the ground plane. **Defaults to `false`** — content
534
+ * renders at its true Rhino coordinates, so the viewer matches the Grasshopper definition.
535
+ *
536
+ * Set `true` to always seat the model on the grid regardless of where it sits in Rhino. Note
537
+ * this shifts objects, so anything read back out of the scene (bounds, measured or picked
538
+ * positions) no longer corresponds to the model's Rhino coordinates.
539
+ */
533
540
  allowAutoPosition?: boolean;
541
+ /**
542
+ * The scene's up axis, used by the `allowAutoPosition` grounding to decide which component to
543
+ * drop to zero. Defaults to `'z'` — the frame Rhino geometry arrives in. Only set this if the
544
+ * viewer is configured with a non-default `sceneUp`.
545
+ */
546
+ groundAxis?: 'x' | 'y' | 'z';
534
547
  /**
535
548
  * rhino3dm instance for decoding curve display items. selva-compute does not own the WASM
536
549
  * instance; the host threads it in. Omit to skip curves (points still render).
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3QSC23Y2cjs = require('./chunk-3QSC23Y2.cjs');require('./chunk-H3FZW6OX.cjs');exports.BINARY_MESH_MAGIC = _chunk3QSC23Y2cjs.F; exports.BINARY_MESH_VERSION = _chunk3QSC23Y2cjs.H; exports.COMPRESSED_MESH_MAGIC = _chunk3QSC23Y2cjs.G; exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunk3QSC23Y2cjs.o; exports.EDGE_USERDATA_KIND = _chunk3QSC23Y2cjs.n; exports.FLAG_DELTA_ENCODED = _chunk3QSC23Y2cjs.L; exports.FLAG_FLOAT32 = _chunk3QSC23Y2cjs.J; exports.FLAG_HAS_UVS = _chunk3QSC23Y2cjs.M; exports.FLAG_HAS_VERTEX_COLORS = _chunk3QSC23Y2cjs.N; exports.FLAG_UINT16_INDICES = _chunk3QSC23Y2cjs.K; exports.LOOKS = _chunk3QSC23Y2cjs.D; exports.MIN_SUPPORTED_VERSION = _chunk3QSC23Y2cjs.I; exports.Materials = _chunk3QSC23Y2cjs.a; exports.SCALE_FACTORS = _chunk3QSC23Y2cjs.U; exports.TEXTURE_CACHE_MAX_ENTRIES = _chunk3QSC23Y2cjs.y; exports.UV_FORMAT_FLOAT32 = _chunk3QSC23Y2cjs.P; exports.UV_FORMAT_UINT16 = _chunk3QSC23Y2cjs.O; exports.addEdges = _chunk3QSC23Y2cjs.q; exports.addEdgesAsync = _chunk3QSC23Y2cjs.r; exports.applyOffset = _chunk3QSC23Y2cjs.i; exports.buildUpBasis = _chunk3QSC23Y2cjs.b; exports.clearTextureCache = _chunk3QSC23Y2cjs.A; exports.computeCombinedBoundingBox = _chunk3QSC23Y2cjs.j; exports.createCameraController = _chunk3QSC23Y2cjs.k; exports.createGrid = _chunk3QSC23Y2cjs.l; exports.createLabelLayer = _chunk3QSC23Y2cjs.v; exports.createMeasureTool = _chunk3QSC23Y2cjs.x; exports.createRenderPipeline = _chunk3QSC23Y2cjs.u; exports.createViewGizmo = _chunk3QSC23Y2cjs.m; exports.environmentRotationFor = _chunk3QSC23Y2cjs.e; exports.getThreeMeshesFromComputeResponse = _chunk3QSC23Y2cjs.V; exports.initThree = _chunk3QSC23Y2cjs.C; exports.isEdgeOverlay = _chunk3QSC23Y2cjs.p; exports.isoOffset = _chunk3QSC23Y2cjs.c; exports.materialAppearanceForLook = _chunk3QSC23Y2cjs.B; exports.parseBinaryMeshBatch = _chunk3QSC23Y2cjs.Q; exports.parseColor = _chunk3QSC23Y2cjs.h; exports.parseDisplayItems = _chunk3QSC23Y2cjs.E; exports.parseMeshBatch = _chunk3QSC23Y2cjs.R; exports.parseMeshBatchBlob = _chunk3QSC23Y2cjs.T; exports.parseMeshBatchObject = _chunk3QSC23Y2cjs.S; exports.removeEdges = _chunk3QSC23Y2cjs.s; exports.setTextureAnisotropy = _chunk3QSC23Y2cjs.z; exports.snapToVertex = _chunk3QSC23Y2cjs.w; exports.sunOffset = _chunk3QSC23Y2cjs.d; exports.upToAxis = _chunk3QSC23Y2cjs.f; exports.updateScene = _chunk3QSC23Y2cjs.g;
2
+ //# sourceMappingURL=visualization-2TKA3LVK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization-2TKA3LVK.cjs"],"names":[],"mappings":"AAAA,iIAA0W,gCAA6B,qtEAAwhC","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization-2TKA3LVK.cjs"}
@@ -0,0 +1,2 @@
1
+ import{A as j,B as S,C as I,D as L,E as R,F as D,G as B,H as G,I as u,J as P,K as F,L as b,M as N,N as U,O as V,P as v,Q as H,R as w,S as z,T as k,U as K,V as X,a as e,b as r,c as o,d as t,e as s,f as a,g as p,h as i,i as n,j as m,k as l,l as f,m as y,n as x,o as E,p as d,q as C,r as h,s as M,u as _,v as A,w as O,x as c,y as g,z as T}from"./chunk-KJVV3L5H.js";import"./chunk-Y3M7P3BW.js";export{D as BINARY_MESH_MAGIC,G as BINARY_MESH_VERSION,B as COMPRESSED_MESH_MAGIC,E as EDGES_SKIPPED_TRIANGLE_CAP,x as EDGE_USERDATA_KIND,b as FLAG_DELTA_ENCODED,P as FLAG_FLOAT32,N as FLAG_HAS_UVS,U as FLAG_HAS_VERTEX_COLORS,F as FLAG_UINT16_INDICES,L as LOOKS,u as MIN_SUPPORTED_VERSION,e as Materials,K as SCALE_FACTORS,g as TEXTURE_CACHE_MAX_ENTRIES,v as UV_FORMAT_FLOAT32,V as UV_FORMAT_UINT16,C as addEdges,h as addEdgesAsync,n as applyOffset,r as buildUpBasis,j as clearTextureCache,m as computeCombinedBoundingBox,l as createCameraController,f as createGrid,A as createLabelLayer,c as createMeasureTool,_ as createRenderPipeline,y as createViewGizmo,s as environmentRotationFor,X as getThreeMeshesFromComputeResponse,I as initThree,d as isEdgeOverlay,o as isoOffset,S as materialAppearanceForLook,H as parseBinaryMeshBatch,i as parseColor,R as parseDisplayItems,w as parseMeshBatch,k as parseMeshBatchBlob,z as parseMeshBatchObject,M as removeEdges,T as setTextureAnisotropy,O as snapToVertex,t as sunOffset,a as upToAxis,p as updateScene};
2
+ //# sourceMappingURL=visualization-XWX3PR4N.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGLOTP5TCcjs = require('./chunk-GLOTP5TC.cjs');require('./chunk-H3FZW6OX.cjs');exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunkGLOTP5TCcjs.j; exports.EDGE_USERDATA_KIND = _chunkGLOTP5TCcjs.i; exports.EdgeDetectionPass = _chunkGLOTP5TCcjs.o; exports.LOOKS = _chunkGLOTP5TCcjs.y; exports.Materials = _chunkGLOTP5TCcjs.a; exports.SCALE_FACTORS = _chunkGLOTP5TCcjs.P; exports.addEdges = _chunkGLOTP5TCcjs.l; exports.addEdgesAsync = _chunkGLOTP5TCcjs.m; exports.applyOffset = _chunkGLOTP5TCcjs.d; exports.computeCombinedBoundingBox = _chunkGLOTP5TCcjs.e; exports.createCameraController = _chunkGLOTP5TCcjs.f; exports.createGrid = _chunkGLOTP5TCcjs.g; exports.createLabelLayer = _chunkGLOTP5TCcjs.q; exports.createMeasureTool = _chunkGLOTP5TCcjs.s; exports.createRenderPipeline = _chunkGLOTP5TCcjs.p; exports.createViewGizmo = _chunkGLOTP5TCcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkGLOTP5TCcjs.Q; exports.initThree = _chunkGLOTP5TCcjs.x; exports.isEdgeOverlay = _chunkGLOTP5TCcjs.k; exports.parseColor = _chunkGLOTP5TCcjs.c; exports.parseDisplayItems = _chunkGLOTP5TCcjs.z; exports.parseMeshBatchBlob = _chunkGLOTP5TCcjs.O; exports.parseMeshBatchObject = _chunkGLOTP5TCcjs.N; exports.removeEdges = _chunkGLOTP5TCcjs.n; exports.snapToVertex = _chunkGLOTP5TCcjs.r; exports.updateScene = _chunkGLOTP5TCcjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3QSC23Y2cjs = require('./chunk-3QSC23Y2.cjs');require('./chunk-H3FZW6OX.cjs');exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunk3QSC23Y2cjs.o; exports.EDGE_USERDATA_KIND = _chunk3QSC23Y2cjs.n; exports.EdgeDetectionPass = _chunk3QSC23Y2cjs.t; exports.LOOKS = _chunk3QSC23Y2cjs.D; exports.Materials = _chunk3QSC23Y2cjs.a; exports.SCALE_FACTORS = _chunk3QSC23Y2cjs.U; exports.addEdges = _chunk3QSC23Y2cjs.q; exports.addEdgesAsync = _chunk3QSC23Y2cjs.r; exports.applyOffset = _chunk3QSC23Y2cjs.i; exports.buildUpBasis = _chunk3QSC23Y2cjs.b; exports.computeCombinedBoundingBox = _chunk3QSC23Y2cjs.j; exports.createCameraController = _chunk3QSC23Y2cjs.k; exports.createGrid = _chunk3QSC23Y2cjs.l; exports.createLabelLayer = _chunk3QSC23Y2cjs.v; exports.createMeasureTool = _chunk3QSC23Y2cjs.x; exports.createRenderPipeline = _chunk3QSC23Y2cjs.u; exports.createViewGizmo = _chunk3QSC23Y2cjs.m; exports.environmentRotationFor = _chunk3QSC23Y2cjs.e; exports.getThreeMeshesFromComputeResponse = _chunk3QSC23Y2cjs.V; exports.initThree = _chunk3QSC23Y2cjs.C; exports.isEdgeOverlay = _chunk3QSC23Y2cjs.p; exports.isoOffset = _chunk3QSC23Y2cjs.c; exports.parseColor = _chunk3QSC23Y2cjs.h; exports.parseDisplayItems = _chunk3QSC23Y2cjs.E; exports.parseMeshBatchBlob = _chunk3QSC23Y2cjs.T; exports.parseMeshBatchObject = _chunk3QSC23Y2cjs.S; exports.removeEdges = _chunk3QSC23Y2cjs.s; exports.snapToVertex = _chunk3QSC23Y2cjs.w; exports.sunOffset = _chunk3QSC23Y2cjs.d; exports.upToAxis = _chunk3QSC23Y2cjs.f; exports.updateScene = _chunk3QSC23Y2cjs.g;
2
2
  //# sourceMappingURL=visualization.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAAuN,gCAA6B,+sCAAojB","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAAqP,gCAA6B,26CAA8oB","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"}
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-C8XWc4Ab.cjs';
4
- export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-C8XWc4Ab.cjs';
3
+ import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-BpOl6U02.cjs';
4
+ export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-BpOl6U02.cjs';
5
5
  import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
6
6
  import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
7
7
  import { Pass } from 'three/addons/postprocessing/Pass.js';
@@ -48,6 +48,15 @@ type EnvironmentConfig = {
48
48
  hdrPath?: string;
49
49
  backgroundColor?: THREE.Color | string;
50
50
  enableEnvironmentLighting?: boolean;
51
+ /**
52
+ * The scene's up axis. **Defaults to `(0, 0, 1)` — Rhino's Z-up**, not Three's native Y-up,
53
+ * because geometry arrives in Rhino's frame and is never rotated on ingress (see
54
+ * `coordinate-transform.ts`). Everything orientation-dependent derives from this: view presets,
55
+ * the default iso camera, sun position, grid plane, floor normal, and the hemisphere light.
56
+ *
57
+ * Overriding it reorients the viewer but does NOT rotate incoming geometry, so a Y-up value only
58
+ * makes sense if the host also feeds Y-up geometry.
59
+ */
51
60
  sceneUp?: THREE.Vector3;
52
61
  showEnvironment?: boolean;
53
62
  /**
@@ -172,7 +181,11 @@ type GridConfig = {
172
181
  majorColor?: THREE.ColorRepresentation;
173
182
  /** World radius at which the grid fully fades. Default 100. */
174
183
  fadeDistance?: number;
175
- /** Plane the grid lies on. 'y' = horizontal ground. Default 'y'. */
184
+ /**
185
+ * Axis the grid lies perpendicular to — the scene's up axis. Defaults to whichever axis
186
+ * `sceneUp` points along, so it is `'z'` (Rhino's horizontal ground) unless you override
187
+ * `sceneUp`. Set explicitly only to force a grid orientation that ignores the scene up.
188
+ */
176
189
  plane?: 'x' | 'y' | 'z';
177
190
  };
178
191
  /** Corner nav-cube/axis gizmo that snaps to preset views. See `createViewGizmo`. */
@@ -309,7 +322,8 @@ interface CameraControllerDeps {
309
322
  /**
310
323
  * The scene's up axis. Presets, the orthographic camera's up, and the iso direction are all derived
311
324
  * from this so the controller is correct in any up convention (Three's native Y-up, Rhino's Z-up, …)
312
- * without hardcoding an axis. Defaults to Y-up.
325
+ * without hardcoding an axis. Falls back to `perspective.up` when omitted; `initThree` always
326
+ * passes the configured `sceneUp`, which itself defaults to Rhino's Z-up.
313
327
  */
314
328
  up?: THREE.Vector3;
315
329
  }
@@ -337,7 +351,13 @@ interface GridOptions {
337
351
  majorColor?: THREE.ColorRepresentation;
338
352
  /** World-space radius at which the grid has fully faded out. Default 100. */
339
353
  fadeDistance?: number;
340
- /** Plane to lay the grid on. 'y' = horizontal ground (Three Y-up). Default 'y'. */
354
+ /**
355
+ * Axis the grid is laid perpendicular to — i.e. the scene's up axis. `'z'` is the horizontal
356
+ * ground in the Rhino Z-up frame the viewer uses; `'y'` is Three's native Y-up.
357
+ *
358
+ * This standalone default is `'y'`, but `initThree` always passes a plane derived from the
359
+ * configured `sceneUp`, so a viewer-created grid defaults to `'z'`.
360
+ */
341
361
  plane?: 'x' | 'y' | 'z';
342
362
  }
343
363
  interface Grid {
@@ -624,7 +644,8 @@ declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camer
624
644
  declare function parseColor(colorString: string): THREE.Color;
625
645
  /**
626
646
  * Shift objects along one world axis. Defaults to `z` — the up axis of the unified Z-up scene
627
- * frame (see `../coordinate-transform.ts`), so grounding subtracts the content's lowest z.
647
+ * frame (see `../coordinate-transform.ts`), so grounding subtracts the content's lowest z. Pass an
648
+ * explicit axis when the scene is configured with a different `sceneUp`.
628
649
  */
629
650
  declare function applyOffset(meshes: THREE.Object3D[], offset: number, axis?: 'x' | 'y' | 'z'): void;
630
651
  /**
@@ -655,6 +676,76 @@ declare namespace threeMaterials {
655
676
  export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_SHARED_MATERIALS as SHARED_MATERIALS, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
656
677
  }
657
678
 
679
+ /**
680
+ * The single source of truth for "which way is up, and what do front/right mean" in the viewer.
681
+ *
682
+ * Every up-dependent default (camera framing, sun position, ground offset, view presets) derives
683
+ * from {@link buildUpBasis} instead of hardcoding an axis. Before this module those defaults each
684
+ * spelled out a Z-up vector inline, so a scene configured Y-up got a below-horizon camera and a
685
+ * near-horizontal sun while the presets and floor correctly followed `sceneUp`.
686
+ *
687
+ * ## Why front is -forward
688
+ *
689
+ * The basis returns `forward` = the direction the camera LOOKS (from camera toward model), and the
690
+ * preset positions are the opposite (from target toward camera). Rhino's convention fixes the signs:
691
+ * its Front view looks along +Y, so the camera sits at -Y; its Right view looks along -X, so the
692
+ * camera sits at +X. Deriving `right` as `seed x up` (rather than `up x seed`) is what makes the
693
+ * handedness come out matching Rhino rather than mirrored.
694
+ */
695
+ /** An orthonormal frame derived from a scene up axis. All vectors are unit length. */
696
+ interface UpBasis {
697
+ /** The scene up axis, normalized. */
698
+ up: THREE.Vector3;
699
+ /** The direction a "front" view looks along (from camera toward the model). */
700
+ forward: THREE.Vector3;
701
+ /** Completes a right-handed frame with `up` and `forward`. */
702
+ right: THREE.Vector3;
703
+ }
704
+ /**
705
+ * Derive the ground-plane axes for a given up vector.
706
+ *
707
+ * The seed picks whichever world axis is least parallel to `up`, so the cross products stay
708
+ * well-conditioned in any up convention. For Rhino's Z-up this yields forward = +Y and right = +X,
709
+ * matching Rhino's own Front/Right views; for Three's native Y-up it yields forward = -Z and
710
+ * right = +X, matching Three's convention that the default camera looks down -Z.
711
+ */
712
+ declare function buildUpBasis(up: THREE.Vector3): UpBasis;
713
+ /**
714
+ * The default 3/4 iso camera OFFSET from the target, scaled to `distance`.
715
+ *
716
+ * Placed behind-left and above the model (the conventional architectural 3/4), expressed in the
717
+ * scene's own basis so it reads the same in any up convention. Callers add this to the framing
718
+ * target to get a camera position.
719
+ */
720
+ declare function isoOffset(up: THREE.Vector3, distance: number): THREE.Vector3;
721
+ /**
722
+ * A default sun position: high above the model, offset to one side so surfaces get a directional
723
+ * gradient instead of flat top-down light. Expressed in the scene basis rather than a literal
724
+ * Z-up vector, so a Y-up scene still gets an overhead sun rather than a horizontal one.
725
+ */
726
+ declare function sunOffset(up: THREE.Vector3, sideDistance: number, height: number): THREE.Vector3;
727
+ /**
728
+ * The rotation that puts an equirectangular environment map's horizon on the scene's ground plane.
729
+ *
730
+ * Three's equirect mapping is hardcoded to Y-up: it assumes the HDR's horizon lies in the XZ plane
731
+ * and its zenith points along +Y. In a Z-up scene that leaves the environment on its side — the
732
+ * horizon runs vertically and image-based lighting arrives from +Y rather than from overhead. The
733
+ * result is a subtly wrong key direction that a neutral studio HDR hides but any sky/ground HDR
734
+ * makes obvious.
735
+ *
736
+ * Returns the Euler that rotates the map's native +Y zenith onto `up`. Identity for a Y-up scene.
737
+ * Apply to BOTH `scene.environmentRotation` and `scene.backgroundRotation` — they are independent
738
+ * properties, and setting only one makes the visible background disagree with the lighting.
739
+ */
740
+ declare function environmentRotationFor(up: THREE.Vector3): THREE.Euler;
741
+ /**
742
+ * Which world axis (`'x' | 'y' | 'z'`) the up vector most closely aligns with.
743
+ *
744
+ * Used for the grid plane and for the ground-offset axis — both need a single component index
745
+ * rather than a full vector. An off-axis up vector resolves to its dominant component.
746
+ */
747
+ declare function upToAxis(up: THREE.Vector3): 'x' | 'y' | 'z';
748
+
658
749
  /**
659
750
  * Crisp boundary/crease edges overlaid on meshes — the defining "technical drawing" look that makes
660
751
  * shaded geometry read as discrete objects rather than blobs.
@@ -910,11 +1001,11 @@ declare const SCALE_FACTORS: Record<string, number>;
910
1001
  * // With debugging enabled
911
1002
  * const meshes = await getThreeMeshesFromComputeResponse(response, { debug: true });
912
1003
  *
913
- * // With advanced options
1004
+ * // Opt in to seating the model on the grid instead of using its Rhino coordinates
914
1005
  * const meshes = await getThreeMeshesFromComputeResponse(response, {
915
1006
  * debug: true,
916
1007
  * allowScaling: true,
917
- * allowAutoPosition: false,
1008
+ * allowAutoPosition: true,
918
1009
  * parsing: {
919
1010
  * mergeByMaterial: false,
920
1011
  * applyTransforms: true,
@@ -983,4 +1074,4 @@ interface DisplayItemParseOptions {
983
1074
  */
984
1075
  declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
985
1076
 
986
- export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
1077
+ export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type UpBasis, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, buildUpBasis, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, environmentRotationFor, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, isoOffset, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, sunOffset, upToAxis, updateScene };
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-Dtok-mVq.js';
4
- export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-Dtok-mVq.js';
3
+ import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-4FMvnx2j.js';
4
+ export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-4FMvnx2j.js';
5
5
  import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
6
6
  import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
7
7
  import { Pass } from 'three/addons/postprocessing/Pass.js';
@@ -48,6 +48,15 @@ type EnvironmentConfig = {
48
48
  hdrPath?: string;
49
49
  backgroundColor?: THREE.Color | string;
50
50
  enableEnvironmentLighting?: boolean;
51
+ /**
52
+ * The scene's up axis. **Defaults to `(0, 0, 1)` — Rhino's Z-up**, not Three's native Y-up,
53
+ * because geometry arrives in Rhino's frame and is never rotated on ingress (see
54
+ * `coordinate-transform.ts`). Everything orientation-dependent derives from this: view presets,
55
+ * the default iso camera, sun position, grid plane, floor normal, and the hemisphere light.
56
+ *
57
+ * Overriding it reorients the viewer but does NOT rotate incoming geometry, so a Y-up value only
58
+ * makes sense if the host also feeds Y-up geometry.
59
+ */
51
60
  sceneUp?: THREE.Vector3;
52
61
  showEnvironment?: boolean;
53
62
  /**
@@ -172,7 +181,11 @@ type GridConfig = {
172
181
  majorColor?: THREE.ColorRepresentation;
173
182
  /** World radius at which the grid fully fades. Default 100. */
174
183
  fadeDistance?: number;
175
- /** Plane the grid lies on. 'y' = horizontal ground. Default 'y'. */
184
+ /**
185
+ * Axis the grid lies perpendicular to — the scene's up axis. Defaults to whichever axis
186
+ * `sceneUp` points along, so it is `'z'` (Rhino's horizontal ground) unless you override
187
+ * `sceneUp`. Set explicitly only to force a grid orientation that ignores the scene up.
188
+ */
176
189
  plane?: 'x' | 'y' | 'z';
177
190
  };
178
191
  /** Corner nav-cube/axis gizmo that snaps to preset views. See `createViewGizmo`. */
@@ -309,7 +322,8 @@ interface CameraControllerDeps {
309
322
  /**
310
323
  * The scene's up axis. Presets, the orthographic camera's up, and the iso direction are all derived
311
324
  * from this so the controller is correct in any up convention (Three's native Y-up, Rhino's Z-up, …)
312
- * without hardcoding an axis. Defaults to Y-up.
325
+ * without hardcoding an axis. Falls back to `perspective.up` when omitted; `initThree` always
326
+ * passes the configured `sceneUp`, which itself defaults to Rhino's Z-up.
313
327
  */
314
328
  up?: THREE.Vector3;
315
329
  }
@@ -337,7 +351,13 @@ interface GridOptions {
337
351
  majorColor?: THREE.ColorRepresentation;
338
352
  /** World-space radius at which the grid has fully faded out. Default 100. */
339
353
  fadeDistance?: number;
340
- /** Plane to lay the grid on. 'y' = horizontal ground (Three Y-up). Default 'y'. */
354
+ /**
355
+ * Axis the grid is laid perpendicular to — i.e. the scene's up axis. `'z'` is the horizontal
356
+ * ground in the Rhino Z-up frame the viewer uses; `'y'` is Three's native Y-up.
357
+ *
358
+ * This standalone default is `'y'`, but `initThree` always passes a plane derived from the
359
+ * configured `sceneUp`, so a viewer-created grid defaults to `'z'`.
360
+ */
341
361
  plane?: 'x' | 'y' | 'z';
342
362
  }
343
363
  interface Grid {
@@ -624,7 +644,8 @@ declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camer
624
644
  declare function parseColor(colorString: string): THREE.Color;
625
645
  /**
626
646
  * Shift objects along one world axis. Defaults to `z` — the up axis of the unified Z-up scene
627
- * frame (see `../coordinate-transform.ts`), so grounding subtracts the content's lowest z.
647
+ * frame (see `../coordinate-transform.ts`), so grounding subtracts the content's lowest z. Pass an
648
+ * explicit axis when the scene is configured with a different `sceneUp`.
628
649
  */
629
650
  declare function applyOffset(meshes: THREE.Object3D[], offset: number, axis?: 'x' | 'y' | 'z'): void;
630
651
  /**
@@ -655,6 +676,76 @@ declare namespace threeMaterials {
655
676
  export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_SHARED_MATERIALS as SHARED_MATERIALS, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
656
677
  }
657
678
 
679
+ /**
680
+ * The single source of truth for "which way is up, and what do front/right mean" in the viewer.
681
+ *
682
+ * Every up-dependent default (camera framing, sun position, ground offset, view presets) derives
683
+ * from {@link buildUpBasis} instead of hardcoding an axis. Before this module those defaults each
684
+ * spelled out a Z-up vector inline, so a scene configured Y-up got a below-horizon camera and a
685
+ * near-horizontal sun while the presets and floor correctly followed `sceneUp`.
686
+ *
687
+ * ## Why front is -forward
688
+ *
689
+ * The basis returns `forward` = the direction the camera LOOKS (from camera toward model), and the
690
+ * preset positions are the opposite (from target toward camera). Rhino's convention fixes the signs:
691
+ * its Front view looks along +Y, so the camera sits at -Y; its Right view looks along -X, so the
692
+ * camera sits at +X. Deriving `right` as `seed x up` (rather than `up x seed`) is what makes the
693
+ * handedness come out matching Rhino rather than mirrored.
694
+ */
695
+ /** An orthonormal frame derived from a scene up axis. All vectors are unit length. */
696
+ interface UpBasis {
697
+ /** The scene up axis, normalized. */
698
+ up: THREE.Vector3;
699
+ /** The direction a "front" view looks along (from camera toward the model). */
700
+ forward: THREE.Vector3;
701
+ /** Completes a right-handed frame with `up` and `forward`. */
702
+ right: THREE.Vector3;
703
+ }
704
+ /**
705
+ * Derive the ground-plane axes for a given up vector.
706
+ *
707
+ * The seed picks whichever world axis is least parallel to `up`, so the cross products stay
708
+ * well-conditioned in any up convention. For Rhino's Z-up this yields forward = +Y and right = +X,
709
+ * matching Rhino's own Front/Right views; for Three's native Y-up it yields forward = -Z and
710
+ * right = +X, matching Three's convention that the default camera looks down -Z.
711
+ */
712
+ declare function buildUpBasis(up: THREE.Vector3): UpBasis;
713
+ /**
714
+ * The default 3/4 iso camera OFFSET from the target, scaled to `distance`.
715
+ *
716
+ * Placed behind-left and above the model (the conventional architectural 3/4), expressed in the
717
+ * scene's own basis so it reads the same in any up convention. Callers add this to the framing
718
+ * target to get a camera position.
719
+ */
720
+ declare function isoOffset(up: THREE.Vector3, distance: number): THREE.Vector3;
721
+ /**
722
+ * A default sun position: high above the model, offset to one side so surfaces get a directional
723
+ * gradient instead of flat top-down light. Expressed in the scene basis rather than a literal
724
+ * Z-up vector, so a Y-up scene still gets an overhead sun rather than a horizontal one.
725
+ */
726
+ declare function sunOffset(up: THREE.Vector3, sideDistance: number, height: number): THREE.Vector3;
727
+ /**
728
+ * The rotation that puts an equirectangular environment map's horizon on the scene's ground plane.
729
+ *
730
+ * Three's equirect mapping is hardcoded to Y-up: it assumes the HDR's horizon lies in the XZ plane
731
+ * and its zenith points along +Y. In a Z-up scene that leaves the environment on its side — the
732
+ * horizon runs vertically and image-based lighting arrives from +Y rather than from overhead. The
733
+ * result is a subtly wrong key direction that a neutral studio HDR hides but any sky/ground HDR
734
+ * makes obvious.
735
+ *
736
+ * Returns the Euler that rotates the map's native +Y zenith onto `up`. Identity for a Y-up scene.
737
+ * Apply to BOTH `scene.environmentRotation` and `scene.backgroundRotation` — they are independent
738
+ * properties, and setting only one makes the visible background disagree with the lighting.
739
+ */
740
+ declare function environmentRotationFor(up: THREE.Vector3): THREE.Euler;
741
+ /**
742
+ * Which world axis (`'x' | 'y' | 'z'`) the up vector most closely aligns with.
743
+ *
744
+ * Used for the grid plane and for the ground-offset axis — both need a single component index
745
+ * rather than a full vector. An off-axis up vector resolves to its dominant component.
746
+ */
747
+ declare function upToAxis(up: THREE.Vector3): 'x' | 'y' | 'z';
748
+
658
749
  /**
659
750
  * Crisp boundary/crease edges overlaid on meshes — the defining "technical drawing" look that makes
660
751
  * shaded geometry read as discrete objects rather than blobs.
@@ -910,11 +1001,11 @@ declare const SCALE_FACTORS: Record<string, number>;
910
1001
  * // With debugging enabled
911
1002
  * const meshes = await getThreeMeshesFromComputeResponse(response, { debug: true });
912
1003
  *
913
- * // With advanced options
1004
+ * // Opt in to seating the model on the grid instead of using its Rhino coordinates
914
1005
  * const meshes = await getThreeMeshesFromComputeResponse(response, {
915
1006
  * debug: true,
916
1007
  * allowScaling: true,
917
- * allowAutoPosition: false,
1008
+ * allowAutoPosition: true,
918
1009
  * parsing: {
919
1010
  * mergeByMaterial: false,
920
1011
  * applyTransforms: true,
@@ -983,4 +1074,4 @@ interface DisplayItemParseOptions {
983
1074
  */
984
1075
  declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
985
1076
 
986
- export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
1077
+ export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type UpBasis, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, buildUpBasis, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, environmentRotationFor, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, isoOffset, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, sunOffset, upToAxis, updateScene };
@@ -1,2 +1,2 @@
1
- import{N as E,O as z,P as D,Q as O,a as e,b as r,c as t,d as o,e as i,f as s,g as a,h as p,i as n,j as f,k as l,l as m,m as y,n as u,o as d,p as x,q as g,r as C,s as c,x as h,y as j,z as v}from"./chunk-NVMSD4CC.js";import"./chunk-Y3M7P3BW.js";export{f as EDGES_SKIPPED_TRIANGLE_CAP,n as EDGE_USERDATA_KIND,d as EdgeDetectionPass,j as LOOKS,e as Materials,D as SCALE_FACTORS,m as addEdges,y as addEdgesAsync,o as applyOffset,i as computeCombinedBoundingBox,s as createCameraController,a as createGrid,g as createLabelLayer,c as createMeasureTool,x as createRenderPipeline,p as createViewGizmo,O as getThreeMeshesFromComputeResponse,h as initThree,l as isEdgeOverlay,t as parseColor,v as parseDisplayItems,z as parseMeshBatchBlob,E as parseMeshBatchObject,u as removeEdges,C as snapToVertex,r as updateScene};
1
+ import{C as D,D as O,E as P,S as B,T as G,U as L,V as M,a as e,b as t,c as r,d as o,e as i,f as s,g as a,h as p,i as n,j as f,k as l,l as m,m as u,n as y,o as d,p as x,q as g,r as C,s as h,t as c,u as j,v,w as z,x as E}from"./chunk-KJVV3L5H.js";import"./chunk-Y3M7P3BW.js";export{d as EDGES_SKIPPED_TRIANGLE_CAP,y as EDGE_USERDATA_KIND,c as EdgeDetectionPass,O as LOOKS,e as Materials,L as SCALE_FACTORS,g as addEdges,C as addEdgesAsync,n as applyOffset,t as buildUpBasis,f as computeCombinedBoundingBox,l as createCameraController,m as createGrid,v as createLabelLayer,E as createMeasureTool,j as createRenderPipeline,u as createViewGizmo,i as environmentRotationFor,M as getThreeMeshesFromComputeResponse,D as initThree,x as isEdgeOverlay,r as isoOffset,p as parseColor,P as parseDisplayItems,G as parseMeshBatchBlob,B as parseMeshBatchObject,h as removeEdges,z as snapToVertex,o as sunOffset,s as upToAxis,a as updateScene};
2
2
  //# sourceMappingURL=visualization.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/compute",
3
- "version": "3.1.0-beta.13",
3
+ "version": "3.1.0-beta.14",
4
4
  "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
5
5
  "author": "VektorNode",
6
6
  "license": "MIT",