@ifc-lite/viewer 1.6.0 → 1.7.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 (95) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/assets/{Arrow.dom-BjDQoB2M.js → Arrow.dom-BGPQieQQ.js} +1 -1
  3. package/dist/assets/ifc-lite_bg-DyIN_nBM.wasm +0 -0
  4. package/dist/assets/{index-YBtrHPu3.js → index-dgdgiQ9p.js} +40212 -30008
  5. package/dist/assets/index-yTqs8kgX.css +1 -0
  6. package/dist/assets/{native-bridge-CULtTDX3.js → native-bridge-DD0SNyQ5.js} +1 -1
  7. package/dist/assets/{wasm-bridge-CjL-lSak.js → wasm-bridge-D54YMO7X.js} +1 -1
  8. package/dist/index.html +2 -2
  9. package/package.json +18 -15
  10. package/src/components/viewer/BCFPanel.tsx +7 -789
  11. package/src/components/viewer/Drawing2DCanvas.tsx +1048 -0
  12. package/src/components/viewer/DrawingSettingsPanel.tsx +3 -3
  13. package/src/components/viewer/HierarchyPanel.tsx +110 -842
  14. package/src/components/viewer/IDSExportDialog.tsx +281 -0
  15. package/src/components/viewer/IDSPanel.tsx +126 -17
  16. package/src/components/viewer/KeyboardShortcutsDialog.tsx +9 -0
  17. package/src/components/viewer/LensPanel.tsx +603 -0
  18. package/src/components/viewer/MainToolbar.tsx +188 -21
  19. package/src/components/viewer/PropertiesPanel.tsx +171 -663
  20. package/src/components/viewer/PropertyEditor.tsx +866 -77
  21. package/src/components/viewer/Section2DPanel.tsx +76 -2648
  22. package/src/components/viewer/ToolOverlays.tsx +3 -1097
  23. package/src/components/viewer/ViewerLayout.tsx +132 -45
  24. package/src/components/viewer/Viewport.tsx +237 -1659
  25. package/src/components/viewer/ViewportContainer.tsx +11 -3
  26. package/src/components/viewer/bcf/BCFCreateTopicForm.tsx +134 -0
  27. package/src/components/viewer/bcf/BCFTopicDetail.tsx +388 -0
  28. package/src/components/viewer/bcf/BCFTopicList.tsx +239 -0
  29. package/src/components/viewer/bcf/bcfHelpers.tsx +109 -0
  30. package/src/components/viewer/hierarchy/HierarchyNode.tsx +328 -0
  31. package/src/components/viewer/hierarchy/treeDataBuilder.ts +464 -0
  32. package/src/components/viewer/hierarchy/types.ts +54 -0
  33. package/src/components/viewer/hierarchy/useHierarchyTree.ts +280 -0
  34. package/src/components/viewer/lists/ListBuilder.tsx +486 -0
  35. package/src/components/viewer/lists/ListPanel.tsx +540 -0
  36. package/src/components/viewer/lists/ListResultsTable.tsx +193 -0
  37. package/src/components/viewer/properties/ClassificationCard.tsx +70 -0
  38. package/src/components/viewer/properties/CoordinateDisplay.tsx +49 -0
  39. package/src/components/viewer/properties/DocumentCard.tsx +89 -0
  40. package/src/components/viewer/properties/MaterialCard.tsx +201 -0
  41. package/src/components/viewer/properties/ModelMetadataPanel.tsx +335 -0
  42. package/src/components/viewer/properties/PropertySetCard.tsx +132 -0
  43. package/src/components/viewer/properties/QuantitySetCard.tsx +79 -0
  44. package/src/components/viewer/properties/RelationshipsCard.tsx +100 -0
  45. package/src/components/viewer/properties/encodingUtils.ts +29 -0
  46. package/src/components/viewer/tools/MeasurePanel.tsx +218 -0
  47. package/src/components/viewer/tools/MeasurementVisuals.tsx +644 -0
  48. package/src/components/viewer/tools/SectionPanel.tsx +183 -0
  49. package/src/components/viewer/tools/SectionVisualization.tsx +78 -0
  50. package/src/components/viewer/tools/formatDistance.ts +18 -0
  51. package/src/components/viewer/tools/sectionConstants.ts +14 -0
  52. package/src/components/viewer/useAnimationLoop.ts +166 -0
  53. package/src/components/viewer/useGeometryStreaming.ts +398 -0
  54. package/src/components/viewer/useKeyboardControls.ts +221 -0
  55. package/src/components/viewer/useMouseControls.ts +1009 -0
  56. package/src/components/viewer/useRenderUpdates.ts +165 -0
  57. package/src/components/viewer/useTouchControls.ts +245 -0
  58. package/src/hooks/ids/idsColorSystem.ts +125 -0
  59. package/src/hooks/ids/idsDataAccessor.ts +237 -0
  60. package/src/hooks/ids/idsExportService.ts +444 -0
  61. package/src/hooks/useBCF.ts +7 -0
  62. package/src/hooks/useDrawingExport.ts +627 -0
  63. package/src/hooks/useDrawingGeneration.ts +627 -0
  64. package/src/hooks/useFloorplanView.ts +108 -0
  65. package/src/hooks/useIDS.ts +270 -463
  66. package/src/hooks/useIfc.ts +26 -1628
  67. package/src/hooks/useIfcFederation.ts +803 -0
  68. package/src/hooks/useIfcLoader.ts +508 -0
  69. package/src/hooks/useIfcServer.ts +465 -0
  70. package/src/hooks/useKeyboardShortcuts.ts +1 -1
  71. package/src/hooks/useLens.ts +129 -0
  72. package/src/hooks/useMeasure2D.ts +365 -0
  73. package/src/hooks/useViewControls.ts +218 -0
  74. package/src/lib/ifc4-pset-definitions.test.ts +161 -0
  75. package/src/lib/ifc4-pset-definitions.ts +621 -0
  76. package/src/lib/ifc4-qto-definitions.ts +315 -0
  77. package/src/lib/lens/adapter.ts +138 -0
  78. package/src/lib/lens/index.ts +5 -0
  79. package/src/lib/lists/adapter.ts +69 -0
  80. package/src/lib/lists/index.ts +28 -0
  81. package/src/lib/lists/persistence.ts +64 -0
  82. package/src/services/fs-cache.ts +1 -1
  83. package/src/services/tauri-modules.d.ts +25 -0
  84. package/src/store/index.ts +38 -2
  85. package/src/store/slices/cameraSlice.ts +14 -1
  86. package/src/store/slices/dataSlice.ts +14 -1
  87. package/src/store/slices/lensSlice.ts +184 -0
  88. package/src/store/slices/listSlice.ts +74 -0
  89. package/src/store/slices/pinboardSlice.ts +114 -0
  90. package/src/store/types.ts +5 -0
  91. package/src/utils/ifcConfig.ts +16 -3
  92. package/src/utils/serverDataModel.ts +64 -101
  93. package/src/vite-env.d.ts +3 -0
  94. package/dist/assets/ifc-lite_bg-C6kblxf9.wasm +0 -0
  95. package/dist/assets/index-v3mcCUPN.css +0 -1
