@ifc-lite/ifcx 4.4.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +10 -0
  2. package/dist/detect-format.d.ts +5 -0
  3. package/dist/detect-format.d.ts.map +1 -0
  4. package/dist/detect-format.js +33 -0
  5. package/dist/detect-format.js.map +1 -0
  6. package/dist/generated/imported-geometry-static.js +17116 -0
  7. package/dist/generated/imported-geometry.d.ts +2 -0
  8. package/dist/generated/imported-geometry.d.ts.map +1 -0
  9. package/dist/generated/imported-geometry.js +13 -0
  10. package/dist/generated/imported-geometry.js.map +1 -0
  11. package/dist/geometry-extractor.d.ts +2 -16
  12. package/dist/geometry-extractor.d.ts.map +1 -1
  13. package/dist/geometry-extractor.js +3 -299
  14. package/dist/geometry-extractor.js.map +1 -1
  15. package/dist/imported-graph-source.d.ts +13 -0
  16. package/dist/imported-graph-source.d.ts.map +1 -0
  17. package/dist/imported-graph-source.js +53 -0
  18. package/dist/imported-graph-source.js.map +1 -0
  19. package/dist/imported-graph.d.ts +13 -0
  20. package/dist/imported-graph.d.ts.map +1 -0
  21. package/dist/imported-graph.js +154 -0
  22. package/dist/imported-graph.js.map +1 -0
  23. package/dist/imported-kernel.d.ts +33 -0
  24. package/dist/imported-kernel.d.ts.map +1 -0
  25. package/dist/imported-kernel.js +172 -0
  26. package/dist/imported-kernel.js.map +1 -0
  27. package/dist/imported-scene.d.ts +7 -0
  28. package/dist/imported-scene.d.ts.map +1 -0
  29. package/dist/imported-scene.js +6 -0
  30. package/dist/imported-scene.js.map +1 -0
  31. package/dist/imported-snapshot.d.ts +3 -0
  32. package/dist/imported-snapshot.d.ts.map +1 -0
  33. package/dist/imported-snapshot.js +53 -0
  34. package/dist/imported-snapshot.js.map +1 -0
  35. package/dist/imported-source.d.ts +59 -0
  36. package/dist/imported-source.d.ts.map +1 -0
  37. package/dist/imported-source.js +96 -0
  38. package/dist/imported-source.js.map +1 -0
  39. package/dist/imported-wire.d.ts +35 -0
  40. package/dist/imported-wire.d.ts.map +1 -0
  41. package/dist/imported-wire.js +108 -0
  42. package/dist/imported-wire.js.map +1 -0
  43. package/dist/index.d.ts +1 -4
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +4 -32
  46. package/dist/index.js.map +1 -1
  47. package/dist/pointcloud-extractor.d.ts +14 -0
  48. package/dist/pointcloud-extractor.d.ts.map +1 -1
  49. package/dist/pointcloud-extractor.js +3 -176
  50. package/dist/pointcloud-extractor.js.map +1 -1
  51. package/package.json +5 -4
  52. package/dist/geometry-normals.d.ts +0 -29
  53. package/dist/geometry-normals.d.ts.map +0 -1
  54. package/dist/geometry-normals.js +0 -91
  55. package/dist/geometry-normals.js.map +0 -1
package/README.md CHANGED
@@ -28,6 +28,16 @@ console.log(`Schema: ${result.schemaVersion}`); // 'IFC5'
28
28
  renderer.loadGeometry(result.meshes);
29
29
  ```
30
30
 
31
+ Geometry extraction uses a Rust-owned imported-geometry program. The synchronous
32
+ `extractGeometry` and `extractPointClouds` helpers keep their existing return
33
+ shapes and require no initialization. A bundled static JavaScript target is
34
+ compiled from the same Rust implementation as the native and WebAssembly entry;
35
+ it needs no runtime WebAssembly compilation or dynamic code generation.
36
+ Composition, layer provenance, images and point-cloud codecs remain with this
37
+ package's existing format adapter. Display buffers preserve the current Float32
38
+ staging and Y-up frame while the internal import owner retains original source
39
+ coefficients and traversal identities.
40
+
31
41
  ## Auto-detect format
32
42
 
33
43
  ```typescript
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Detect if a buffer contains IFCX (JSON), IFC (STEP), or GLB (binary glTF) format.
3
+ */
4
+ export declare function detectFormat(buffer: ArrayBuffer): 'ifcx' | 'ifc' | 'glb' | 'unknown';
5
+ //# sourceMappingURL=detect-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-format.d.ts","sourceRoot":"","sources":["../src/detect-format.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CA0BpF"}
@@ -0,0 +1,33 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ // Kept out of index.ts so a bundler can place the parser entry points (and the
5
+ // imported-geometry kernel they reach) apart from this tiny format sniffer.
6
+ import { safeUtf8Decode } from '@ifc-lite/data';
7
+ /**
8
+ * Detect if a buffer contains IFCX (JSON), IFC (STEP), or GLB (binary glTF) format.
9
+ */
10
+ export function detectFormat(buffer) {
11
+ // Check GLB magic bytes first (binary format, 4-byte magic: 0x46546C67 = 'glTF')
12
+ if (buffer.byteLength >= 4) {
13
+ const magic = new DataView(buffer).getUint32(0, true);
14
+ if (magic === 0x46546c67) {
15
+ return 'glb';
16
+ }
17
+ }
18
+ const bytes = new Uint8Array(buffer, 0, Math.min(100, buffer.byteLength));
19
+ // SAB-safe: the upload entry path streams the file directly into a
20
+ // SharedArrayBuffer for files ≥ STREAM_SAB_THRESHOLD, and both Firefox
21
+ // and Chromium reject TextDecoder.decode() on SAB-backed views.
22
+ const start = safeUtf8Decode(bytes).trim();
23
+ // IFCX is JSON starting with {
24
+ if (start.startsWith('{')) {
25
+ return 'ifcx';
26
+ }
27
+ // IFC STEP starts with ISO-10303-21
28
+ if (start.includes('ISO-10303-21') || start.startsWith('ISO')) {
29
+ return 'ifc';
30
+ }
31
+ return 'unknown';
32
+ }
33
+ //# sourceMappingURL=detect-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-format.js","sourceRoot":"","sources":["../src/detect-format.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,+EAA+E;AAC/E,4EAA4E;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC9C,iFAAiF;IACjF,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACtD,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1E,mEAAmE;IACnE,uEAAuE;IACvE,gEAAgE;IAChE,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAE3C,+BAA+B;IAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,oCAAoC;IACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}