@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
@@ -0,0 +1,172 @@
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
+ import { createImportedGeometryKernel } from './generated/imported-geometry-static.js';
5
+ let cachedKernel;
6
+ function instance() { return cachedKernel ??= createImportedGeometryKernel(); }
7
+ class Packet {
8
+ bytes = new Uint8Array(1024);
9
+ view = new DataView(this.bytes.buffer);
10
+ offset = 0;
11
+ constructor(kind) { this.u32(1); this.u32(kind); }
12
+ reserve(length) {
13
+ const needed = this.offset + length;
14
+ if (!Number.isSafeInteger(needed) || needed > 0xffffffff)
15
+ throw new RangeError('Imported geometry packet exceeds u32 address space');
16
+ if (needed <= this.bytes.length)
17
+ return;
18
+ let capacity = this.bytes.length;
19
+ while (capacity < needed)
20
+ capacity = Math.min(0xffffffff, capacity * 2);
21
+ const next = new Uint8Array(capacity);
22
+ next.set(this.bytes.subarray(0, this.offset));
23
+ this.bytes = next;
24
+ this.view = new DataView(next.buffer);
25
+ }
26
+ u32(value) {
27
+ if (!Number.isSafeInteger(value) || value < 0 || value > 0xffffffff)
28
+ throw new RangeError('Imported geometry packet u32 overflow');
29
+ this.reserve(4);
30
+ this.view.setUint32(this.offset, value, true);
31
+ this.offset += 4;
32
+ }
33
+ identity(identity) {
34
+ const values = identity ? [identity.store, identity.revision, identity.definition, identity.occurrence] : [1, 1, 1, nextOccurrence++];
35
+ this.reserve(32);
36
+ for (const value of values) {
37
+ if (!Number.isSafeInteger(value) || value < 0)
38
+ throw new RangeError('Imported geometry identity must be a nonnegative safe integer');
39
+ this.view.setBigUint64(this.offset, BigInt(value), true);
40
+ this.offset += 8;
41
+ }
42
+ }
43
+ values(values) {
44
+ this.u32(values.length);
45
+ this.reserve(values.length * 8);
46
+ for (let i = 0; i < values.length; i++) {
47
+ this.view.setFloat64(this.offset, values[i], true);
48
+ this.offset += 8;
49
+ }
50
+ }
51
+ indices(values) {
52
+ this.u32(values.length);
53
+ this.reserve(values.length * 4);
54
+ for (const value of values) {
55
+ this.view.setUint32(this.offset, value, true);
56
+ this.offset += 4;
57
+ }
58
+ }
59
+ rows(rows) { this.u32(rows.length); for (const row of rows)
60
+ this.values(row); }
61
+ stack(stack) { this.u32(stack.length); for (const matrix of stack)
62
+ this.rows(matrix); }
63
+ run() { return new ResultPacket(runImportedPacket(this.bytes.subarray(0, this.offset))); }
64
+ }
65
+ /** Execute any versioned numeric or graph-control packet. Returns the complete
66
+ * length/status/payload packet, throwing its UTF-8 error when status is nonzero. */
67
+ export function runImportedPacket(input) {
68
+ if (input.length > 0xffffffff)
69
+ throw new RangeError('Imported geometry packet exceeds u32 address space');
70
+ const k = instance();
71
+ const pointer = k.imported_alloc(input.length) >>> 0;
72
+ let output = 0;
73
+ let outputLength = 0;
74
+ try {
75
+ new Uint8Array(k.memory.buffer, pointer, input.length).set(input);
76
+ output = k.imported_run(pointer, input.length) >>> 0;
77
+ outputLength = new DataView(k.memory.buffer).getUint32(output, true);
78
+ const bytes = new Uint8Array(k.memory.buffer, output, outputLength).slice();
79
+ const status = new DataView(bytes.buffer).getUint32(4, true);
80
+ if (status)
81
+ throw new Error(new TextDecoder().decode(bytes.subarray(8)));
82
+ return bytes;
83
+ }
84
+ finally {
85
+ k.imported_free(pointer, input.length);
86
+ if (output)
87
+ k.imported_free(output, outputLength);
88
+ }
89
+ }
90
+ let nextOccurrence = 1;
91
+ class ResultPacket {
92
+ offset = 8;
93
+ view;
94
+ constructor(bytes) { this.view = new DataView(bytes.buffer); }
95
+ floats() {
96
+ const n = this.view.getUint32(this.offset, true);
97
+ this.offset += 4;
98
+ const out = new Float32Array(n);
99
+ // Copy bits, including NaN and negative zero, without a JSON conversion.
100
+ const bits = new Uint32Array(out.buffer);
101
+ for (let i = 0; i < n; i++) {
102
+ bits[i] = this.view.getUint32(this.offset, true);
103
+ this.offset += 4;
104
+ }
105
+ return out;
106
+ }
107
+ indices() {
108
+ const n = this.view.getUint32(this.offset, true);
109
+ this.offset += 4;
110
+ const out = new Uint32Array(n);
111
+ for (let i = 0; i < n; i++) {
112
+ out[i] = this.view.getUint32(this.offset, true);
113
+ this.offset += 4;
114
+ }
115
+ return out;
116
+ }
117
+ triple() {
118
+ const out = [0, 0, 0];
119
+ for (let i = 0; i < 3; i++) {
120
+ out[i] = this.view.getFloat64(this.offset, true);
121
+ this.offset += 8;
122
+ }
123
+ return out;
124
+ }
125
+ }
126
+ export function stageTransform(stack) {
127
+ const p = new Packet(1);
128
+ p.stack(stack);
129
+ const values = p.run().floats();
130
+ return values.length ? values : null;
131
+ }
132
+ export function executeMesh(source, stack, identity) {
133
+ const p = new Packet(2);
134
+ p.identity(identity);
135
+ p.stack(stack);
136
+ p.rows(source.points);
137
+ p.values(source.faceVertexIndices ?? []);
138
+ p.u32(source.faceVertexCounts ? 1 : 0);
139
+ if (source.faceVertexCounts)
140
+ p.values(source.faceVertexCounts);
141
+ p.u32(source.normals ? 1 : 0);
142
+ if (source.normals)
143
+ p.rows(source.normals);
144
+ const result = p.run();
145
+ return { positions: result.floats(), normals: result.floats(), indices: result.indices() };
146
+ }
147
+ export function executePoints(source, stack, identity) {
148
+ const p = new Packet(3);
149
+ p.identity(identity);
150
+ p.stack(stack);
151
+ p.values(source instanceof Float32Array || source instanceof Float64Array ? source : source.flatMap(row => [...row]));
152
+ const result = p.run();
153
+ return { positions: result.floats(), bbox: { min: result.triple(), max: result.triple() } };
154
+ }
155
+ export function stageUvs(values) {
156
+ const p = new Packet(4);
157
+ p.values(values);
158
+ return p.run().floats();
159
+ }
160
+ export function computeNormalMatrix(matrix) {
161
+ const p = new Packet(5);
162
+ p.values(matrix);
163
+ const out = p.run().floats();
164
+ return out.length ? out : null;
165
+ }
166
+ export function computeNormals(positions, indices) {
167
+ const p = new Packet(6);
168
+ p.values(positions);
169
+ p.indices(indices);
170
+ return p.run().floats();
171
+ }
172
+ //# sourceMappingURL=imported-kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-kernel.js","sourceRoot":"","sources":["../src/imported-kernel.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAqBvF,IAAI,YAAuC,CAAC;AAC5C,SAAS,QAAQ,KAAoB,OAAO,YAAY,KAAK,4BAA4B,EAAE,CAAC,CAAC,CAAC;AAC9F,MAAM,MAAM;IACF,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,GAAG,CAAC,CAAC;IACnB,YAAY,IAAY,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,MAAc;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,UAAU;YAAE,MAAM,IAAI,UAAU,CAAC,oDAAoD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AAC,CAAC;IAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ComposedNode } from './types.js';
2
+ /** Both parser entries consume the same Rust mesh-then-point program. */
3
+ export declare function extractImportedScene(composed: Map<string, ComposedNode>, pathToId: Map<string, number>): {
4
+ meshes: import("./geometry-extractor.js").MeshData[];
5
+ pointClouds: import("./pointcloud-extractor.js").PointCloudExtraction[];
6
+ };
7
+ //# sourceMappingURL=imported-scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-scene.d.ts","sourceRoot":"","sources":["../src/imported-scene.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;EAEtG"}
@@ -0,0 +1,6 @@
1
+ import { executeImportedGraph } from './imported-graph.js';
2
+ /** Both parser entries consume the same Rust mesh-then-point program. */
3
+ export function extractImportedScene(composed, pathToId) {
4
+ return executeImportedGraph(composed, pathToId, 3);
5
+ }
6
+ //# sourceMappingURL=imported-scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-scene.js","sourceRoot":"","sources":["../src/imported-scene.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,yEAAyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,QAAmC,EAAE,QAA6B;IACrG,OAAO,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Own composed JSON facts without invoking accessors on uninterpreted values. */
2
+ export declare function snapshotAttribute(value: unknown, seen?: WeakMap<object, unknown>): unknown;
3
+ //# sourceMappingURL=imported-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-snapshot.d.ts","sourceRoot":"","sources":["../src/imported-snapshot.ts"],"names":[],"mappings":"AAIA,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,2BAAiC,GAAG,OAAO,CA+BhG"}
@@ -0,0 +1,53 @@
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
+ /** Own composed JSON facts without invoking accessors on uninterpreted values. */
5
+ export function snapshotAttribute(value, seen = new WeakMap()) {
6
+ if (value === null || typeof value !== 'object')
7
+ return value;
8
+ if (seen.has(value))
9
+ return seen.get(value);
10
+ if (value instanceof ArrayBuffer) {
11
+ const copy = value.slice(0);
12
+ seen.set(value, copy);
13
+ return copy;
14
+ }
15
+ if (ArrayBuffer.isView(value)) {
16
+ const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength).slice().buffer;
17
+ const Constructor = value.constructor;
18
+ const copy = new Constructor(buffer);
19
+ seen.set(value, copy);
20
+ return copy;
21
+ }
22
+ if (value instanceof Date) {
23
+ const copy = new Date(value.getTime());
24
+ seen.set(value, copy);
25
+ return copy;
26
+ }
27
+ if (value instanceof Map) {
28
+ const copy = new Map();
29
+ seen.set(value, copy);
30
+ for (const [key, item] of value)
31
+ copy.set(snapshotAttribute(key, seen), snapshotAttribute(item, seen));
32
+ return copy;
33
+ }
34
+ if (value instanceof Set) {
35
+ const copy = new Set();
36
+ seen.set(value, copy);
37
+ for (const item of value)
38
+ copy.add(snapshotAttribute(item, seen));
39
+ return copy;
40
+ }
41
+ const copy = Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(value));
42
+ seen.set(value, copy);
43
+ for (const key of Reflect.ownKeys(value)) {
44
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
45
+ if (!descriptor)
46
+ continue;
47
+ if ('value' in descriptor)
48
+ descriptor.value = snapshotAttribute(descriptor.value, seen);
49
+ Object.defineProperty(copy, key, descriptor);
50
+ }
51
+ return copy;
52
+ }
53
+ //# sourceMappingURL=imported-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-snapshot.js","sourceRoot":"","sources":["../src/imported-snapshot.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,OAAO,IAAI,OAAO,EAAmB;IACrF,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAClE,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC;QAC/F,MAAM,WAAW,GAAG,KAAK,CAAC,WAA2D,CAAC;QACtF,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAC3E,CAAC;IACD,IA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BAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU;YAAE,SAAS;QAC1B,IAAI,OAAO,IAAI,UAAU;YAAE,UAAU,CAAC,KAAK,GAAG,iBAAiB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACxF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { type ComposedNode, type UsdMesh } from './types.js';
2
+ import { type TraversalFrame } from './traversal.js';
3
+ import type { IfcxPointSource } from '@ifc-lite/pointcloud';
4
+ import type { TransformStack, ImportedOperationIdentity } from './imported-kernel.js';
5
+ /** Authored JSON numbers, before the compatibility display staging in Rust. */
6
+ export declare function appendSourceTransform(node: ComposedNode, parent: TransformStack): TransformStack;
7
+ export interface ImportedNodeSource {
8
+ readonly attributes: ReadonlyMap<string, unknown>;
9
+ readonly attributeSources?: ReadonlyMap<string, unknown>;
10
+ readonly contributingLayers?: ReadonlySet<string>;
11
+ }
12
+ export interface ImportedOccurrence {
13
+ readonly identity: ImportedOperationIdentity;
14
+ readonly ordinal: number;
15
+ readonly path: string;
16
+ readonly lineage: readonly {
17
+ path: string;
18
+ edgeName: string | null;
19
+ }[];
20
+ readonly transforms: TransformStack;
21
+ readonly definition: UsdMesh;
22
+ }
23
+ /**
24
+ * Import-local source authority. Definitions are copied once per composed node,
25
+ * not reconstructed from presented buffers. Occurrences retain traversal edges
26
+ * separately from entity ids (which are importer ids, never STEP references).
27
+ * Composition and asset objects remain owned by the existing format composer.
28
+ */
29
+ export interface ImportedPointOccurrence {
30
+ readonly identity: ImportedOperationIdentity;
31
+ readonly ordinal: number;
32
+ readonly path: string;
33
+ readonly lineage: readonly {
34
+ path: string;
35
+ edgeName: string | null;
36
+ }[];
37
+ readonly transforms: TransformStack;
38
+ readonly definition: IfcxPointSource;
39
+ }
40
+ export declare class ImportedSourceDocument {
41
+ readonly store: number;
42
+ readonly revision = 1;
43
+ private nextDefinition;
44
+ private nextOccurrence;
45
+ private definitionIds;
46
+ private snapshots;
47
+ readonly definitions: Map<string, UsdMesh>;
48
+ readonly nodes: Map<string, ImportedNodeSource>;
49
+ readonly pointDefinitions: Map<string, IfcxPointSource>;
50
+ readonly pointOccurrences: ImportedPointOccurrence[];
51
+ admitPoints(frame: TraversalFrame, transforms: TransformStack, definition: IfcxPointSource, identity?: ImportedOperationIdentity): ImportedPointOccurrence;
52
+ readonly occurrences: ImportedOccurrence[];
53
+ private identity;
54
+ private rememberLineage;
55
+ admitMesh(frame: TraversalFrame, transforms: TransformStack, source: UsdMesh, identity?: ImportedOperationIdentity): ImportedOccurrence;
56
+ }
57
+ export declare function retainImportedSource(owner: object, source: ImportedSourceDocument): void;
58
+ export declare function importedSourceFor(owner: object): ImportedSourceDocument | undefined;
59
+ //# sourceMappingURL=imported-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-source.d.ts","sourceRoot":"","sources":["../src/imported-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,KAAK,YAAY,EAAE,KAAK,OAAO,EAAqB,MAAM,YAAY,CAAC;AACtF,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,cAAc,CAUhG;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,O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AE,CAAM;IAE1D,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,yBAAyB,GAAG,uBAAuB;IAa1J,QAAQ,CAAC,WAAW,EAAE,kBAAkB,EAAE,CAAM;IAEhD,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,eAAe;IAgBvB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,yBAAyB,GAAG,kBAAkB;CAmBxI;AAKD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAExF;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAEnF"}
@@ -0,0 +1,96 @@
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
+ import { snapshotAttribute } from './imported-snapshot.js';
5
+ import { ATTR } from './types.js';
6
+ import { getFrameLineage } from './traversal.js';
7
+ /** Authored JSON numbers, before the compatibility display staging in Rust. */
8
+ export function appendSourceTransform(node, parent) {
9
+ const source = node.attributes.get(ATTR.TRANSFORM)?.transform;
10
+ if (!source)
11
+ return parent;
12
+ // Preserve absent matrix cells: Rust applies the historical diagonal defaults.
13
+ // Copy without Float32Array so large translations and local coefficients survive.
14
+ // Nullish cells have always meant identity defaults in IFCX. Resolve those
15
+ // format defaults in f64; the untouched authored attribute remains in nodes.
16
+ const matrix = Array.from({ length: 4 }, (_, row) => Array.from({ length: 4 }, (_, col) => source[row]?.[col] ?? (row === col ? 1 : 0)));
17
+ return [...parent, matrix];
18
+ }
19
+ let nextStore = 1;
20
+ export class ImportedSourceDocument {
21
+ store = nextStore++;
22
+ revision = 1;
23
+ nextDefinition = 1;
24
+ nextOccurrence = 1;
25
+ definitionIds = new Map();
26
+ snapshots = new WeakMap();
27
+ definitions = new Map();
28
+ nodes = new Map();
29
+ pointDefinitions = new Map();
30
+ pointOccurrences = [];
31
+ admitPoints(frame, transforms, definition, identity) {
32
+ this.rememberLineage(frame);
33
+ const existing = this.pointDefinitions.get(frame.node.path);
34
+ definition = existing ?? definition;
35
+ if (!existing)
36
+ this.pointDefinitions.set(frame.node.path, definition);
37
+ const occurrence = { identity: identity ?? this.identity(`points:${frame.node.path}`),
38
+ ordinal: this.pointOccurrences.length, path: frame.node.path,
39
+ lineage: getFrameLineage(frame).map(entry => ({ path: entry.node.path, edgeName: entry.edgeName })),
40
+ transforms, definition };
41
+ this.pointOccurrences.push(occurrence);
42
+ return occurrence;
43
+ }
44
+ occurrences = [];
45
+ identity(path) {
46
+ let definition = this.definitionIds.get(path);
47
+ if (definition === undefined) {
48
+ definition = this.nextDefinition++;
49
+ this.definitionIds.set(path, definition);
50
+ }
51
+ return { store: this.store, revision: this.revision, definition, occurrence: this.nextOccurrence++ };
52
+ }
53
+ rememberLineage(frame) {
54
+ for (const entry of getFrameLineage(frame)) {
55
+ if (this.nodes.has(entry.node.path))
56
+ continue;
57
+ const node = entry.node;
58
+ const attributeSources = 'attributeSources' in node && node.attributeSources instanceof Map
59
+ ? new Map([...node.attributeSources].map(([key, value]) => [key, snapshotAttribute(value, this.snapshots)])) : undefined;
60
+ const contributingLayers = 'contributingLayers' in node && node.contributingLayers instanceof Set
61
+ ? new Set(node.contributingLayers) : undefined;
62
+ this.nodes.set(node.path, {
63
+ attributes: new Map([...node.attributes].map(([key, value]) => [key, snapshotAttribute(value, this.snapshots)])),
64
+ attributeSources, contributingLayers,
65
+ });
66
+ }
67
+ }
68
+ admitMesh(frame, transforms, source, identity) {
69
+ this.rememberLineage(frame);
70
+ let definition = this.definitions.get(frame.node.path);
71
+ if (!definition) {
72
+ definition = snapshotAttribute(source, this.snapshots);
73
+ this.definitions.set(frame.node.path, definition);
74
+ }
75
+ const occurrence = {
76
+ identity: identity ?? this.identity(`mesh:${frame.node.path}`),
77
+ ordinal: this.occurrences.length,
78
+ path: frame.node.path,
79
+ lineage: getFrameLineage(frame).map(entry => ({ path: entry.node.path, edgeName: entry.edgeName })),
80
+ transforms,
81
+ definition,
82
+ };
83
+ this.occurrences.push(occurrence);
84
+ return occurrence;
85
+ }
86
+ }
87
+ // Retain authored definitions for exactly as long as their presented import.
88
+ // This internal service avoids adding fields to the published MeshData surface.
89
+ const documents = new WeakMap();
90
+ export function retainImportedSource(owner, source) {
91
+ documents.set(owner, source);
92
+ }
93
+ export function importedSourceFor(owner) {
94
+ return documents.get(owner);
95
+ }
96
+ //# sourceMappingURL=imported-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-source.js","sourceRoot":"","sources":["../src/imported-source.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAsD,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,eAAe,EAAuB,MAAM,gBAAgB,CAAC;AAItE,+EAA+E;AAC/E,MAAM,UAAU,qBAAqB,CAAC,IAAkB,EAAE,MAAsB;IAC9E,MAAM,MAAM,GAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAA8B,EAAE,SAAS,CAAC;IAC5F,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,kFAAkF;IAClF,2EAA2E;IAC3E,6EAA6E;IAC7E,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAClD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAA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M,UAAU,GAAuB;YACrC,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9D,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM;YAChC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;YACrB,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnG,UAAU;YACV,UAAU;SACX,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,6EAA6E;AAC7E,gFAAgF;AAChF,MAAM,SAAS,GAAG,IAAI,OAAO,EAAkC,CAAC;AAChE,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,MAA8B;IAChF,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AACD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** Internal binary transport; never performs geometry arithmetic. */
2
+ export declare class ImportWriter {
3
+ private bytes;
4
+ private offset;
5
+ private view;
6
+ constructor(kind: number);
7
+ private reserve;
8
+ u32(value: number): this;
9
+ u64(value: number): this;
10
+ f64(value: number): this;
11
+ string(value: string): this;
12
+ identityString(value: string): this;
13
+ optionalString(value: string | undefined): this;
14
+ values(values: ArrayLike<number>): this;
15
+ rows(rows: readonly (readonly number[])[]): this;
16
+ matrix(rows: readonly (readonly number[])[]): this;
17
+ run(): ImportReader;
18
+ }
19
+ export declare class ImportReader {
20
+ private bytes;
21
+ private offset;
22
+ private view;
23
+ constructor(bytes: Uint8Array);
24
+ u32(): number;
25
+ u64(): number;
26
+ f64(): number;
27
+ string(): string;
28
+ identityString(): string;
29
+ optionalIdentityString(): string | undefined;
30
+ optionalString(): string | undefined;
31
+ floats(): Float32Array;
32
+ indices(): Uint32Array;
33
+ triple(): [number, number, number];
34
+ }
35
+ //# sourceMappingURL=imported-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-wire.d.ts","sourceRoot":"","sources":["../src/imported-wire.ts"],"names":[],"mappings":"AAKA,qEAAqE;AACrE,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,IAAI,CAAmC;gBACnC,IAAI,EAAE,MAAM;IACxB,OAAO,CAAC,OAAO;IASf,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACxB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACxB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM3B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACnC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI;IACvC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI;IAChD,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI;IAQlD,GAAG,IAAI,YAAY;CACpB;AACD,qBAAa,YAAY;IAGX,OAAO,CAAC,KAAK;IAFzB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,IAAI,CAAW;gBACH,KAAK,EAAE,UAAU;IACrC,GAAG,IAAI,MAAM;IACb,GAAG,IAAI,MAAM;IAKb,GAAG,IAAI,MAAM;IACb,MAAM,IAAI,MAAM;IAIhB,cAAc,IAAI,MAAM;IAKxB,sBAAsB,IAAI,MAAM,GAAG,SAAS;IAC5C,cAAc,IAAI,MAAM,GAAG,SAAS;IACpC,MAAM,IAAI,YAAY;IAKtB,OAAO,IAAI,WAAW;IAKtB,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;CACnC"}
@@ -0,0 +1,108 @@
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
+ import { runImportedPacket } from './imported-kernel.js';
5
+ /** Internal binary transport; never performs geometry arithmetic. */
6
+ export class ImportWriter {
7
+ bytes = new Uint8Array(256);
8
+ offset = 0;
9
+ view = new DataView(this.bytes.buffer);
10
+ constructor(kind) { this.u32(1); this.u32(kind); }
11
+ reserve(size) {
12
+ const needed = this.offset + size;
13
+ if (!Number.isSafeInteger(needed) || needed > 0xffff_ffff)
14
+ throw new RangeError('Imported geometry packet exceeds addressable memory');
15
+ if (needed > this.bytes.length) {
16
+ const next = new Uint8Array(Math.max(needed, Math.min(0xffff_ffff, this.bytes.length * 2)));
17
+ next.set(this.bytes);
18
+ this.bytes = next;
19
+ this.view = new DataView(next.buffer);
20
+ }
21
+ return this.view;
22
+ }
23
+ u32(value) {
24
+ if (!Number.isSafeInteger(value) || value < 0 || value > 0xffff_ffff)
25
+ throw new RangeError('Imported geometry uint32 overflow');
26
+ this.reserve(4).setUint32(this.offset, value, true);
27
+ this.offset += 4;
28
+ return this;
29
+ }
30
+ u64(value) { this.reserve(8).setBigUint64(this.offset, BigInt(value), true); this.offset += 8; return this; }
31
+ f64(value) { this.reserve(8).setFloat64(this.offset, value, true); this.offset += 8; return this; }
32
+ string(value) {
33
+ const text = new TextEncoder().encode(value);
34
+ this.u32(text.length);
35
+ this.reserve(text.length);
36
+ this.bytes.set(text, this.offset);
37
+ this.offset += text.length;
38
+ return this;
39
+ }
40
+ // JSON string serialization is injective over JavaScript UTF-16, including
41
+ // isolated surrogates which TextEncoder alone would replace with U+FFFD.
42
+ identityString(value) { return this.string(JSON.stringify(value)); }
43
+ optionalString(value) { this.u32(value === undefined ? 0 : 1); if (value !== undefined)
44
+ this.string(value); return this; }
45
+ values(values) { this.u32(values.length); for (let i = 0; i < values.length; i++)
46
+ this.f64(values[i]); return this; }
47
+ rows(rows) { this.u32(rows.length); for (const row of rows)
48
+ this.values(row); return this; }
49
+ matrix(rows) {
50
+ this.u32(4);
51
+ for (let row = 0; row < 4; row++) {
52
+ this.u32(4);
53
+ for (let col = 0; col < 4; col++)
54
+ this.f64(rows[row]?.[col] ?? (row === col ? 1 : 0));
55
+ }
56
+ return this;
57
+ }
58
+ run() { return new ImportReader(runImportedPacket(this.bytes.subarray(0, this.offset))); }
59
+ }
60
+ export class ImportReader {
61
+ bytes;
62
+ offset = 8;
63
+ view;
64
+ constructor(bytes) {
65
+ this.bytes = bytes;
66
+ this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
67
+ }
68
+ u32() { const value = this.view.getUint32(this.offset, true); this.offset += 4; return value; }
69
+ u64() {
70
+ const value = this.view.getBigUint64(this.offset, true);
71
+ this.offset += 8;
72
+ if (value > BigInt(Number.MAX_SAFE_INTEGER))
73
+ throw new RangeError('Imported geometry identity exceeds safe integer');
74
+ return Number(value);
75
+ }
76
+ f64() { const value = this.view.getFloat64(this.offset, true); this.offset += 8; return value; }
77
+ string() {
78
+ const length = this.u32();
79
+ const text = new TextDecoder().decode(this.bytes.subarray(this.offset, this.offset + length));
80
+ this.offset += length;
81
+ return text;
82
+ }
83
+ identityString() {
84
+ const value = JSON.parse(this.string());
85
+ if (typeof value !== 'string')
86
+ throw new Error('Imported geometry: malformed source identity');
87
+ return value;
88
+ }
89
+ optionalIdentityString() { return this.u32() ? this.identityString() : undefined; }
90
+ optionalString() { return this.u32() ? this.string() : undefined; }
91
+ floats() {
92
+ const length = this.u32();
93
+ const output = new Float32Array(length);
94
+ const bits = new Uint32Array(output.buffer);
95
+ for (let i = 0; i < length; i++)
96
+ bits[i] = this.u32();
97
+ return output;
98
+ }
99
+ indices() {
100
+ const length = this.u32();
101
+ const output = new Uint32Array(length);
102
+ for (let i = 0; i < length; i++)
103
+ output[i] = this.u32();
104
+ return output;
105
+ }
106
+ triple() { return [this.f64(), this.f64(), this.f64()]; }
107
+ }
108
+ //# sourceMappingURL=imported-wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-wire.js","sourceRoot":"","sources":["../src/imported-wire.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qEAAqE;AACrE,MAAM,OAAO,YAAY;IACf,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,GAAG,CAAC,CAAC;IACX,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/C,YAAY,IAAY,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,IAAY;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,WAAW;YAAE,MAAM,IAAI,UAAU,CAAC,qDAAqD,CAAC,CAAC;QACvI,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC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G,EAAE,CAAC;QAAC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAAC,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO;QACL,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAAC,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;YAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,KAA+B,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;CACpF"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export type { IfcxParseResult, IfcxParseOptions } from './parse-result.js';
3
3
  import { LayerStack } from './layer-stack.js';
