@ifc-lite/ifcx 4.3.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 (63) hide show
  1. package/README.md +12 -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/georeference.d.ts +17 -0
  16. package/dist/georeference.d.ts.map +1 -0
  17. package/dist/georeference.js +44 -0
  18. package/dist/georeference.js.map +1 -0
  19. package/dist/imported-graph-source.d.ts +13 -0
  20. package/dist/imported-graph-source.d.ts.map +1 -0
  21. package/dist/imported-graph-source.js +53 -0
  22. package/dist/imported-graph-source.js.map +1 -0
  23. package/dist/imported-graph.d.ts +13 -0
  24. package/dist/imported-graph.d.ts.map +1 -0
  25. package/dist/imported-graph.js +154 -0
  26. package/dist/imported-graph.js.map +1 -0
  27. package/dist/imported-kernel.d.ts +33 -0
  28. package/dist/imported-kernel.d.ts.map +1 -0
  29. package/dist/imported-kernel.js +172 -0
  30. package/dist/imported-kernel.js.map +1 -0
  31. package/dist/imported-scene.d.ts +7 -0
  32. package/dist/imported-scene.d.ts.map +1 -0
  33. package/dist/imported-scene.js +6 -0
  34. package/dist/imported-scene.js.map +1 -0
  35. package/dist/imported-snapshot.d.ts +3 -0
  36. package/dist/imported-snapshot.d.ts.map +1 -0
  37. package/dist/imported-snapshot.js +53 -0
  38. package/dist/imported-snapshot.js.map +1 -0
  39. package/dist/imported-source.d.ts +59 -0
  40. package/dist/imported-source.d.ts.map +1 -0
  41. package/dist/imported-source.js +96 -0
  42. package/dist/imported-source.js.map +1 -0
  43. package/dist/imported-wire.d.ts +35 -0
  44. package/dist/imported-wire.d.ts.map +1 -0
  45. package/dist/imported-wire.js +108 -0
  46. package/dist/imported-wire.js.map +1 -0
  47. package/dist/index.d.ts +3 -49
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +36 -51
  50. package/dist/index.js.map +1 -1
  51. package/dist/parse-result.d.ts +48 -0
  52. package/dist/parse-result.d.ts.map +1 -0
  53. package/dist/parse-result.js +5 -0
  54. package/dist/parse-result.js.map +1 -0
  55. package/dist/pointcloud-extractor.d.ts +14 -0
  56. package/dist/pointcloud-extractor.d.ts.map +1 -1
  57. package/dist/pointcloud-extractor.js +3 -176
  58. package/dist/pointcloud-extractor.js.map +1 -1
  59. package/package.json +6 -5
  60. package/dist/geometry-normals.d.ts +0 -29
  61. package/dist/geometry-normals.d.ts.map +0 -1
  62. package/dist/geometry-normals.js +0 -91
  63. 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
@@ -102,3 +112,5 @@ RGBA pixels, plus optional original PNG/JPEG bytes retained without decoding.
102
112
  The shared wire exports are consumed by `@ifc-lite/export`; see
103
113
  [texture portability](../../docs/guide/exporting.md#ifcx-texture-portability)
104
114
  for interoperability, allocation limits, and the native structural-only boundary.
115
+
116
+ IFCX files may carry `ifclite::georeference::v1` on one model node. The parse result's optional `georeferencing` field preserves canonical `IfcProjectedCRS` (`Name`, metre `MapUnit`) and `IfcMapConversion` (`Eastings`, `Northings`, `OrthogonalHeight`, `XAxisAbscissa`, `XAxisOrdinate`, `Scale`) attributes. The viewer maps this into its existing federation alignment and map placement path. Invalid or conflicting placement records fail parsing. If an overlay fails composition or extraction, `addIfcxOverlay` removes the rejected layer so the previous stage remains usable.
@@ -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"}