@selvajs/compute 3.1.1 → 4.0.0-beta.1
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.
- package/README.md +4 -13
- package/dist/chunk-BCVDB6AE.js +2 -0
- package/dist/chunk-BCVDB6AE.js.map +1 -0
- package/dist/chunk-BVMGO7IG.cjs +2 -0
- package/dist/chunk-BVMGO7IG.cjs.map +1 -0
- package/dist/chunk-LLUNR66G.cjs +4 -0
- package/dist/chunk-LLUNR66G.cjs.map +1 -0
- package/dist/chunk-XT3XWDDV.js +4 -0
- package/dist/chunk-XT3XWDDV.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +13 -4
- package/dist/core.d.ts +13 -4
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +416 -50
- package/dist/grasshopper.d.ts +416 -50
- package/dist/grasshopper.js +1 -1
- package/dist/{handle-files-BISo_wob.d.cts → handle-files-DcA24IkS.d.cts} +45 -1
- package/dist/{handle-files-BISo_wob.d.ts → handle-files-DcA24IkS.d.ts} +45 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +1 -1
- package/package.json +8 -29
- package/dist/chunk-FQKQISPG.cjs +0 -2
- package/dist/chunk-FQKQISPG.cjs.map +0 -1
- package/dist/chunk-H3FZW6OX.cjs +0 -4
- package/dist/chunk-H3FZW6OX.cjs.map +0 -1
- package/dist/chunk-N2WCSETE.js +0 -120
- package/dist/chunk-N2WCSETE.js.map +0 -1
- package/dist/chunk-RFE763NG.cjs +0 -120
- package/dist/chunk-RFE763NG.cjs.map +0 -1
- package/dist/chunk-S3VUIIRE.js +0 -2
- package/dist/chunk-S3VUIIRE.js.map +0 -1
- package/dist/chunk-Y3M7P3BW.js +0 -4
- package/dist/chunk-Y3M7P3BW.js.map +0 -1
- package/dist/types-4FMvnx2j.d.ts +0 -556
- package/dist/types-BGhtYxZ-.d.cts +0 -45
- package/dist/types-BGhtYxZ-.d.ts +0 -45
- package/dist/types-BpOl6U02.d.cts +0 -556
- package/dist/visualization-E6BTQZCA.cjs +0 -2
- package/dist/visualization-E6BTQZCA.cjs.map +0 -1
- package/dist/visualization-HDBKPJGQ.js +0 -2
- package/dist/visualization-HDBKPJGQ.js.map +0 -1
- package/dist/visualization.cjs +0 -2
- package/dist/visualization.cjs.map +0 -1
- package/dist/visualization.d.cts +0 -1093
- package/dist/visualization.d.ts +0 -1093
- package/dist/visualization.js +0 -2
- package/dist/visualization.js.map +0 -1
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
import { C as ComputeConfig, a as RhinoModelUnit } from './types-BGhtYxZ-.cjs';
|
|
2
|
-
import { RhinoModule } from 'rhino3dm';
|
|
3
|
-
|
|
4
|
-
type DataTreePath = `{${string}}`;
|
|
5
|
-
interface DataItem {
|
|
6
|
-
type: string;
|
|
7
|
-
data: string;
|
|
8
|
-
id: string;
|
|
9
|
-
}
|
|
10
|
-
type DataTreeDefault<T = any> = {
|
|
11
|
-
[K in DataTreePath]?: T[];
|
|
12
|
-
};
|
|
13
|
-
type InnerTreeData = {
|
|
14
|
-
[path in DataTreePath]: DataItem[];
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Tree with parameter metadata (used in compute requests and responses).
|
|
18
|
-
*
|
|
19
|
-
* Field casing varies by server branch: stock mcneel compute (8.x/9.x)
|
|
20
|
-
* serializes `Resthopper.IO.DataTree` in PascalCase (`ParamName`/`InnerTree`
|
|
21
|
-
* — the C# class carries no `[JsonProperty]` attributes), while
|
|
22
|
-
* camelCase-serializing forks return `paramName`/`innerTree` instead. This
|
|
23
|
-
* client always *sends* PascalCase (see `DataTree.toCompute()` in
|
|
24
|
-
* `data-tree.ts`), so the PascalCase fields remain the canonical/required
|
|
25
|
-
* shape; the optional camelCase fields exist so responses from camelCase
|
|
26
|
-
* forks are representable without casts. Code that must read trees across
|
|
27
|
-
* both server families should use `readField`/`hasField`
|
|
28
|
-
* (`@/core/utils/read-field`, case-insensitive) rather than direct property
|
|
29
|
-
* access — `warnOnEmptyInnerTrees` in `solve.ts` is the reference example.
|
|
30
|
-
*/
|
|
31
|
-
interface DataTree {
|
|
32
|
-
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
33
|
-
InnerTree: InnerTreeData;
|
|
34
|
-
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
35
|
-
ParamName: string;
|
|
36
|
-
/** camelCase — sent instead of `InnerTree` by camelCase server forks. */
|
|
37
|
-
innerTree?: InnerTreeData;
|
|
38
|
-
/** camelCase — sent instead of `ParamName` by camelCase server forks. */
|
|
39
|
-
paramName?: string;
|
|
40
|
-
}
|
|
41
|
-
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | (string & {});
|
|
42
|
-
/**
|
|
43
|
-
* Union type for all possible default value types
|
|
44
|
-
*/
|
|
45
|
-
type DefaultValue<T> = T | T[] | DataTreeDefault<T> | undefined | null;
|
|
46
|
-
/**
|
|
47
|
-
* Base properties common to all processed input types.
|
|
48
|
-
* Note: `groupName` and `id` require the custom Rhino Compute branch.
|
|
49
|
-
*/
|
|
50
|
-
interface BaseInputType {
|
|
51
|
-
description: string;
|
|
52
|
-
name: string;
|
|
53
|
-
nickname: string | null;
|
|
54
|
-
treeAccess: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Name of the group this parameter belongs to.
|
|
57
|
-
* @requires Custom branch of compute.rhino3d
|
|
58
|
-
*/
|
|
59
|
-
groupName?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Unique identifier for the parameter.
|
|
62
|
-
* @requires Custom branch of compute.rhino3d
|
|
63
|
-
*/
|
|
64
|
-
id?: string;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Numeric input type (Number or Integer)
|
|
68
|
-
*/
|
|
69
|
-
interface NumericInputType extends BaseInputType {
|
|
70
|
-
paramType: 'Number' | 'Integer';
|
|
71
|
-
minimum?: number | null;
|
|
72
|
-
maximum?: number | null;
|
|
73
|
-
atLeast?: number | null;
|
|
74
|
-
atMost?: number | null;
|
|
75
|
-
stepSize?: number | null;
|
|
76
|
-
default: DefaultValue<number>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Text input type
|
|
80
|
-
*/
|
|
81
|
-
interface TextInputType extends BaseInputType {
|
|
82
|
-
paramType: 'Text';
|
|
83
|
-
default: DefaultValue<string>;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Boolean input type
|
|
87
|
-
*/
|
|
88
|
-
interface BooleanInputType extends BaseInputType {
|
|
89
|
-
paramType: 'Boolean';
|
|
90
|
-
default: DefaultValue<boolean>;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Geometry input type (generic geometry)
|
|
94
|
-
*/
|
|
95
|
-
interface GeometryInputType extends BaseInputType {
|
|
96
|
-
paramType: 'Geometry';
|
|
97
|
-
default: DefaultValue<object | string>;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* ValueList input type (dropdown/select)
|
|
101
|
-
*/
|
|
102
|
-
interface ValueListInputType extends BaseInputType {
|
|
103
|
-
paramType: 'ValueList';
|
|
104
|
-
values: Record<string, string>;
|
|
105
|
-
default?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* File input type
|
|
109
|
-
*/
|
|
110
|
-
interface FileInputType extends BaseInputType {
|
|
111
|
-
paramType: 'File';
|
|
112
|
-
acceptedFormats?: string[];
|
|
113
|
-
default: DefaultValue<object | string>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Color input type (stored as hex string)
|
|
117
|
-
*/
|
|
118
|
-
interface ColorInputType extends BaseInputType {
|
|
119
|
-
paramType: 'Color';
|
|
120
|
-
default: DefaultValue<string>;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Discriminated union of all input parameter types
|
|
124
|
-
*/
|
|
125
|
-
type InputParam = NumericInputType | BooleanInputType | TextInputType | ValueListInputType | GeometryInputType | FileInputType | ColorInputType;
|
|
126
|
-
/**
|
|
127
|
-
* Base Grasshopper schema properties shared by config, args, and response
|
|
128
|
-
*/
|
|
129
|
-
interface GrasshopperBaseSchema {
|
|
130
|
-
/** Absolute tolerance used in computation */
|
|
131
|
-
absolutetolerance?: number | null;
|
|
132
|
-
/** Angular tolerance used in computation */
|
|
133
|
-
angletolerance?: number | null;
|
|
134
|
-
/** Model units used */
|
|
135
|
-
modelunits?: RhinoModelUnit | null;
|
|
136
|
-
/** Data version (7 or 8) */
|
|
137
|
-
dataversion?: 7 | 8 | null;
|
|
138
|
-
/** Whether to use cached solution */
|
|
139
|
-
cachesolve?: boolean | null;
|
|
140
|
-
/**
|
|
141
|
-
* Opt-in: cache a solve even when the definition reported GH errors. Default
|
|
142
|
-
* (false/unset) means errored solves are never cached server-side. Some
|
|
143
|
-
* definitions throw GH errors by design (a guarded Python component, a
|
|
144
|
-
* filtered branch) while still producing correct geometry — set this so those
|
|
145
|
-
* still benefit from the server's solve cache. Only meaningful with
|
|
146
|
-
* `cachesolve`. Requires a server that honors it (VektorNode fork).
|
|
147
|
-
*/
|
|
148
|
-
cacheerroredsolves?: boolean | null;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Definition source (used in args and response)
|
|
152
|
-
*/
|
|
153
|
-
interface GrasshopperDefinitionSource {
|
|
154
|
-
/** Base64 encoded algorithm (if embedded) */
|
|
155
|
-
algo?: string | null;
|
|
156
|
-
/** URL pointer to definition file */
|
|
157
|
-
pointer?: string | null;
|
|
158
|
-
/** Filename of the definition */
|
|
159
|
-
filename?: string | null;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Configuration for Grasshopper compute operations
|
|
163
|
-
* Combines server config with optional Grasshopper-specific computation settings
|
|
164
|
-
*
|
|
165
|
-
* Note: The definition source (pointer/algo) is NOT part of config.
|
|
166
|
-
* Instead, pass the definition directly to methods like solve(), getIO(), etc.
|
|
167
|
-
*/
|
|
168
|
-
interface GrasshopperComputeConfig extends ComputeConfig {
|
|
169
|
-
/** Absolute tolerance used in computation */
|
|
170
|
-
absolutetolerance?: number | null;
|
|
171
|
-
/** Angular tolerance used in computation */
|
|
172
|
-
angletolerance?: number | null;
|
|
173
|
-
/** Model units used */
|
|
174
|
-
modelunits?: RhinoModelUnit | null;
|
|
175
|
-
/** Data version (7 or 8) */
|
|
176
|
-
dataversion?: 7 | 8 | null;
|
|
177
|
-
/** Whether to use cached solution */
|
|
178
|
-
cachesolve?: boolean | null;
|
|
179
|
-
/**
|
|
180
|
-
* Opt-in: cache a solve even when the definition reported GH errors. See
|
|
181
|
-
* {@link GrasshopperBaseSchema.cacheerroredsolves}. Only meaningful with
|
|
182
|
-
* `cachesolve`.
|
|
183
|
-
*/
|
|
184
|
-
cacheerroredsolves?: boolean | null;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Arguments sent to Grasshopper compute endpoint
|
|
188
|
-
* Includes config options + definition source + input values
|
|
189
|
-
*/
|
|
190
|
-
interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
|
|
191
|
-
/** Input values organized by parameter */
|
|
192
|
-
values?: DataTree[];
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Response from Grasshopper compute server
|
|
196
|
-
* Includes all schema fields + computed results
|
|
197
|
-
*
|
|
198
|
-
* `pointer` is deliberately excluded (`Omit`): the solve layer (`runSolve` in
|
|
199
|
-
* `solve.ts`) splits the server's echoed `pointer` off as the solve's
|
|
200
|
-
* `cacheKey` and strips it from the returned response, so client-returned
|
|
201
|
-
* responses never carry it.
|
|
202
|
-
*
|
|
203
|
-
* The schema-echo fields (`cachesolve`/`modelunits`/`dataversion`) stay
|
|
204
|
-
* optional as inherited from {@link GrasshopperBaseSchema}: the server echoes
|
|
205
|
-
* them back when set, but nothing client-side enforces their presence — don't
|
|
206
|
-
* rely on them without a fallback.
|
|
207
|
-
*/
|
|
208
|
-
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, Omit<GrasshopperDefinitionSource, 'pointer'> {
|
|
209
|
-
/**
|
|
210
|
-
* Model units the definition was solved in. Every conforming server response
|
|
211
|
-
* carries this (it drives downstream scaling, e.g. the webdisplay parser),
|
|
212
|
-
* but note it is not validated client-side — a non-conforming server or
|
|
213
|
-
* hand-built mock may omit it at runtime.
|
|
214
|
-
*/
|
|
215
|
-
modelunits: RhinoModelUnit;
|
|
216
|
-
/**
|
|
217
|
-
* The server echoes the request's full base64 definition back as `algo`, but the client strips
|
|
218
|
-
* it before returning — retaining it would pin a multi-MB copy of the definition per response,
|
|
219
|
-
* multiplied by every cache that holds responses. Always `undefined` on client-returned
|
|
220
|
-
* responses (inherited optional field from {@link GrasshopperDefinitionSource}).
|
|
221
|
-
*/
|
|
222
|
-
algo?: string | null;
|
|
223
|
-
/** Filename of the definition (always present in response) */
|
|
224
|
-
filename: string | null;
|
|
225
|
-
/** Recursion level used */
|
|
226
|
-
recursionlevel?: number;
|
|
227
|
-
/** Output values organized by parameter */
|
|
228
|
-
values: DataTree[];
|
|
229
|
-
/** Computation errors */
|
|
230
|
-
errors?: string[];
|
|
231
|
-
/** Computation warnings */
|
|
232
|
-
warnings?: string[];
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Output parameter
|
|
236
|
-
*/
|
|
237
|
-
interface OutputParamSchema {
|
|
238
|
-
name: string;
|
|
239
|
-
nickname: string | null;
|
|
240
|
-
paramType: string;
|
|
241
|
-
/**
|
|
242
|
-
* Grasshopper parameter instance GUID
|
|
243
|
-
*/
|
|
244
|
-
id: string;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Input parameter
|
|
248
|
-
*/
|
|
249
|
-
interface InputParamSchema {
|
|
250
|
-
/**
|
|
251
|
-
* Grasshopper parameter instance GUID
|
|
252
|
-
*/
|
|
253
|
-
id: string;
|
|
254
|
-
name: string;
|
|
255
|
-
nickname: string | null;
|
|
256
|
-
description: string;
|
|
257
|
-
paramType: string;
|
|
258
|
-
treeAccess: boolean;
|
|
259
|
-
minimum: number | null;
|
|
260
|
-
maximum: number | null;
|
|
261
|
-
atLeast: number;
|
|
262
|
-
atMost: number;
|
|
263
|
-
stepSize?: number;
|
|
264
|
-
default: any;
|
|
265
|
-
/**
|
|
266
|
-
* Key-value pairs for dropdown options
|
|
267
|
-
*/
|
|
268
|
-
values?: Record<string, string>;
|
|
269
|
-
/**
|
|
270
|
-
* Accepted file formats for File input
|
|
271
|
-
*/
|
|
272
|
-
acceptedFormats?: string[];
|
|
273
|
-
groupName?: string | null;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Parsed input/output structure with raw schemas.
|
|
277
|
-
*
|
|
278
|
-
* `loadWarnings` / `loadErrors` carry the server's definition-load diagnostics
|
|
279
|
-
* (missing plugin, broken component, etc.) from the `/io` response. They are
|
|
280
|
-
* distinct from per-input parse failures (`InputParseError`): these come from
|
|
281
|
-
* the server loading the definition, those from the client typing an input.
|
|
282
|
-
*/
|
|
283
|
-
interface GrasshopperParsedIORaw {
|
|
284
|
-
inputs: InputParamSchema[];
|
|
285
|
-
outputs: OutputParamSchema[];
|
|
286
|
-
/** Server-side definition-load warnings, if any. */
|
|
287
|
-
loadWarnings?: string[];
|
|
288
|
-
/** Server-side definition-load errors, if any (e.g. missing plugin). */
|
|
289
|
-
loadErrors?: string[];
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Per-input parse failure. The corresponding entry in `inputs` was filled
|
|
293
|
-
* with a safe default so the rest of the pipeline can keep going — but the
|
|
294
|
-
* caller should surface this so the user knows their definition has a
|
|
295
|
-
* misconfigured parameter.
|
|
296
|
-
*/
|
|
297
|
-
interface InputParseError {
|
|
298
|
-
/** The input's `name` (or `'unknown'` if the schema didn't have one). */
|
|
299
|
-
inputName: string;
|
|
300
|
-
/** The declared paramType from the raw schema. */
|
|
301
|
-
paramType: string;
|
|
302
|
-
/** Human-readable reason from the underlying RhinoComputeError. */
|
|
303
|
-
message: string;
|
|
304
|
-
/** Error code from the underlying RhinoComputeError, if available. */
|
|
305
|
-
code?: string;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Parsed input/output structure with processed types.
|
|
309
|
-
*
|
|
310
|
-
* `parseErrors` is populated when one or more inputs failed validation and
|
|
311
|
-
* fell back to a safe default. The result is still usable, but the UI should
|
|
312
|
-
* surface these so the user can fix their definition.
|
|
313
|
-
*/
|
|
314
|
-
interface GrasshopperParsedIO {
|
|
315
|
-
inputs: InputParam[];
|
|
316
|
-
outputs: OutputParamSchema[];
|
|
317
|
-
parseErrors?: InputParseError[];
|
|
318
|
-
/**
|
|
319
|
-
* Server-side definition-load warnings from the `/io` response (e.g. an
|
|
320
|
-
* obsolete component). Surface these so the user understands a degraded IO
|
|
321
|
-
* list. Distinct from `parseErrors` (client-side input typing failures).
|
|
322
|
-
*/
|
|
323
|
-
loadWarnings?: string[];
|
|
324
|
-
/**
|
|
325
|
-
* Server-side definition-load errors from the `/io` response (e.g. a missing
|
|
326
|
-
* plugin that left inputs unresolved). When present, the inputs/outputs may
|
|
327
|
-
* be incomplete — the user needs to fix their server/definition.
|
|
328
|
-
*/
|
|
329
|
-
loadErrors?: string[];
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Non-mesh display items: curves and points. Ride as JSON inside {@link DisplayBatch} alongside
|
|
334
|
-
* the binary mesh blob. The union is STRICT and discriminated on `kind`; the parser uses a
|
|
335
|
-
* `never`-exhaustiveness check, so adding a new kind is a compile error until handled.
|
|
336
|
-
*/
|
|
337
|
-
/**
|
|
338
|
-
* Identity + tagging shared by every display thing — meshes (via an adapter over `MeshMetadata`)
|
|
339
|
-
* and items alike — so pick / filter / label code treats them uniformly. Deliberately excludes
|
|
340
|
-
* rendering concerns (color/material): those differ by kind and are not identity.
|
|
341
|
-
*/
|
|
342
|
-
interface DisplayIdentity {
|
|
343
|
-
/** Stable pick key. Both meshes and items synthesize it as `${sourceComponentId}:${originalIndex}`. */
|
|
344
|
-
id: string;
|
|
345
|
-
/** Human label (e.g. "North wall"). Distinct from {@link id} — renaming must not change identity. */
|
|
346
|
-
name: string;
|
|
347
|
-
/** Layer path for grouping in the scene manager (e.g. "Structure/Walls"). */
|
|
348
|
-
layer: string;
|
|
349
|
-
/** Arbitrary key-value pairs from the GH Metadata input. */
|
|
350
|
-
metadata?: Record<string, string>;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Style fields every visible item can honour. Lines and points have no PBR (no metalness/roughness),
|
|
354
|
-
* so only color + opacity apply here; a future kind that needs richer material adds fields to its own
|
|
355
|
-
* variant rather than bloating this base.
|
|
356
|
-
*/
|
|
357
|
-
interface DisplayItemBase extends DisplayIdentity {
|
|
358
|
-
/** Hex/rgb/named color string, parsed by `parseColor`. Falls back to a viewer default. */
|
|
359
|
-
color?: string;
|
|
360
|
-
/** Opacity 0–1. Omitted means fully opaque. */
|
|
361
|
-
opacity?: number;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* A world position in Rhino's Z-up frame, in Rhino's `{X,Y,Z}` casing. Used unchanged on parse —
|
|
365
|
-
* the Three scene IS Rhino's Z-up frame, so no rotation is applied (see `../coordinate-transform.ts`).
|
|
366
|
-
*/
|
|
367
|
-
interface DisplayPosition {
|
|
368
|
-
X: number;
|
|
369
|
-
Y: number;
|
|
370
|
-
Z: number;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* A curve shipped as Rhino-native JSON (`curve.ToNurbsCurve().ToJSON()`), decoded via rhino3dm and
|
|
374
|
-
* tessellated to a fat `Line2` on the web (so {@link DisplayCurve.width} is honoured).
|
|
375
|
-
*/
|
|
376
|
-
interface DisplayCurve extends DisplayItemBase {
|
|
377
|
-
kind: 'curve';
|
|
378
|
-
/** Rhino CommonObject JSON for the curve. */
|
|
379
|
-
json: string;
|
|
380
|
-
/**
|
|
381
|
-
* Line thickness in CSS pixels (screen-space, constant regardless of zoom). Rendered via a fat
|
|
382
|
-
* `Line2`, so unlike `THREE.Line` this is actually honoured. Omitted → viewer default.
|
|
383
|
-
*/
|
|
384
|
-
width?: number;
|
|
385
|
-
}
|
|
386
|
-
/** A single point, shipped raw (no rhino3dm decode), rendered as one vertex of a `THREE.Points`. */
|
|
387
|
-
interface DisplayPoint extends DisplayItemBase {
|
|
388
|
-
kind: 'point';
|
|
389
|
-
/** World position in Rhino Z-up, used directly — the Three scene shares Rhino's Z-up frame. */
|
|
390
|
-
position: DisplayPosition;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* One non-mesh display item. Meshes do NOT appear here — they ride the binary blob in `DisplayBatch`.
|
|
394
|
-
* New kinds (`label`, `icon`) extend this union and add a parser case; the parser's `never` guard
|
|
395
|
-
* forces them to be handled.
|
|
396
|
-
*/
|
|
397
|
-
type DisplayItem = DisplayCurve | DisplayPoint;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Material properties for Three.js rendering.
|
|
401
|
-
*/
|
|
402
|
-
interface SerializableMaterial {
|
|
403
|
-
color: string;
|
|
404
|
-
metalness: number;
|
|
405
|
-
roughness: number;
|
|
406
|
-
opacity: number;
|
|
407
|
-
transparent: boolean;
|
|
408
|
-
/**
|
|
409
|
-
* Optional color-map texture reference: an http(s) URL, a data URI, or a plugin asset URL
|
|
410
|
-
* (`http://localhost:{port}/assets/{hash}`). Absent for untextured materials — the field is
|
|
411
|
-
* omitted from JSON entirely, so pre-texture payloads are unchanged. When set, the mesh blob
|
|
412
|
-
* also carries per-vertex UVs (FLAG_HAS_UVS) for meshes using this material.
|
|
413
|
-
*/
|
|
414
|
-
map?: string;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Metadata for a single mesh within a batch.
|
|
418
|
-
*
|
|
419
|
-
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
420
|
-
* **index-count units** — i.e. element offsets into the decoded typed arrays, which is how
|
|
421
|
-
* consumers address them (`indices.subarray(indexStart, indexStart + indexCount)`). To address
|
|
422
|
-
* the typed-array storage:
|
|
423
|
-
* - vertex component offset = `vertexStart * 3`
|
|
424
|
-
* - vertex component count = `vertexCount * 3`
|
|
425
|
-
* - index element offset = `indexStart`
|
|
426
|
-
* - index count = `indexCount`
|
|
427
|
-
*
|
|
428
|
-
* If you need *byte* offsets, multiply by the element size, which depends on the blob's flags:
|
|
429
|
-
* indices are 2 bytes each for `FLAG_UINT16_INDICES` (wire v2+) blobs and 4 bytes for uint32
|
|
430
|
-
* blobs; vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
431
|
-
*/
|
|
432
|
-
interface MeshMetadata {
|
|
433
|
-
name: string;
|
|
434
|
-
/** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
|
|
435
|
-
layer: string;
|
|
436
|
-
/** Original index in the GH input tree before material grouping. Combined with
|
|
437
|
-
* MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
|
|
438
|
-
originalIndex: number;
|
|
439
|
-
/** Number of vertices in this mesh (each vertex is 3 components: x, y, z). */
|
|
440
|
-
vertexCount: number;
|
|
441
|
-
/** Number of indices in this mesh (3 per triangle). */
|
|
442
|
-
indexCount: number;
|
|
443
|
-
/** Index of this mesh's first vertex in the combined vertex array, in vertex-count units.
|
|
444
|
-
* The corresponding component offset into the int16/float32 typed array is `vertexStart * 3`. */
|
|
445
|
-
vertexStart: number;
|
|
446
|
-
/** Index of this mesh's first index in the combined index array, in index-count units. */
|
|
447
|
-
indexStart: number;
|
|
448
|
-
/** Arbitrary key-value pairs from the GH Metadata input */
|
|
449
|
-
metadata?: Record<string, string>;
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* A group of meshes sharing the same material.
|
|
453
|
-
*/
|
|
454
|
-
interface MaterialGroup {
|
|
455
|
-
/** Reference to the material ID in the materials array */
|
|
456
|
-
materialId: number;
|
|
457
|
-
/** Individual meshes in this group */
|
|
458
|
-
meshes: MeshMetadata[];
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* One Display component's payload, ready for Three.js rendering.
|
|
462
|
-
*
|
|
463
|
-
* `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
|
|
464
|
-
* float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
|
|
465
|
-
* The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
|
|
466
|
-
* without changing this shape.
|
|
467
|
-
*
|
|
468
|
-
* Today this carries only meshes (the binary blob). It is named `DisplayBatch` rather than
|
|
469
|
-
* `MeshBatch` because it is the seam through which non-mesh display items (curves, points, and
|
|
470
|
-
* later labels/icons) also travel — those ride as JSON alongside the mesh blob, not inside it.
|
|
471
|
-
*/
|
|
472
|
-
interface DisplayBatch {
|
|
473
|
-
materials: SerializableMaterial[];
|
|
474
|
-
groups: MaterialGroup[];
|
|
475
|
-
compressedData: string;
|
|
476
|
-
/** InstanceGuid of the WebDisplay GH component that produced this batch.
|
|
477
|
-
* Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
478
|
-
sourceComponentId?: string;
|
|
479
|
-
/**
|
|
480
|
-
* Non-mesh display items (curves, points; later labels/icons) — see {@link DisplayItem}.
|
|
481
|
-
* Optional: omitted when there are none, so mesh-only batches are unchanged on the wire. These
|
|
482
|
-
* ride as JSON alongside the mesh blob and are parsed by the separate `display-items` path, not
|
|
483
|
-
* the SLVA mesh parser.
|
|
484
|
-
*/
|
|
485
|
-
items?: DisplayItem[];
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* @deprecated Renamed to {@link DisplayBatch} — the payload now carries more than meshes.
|
|
489
|
-
* This alias keeps existing imports compiling; remove it once consumers migrate.
|
|
490
|
-
*/
|
|
491
|
-
type MeshBatch = DisplayBatch;
|
|
492
|
-
interface MeshBatchParsingOptions {
|
|
493
|
-
/** Merge meshes with same material into single geometry. Defaults to true. */
|
|
494
|
-
mergeByMaterial?: boolean;
|
|
495
|
-
/** Apply coordinate system transformations. Defaults to true. */
|
|
496
|
-
applyTransforms?: boolean;
|
|
497
|
-
/** Enable performance monitoring. Defaults to false. */
|
|
498
|
-
debug?: boolean;
|
|
499
|
-
/**
|
|
500
|
-
* Appearance dials applied to every material built from this batch. These drive how "studio"
|
|
501
|
-
* vs "matte technical" the meshes look; they are set once at parse time (materials are rebuilt
|
|
502
|
-
* per solve). Runtime restyling of an already-built scene lives in the viewer's `setLook`.
|
|
503
|
-
*/
|
|
504
|
-
material?: MaterialAppearanceOptions;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* How compute meshes read visually. Bundled so a caller can pick a coherent look ('technical' vs
|
|
508
|
-
* 'rendered') by setting all three together rather than dialing each in isolation.
|
|
509
|
-
*/
|
|
510
|
-
interface MaterialAppearanceOptions {
|
|
511
|
-
/**
|
|
512
|
-
* Multiplier on the HDR image-based-lighting reflection strength. ~0.5 reads matte/technical,
|
|
513
|
-
* ~1.3 reads glossy/presentation. Default 1 (three.js's own default — unchanged look).
|
|
514
|
-
*/
|
|
515
|
-
envMapIntensity?: number;
|
|
516
|
-
/**
|
|
517
|
-
* Cull back faces (`THREE.FrontSide`) instead of rendering both sides (`THREE.DoubleSide`).
|
|
518
|
-
* FrontSide gives cleaner interior shading, a crisper silhouette, and less overdraw on closed
|
|
519
|
-
* solids — but open surfaces (which Rhino also emits) then vanish when viewed from behind.
|
|
520
|
-
* Default false (keep DoubleSide) to stay safe for surface geometry.
|
|
521
|
-
*/
|
|
522
|
-
cullBackfaces?: boolean;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Options for extracting and processing meshes from compute responses.
|
|
526
|
-
*/
|
|
527
|
-
interface MeshExtractionOptions {
|
|
528
|
-
/** Configuration for parsing mesh batches. */
|
|
529
|
-
parsing?: MeshBatchParsingOptions;
|
|
530
|
-
/** Apply scaling based on model units. Defaults to true. */
|
|
531
|
-
allowScaling?: boolean;
|
|
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
|
-
*/
|
|
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';
|
|
547
|
-
/**
|
|
548
|
-
* rhino3dm instance for decoding curve display items. selva-compute does not own the WASM
|
|
549
|
-
* instance; the host threads it in. Omit to skip curves (points still render).
|
|
550
|
-
*/
|
|
551
|
-
rhino?: RhinoModule;
|
|
552
|
-
/** Enable verbose logging. Defaults to false. */
|
|
553
|
-
debug?: boolean;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
export type { BooleanInputType as B, DataItem as D, FileInputType as F, GeometryInputType as G, InnerTreeData as I, MaterialAppearanceOptions 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, MeshExtractionOptions as m, MeshBatchParsingOptions as n, DisplayBatch as o, DisplayItem as p, DisplayCurve as q, DisplayIdentity as r, DisplayItemBase as s, DisplayPoint as t, DisplayPosition as u, MeshBatch as v };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRFE763NGcjs = require('./chunk-RFE763NG.cjs');require('./chunk-H3FZW6OX.cjs');exports.BINARY_MESH_MAGIC = _chunkRFE763NGcjs.F; exports.BINARY_MESH_VERSION = _chunkRFE763NGcjs.H; exports.COMPRESSED_MESH_MAGIC = _chunkRFE763NGcjs.G; exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunkRFE763NGcjs.o; exports.EDGE_USERDATA_KIND = _chunkRFE763NGcjs.n; exports.FLAG_DELTA_ENCODED = _chunkRFE763NGcjs.L; exports.FLAG_FLOAT32 = _chunkRFE763NGcjs.J; exports.FLAG_HAS_UVS = _chunkRFE763NGcjs.M; exports.FLAG_HAS_VERTEX_COLORS = _chunkRFE763NGcjs.N; exports.FLAG_UINT16_INDICES = _chunkRFE763NGcjs.K; exports.LOOKS = _chunkRFE763NGcjs.D; exports.MIN_SUPPORTED_VERSION = _chunkRFE763NGcjs.I; exports.Materials = _chunkRFE763NGcjs.a; exports.SCALE_FACTORS = _chunkRFE763NGcjs.U; exports.TEXTURE_CACHE_MAX_ENTRIES = _chunkRFE763NGcjs.y; exports.UV_FORMAT_FLOAT32 = _chunkRFE763NGcjs.P; exports.UV_FORMAT_UINT16 = _chunkRFE763NGcjs.O; exports.addEdges = _chunkRFE763NGcjs.q; exports.addEdgesAsync = _chunkRFE763NGcjs.r; exports.applyOffset = _chunkRFE763NGcjs.i; exports.buildUpBasis = _chunkRFE763NGcjs.b; exports.clearTextureCache = _chunkRFE763NGcjs.A; exports.computeCombinedBoundingBox = _chunkRFE763NGcjs.j; exports.createCameraController = _chunkRFE763NGcjs.k; exports.createGrid = _chunkRFE763NGcjs.l; exports.createLabelLayer = _chunkRFE763NGcjs.v; exports.createMeasureTool = _chunkRFE763NGcjs.x; exports.createRenderPipeline = _chunkRFE763NGcjs.u; exports.createViewGizmo = _chunkRFE763NGcjs.m; exports.environmentRotationFor = _chunkRFE763NGcjs.e; exports.getThreeMeshesFromComputeResponse = _chunkRFE763NGcjs.V; exports.initThree = _chunkRFE763NGcjs.C; exports.isEdgeOverlay = _chunkRFE763NGcjs.p; exports.isoOffset = _chunkRFE763NGcjs.c; exports.materialAppearanceForLook = _chunkRFE763NGcjs.B; exports.parseBinaryMeshBatch = _chunkRFE763NGcjs.Q; exports.parseColor = _chunkRFE763NGcjs.h; exports.parseDisplayItems = _chunkRFE763NGcjs.E; exports.parseMeshBatch = _chunkRFE763NGcjs.R; exports.parseMeshBatchBlob = _chunkRFE763NGcjs.T; exports.parseMeshBatchObject = _chunkRFE763NGcjs.S; exports.removeEdges = _chunkRFE763NGcjs.s; exports.setTextureAnisotropy = _chunkRFE763NGcjs.z; exports.snapToVertex = _chunkRFE763NGcjs.w; exports.sunOffset = _chunkRFE763NGcjs.d; exports.upToAxis = _chunkRFE763NGcjs.f; exports.updateScene = _chunkRFE763NGcjs.g;
|
|
2
|
-
//# sourceMappingURL=visualization-E6BTQZCA.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization-E6BTQZCA.cjs"],"names":[],"mappings":"AAAA,iIAA0W,gCAA6B,qtEAAwhC","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization-E6BTQZCA.cjs"}
|
|
@@ -1,2 +0,0 @@
|
|
|
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-N2WCSETE.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-HDBKPJGQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/visualization.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRFE763NGcjs = require('./chunk-RFE763NG.cjs');require('./chunk-H3FZW6OX.cjs');exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunkRFE763NGcjs.o; exports.EDGE_USERDATA_KIND = _chunkRFE763NGcjs.n; exports.EdgeDetectionPass = _chunkRFE763NGcjs.t; exports.LOOKS = _chunkRFE763NGcjs.D; exports.Materials = _chunkRFE763NGcjs.a; exports.SCALE_FACTORS = _chunkRFE763NGcjs.U; exports.addEdges = _chunkRFE763NGcjs.q; exports.addEdgesAsync = _chunkRFE763NGcjs.r; exports.applyOffset = _chunkRFE763NGcjs.i; exports.buildUpBasis = _chunkRFE763NGcjs.b; exports.computeCombinedBoundingBox = _chunkRFE763NGcjs.j; exports.createCameraController = _chunkRFE763NGcjs.k; exports.createGrid = _chunkRFE763NGcjs.l; exports.createLabelLayer = _chunkRFE763NGcjs.v; exports.createMeasureTool = _chunkRFE763NGcjs.x; exports.createRenderPipeline = _chunkRFE763NGcjs.u; exports.createViewGizmo = _chunkRFE763NGcjs.m; exports.environmentRotationFor = _chunkRFE763NGcjs.e; exports.getThreeMeshesFromComputeResponse = _chunkRFE763NGcjs.V; exports.initThree = _chunkRFE763NGcjs.C; exports.isEdgeOverlay = _chunkRFE763NGcjs.p; exports.isoOffset = _chunkRFE763NGcjs.c; exports.parseColor = _chunkRFE763NGcjs.h; exports.parseDisplayItems = _chunkRFE763NGcjs.E; exports.parseMeshBatchBlob = _chunkRFE763NGcjs.T; exports.parseMeshBatchObject = _chunkRFE763NGcjs.S; exports.removeEdges = _chunkRFE763NGcjs.s; exports.snapToVertex = _chunkRFE763NGcjs.w; exports.sunOffset = _chunkRFE763NGcjs.d; exports.upToAxis = _chunkRFE763NGcjs.f; exports.updateScene = _chunkRFE763NGcjs.g;
|
|
2
|
-
//# sourceMappingURL=visualization.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|