nodi-modular 0.0.2 → 0.0.3

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/index.d.ts CHANGED
@@ -1,5 +1,36 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export interface NodeConnectionInterop {
4
+ outputNodeId: string;
5
+ outputIndex: number;
6
+ inputNodeId: string;
7
+ inputIndex: number;
8
+ }
9
+
10
+ export type GeometryInteropHandleProxy = { variant: "Mesh"; data: MeshInteropHandle } | { variant: "Curve"; data: CurveInteropHandle } | { variant: "Group"; data: GroupInteropHandle };
11
+
12
+ /**
13
+ * Geometry identifier
14
+ */
15
+ export interface GeometryIdentifier {
16
+ /**
17
+ * Parent node ID
18
+ */
19
+ nodeId?: NodeId;
20
+ /**
21
+ * Output ID that the geometry is belonged to
22
+ */
23
+ outputId: OutputId;
24
+ /**
25
+ * Geometry ID
26
+ */
27
+ geometryId: ID<GeometryProxy>;
28
+ /**
29
+ * Transform matrix in interop format
30
+ */
31
+ transform: TransformInterop;
32
+ }
33
+
3
34
  export interface MeshInteropHandle {
4
35
  count: number;
5
36
  vertices: number;
@@ -8,6 +39,16 @@ export interface MeshInteropHandle {
8
39
  transform: TransformInterop | undefined;
9
40
  }
10
41
 
42
+ export interface DataTreeInterop {
43
+ outputs: IndexMap<string, string>;
44
+ }
45
+
46
+ /**
47
+ * Interop struct for transform
48
+ * Represents a 4x4 matrix as a 16-element array
49
+ */
50
+ export type TransformInterop = number[];
51
+
11
52
  export type NodeSectionInterop = { type: "section"; content: NodeFolderInterop } | { type: "item"; content: NodeItemInterop };
12
53
 
13
54
  export interface NodeItemInterop {
@@ -21,8 +62,53 @@ export interface NodeMapInterop {
21
62
  folder: NodeFolderInterop;
22
63
  }
23
64
 
24
- export interface DataTreeInterop {
25
- outputs: IndexMap<string, string>;
65
+ /**
66
+ * Interop struct for evaluation results
67
+ */
68
+ export interface EvaluationInterop {
69
+ /**
70
+ * Processed nodes in the latest evaluation
71
+ */
72
+ processedNodes: NodeId[];
73
+ /**
74
+ * Geometry identifiers in the latest evaluation
75
+ */
76
+ geometryIdentifiers: GeometryIdentifier[];
77
+ }
78
+
79
+ export interface IndicesInteropHandle {
80
+ count: number;
81
+ indices: number;
82
+ }
83
+
84
+ /**
85
+ * Options for adaptive tessellation to create geometry interoperability
86
+ */
87
+ export interface AdaptiveTessellationOptions {
88
+ /**
89
+ * Whether to enable adaptive tessellation
90
+ */
91
+ enabled: boolean;
92
+ /**
93
+ * Tolerance for the normal vector: if the L2 norm of the normal vectors is below this value, the edge is considered flat
94
+ */
95
+ normTolerance: number;
96
+ /**
97
+ * Minimum number of divisions in u direction
98
+ */
99
+ minDivsU: number;
100
+ /**
101
+ * Minimum number of divisions in v direction
102
+ */
103
+ minDivsV: number;
104
+ /**
105
+ * Minimum depth for division
106
+ */
107
+ minDepth: number;
108
+ /**
109
+ * Maximum depth for division
110
+ */
111
+ maxDepth: number;
26
112
  }
27
113
 
28
114
  export interface NodeCreationSetting {
@@ -35,36 +121,37 @@ export interface NodeCreationSetting {
35
121
  visible?: boolean;
36
122
  }
37
123
 
38
- export interface EvaluationInterop {
39
- processedNodes: NodeId[];
40
- geometryIdentifiers: GeometryIdentifier[];
41
- }
42
-
43
- export type GeometryInteropHandleProxy = { variant: "Mesh"; data: MeshInteropHandle } | { variant: "Curve"; data: CurveInteropHandle } | { variant: "Group"; data: GroupInteropHandle };
44
-
45
- export interface GeometryIdentifier {
46
- nodeId?: NodeId;
47
- outputId: OutputId;
48
- geometryId: ID<GeometryProxy>;
49
- transform: TransformInterop;
50
- }
51
-
52
- export interface EdgeInterop {
53
- source: EdgeUnitInterop<OutputId>;
54
- destination: EdgeUnitInterop<InputId>;
55
- empty: boolean;
124
+ export interface GeometrySpreadsheet {
125
+ points: Point3<number>[];
126
+ curves: CurveProxy[];
127
+ surfaces: SurfaceProxy[];
128
+ meshes: MeshInterop[];
56
129
  }
57
130
 
58
- export interface EdgeUnitInterop<IO> {
59
- node: NodeId;
60
- io: IO;
131
+ export interface GroupInteropHandle {
132
+ objects: GeometryInteropHandleProxy[];
61
133
  }
62
134
 
63
- export interface IOInterop {
64
- id: string;
135
+ /**
136
+ * Interop struct for node property
137
+ */
138
+ export interface NodePropertyInterop {
139
+ /**
140
+ * Property name
141
+ */
65
142
  name: string;
66
- accessType: string;
67
- connections: string[];
143
+ /**
144
+ * Property value
145
+ */
146
+ value: NodePropertyValue;
147
+ /**
148
+ * Whether the node has input connection and the property change is disabled
149
+ */
150
+ connected?: boolean;
151
+ /**
152
+ * Whether the property is disabled in node\' inspector
153
+ */
154
+ disabled?: boolean;
68
155
  }
69
156
 
70
157
  export type GeometryInteropVec = GeometryInterop[];
@@ -77,30 +164,66 @@ export type NodeInteropVec = NodeInterop[];
77
164
 
78
165
  export type EdgeInteropVec = EdgeInterop[];
79
166
 
80
- export interface CurveInteropHandle {
81
- count: number;
82
- vertices: number;
83
- transform: TransformInterop | undefined;
167
+ /**
168
+ * Interop struct for node
169
+ */
170
+ export interface NodeInterop {
171
+ /**
172
+ * Node variant
173
+ */
174
+ variant: string;
175
+ /**
176
+ * Node identifier
177
+ */
178
+ id: string;
179
+ name: string;
180
+ label: string | undefined;
181
+ /**
182
+ * Input parameters
183
+ */
184
+ inputs: IOInterop[];
185
+ /**
186
+ * Output parameters
187
+ */
188
+ outputs: IOInterop[];
189
+ /**
190
+ * Node properties
191
+ */
192
+ properties: NodePropertyInterop[];
193
+ enabled: boolean;
194
+ visible: boolean;
195
+ meta: NodeMetaInterop;
84
196
  }
85
197
 
86
- export interface NodePropertyInterop {
198
+ export interface NodeEntityInterop {
199
+ variant: string;
200
+ id: string;
87
201
  name: string;
88
- value: NodePropertyValue;
89
- connected?: boolean;
90
- disabled?: boolean;
202
+ label: string | undefined;
203
+ inputs: string[];
204
+ outputs: string[];
205
+ enabled: boolean;
206
+ visible: boolean;
91
207
  }
92
208
 
93
- export interface GeometrySpreadsheet {
94
- points: Point3<number>[];
95
- curves: CurveProxy[];
96
- surfaces: SurfaceProxy[];
97
- meshes: MeshInterop[];
209
+ /**
210
+ * Interop struct for node meta
211
+ */
212
+ export interface NodeMetaInterop {
213
+ /**
214
+ * Error message
215
+ */
216
+ error: string | undefined;
217
+ /**
218
+ * Node\' output has geometry or not
219
+ */
220
+ hasGeometry: boolean;
98
221
  }
99
222
 
100
- export type TransformInterop = number[];
101
-
102
- export interface GroupInteropHandle {
103
- objects: GeometryInteropHandleProxy[];
223
+ export interface CurveInteropHandle {
224
+ count: number;
225
+ vertices: number;
226
+ transform: TransformInterop | undefined;
104
227
  }
105
228
 
106
229
 
@@ -132,45 +255,22 @@ export type Vector4<T = number> = SVector<T, 4>;
132
255
  export type Transform3<T = number> = FixedLengthArray<T, 16>;
133
256
 
134
257
 
135
- export interface NodeInterop {
136
- variant: string;
137
- id: string;
138
- name: string;
139
- label: string | undefined;
140
- inputs: IOInterop[];
141
- outputs: IOInterop[];
142
- properties: NodePropertyInterop[];
143
- enabled: boolean;
144
- visible: boolean;
145
- meta: NodeMetaInterop;
146
- }
147
-
148
- export interface NodeEntityInterop {
149
- variant: string;
258
+ export interface IOInterop {
150
259
  id: string;
151
260
  name: string;
152
- label: string | undefined;
153
- inputs: string[];
154
- outputs: string[];
155
- enabled: boolean;
156
- visible: boolean;
157
- }
158
-
159
- export interface NodeMetaInterop {
160
- error: string | undefined;
161
- hasGeometry: boolean;
261
+ accessType: string;
262
+ connections: string[];
162
263
  }
163
264
 
164
- export interface NodeConnectionInterop {
165
- outputNodeId: string;
166
- outputIndex: number;
167
- inputNodeId: string;
168
- inputIndex: number;
265
+ export interface EdgeInterop {
266
+ source: EdgeUnitInterop<OutputId>;
267
+ destination: EdgeUnitInterop<InputId>;
268
+ empty: boolean;
169
269
  }
170
270
 
171
- export interface IndicesInteropHandle {
172
- count: number;
173
- indices: number;
271
+ export interface EdgeUnitInterop<IO> {
272
+ node: NodeId;
273
+ io: IO;
174
274
  }
175
275
 
176
276
  export interface NodePropertyCategoryValue {
@@ -233,116 +333,245 @@ export interface Prune<T, U> {
233
333
  bypass: Connection[] | undefined;
234
334
  }
235
335
 
336
+ /**
337
+ * Graph structure
338
+ */
236
339
  export interface Graph<T, U> {
340
+ /**
341
+ * Nodes in the graph
342
+ */
237
343
  nodes: IndexMap<NodeId, Node<T, U>>;
238
344
  }
239
345
 
240
346
 
241
- export type NurbsCurve3D<T = number> = {
242
- control_points: Point4<T>[];
243
- knots: T[];
244
- degree: T;
245
- };
246
-
247
- export interface PointCloudInterop {
248
- vertices: [number, number, number][];
249
- transform: Transform3<number>;
250
- }
251
-
252
- export type GeometryProxy = { variant: "Curve"; data: CurveProxy } | { variant: "Surface"; data: SurfaceProxy } | { variant: "Extrusion"; data: Extrusion<SurfaceProxy> } | { variant: "Brep"; data: Brep } | { variant: "Mesh"; data: Mesh } | { variant: "BBox"; data: OrientedBox } | { variant: "Group"; data: Group };
253
-
254
- export type NurbsCurve = NurbsCurve3D<number>;
255
-
256
-
257
347
  export type LineCurve3D = {
258
348
  a: Point3;
259
349
  b: Point3;
260
350
  };
261
351
 
352
+ /**
353
+ * An oriented box in 3D space
354
+ */
262
355
  export interface OrientedBox {
356
+ /**
357
+ * The plane that the box is aligned to
358
+ */
263
359
  plane: Plane;
360
+ /**
361
+ * The bounding box in the local coordinate system
362
+ */
264
363
  bounds: BoundingBox3D;
265
364
  }
266
365
 
267
366
  /**
268
- * Represents a mesh.
367
+ * Mesh representation with vertices, normals, uv, and index
269
368
  */
270
369
  export interface Mesh {
370
+ /**
371
+ * Vertices of the mesh
372
+ */
271
373
  vertices: Point3<number>[];
374
+ /**
375
+ * Normals of the mesh
376
+ */
272
377
  normals: Vector3<number>[] | undefined;
378
+ /**
379
+ * UV coordinates of the mesh
380
+ */
273
381
  uv: Vector2<number>[] | undefined;
382
+ /**
383
+ * Index of the mesh
384
+ */
274
385
  index: [number, number, number][];
275
386
  }
276
387
 
388
+ /**
389
+ * An arc curve in 3D space
390
+ */
277
391
  export interface ArcCurve {
392
+ /**
393
+ * The base plane of the arc
394
+ */
278
395
  plane: Plane;
396
+ /**
397
+ * The start angle of the arc
398
+ */
279
399
  startAngle: number;
400
+ /**
401
+ * The end angle of the arc
402
+ */
280
403
  endAngle: number;
404
+ /**
405
+ * The radius of the arc
406
+ */
281
407
  radius: number;
282
408
  }
283
409
 
284
410
 
285
- export type BoundingBox3D = {
286
- min: Vector3;
287
- max: Vector3;
411
+ export type NurbsCurve3D<T = number> = {
412
+ control_points: Point4<T>[];
413
+ knots: T[];
414
+ degree: T;
288
415
  };
289
416
 
290
- export type GeometryInterop = { variant: "Mesh"; data: MeshInterop } | { variant: "Curve"; data: CurveInterop } | { variant: "Point"; data: PointCloudInterop } | { variant: "Plane"; data: Plane } | { variant: "Group"; data: GeometryInterop[] };
291
-
292
- export interface CurveInterop {
417
+ /**
418
+ * Interop struct for point cloud data
419
+ */
420
+ export interface PointCloudInterop {
421
+ /**
422
+ * Vertices of the point cloud
423
+ */
293
424
  vertices: [number, number, number][];
294
- transform: Transform3<number> | undefined;
425
+ /**
426
+ * Transform matrix of the point cloud
427
+ */
428
+ transform: Transform3<number>;
295
429
  }
296
430
 
297
- export type SurfaceProxy = { variant: "Circular"; data: CircularSurface } | { variant: "Hemisphere"; data: HemisphereSurface } | { variant: "Triangle"; data: TriangleSurface } | { variant: "Plane"; data: PlaneSurface } | { variant: "NURBS"; data: NurbsSurface } | { variant: "Trimmed"; data: TrimmedSurface<SurfaceProxy, CurveProxy> };
298
-
431
+ /**
432
+ * Geometry proxy for various geometry types
433
+ */
434
+ export type GeometryProxy = { variant: "Curve"; data: CurveProxy } | { variant: "Surface"; data: SurfaceProxy } | { variant: "Extrusion"; data: Extrusion<SurfaceProxy> } | { variant: "Brep"; data: Brep } | { variant: "Mesh"; data: Mesh } | { variant: "BBox"; data: OrientedBox } | { variant: "Group"; data: Group };
299
435
 
300
- export type Triangle3D = {
301
- a: Point3;
302
- b: Point3;
303
- c: Point3;
304
- };
436
+ export type NurbsCurve = NurbsCurve3D<number>;
305
437
 
438
+ /**
439
+ * A hemisphere surface
440
+ */
306
441
  export interface HemisphereSurface {
442
+ /**
443
+ * The base plane of the hemisphere
444
+ */
307
445
  plane: Plane;
446
+ /**
447
+ * The radius of the hemisphere
448
+ */
308
449
  radius: number;
309
450
  }
310
451
 
311
- export interface Domain {
312
- min: number;
313
- max: number;
314
- }
315
-
316
- export interface Plane {
317
- origin: Point3<number>;
318
- normal: Vector3<number>;
319
- xAxis: Vector3<number>;
320
- yAxis: Vector3<number>;
321
- }
322
-
452
+ /**
453
+ * Interop struct for mesh data
454
+ */
323
455
  export interface MeshInterop {
456
+ /**
457
+ * Vertices of the mesh
458
+ */
324
459
  vertices: [number, number, number][];
460
+ /**
461
+ * Normals of the mesh
462
+ */
325
463
  normals: [number, number, number][];
464
+ /**
465
+ * UV coordinates of the mesh
466
+ */
326
467
  uv?: [number, number][];
468
+ /**
469
+ * Faces of the mesh
470
+ */
327
471
  faces?: [number, number, number][];
472
+ /**
473
+ * Transform matrix of the mesh
474
+ */
328
475
  transform?: Transform3<number>;
329
476
  }
330
477
 
478
+ /**
479
+ * A surface defined by three points
480
+ */
331
481
  export type TriangleSurface = Triangle3D;
332
482
 
483
+ /**
484
+ * A surface defined by a plane and two domains in x and y directions
485
+ */
333
486
  export interface PlaneSurface {
487
+ /**
488
+ * The base plane of the surface
489
+ */
334
490
  plane: Plane;
491
+ /**
492
+ * The domain in x direction
493
+ */
335
494
  x: Domain;
495
+ /**
496
+ * The domain in y direction
497
+ */
336
498
  y: Domain;
337
499
  }
338
500
 
501
+ /**
502
+ * Proxy for various curve types
503
+ */
339
504
  export type CurveProxy = { variant: "Line"; data: LineCurve3D } | { variant: "Arc"; data: ArcCurve } | { variant: "Circle"; data: CircleCurve } | { variant: "Rectangle"; data: RectangleCurve } | { variant: "Polyline"; data: PolylineCurve3D } | { variant: "NURBS"; data: NurbsCurve };
340
505
 
341
506
 
507
+ export type Triangle3D = {
508
+ a: Point3;
509
+ b: Point3;
510
+ c: Point3;
511
+ };
512
+
513
+ export interface Domain {
514
+ min: number;
515
+ max: number;
516
+ }
517
+
518
+ /**
519
+ * Plane representation with origin, normal, x axis, and y axis
520
+ */
521
+ export interface Plane {
522
+ /**
523
+ * Origin coordinate of the plane
524
+ */
525
+ origin: Point3<number>;
526
+ /**
527
+ * Normal vector of the plane
528
+ */
529
+ normal: Vector3<number>;
530
+ /**
531
+ * X axis of the plane
532
+ */
533
+ xAxis: Vector3<number>;
534
+ /**
535
+ * Y axis of the plane
536
+ */
537
+ yAxis: Vector3<number>;
538
+ }
539
+
540
+
541
+ export type BoundingBox3D = {
542
+ min: Vector3;
543
+ max: Vector3;
544
+ };
545
+
546
+ /**
547
+ * Interop proxy for various geometry types
548
+ */
549
+ export type GeometryInterop = { variant: "Mesh"; data: MeshInterop } | { variant: "Curve"; data: CurveInterop } | { variant: "Point"; data: PointCloudInterop } | { variant: "Plane"; data: Plane } | { variant: "Group"; data: GeometryInterop[] };
550
+
551
+ /**
552
+ * Interop struct for curve data
553
+ */
554
+ export interface CurveInterop {
555
+ /**
556
+ * Vertices of the curve
557
+ */
558
+ vertices: [number, number, number][];
559
+ /**
560
+ * Transform matrix of the curve
561
+ */
562
+ transform: Transform3<number> | undefined;
563
+ }
564
+
565
+
342
566
  export type PolylineCurve3D = {
343
567
  points: Point3[];
344
568
  };
345
569
 
570
+ /**
571
+ * Proxy for various surface types
572
+ */
573
+ export type SurfaceProxy = { variant: "Circular"; data: CircularSurface } | { variant: "Hemisphere"; data: HemisphereSurface } | { variant: "Triangle"; data: TriangleSurface } | { variant: "Plane"; data: PlaneSurface } | { variant: "NURBS"; data: NurbsSurface } | { variant: "Trimmed"; data: TrimmedSurface<SurfaceProxy, CurveProxy> };
574
+
346
575
 
347
576
  export type NurbsSurface3D<T = number> = {
348
577
  control_points: Point4<T>[][];
@@ -352,63 +581,115 @@ export type NurbsSurface3D<T = number> = {
352
581
  v_degree: T;
353
582
  };
354
583
 
584
+ /**
585
+ * A NURBS surface
586
+ */
355
587
  export type NurbsSurface = NurbsSurface3D<number>;
356
588
 
589
+ /**
590
+ * A circular surface
591
+ */
357
592
  export interface CircularSurface {
593
+ /**
594
+ * The base plane of the circle
595
+ */
358
596
  plane: Plane;
597
+ /**
598
+ * The radius of the circle
599
+ */
359
600
  radius: number;
360
601
  }
361
602
 
603
+ /**
604
+ * A rectangle curve in 3D space
605
+ */
362
606
  export interface RectangleCurve {
607
+ /**
608
+ * The base plane of the rectangle
609
+ */
363
610
  plane: Plane;
611
+ /**
612
+ * The domain of the rectangle in the plane x axis
613
+ */
364
614
  x: Domain;
615
+ /**
616
+ * The domain of the rectangle in the plane y axis
617
+ */
365
618
  y: Domain;
366
619
  }
367
620
 
621
+ /**
622
+ * A circle curve in 3D space
623
+ */
368
624
  export interface CircleCurve {
625
+ /**
626
+ * The base plane of the circle
627
+ */
369
628
  plane: Plane;
629
+ /**
630
+ * The radius of the circle
631
+ */
370
632
  radius: number;
371
633
  }
372
634
 
635
+ /**
636
+ * Modular structure with a graph handle
637
+ */
373
638
  export class Modular {
374
639
  free(): void;
375
640
  /**
641
+ * Create a new modular instance
376
642
  * @returns {Modular}
377
643
  */
378
644
  static new(): Modular;
379
645
  /**
646
+ * Load a graph from a JSON string
380
647
  * @param {string} input
381
648
  */
382
649
  loadGraph(input: string): void;
383
650
  /**
651
+ * Export the graph in JSON format
384
652
  * @returns {Graph}
385
653
  */
386
654
  exportGraph(): Graph;
655
+ /**
656
+ * Clear the graph
657
+ */
387
658
  clearGraph(): void;
388
659
  /**
660
+ * Evaluate the graph with latest state
389
661
  * @returns {Promise<EvaluationInterop>}
390
662
  */
391
663
  evaluate(): Promise<EvaluationInterop>;
392
664
  /**
393
- * @param {string} id
665
+ * Get all nodes in the graph
666
+ * @returns {(NodeInterop)[]}
667
+ */
668
+ getNodes(): (NodeInterop)[];
669
+ /**
670
+ * Change a node property with node id and property
671
+ * @param {string} node_id
394
672
  * @param {NodePropertyInterop} prop
395
673
  * @returns {Promise<boolean>}
396
674
  */
397
- changeNodeProperty(id: string, prop: NodePropertyInterop): Promise<boolean>;
675
+ changeNodeProperty(node_id: string, prop: NodePropertyInterop): Promise<boolean>;
398
676
  /**
399
- * @returns {(NodeInterop)[]}
677
+ * Find a geometry by its identifier
678
+ * @param {GeometryIdentifier} identifier
679
+ * @returns {GeometryProxy | undefined}
400
680
  */
401
- getNodes(): (NodeInterop)[];
681
+ findGeometryById(identifier: GeometryIdentifier): GeometryProxy | undefined;
402
682
  /**
683
+ * Find a geometry interop by its identifier
403
684
  * @param {GeometryIdentifier} identifier
404
685
  * @returns {GeometryInterop | undefined}
405
686
  */
406
687
  findGeometryInteropById(identifier: GeometryIdentifier): GeometryInterop | undefined;
407
688
  /**
408
- * @param {GeometryIdentifier} identifier
409
- * @returns {GeometryProxy | undefined}
689
+ * Update the tessellation options to modify the tessellation quality for geometry interoperability
690
+ * @param {AdaptiveTessellationOptions | undefined} [options]
410
691
  */
411
- findGeometryById(identifier: GeometryIdentifier): GeometryProxy | undefined;
692
+ updateTessellationOptions(options?: AdaptiveTessellationOptions): void;
412
693
  }
413
694
 
414
695
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -421,21 +702,22 @@ export interface InitOutput {
421
702
  readonly modular_exportGraph: (a: number) => number;
422
703
  readonly modular_clearGraph: (a: number) => void;
423
704
  readonly modular_evaluate: (a: number) => number;
424
- readonly modular_changeNodeProperty: (a: number, b: number, c: number, d: number) => number;
425
705
  readonly modular_getNodes: (a: number) => Array;
426
- readonly modular_findGeometryInteropById: (a: number, b: number) => number;
706
+ readonly modular_changeNodeProperty: (a: number, b: number, c: number, d: number) => number;
427
707
  readonly modular_findGeometryById: (a: number, b: number) => number;
708
+ readonly modular_findGeometryInteropById: (a: number, b: number) => number;
709
+ readonly modular_updateTessellationOptions: (a: number, b: number) => void;
428
710
  readonly __wbindgen_malloc: (a: number, b: number) => number;
429
711
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
430
712
  readonly __wbindgen_export_2: WebAssembly.Table;
431
713
  readonly __wbindgen_export_3: WebAssembly.Table;
432
- readonly closure537_externref_shim: (a: number, b: number, c: number) => void;
714
+ readonly closure538_externref_shim: (a: number, b: number, c: number) => void;
433
715
  readonly __externref_table_dealloc: (a: number) => void;
434
716
  readonly __externref_drop_slice: (a: number, b: number) => void;
435
717
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
436
- readonly __wbindgen_exn_store: (a: number) => void;
437
718
  readonly __externref_table_alloc: () => number;
438
- readonly closure822_externref_shim: (a: number, b: number, c: number, d: number) => void;
719
+ readonly __wbindgen_exn_store: (a: number) => void;
720
+ readonly closure820_externref_shim: (a: number, b: number, c: number, d: number) => void;
439
721
  readonly __wbindgen_start: () => void;
440
722
  }
441
723
 
package/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  let wasm;
2
2
 
3
- let WASM_VECTOR_LEN = 0;
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
+
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
4
6
 
5
7
  let cachedUint8ArrayMemory0 = null;
6
8
 
@@ -11,6 +13,26 @@ function getUint8ArrayMemory0() {
11
13
  return cachedUint8ArrayMemory0;
12
14
  }
13
15
 
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
+ }
20
+
21
+ function isLikeNone(x) {
22
+ return x === undefined || x === null;
23
+ }
24
+
25
+ let cachedDataViewMemory0 = null;
26
+
27
+ function getDataViewMemory0() {
28
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
29
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
30
+ }
31
+ return cachedDataViewMemory0;
32
+ }
33
+
34
+ let WASM_VECTOR_LEN = 0;
35
+
14
36
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
37
 
16
38
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -65,28 +87,6 @@ function passStringToWasm0(arg, malloc, realloc) {
65
87
  return ptr;
66
88
  }
67
89
 
68
- function isLikeNone(x) {
69
- return x === undefined || x === null;
70
- }
71
-
72
- let cachedDataViewMemory0 = null;
73
-
74
- function getDataViewMemory0() {
75
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
76
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
77
- }
78
- return cachedDataViewMemory0;
79
- }
80
-
81
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
82
-
83
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
84
-
85
- function getStringFromWasm0(ptr, len) {
86
- ptr = ptr >>> 0;
87
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
88
- }
89
-
90
90
  function debugString(val) {
91
91
  // primitive types
92
92
  const type = typeof val;
@@ -183,7 +183,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
183
183
  return real;
184
184
  }
185
185
  function __wbg_adapter_52(arg0, arg1, arg2) {
186
- wasm.closure537_externref_shim(arg0, arg1, arg2);
186
+ wasm.closure538_externref_shim(arg0, arg1, arg2);
187
187
  }
188
188
 
189
189
  function takeFromExternrefTable0(idx) {
@@ -203,14 +203,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
203
203
  return result;
204
204
  }
205
205
 
206
- function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
207
-
208
206
  function addToExternrefTable0(obj) {
209
207
  const idx = wasm.__externref_table_alloc();
210
208
  wasm.__wbindgen_export_2.set(idx, obj);
211
209
  return idx;
212
210
  }
213
211
 
212
+ function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
213
+
214
214
  function handleError(f, args) {
215
215
  try {
216
216
  return f.apply(this, args);
@@ -219,8 +219,8 @@ function handleError(f, args) {
219
219
  wasm.__wbindgen_exn_store(idx);
220
220
  }
221
221
  }
222
- function __wbg_adapter_130(arg0, arg1, arg2, arg3) {
223
- wasm.closure822_externref_shim(arg0, arg1, arg2, arg3);
222
+ function __wbg_adapter_131(arg0, arg1, arg2, arg3) {
223
+ wasm.closure820_externref_shim(arg0, arg1, arg2, arg3);
224
224
  }
225
225
 
226
226
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -230,7 +230,9 @@ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate
230
230
  const ModularFinalization = (typeof FinalizationRegistry === 'undefined')
231
231
  ? { register: () => {}, unregister: () => {} }
232
232
  : new FinalizationRegistry(ptr => wasm.__wbg_modular_free(ptr >>> 0, 1));
233
-
233
+ /**
234
+ * Modular structure with a graph handle
235
+ */
234
236
  export class Modular {
235
237
 
236
238
  static __wrap(ptr) {
@@ -253,6 +255,7 @@ export class Modular {
253
255
  wasm.__wbg_modular_free(ptr, 0);
254
256
  }
255
257
  /**
258
+ * Create a new modular instance
256
259
  * @returns {Modular}
257
260
  */
258
261
  static new() {
@@ -260,6 +263,7 @@ export class Modular {
260
263
  return Modular.__wrap(ret);
261
264
  }
262
265
  /**
266
+ * Load a graph from a JSON string
263
267
  * @param {string} input
264
268
  */
265
269
  loadGraph(input) {
@@ -271,16 +275,21 @@ export class Modular {
271
275
  }
272
276
  }
273
277
  /**
278
+ * Export the graph in JSON format
274
279
  * @returns {Graph}
275
280
  */
276
281
  exportGraph() {
277
282
  const ret = wasm.modular_exportGraph(this.__wbg_ptr);
278
283
  return ret;
279
284
  }
285
+ /**
286
+ * Clear the graph
287
+ */
280
288
  clearGraph() {
281
289
  wasm.modular_clearGraph(this.__wbg_ptr);
282
290
  }
283
291
  /**
292
+ * Evaluate the graph with latest state
284
293
  * @returns {Promise<EvaluationInterop>}
285
294
  */
286
295
  evaluate() {
@@ -288,26 +297,38 @@ export class Modular {
288
297
  return ret;
289
298
  }
290
299
  /**
291
- * @param {string} id
300
+ * Get all nodes in the graph
301
+ * @returns {(NodeInterop)[]}
302
+ */
303
+ getNodes() {
304
+ const ret = wasm.modular_getNodes(this.__wbg_ptr);
305
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
306
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
307
+ return v1;
308
+ }
309
+ /**
310
+ * Change a node property with node id and property
311
+ * @param {string} node_id
292
312
  * @param {NodePropertyInterop} prop
293
313
  * @returns {Promise<boolean>}
294
314
  */
295
- changeNodeProperty(id, prop) {
296
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
315
+ changeNodeProperty(node_id, prop) {
316
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
317
  const len0 = WASM_VECTOR_LEN;
298
318
  const ret = wasm.modular_changeNodeProperty(this.__wbg_ptr, ptr0, len0, prop);
299
319
  return ret;
300
320
  }
301
321
  /**
302
- * @returns {(NodeInterop)[]}
322
+ * Find a geometry by its identifier
323
+ * @param {GeometryIdentifier} identifier
324
+ * @returns {GeometryProxy | undefined}
303
325
  */
304
- getNodes() {
305
- const ret = wasm.modular_getNodes(this.__wbg_ptr);
306
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
307
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
308
- return v1;
326
+ findGeometryById(identifier) {
327
+ const ret = wasm.modular_findGeometryById(this.__wbg_ptr, identifier);
328
+ return ret;
309
329
  }
310
330
  /**
331
+ * Find a geometry interop by its identifier
311
332
  * @param {GeometryIdentifier} identifier
312
333
  * @returns {GeometryInterop | undefined}
313
334
  */
@@ -316,12 +337,11 @@ export class Modular {
316
337
  return ret;
317
338
  }
318
339
  /**
319
- * @param {GeometryIdentifier} identifier
320
- * @returns {GeometryProxy | undefined}
340
+ * Update the tessellation options to modify the tessellation quality for geometry interoperability
341
+ * @param {AdaptiveTessellationOptions | undefined} [options]
321
342
  */
322
- findGeometryById(identifier) {
323
- const ret = wasm.modular_findGeometryById(this.__wbg_ptr, identifier);
324
- return ret;
343
+ updateTessellationOptions(options) {
344
+ wasm.modular_updateTessellationOptions(this.__wbg_ptr, isLikeNone(options) ? 0 : addToExternrefTable0(options));
325
345
  }
326
346
  }
327
347
 
@@ -359,18 +379,18 @@ async function __wbg_load(module, imports) {
359
379
  function __wbg_get_imports() {
360
380
  const imports = {};
361
381
  imports.wbg = {};
362
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
363
- const obj = arg1;
364
- const ret = typeof(obj) === 'string' ? obj : undefined;
365
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
366
- var len1 = WASM_VECTOR_LEN;
367
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
368
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
369
- };
370
382
  imports.wbg.__wbindgen_is_string = function(arg0) {
371
383
  const ret = typeof(arg0) === 'string';
372
384
  return ret;
373
385
  };
386
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
387
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
388
+ return ret;
389
+ };
390
+ imports.wbg.__wbindgen_as_number = function(arg0) {
391
+ const ret = +arg0;
392
+ return ret;
393
+ };
374
394
  imports.wbg.__wbindgen_is_object = function(arg0) {
375
395
  const val = arg0;
376
396
  const ret = typeof(val) === 'object' && val !== null;
@@ -382,31 +402,31 @@ function __wbg_get_imports() {
382
402
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
383
403
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
384
404
  };
385
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
386
- const ret = new Error(getStringFromWasm0(arg0, arg1));
387
- return ret;
405
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
406
+ const obj = arg1;
407
+ const ret = typeof(obj) === 'string' ? obj : undefined;
408
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
409
+ var len1 = WASM_VECTOR_LEN;
410
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
411
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
388
412
  };
389
413
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
390
414
  const v = arg0;
391
415
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
392
416
  return ret;
393
417
  };
394
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
395
- const ret = getStringFromWasm0(arg0, arg1);
418
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
419
+ const ret = arg0 === undefined;
396
420
  return ret;
397
421
  };
398
- imports.wbg.__wbindgen_as_number = function(arg0) {
399
- const ret = +arg0;
422
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
423
+ const ret = arg0 in arg1;
400
424
  return ret;
401
425
  };
402
426
  imports.wbg.__wbindgen_is_bigint = function(arg0) {
403
427
  const ret = typeof(arg0) === 'bigint';
404
428
  return ret;
405
429
  };
406
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
407
- const ret = arg0 in arg1;
408
- return ret;
409
- };
410
430
  imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
411
431
  const ret = arg0;
412
432
  return ret;
@@ -419,8 +439,8 @@ function __wbg_get_imports() {
419
439
  const ret = BigInt.asUintN(64, arg0);
420
440
  return ret;
421
441
  };
422
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
423
- const ret = arg0 === undefined;
442
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
443
+ const ret = getStringFromWasm0(arg0, arg1);
424
444
  return ret;
425
445
  };
426
446
  imports.wbg.__wbg_queueMicrotask_848aa4969108a57e = function(arg0) {
@@ -615,7 +635,7 @@ function __wbg_get_imports() {
615
635
  const a = state0.a;
616
636
  state0.a = 0;
617
637
  try {
618
- return __wbg_adapter_130(a, state0.b, arg0, arg1);
638
+ return __wbg_adapter_131(a, state0.b, arg0, arg1);
619
639
  } finally {
620
640
  state0.a = a;
621
641
  }
@@ -691,8 +711,8 @@ function __wbg_get_imports() {
691
711
  const ret = wasm.memory;
692
712
  return ret;
693
713
  };
694
- imports.wbg.__wbindgen_closure_wrapper2518 = function(arg0, arg1, arg2) {
695
- const ret = makeMutClosure(arg0, arg1, 538, __wbg_adapter_52);
714
+ imports.wbg.__wbindgen_closure_wrapper2531 = function(arg0, arg1, arg2) {
715
+ const ret = makeMutClosure(arg0, arg1, 539, __wbg_adapter_52);
696
716
  return ret;
697
717
  };
698
718
  imports.wbg.__wbindgen_init_externref_table = function() {
package/index_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Masatatsu Nakamura <masatatsu.nakamura@gmail.com"
6
6
  ],
7
7
  "description": "Modular is a module project designed to import node graphs created in Nodi in JSON format, enabling the extraction of geometric data generated based on the node graph structure.",
8
- "version": "0.0.2",
8
+ "version": "0.0.3",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",