@@ -0,0 +1,161 @@
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
+
5
+ import { describe, it } from 'node:test';
6
+ import assert from 'node:assert';
7
+ import {
8
+ getPsetDefinitionsForType,
9
+ getPsetDefinition,
10
+ getAllPsetDefinitions,
11
+ isStandardPset,
12
+ getPropertiesForPset,
13
+ CLASSIFICATION_SYSTEMS,
14
+ } from './ifc4-pset-definitions.js';
15
+
16
+ describe('IFC4 PSet Definitions', () => {
17
+ describe('getPsetDefinitionsForType', () => {
18
+ it('should return wall psets for IfcWall', () => {
19
+ const psets = getPsetDefinitionsForType('IfcWall');
20
+ const names = psets.map(p => p.name);
21
+ assert.ok(names.includes('Pset_WallCommon'), 'Should include Pset_WallCommon');
22
+ assert.ok(names.includes('Pset_ManufacturerTypeInformation'), 'Should include generic Pset_ManufacturerTypeInformation');
23
+ assert.ok(names.includes('Pset_Condition'), 'Should include generic Pset_Condition');
24
+ assert.ok(!names.includes('Pset_DoorCommon'), 'Should NOT include Pset_DoorCommon');
25
+ assert.ok(!names.includes('Pset_SlabCommon'), 'Should NOT include Pset_SlabCommon');
26
+ });
27
+
28
+ it('should return door psets for IfcDoor', () => {
29
+ const psets = getPsetDefinitionsForType('IfcDoor');
30
+ const names = psets.map(p => p.name);
31
+ assert.ok(names.includes('Pset_DoorCommon'), 'Should include Pset_DoorCommon');
32
+ assert.ok(names.includes('Pset_DoorWindowGlazingType'), 'Doors share glazing pset');
33
+ assert.ok(!names.includes('Pset_WallCommon'), 'Should NOT include wall psets');
34
+ });
35
+
36
+ it('should return window psets for IfcWindow', () => {
37
+ const psets = getPsetDefinitionsForType('IfcWindow');
38
+ const names = psets.map(p => p.name);
39
+ assert.ok(names.includes('Pset_WindowCommon'));
40
+ assert.ok(names.includes('Pset_DoorWindowGlazingType'), 'Windows share glazing pset');
41
+ });
42
+
43
+ it('should return space psets for IfcSpace', () => {
44
+ const psets = getPsetDefinitionsForType('IfcSpace');
45
+ const names = psets.map(p => p.name);
46
+ assert.ok(names.includes('Pset_SpaceCommon'));
47
+ assert.ok(names.includes('Pset_SpaceFireSafetyRequirements'));
48
+ assert.ok(names.includes('Pset_SpaceOccupancyRequirements'));
49
+ });
50
+
51
+ it('should normalize UPPERCASE type names (IFCWALL -> IfcWall)', () => {
52
+ const psets = getPsetDefinitionsForType('IFCWALL');
53
+ const names = psets.map(p => p.name);
54
+ assert.ok(names.includes('Pset_WallCommon'), 'Should normalize IFCWALL to IfcWall');
55
+ });
56
+
57
+ it('should return empty array for unknown type', () => {
58
+ const psets = getPsetDefinitionsForType('IfcUnknownType');
59
+ assert.strictEqual(psets.length, 0);
60
+ });
61
+
62
+ it('should return building storey psets', () => {
63
+ const psets = getPsetDefinitionsForType('IfcBuildingStorey');
64
+ const names = psets.map(p => p.name);
65
+ assert.ok(names.includes('Pset_BuildingStoreyCommon'));
66
+ });
67
+
68
+ it('should return building psets', () => {
69
+ const psets = getPsetDefinitionsForType('IfcBuilding');
70
+ const names = psets.map(p => p.name);
71
+ assert.ok(names.includes('Pset_BuildingCommon'));
72
+ });
73
+
74
+ it('should include generic psets for IfcWallStandardCase', () => {
75
+ const psets = getPsetDefinitionsForType('IfcWallStandardCase');
76
+ const names = psets.map(p => p.name);
77
+ assert.ok(names.includes('Pset_WallCommon'), 'WallStandardCase should get WallCommon');
78
+ assert.ok(names.includes('Pset_Warranty'), 'Should get generic warranty pset');
79
+ });
80
+ });
81
+
82
+ describe('getPsetDefinition', () => {
83
+ it('should return a specific pset by name', () => {
84
+ const pset = getPsetDefinition('Pset_WallCommon');
85
+ assert.ok(pset);
86
+ assert.strictEqual(pset.name, 'Pset_WallCommon');
87
+ assert.ok(pset.properties.length > 0);
88
+ });
89
+
90
+ it('should return undefined for unknown pset', () => {
91
+ const pset = getPsetDefinition('Pset_NonExistent');
92
+ assert.strictEqual(pset, undefined);
93
+ });
94
+ });
95
+
96
+ describe('getAllPsetDefinitions', () => {
97
+ it('should return all definitions', () => {
98
+ const all = getAllPsetDefinitions();
99
+ assert.ok(all.length > 20, 'Should have many pset definitions');
100
+ });
101
+ });
102
+
103
+ describe('isStandardPset', () => {
104
+ it('should return true for standard pset names', () => {
105
+ assert.ok(isStandardPset('Pset_WallCommon'));
106
+ assert.ok(isStandardPset('Pset_DoorCommon'));
107
+ assert.ok(isStandardPset('Pset_SlabCommon'));
108
+ });
109
+
110
+ it('should return false for custom pset names', () => {
111
+ assert.ok(!isStandardPset('MyCustomPropertySet'));
112
+ assert.ok(!isStandardPset('Pset_CustomThing'));
113
+ });
114
+ });
115
+
116
+ describe('getPropertiesForPset', () => {
117
+ it('should return properties for Pset_WallCommon', () => {
118
+ const props = getPropertiesForPset('Pset_WallCommon');
119
+ assert.ok(props.length > 0);
120
+ const propNames = props.map(p => p.name);
121
+ assert.ok(propNames.includes('IsExternal'));
122
+ assert.ok(propNames.includes('LoadBearing'));
123
+ assert.ok(propNames.includes('FireRating'));
124
+ assert.ok(propNames.includes('ThermalTransmittance'));
125
+ });
126
+
127
+ it('should return empty array for unknown pset', () => {
128
+ const props = getPropertiesForPset('Pset_Unknown');
129
+ assert.strictEqual(props.length, 0);
130
+ });
131
+
132
+ it('should have proper types on properties', () => {
133
+ const props = getPropertiesForPset('Pset_WallCommon');
134
+ const isExternal = props.find(p => p.name === 'IsExternal');
135
+ assert.ok(isExternal);
136
+ // PropertyValueType.Boolean = 3
137
+ assert.strictEqual(isExternal.type, 3);
138
+
139
+ const thermalTransmittance = props.find(p => p.name === 'ThermalTransmittance');
140
+ assert.ok(thermalTransmittance);
141
+ // PropertyValueType.Real = 1
142
+ assert.strictEqual(thermalTransmittance.type, 1);
143
+ });
144
+ });
145
+
146
+ describe('CLASSIFICATION_SYSTEMS', () => {
147
+ it('should contain common classification systems', () => {
148
+ const names = CLASSIFICATION_SYSTEMS.map(c => c.name);
149
+ assert.ok(names.includes('Uniclass 2015'));
150
+ assert.ok(names.includes('OmniClass'));
151
+ assert.ok(names.includes('MasterFormat'));
152
+ assert.ok(names.includes('Custom'));
153
+ });
154
+
155
+ it('should have descriptions for all systems', () => {
156
+ for (const system of CLASSIFICATION_SYSTEMS) {
157
+ assert.ok(system.description, `${system.name} should have a description`);
158
+ }
159
+ });
160
+ });
161
+ });