@ifc-lite/wasm 2.6.1 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ifc-lite/wasm
2
2
 
3
- Pre-built WebAssembly bindings for the IFClite Rust core, covering STEP parsing and geometry tessellation (including the Manifold CSG kernel).
3
+ Pre-built WebAssembly bindings for the IFClite Rust core, covering STEP parsing and geometry tessellation (including the pure-Rust exact CSG kernel).
4
4
 
5
5
  > **You probably don't need to use this package directly.** It's the WASM binary plus generated JS/TypeScript bindings that `@ifc-lite/parser`, `@ifc-lite/geometry`, and `@ifc-lite/renderer` consume internally. Reach for it when you want raw access to the Rust core without the higher-level wrappers.
6
6
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "2.6.1",
8
+ "version": "2.8.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -82,13 +82,6 @@ export class GridAxisJs {
82
82
  export class IfcAPI {
83
83
  free(): void;
84
84
  [Symbol.dispose](): void;
85
- /**
86
- * Fast pre-pass: scans for geometry entities ONLY (skips style/void/material resolution).
87
- * Returns job list + unit scale + RTC offset in ~1-2s instead of ~6s.
88
- * Geometry workers can start immediately with default colors + no void subtraction.
89
- * A parallel style worker can run buildPrePassOnce for correct colors later.
90
- */
91
- buildPrePassFast(data: Uint8Array): any;
92
85
  /**
93
86
  * Run the pre-pass ONCE and return serialized results for worker distribution.
94
87
  * Takes raw bytes (&[u8]) to avoid TextDecoder overhead.
@@ -105,9 +98,8 @@ export class IfcAPI {
105
98
  *
106
99
  * Single linear walk over the file:
107
100
  * 1. Builds the entity index incrementally from the same scan that
108
- * collects geometry jobs (the old `build_pre_pass_fast` did two
109
- * full-file scans — one for entities, one for the index — which
110
- * doubled wall-clock).
101
+ * collects geometry jobs (a separate index scan would double
102
+ * wall-clock).
111
103
  * 2. As soon as `IFCPROJECT` has been seen, the unit scale and the
112
104
  * first ~50 geometry jobs have been collected, resolves
113
105
  * `unitScale` + `rtcOffset` and emits a `meta` callback so the
@@ -259,19 +251,6 @@ export class IfcAPI {
259
251
  * Create and initialize the IFC API
260
252
  */
261
253
  constructor();
262
- /**
263
- * Parse IFC file with streaming events
264
- * Calls the callback function for each parse event
265
- *
266
- * Example:
267
- * ```javascript
268
- * const api = new IfcAPI();
269
- * await api.parseStreaming(ifcData, (event) => {
270
- * console.log('Event:', event);
271
- * });
272
- * ```
273
- */
274
- parseStreaming(content: string, callback: Function): Promise<any>;
275
254
  /**
276
255
  * Fast entity scanning using SIMD-accelerated Rust scanner
277
256
  * Returns array of entity references for data model parsing
@@ -291,22 +270,6 @@ export class IfcAPI {
291
270
  * Much faster than scanning all entities (3x speedup for large files)
292
271
  */
293
272
  scanGeometryEntitiesFast(content: string): any;
294
- /**
295
- * Fast scan that only returns metadata-relevant entity refs.
296
- * This drastically reduces transfer size for huge-file metadata hydration.
297
- */
298
- scanRelevantEntitiesFastBytes(data: Uint8Array): any;
299
- /**
300
- * Parse IFC file (traditional - waits for completion)
301
- *
302
- * Example:
303
- * ```javascript
304
- * const api = new IfcAPI();
305
- * const result = await api.parse(ifcData);
306
- * console.log('Entities:', result.entityCount);
307
- * ```
308
- */
309
- parse(content: string): Promise<any>;
310
273
  /**
311
274
  * Parse IFC file and extract symbolic representations (Plan,
312
275
  * Annotation, FootPrint, Axis). These are 2D curves used for
@@ -342,11 +305,6 @@ export class MeshCollection {
342
305
  * Check if RTC offset is significant (>10km)
343
306
  */
344
307
  hasRtcOffset(): boolean;
345
- /**
346
- * Convert local coordinates to world coordinates
347
- * Use this to convert mesh positions back to original IFC coordinates
348
- */
349
- localToWorld(x: number, y: number, z: number): Float64Array;
350
308
  /**
351
309
  * Get mesh at index
352
310
  */
@@ -876,7 +834,6 @@ export interface InitOutput {
876
834
  readonly gridaxisjs_gridId: (a: number) => number;
877
835
  readonly gridaxisjs_start: (a: number) => number;
878
836
  readonly gridaxisjs_tag: (a: number, b: number) => void;
879
- readonly ifcapi_buildPrePassFast: (a: number, b: number, c: number) => number;
880
837
  readonly ifcapi_buildPrePassOnce: (a: number, b: number, c: number) => number;
881
838
  readonly ifcapi_buildPrePassStreaming: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
882
839
  readonly ifcapi_clearPrePassCache: (a: number) => void;
@@ -884,17 +841,14 @@ export interface InitOutput {
884
841
  readonly ifcapi_getMemory: (a: number) => number;
885
842
  readonly ifcapi_is_ready: (a: number) => number;
886
843
  readonly ifcapi_new: () => number;
887
- readonly ifcapi_parse: (a: number, b: number, c: number) => number;
888
844
  readonly ifcapi_parseAlignmentLines: (a: number, b: number, c: number) => number;
889
845
  readonly ifcapi_parseGridAxes: (a: number, b: number, c: number) => number;
890
846
  readonly ifcapi_parseGridLines: (a: number, b: number, c: number) => number;
891
- readonly ifcapi_parseStreaming: (a: number, b: number, c: number, d: number) => number;
892
847
  readonly ifcapi_parseSymbolicRepresentations: (a: number, b: number, c: number) => number;
893
848
  readonly ifcapi_processGeometryBatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number) => number;
894
849
  readonly ifcapi_scanEntitiesFast: (a: number, b: number, c: number) => number;
895
850
  readonly ifcapi_scanEntitiesFastBytes: (a: number, b: number, c: number) => number;
896
851
  readonly ifcapi_scanGeometryEntitiesFast: (a: number, b: number, c: number) => number;
897
- readonly ifcapi_scanRelevantEntitiesFastBytes: (a: number, b: number, c: number) => number;
898
852
  readonly ifcapi_setComputeGeometryHashes: (a: number, b: number, c: number) => void;
899
853
  readonly ifcapi_setEntityIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
900
854
  readonly ifcapi_setMergeLayers: (a: number, b: number) => void;
@@ -908,7 +862,6 @@ export interface InitOutput {
908
862
  readonly meshcollection_get: (a: number, b: number) => number;
909
863
  readonly meshcollection_hasRtcOffset: (a: number) => number;
910
864
  readonly meshcollection_length: (a: number) => number;
911
- readonly meshcollection_localToWorld: (a: number, b: number, c: number, d: number, e: number) => void;
912
865
  readonly meshcollection_rtcOffsetX: (a: number) => number;
913
866
  readonly meshcollection_rtcOffsetY: (a: number) => number;
914
867
  readonly meshcollection_rtcOffsetZ: (a: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -15,10 +15,6 @@ function addBorrowedObject(obj) {
15
15
  return stack_pointer;
16
16
  }
17
17
 
18
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
19
- ? { register: () => {}, unregister: () => {} }
20
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
21
-
22
18
  function dropObject(idx) {
23
19
  if (idx < 132) return;
24
20
  heap[idx] = heap_next;
@@ -122,34 +118,6 @@ function isLikeNone(x) {
122
118
  return x === undefined || x === null;
123
119
  }
124
120
 
125
- function makeMutClosure(arg0, arg1, dtor, f) {
126
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
127
- const real = (...args) => {
128
-
129
- // First up with a closure we increment the internal reference
130
- // count. This ensures that the Rust closure environment won't
131
- // be deallocated while we're invoking it.
132
- state.cnt++;
133
- const a = state.a;
134
- state.a = 0;
135
- try {
136
- return f(a, state.b, ...args);
137
- } finally {
138
- state.a = a;
139
- real._wbg_cb_unref();
140
- }
141
- };
142
- real._wbg_cb_unref = () => {
143
- if (--state.cnt === 0) {
144
- state.dtor(state.a, state.b);
145
- state.a = 0;
146
- CLOSURE_DTORS.unregister(state);
147
- }
148
- };
149
- CLOSURE_DTORS.register(real, state, state);
150
- return real;
151
- }
152
-
153
121
  function passArray32ToWasm0(arg, malloc) {
154
122
  const ptr = malloc(arg.length * 4, 4) >>> 0;
155
123
  getUint32ArrayMemory0().set(arg, ptr / 4);
@@ -252,14 +220,6 @@ if (!('encodeInto' in cachedTextEncoder)) {
252
220
 
253
221
  let WASM_VECTOR_LEN = 0;
254
222
 
255
- function __wasm_bindgen_func_elem_721(arg0, arg1, arg2) {
256
- wasm.__wasm_bindgen_func_elem_721(arg0, arg1, addHeapObject(arg2));
257
- }
258
-
259
- function __wasm_bindgen_func_elem_755(arg0, arg1, arg2, arg3) {
260
- wasm.__wasm_bindgen_func_elem_755(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
261
- }
262
-
263
223
  const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
264
224
  ? { register: () => {}, unregister: () => {} }
265
225
  : new FinalizationRegistry(ptr => wasm.__wbg_clashrunresult_free(ptr >>> 0, 1));
@@ -654,20 +614,6 @@ export class IfcAPI {
654
614
  const ptr = this.__destroy_into_raw();
655
615
  wasm.__wbg_ifcapi_free(ptr, 0);
656
616
  }
657
- /**
658
- * Fast pre-pass: scans for geometry entities ONLY (skips style/void/material resolution).
659
- * Returns job list + unit scale + RTC offset in ~1-2s instead of ~6s.
660
- * Geometry workers can start immediately with default colors + no void subtraction.
661
- * A parallel style worker can run buildPrePassOnce for correct colors later.
662
- * @param {Uint8Array} data
663
- * @returns {any}
664
- */
665
- buildPrePassFast(data) {
666
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
667
- const len0 = WASM_VECTOR_LEN;
668
- const ret = wasm.ifcapi_buildPrePassFast(this.__wbg_ptr, ptr0, len0);
669
- return takeObject(ret);
670
- }
671
617
  /**
672
618
  * Run the pre-pass ONCE and return serialized results for worker distribution.
673
619
  * Takes raw bytes (&[u8]) to avoid TextDecoder overhead.
@@ -721,9 +667,8 @@ export class IfcAPI {
721
667
  *
722
668
  * Single linear walk over the file:
723
669
  * 1. Builds the entity index incrementally from the same scan that
724
- * collects geometry jobs (the old `build_pre_pass_fast` did two
725
- * full-file scans — one for entities, one for the index — which
726
- * doubled wall-clock).
670
+ * collects geometry jobs (a separate index scan would double
671
+ * wall-clock).
727
672
  * 2. As soon as `IFCPROJECT` has been seen, the unit scale and the
728
673
  * first ~50 geometry jobs have been collected, resolves
729
674
  * `unitScale` + `rtcOffset` and emits a `meta` callback so the
@@ -996,27 +941,6 @@ export class IfcAPI {
996
941
  const ret = wasm.ifcapi_is_ready(this.__wbg_ptr);
997
942
  return ret !== 0;
998
943
  }
999
- /**
1000
- * Parse IFC file with streaming events
1001
- * Calls the callback function for each parse event
1002
- *
1003
- * Example:
1004
- * ```javascript
1005
- * const api = new IfcAPI();
1006
- * await api.parseStreaming(ifcData, (event) => {
1007
- * console.log('Event:', event);
1008
- * });
1009
- * ```
1010
- * @param {string} content
1011
- * @param {Function} callback
1012
- * @returns {Promise<any>}
1013
- */
1014
- parseStreaming(content, callback) {
1015
- const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1016
- const len0 = WASM_VECTOR_LEN;
1017
- const ret = wasm.ifcapi_parseStreaming(this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
1018
- return takeObject(ret);
1019
- }
1020
944
  /**
1021
945
  * Fast entity scanning using SIMD-accelerated Rust scanner
1022
946
  * Returns array of entity references for data model parsing
@@ -1057,36 +981,6 @@ export class IfcAPI {
1057
981
  const ret = wasm.ifcapi_scanGeometryEntitiesFast(this.__wbg_ptr, ptr0, len0);
1058
982
  return takeObject(ret);
1059
983
  }
1060
- /**
1061
- * Fast scan that only returns metadata-relevant entity refs.
1062
- * This drastically reduces transfer size for huge-file metadata hydration.
1063
- * @param {Uint8Array} data
1064
- * @returns {any}
1065
- */
1066
- scanRelevantEntitiesFastBytes(data) {
1067
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1068
- const len0 = WASM_VECTOR_LEN;
1069
- const ret = wasm.ifcapi_scanRelevantEntitiesFastBytes(this.__wbg_ptr, ptr0, len0);
1070
- return takeObject(ret);
1071
- }
1072
- /**
1073
- * Parse IFC file (traditional - waits for completion)
1074
- *
1075
- * Example:
1076
- * ```javascript
1077
- * const api = new IfcAPI();
1078
- * const result = await api.parse(ifcData);
1079
- * console.log('Entities:', result.entityCount);
1080
- * ```
1081
- * @param {string} content
1082
- * @returns {Promise<any>}
1083
- */
1084
- parse(content) {
1085
- const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1086
- const len0 = WASM_VECTOR_LEN;
1087
- const ret = wasm.ifcapi_parse(this.__wbg_ptr, ptr0, len0);
1088
- return takeObject(ret);
1089
- }
1090
984
  /**
1091
985
  * Parse IFC file and extract symbolic representations (Plan,
1092
986
  * Annotation, FootPrint, Axis). These are 2D curves used for
@@ -1168,27 +1062,6 @@ export class MeshCollection {
1168
1062
  const ret = wasm.meshcollection_hasRtcOffset(this.__wbg_ptr);
1169
1063
  return ret !== 0;
1170
1064
  }
1171
- /**
1172
- * Convert local coordinates to world coordinates
1173
- * Use this to convert mesh positions back to original IFC coordinates
1174
- * @param {number} x
1175
- * @param {number} y
1176
- * @param {number} z
1177
- * @returns {Float64Array}
1178
- */
1179
- localToWorld(x, y, z) {
1180
- try {
1181
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1182
- wasm.meshcollection_localToWorld(retptr, this.__wbg_ptr, x, y, z);
1183
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1184
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1185
- var v1 = getArrayF64FromWasm0(r0, r1).slice();
1186
- wasm.__wbindgen_export4(r0, r1 * 8, 8);
1187
- return v1;
1188
- } finally {
1189
- wasm.__wbindgen_add_to_stack_pointer(16);
1190
- }
1191
- }
1192
1065
  /**
1193
1066
  * Get total vertex count across all meshes
1194
1067
  * @returns {number}
@@ -2817,14 +2690,6 @@ function __wbg_get_imports() {
2817
2690
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2818
2691
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2819
2692
  };
2820
- imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
2821
- const ret = typeof(getObject(arg0)) === 'function';
2822
- return ret;
2823
- };
2824
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
2825
- const ret = getObject(arg0) === undefined;
2826
- return ret;
2827
- };
2828
2693
  imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
2829
2694
  const ret = wasm.memory;
2830
2695
  return addHeapObject(ret);
@@ -2832,17 +2697,10 @@ function __wbg_get_imports() {
2832
2697
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
2833
2698
  throw new Error(getStringFromWasm0(arg0, arg1));
2834
2699
  };
2835
- imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
2836
- getObject(arg0)._wbg_cb_unref();
2837
- };
2838
2700
  imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
2839
2701
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2840
2702
  return addHeapObject(ret);
2841
2703
  }, arguments) };
2842
- imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
2843
- const ret = getObject(arg0).call(getObject(arg1));
2844
- return addHeapObject(ret);
2845
- }, arguments) };
2846
2704
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
2847
2705
  let deferred0_0;
2848
2706
  let deferred0_1;
@@ -2869,24 +2727,6 @@ function __wbg_get_imports() {
2869
2727
  const ret = new Error();
2870
2728
  return addHeapObject(ret);
2871
2729
  };
2872
- imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
2873
- try {
2874
- var state0 = {a: arg0, b: arg1};
2875
- var cb0 = (arg0, arg1) => {
2876
- const a = state0.a;
2877
- state0.a = 0;
2878
- try {
2879
- return __wasm_bindgen_func_elem_755(a, state0.b, arg0, arg1);
2880
- } finally {
2881
- state0.a = a;
2882
- }
2883
- };
2884
- const ret = new Promise(cb0);
2885
- return addHeapObject(ret);
2886
- } finally {
2887
- state0.a = state0.b = 0;
2888
- }
2889
- };
2890
2730
  imports.wbg.__wbg_new_from_slice_41e2764a343e3cb1 = function(arg0, arg1) {
2891
2731
  const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
2892
2732
  return addHeapObject(ret);
@@ -2903,10 +2743,6 @@ function __wbg_get_imports() {
2903
2743
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2904
2744
  return addHeapObject(ret);
2905
2745
  };
2906
- imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
2907
- const ret = new Function(getStringFromWasm0(arg0, arg1));
2908
- return addHeapObject(ret);
2909
- };
2910
2746
  imports.wbg.__wbg_new_with_length_202b3db94ba5fc86 = function(arg0) {
2911
2747
  const ret = new Uint32Array(arg0 >>> 0);
2912
2748
  return addHeapObject(ret);
@@ -2919,17 +2755,6 @@ function __wbg_get_imports() {
2919
2755
  const ret = new Uint8Array(arg0 >>> 0);
2920
2756
  return addHeapObject(ret);
2921
2757
  };
2922
- imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
2923
- const ret = getObject(arg0).queueMicrotask;
2924
- return addHeapObject(ret);
2925
- };
2926
- imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
2927
- queueMicrotask(getObject(arg0));
2928
- };
2929
- imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
2930
- const ret = Promise.resolve(getObject(arg0));
2931
- return addHeapObject(ret);
2932
- };
2933
2758
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2934
2759
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2935
2760
  };
@@ -2956,26 +2781,6 @@ function __wbg_get_imports() {
2956
2781
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2957
2782
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2958
2783
  };
2959
- imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
2960
- const ret = typeof global === 'undefined' ? null : global;
2961
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2962
- };
2963
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
2964
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
2965
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2966
- };
2967
- imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
2968
- const ret = typeof self === 'undefined' ? null : self;
2969
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2970
- };
2971
- imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
2972
- const ret = typeof window === 'undefined' ? null : window;
2973
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2974
- };
2975
- imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
2976
- const ret = getObject(arg0).then(getObject(arg1));
2977
- return addHeapObject(ret);
2978
- };
2979
2784
  imports.wbg.__wbg_warn_6e567d0d926ff881 = function(arg0) {
2980
2785
  console.warn(getObject(arg0));
2981
2786
  };
@@ -2994,11 +2799,6 @@ function __wbg_get_imports() {
2994
2799
  const ret = arg0;
2995
2800
  return addHeapObject(ret);
2996
2801
  };
2997
- imports.wbg.__wbindgen_cast_efaa74e24e38a7b5 = function(arg0, arg1) {
2998
- // Cast intrinsic for `Closure(Closure { dtor_idx: 65, function: Function { arguments: [Externref], shim_idx: 66, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2999
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_720, __wasm_bindgen_func_elem_721);
3000
- return addHeapObject(ret);
3001
- };
3002
2802
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
3003
2803
  const ret = getObject(arg0);
3004
2804
  return addHeapObject(ret);
Binary file