4
4
  import { PathIndex } from './path-resolver.js';
5
5
  export { IFCX_VERSION } from '@ifc-lite/data';
6
+ export { detectFormat } from './detect-format.js';
6
7
  export * from './types.js';
7
8
  export { encodeIfcxImage, IFCX_APPEARANCE, IFCX_IMAGE, IFCX_APPEARANCE_SCHEMAS, type IfcxPixels, type IfcxEncodedImage } from './appearance-wire.js';
8
9
  export { composeIfcx, findRoots, getDescendants } from './composition.js';
@@ -24,10 +25,6 @@ export { IfcxWriter, exportToIfcx, type IfcxExportOptions, type IfcxExportData,
24
25
  * Parse an IFCX file and return data compatible with existing ifc-lite pipeline.
25
26
  */
26
27
  export declare function parseIfcx(buffer: ArrayBuffer, options?: IfcxParseOptions): Promise<IfcxParseResult>;
27
- /**
28
- * Detect if a buffer contains IFCX (JSON), IFC (STEP), or GLB (binary glTF) format.
29
- */
30
- export declare function detectFormat(buffer: ArrayBuffer): 'ifcx' | 'ifc' | 'glb' | 'unknown';
31
28
  /**
32
29
  * Input for federated parsing - a buffer with a name.
33
30
  */