@collabdt/core 0.13.2 → 0.14.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 (263) hide show
  1. package/dist/core/components/ConfirmDialog.d.ts +3 -3
  2. package/dist/core/components/ConfirmDialog.d.ts.map +1 -1
  3. package/dist/core/components/ConfirmDialog.js +1 -1
  4. package/dist/core/components/ConfirmDialog.js.map +1 -1
  5. package/dist/core/components/ui/FilesManager/src/FileItemComponent.d.ts.map +1 -1
  6. package/dist/core/components/ui/FilesManager/src/FileItemComponent.js +13 -0
  7. package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
  8. package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts +2 -1
  9. package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts.map +1 -1
  10. package/dist/core/components/ui/FilesManager/src/useFileActions.js +4 -1
  11. package/dist/core/components/ui/FilesManager/src/useFileActions.js.map +1 -1
  12. package/dist/core/components/ui/chart.js +3 -3
  13. package/dist/core/components/ui/chart.js.map +1 -1
  14. package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
  15. package/dist/core/components/viewers/Viewer.js +15 -3
  16. package/dist/core/components/viewers/Viewer.js.map +1 -1
  17. package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
  18. package/dist/core/components/viewers/bim/BimViewer.js +2 -1
  19. package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
  20. package/dist/core/components/viewers/bim/src/BimLoadingState/index.d.ts.map +1 -1
  21. package/dist/core/components/viewers/bim/src/BimLoadingState/index.js +1 -6
  22. package/dist/core/components/viewers/bim/src/BimLoadingState/index.js.map +1 -1
  23. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.d.ts.map +1 -1
  24. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js +1 -6
  25. package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js.map +1 -1
  26. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.d.ts.map +1 -1
  27. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js +5 -2
  28. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js.map +1 -1
  29. package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.d.ts.map +1 -1
  30. package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js +24 -15
  31. package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js.map +1 -1
  32. package/dist/core/components/viewers/bim/src/CameraNavigation.d.ts.map +1 -1
  33. package/dist/core/components/viewers/bim/src/CameraNavigation.js +2 -7
  34. package/dist/core/components/viewers/bim/src/CameraNavigation.js.map +1 -1
  35. package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts +37 -129
  36. package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts.map +1 -1
  37. package/dist/core/components/viewers/bim/src/FloorplanTool/index.js +193 -395
  38. package/dist/core/components/viewers/bim/src/FloorplanTool/index.js.map +1 -1
  39. package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts +1 -12
  40. package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts.map +1 -1
  41. package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js +3 -5
  42. package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js.map +1 -1
  43. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts +15 -0
  44. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts.map +1 -0
  45. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js +61 -0
  46. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js.map +1 -0
  47. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts +37 -0
  48. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts.map +1 -0
  49. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js +264 -0
  50. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js.map +1 -0
  51. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts +56 -0
  52. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts.map +1 -0
  53. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js +337 -0
  54. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js.map +1 -0
  55. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts +51 -0
  56. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts.map +1 -0
  57. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js +238 -0
  58. package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js.map +1 -0
  59. package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts +1 -6
  60. package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts.map +1 -1
  61. package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js +9 -18
  62. package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js.map +1 -1
  63. package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts +6 -0
  64. package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts.map +1 -0
  65. package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js +91 -0
  66. package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js.map +1 -0
  67. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts +38 -0
  68. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts.map +1 -0
  69. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js +77 -0
  70. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js.map +1 -0
  71. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts +15 -0
  72. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts.map +1 -0
  73. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js +34 -0
  74. package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js.map +1 -0
  75. package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts +17 -0
  76. package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts.map +1 -0
  77. package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js +75 -0
  78. package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js.map +1 -0
  79. package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts +16 -0
  80. package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts.map +1 -0
  81. package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js +41 -0
  82. package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js.map +1 -0
  83. package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts +5 -5
  84. package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts.map +1 -1
  85. package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js +12 -1
  86. package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js.map +1 -1
  87. package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts +14 -6
  88. package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts.map +1 -1
  89. package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js +76 -12
  90. package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js.map +1 -1
  91. package/dist/core/components/viewers/bim/src/LoadModels.d.ts +3 -1
  92. package/dist/core/components/viewers/bim/src/LoadModels.d.ts.map +1 -1
  93. package/dist/core/components/viewers/bim/src/LoadModels.js +10 -14
  94. package/dist/core/components/viewers/bim/src/LoadModels.js.map +1 -1
  95. package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts +7 -0
  96. package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts.map +1 -0
  97. package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js +78 -0
  98. package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js.map +1 -0
  99. package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.d.ts.map +1 -1
  100. package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js +18 -14
  101. package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js.map +1 -1
  102. package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.d.ts.map +1 -1
  103. package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js +19 -0
  104. package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js.map +1 -1
  105. package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts +1 -1
  106. package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts.map +1 -1
  107. package/dist/core/components/viewers/bim/src/SimpleBimViewer.js +22 -3
  108. package/dist/core/components/viewers/bim/src/SimpleBimViewer.js.map +1 -1
  109. package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts +7 -17
  110. package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts.map +1 -1
  111. package/dist/core/components/viewers/bim/src/lib/CameraController.js +26 -14
  112. package/dist/core/components/viewers/bim/src/lib/CameraController.js.map +1 -1
  113. package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts +7 -8
  114. package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts.map +1 -1
  115. package/dist/core/components/viewers/bim/src/lib/ChromeController.js +22 -3
  116. package/dist/core/components/viewers/bim/src/lib/ChromeController.js.map +1 -1
  117. package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts +4 -12
  118. package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts.map +1 -1
  119. package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js +2 -2
  120. package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js.map +1 -1
  121. package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts +3 -2
  122. package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts.map +1 -1
  123. package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js +6 -2
  124. package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js.map +1 -1
  125. package/dist/core/components/viewers/bim/src/lib/createBimWorld.d.ts.map +1 -1
  126. package/dist/core/components/viewers/bim/src/lib/createBimWorld.js +2 -0
  127. package/dist/core/components/viewers/bim/src/lib/createBimWorld.js.map +1 -1
  128. package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts +3 -25
  129. package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts.map +1 -1
  130. package/dist/core/components/viewers/bim/src/lib/drawingProjection.js +2 -35
  131. package/dist/core/components/viewers/bim/src/lib/drawingProjection.js.map +1 -1
  132. package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts +38 -0
  133. package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts.map +1 -0
  134. package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js +58 -0
  135. package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js.map +1 -0
  136. package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts +14 -0
  137. package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts.map +1 -0
  138. package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js +126 -0
  139. package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js.map +1 -0
  140. package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts +19 -0
  141. package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts.map +1 -0
  142. package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js +41 -0
  143. package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js.map +1 -0
  144. package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts +10 -34
  145. package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts.map +1 -1
  146. package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js +83 -53
  147. package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js.map +1 -1
  148. package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts +8 -0
  149. package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts.map +1 -0
  150. package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js +81 -0
  151. package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js.map +1 -0
  152. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.d.ts.map +1 -1
  153. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js +1 -0
  154. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js.map +1 -1
  155. package/dist/core/components/viewers/bim/src/tools/bimToolbar.d.ts.map +1 -1
  156. package/dist/core/components/viewers/bim/src/tools/bimToolbar.js +2 -14
  157. package/dist/core/components/viewers/bim/src/tools/bimToolbar.js.map +1 -1
  158. package/dist/core/components/viewers/plugins/PluginsManager.d.ts.map +1 -1
  159. package/dist/core/components/viewers/plugins/PluginsManager.js +7 -4
  160. package/dist/core/components/viewers/plugins/PluginsManager.js.map +1 -1
  161. package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts +9 -0
  162. package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts.map +1 -0
  163. package/dist/core/components/viewers/plugins/src/InstallHereButton.js +33 -0
  164. package/dist/core/components/viewers/plugins/src/InstallHereButton.js.map +1 -0
  165. package/dist/core/components/viewers/plugins/src/RegistryDetails.js +11 -6
  166. package/dist/core/components/viewers/plugins/src/RegistryDetails.js.map +1 -1
  167. package/dist/core/components/viewers/plugins/src/useRegistryPlugins.d.ts.map +1 -1
  168. package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js +20 -7
  169. package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js.map +1 -1
  170. package/dist/core/components/viewers/plugins/types.d.ts +11 -1
  171. package/dist/core/components/viewers/plugins/types.d.ts.map +1 -1
  172. package/dist/core/components/viewers/shared/placement/objectTarget.d.ts +2 -1
  173. package/dist/core/components/viewers/shared/placement/objectTarget.d.ts.map +1 -1
  174. package/dist/core/components/viewers/shared/placement/objectTarget.js +6 -3
  175. package/dist/core/components/viewers/shared/placement/objectTarget.js.map +1 -1
  176. package/dist/core/components/viewers/shared/placement/placementCore.d.ts +1 -0
  177. package/dist/core/components/viewers/shared/placement/placementCore.d.ts.map +1 -1
  178. package/dist/core/components/viewers/shared/placement/placementCore.js +12 -1
  179. package/dist/core/components/viewers/shared/placement/placementCore.js.map +1 -1
  180. package/dist/core/components/viewers/shared/placement/placementTarget.d.ts +2 -0
  181. package/dist/core/components/viewers/shared/placement/placementTarget.d.ts.map +1 -1
  182. package/dist/core/components/viewers/shared/placement/placementTarget.js.map +1 -1
  183. package/dist/core/components/viewers/shared/placement/projectNorth.d.ts +22 -0
  184. package/dist/core/components/viewers/shared/placement/projectNorth.d.ts.map +1 -0
  185. package/dist/core/components/viewers/shared/placement/projectNorth.js +39 -0
  186. package/dist/core/components/viewers/shared/placement/projectNorth.js.map +1 -0
  187. package/dist/core/hooks/plugins/createPluginHooks.d.ts +1 -0
  188. package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -1
  189. package/dist/core/hooks/plugins/createPluginHooks.js +5 -4
  190. package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -1
  191. package/dist/core/hooks/useUndoRedoShortcuts.d.ts.map +1 -1
  192. package/dist/core/hooks/useUndoRedoShortcuts.js +1 -6
  193. package/dist/core/hooks/useUndoRedoShortcuts.js.map +1 -1
  194. package/dist/core/i18n/messages/en.json +16 -4
  195. package/dist/core/i18n/messages/es.json +16 -4
  196. package/dist/core/i18n/messages/fr.json +16 -4
  197. package/dist/core/plugins/host/PluginDataPageHost.d.ts.map +1 -1
  198. package/dist/core/plugins/host/PluginDataPageHost.js +30 -25
  199. package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -1
  200. package/dist/core/plugins/host/pluginDatasetLookup.d.ts +6 -0
  201. package/dist/core/plugins/host/pluginDatasetLookup.d.ts.map +1 -0
  202. package/dist/core/plugins/host/pluginDatasetLookup.js +9 -0
  203. package/dist/core/plugins/host/pluginDatasetLookup.js.map +1 -0
  204. package/dist/core/plugins/host/pluginDatasets.d.ts +0 -8
  205. package/dist/core/plugins/host/pluginDatasets.d.ts.map +1 -1
  206. package/dist/core/plugins/host/pluginDatasets.js +1 -65
  207. package/dist/core/plugins/host/pluginDatasets.js.map +1 -1
  208. package/dist/core/plugins/host/provider.d.ts.map +1 -1
  209. package/dist/core/plugins/host/provider.js +12 -1
  210. package/dist/core/plugins/host/provider.js.map +1 -1
  211. package/dist/core/plugins/host/runtimeMessages.d.ts +13 -0
  212. package/dist/core/plugins/host/runtimeMessages.d.ts.map +1 -0
  213. package/dist/core/plugins/host/runtimeMessages.js +21 -0
  214. package/dist/core/plugins/host/runtimeMessages.js.map +1 -0
  215. package/dist/core/plugins/host/runtimeShims.d.ts +2 -0
  216. package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -1
  217. package/dist/core/plugins/host/runtimeShims.js +28 -1
  218. package/dist/core/plugins/host/runtimeShims.js.map +1 -1
  219. package/dist/core/plugins/host/toPluginDataset.d.ts +10 -0
  220. package/dist/core/plugins/host/toPluginDataset.d.ts.map +1 -0
  221. package/dist/core/plugins/host/toPluginDataset.js +68 -0
  222. package/dist/core/plugins/host/toPluginDataset.js.map +1 -0
  223. package/dist/core/plugins/host/usePluginToolbarTools.d.ts.map +1 -1
  224. package/dist/core/plugins/host/usePluginToolbarTools.js +6 -2
  225. package/dist/core/plugins/host/usePluginToolbarTools.js.map +1 -1
  226. package/dist/core/plugins/sdk/bimViewer.d.ts +25 -5
  227. package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -1
  228. package/dist/core/plugins/sdk/bimViewer.js +66 -10
  229. package/dist/core/plugins/sdk/bimViewer.js.map +1 -1
  230. package/dist/core/plugins/sdk/charts.d.ts +4 -0
  231. package/dist/core/plugins/sdk/charts.d.ts.map +1 -0
  232. package/dist/core/plugins/sdk/charts.js +46 -0
  233. package/dist/core/plugins/sdk/charts.js.map +1 -0
  234. package/dist/core/plugins/sdk/components.d.ts +1 -0
  235. package/dist/core/plugins/sdk/components.d.ts.map +1 -1
  236. package/dist/core/plugins/sdk/components.js +2 -0
  237. package/dist/core/plugins/sdk/components.js.map +1 -1
  238. package/dist/core/plugins/sdk/datasets.d.ts +6 -2
  239. package/dist/core/plugins/sdk/datasets.d.ts.map +1 -1
  240. package/dist/core/plugins/sdk/datasets.js +15 -2
  241. package/dist/core/plugins/sdk/datasets.js.map +1 -1
  242. package/dist/core/plugins/sdk/floorplan.d.ts +64 -0
  243. package/dist/core/plugins/sdk/floorplan.d.ts.map +1 -0
  244. package/dist/core/plugins/sdk/floorplan.js +102 -0
  245. package/dist/core/plugins/sdk/floorplan.js.map +1 -0
  246. package/dist/core/plugins/sdk/messages.d.ts.map +1 -1
  247. package/dist/core/plugins/sdk/messages.js +31 -15
  248. package/dist/core/plugins/sdk/messages.js.map +1 -1
  249. package/dist/core/plugins/sdk/types.d.ts +13 -2
  250. package/dist/core/plugins/sdk/types.d.ts.map +1 -1
  251. package/dist/core/plugins/sdk/types.js.map +1 -1
  252. package/dist/core/plugins/sdk/ui.d.ts +6 -0
  253. package/dist/core/plugins/sdk/ui.d.ts.map +1 -1
  254. package/dist/core/plugins/sdk/ui.js +13 -0
  255. package/dist/core/plugins/sdk/ui.js.map +1 -1
  256. package/dist/core/types/global.d.ts +1 -1
  257. package/dist/core/types/global.d.ts.map +1 -1
  258. package/dist/core/types/global.js.map +1 -1
  259. package/dist/core/utils/utils.d.ts +2 -0
  260. package/dist/core/utils/utils.d.ts.map +1 -1
  261. package/dist/core/utils/utils.js +4 -0
  262. package/dist/core/utils/utils.js.map +1 -1
  263. package/package.json +1 -1
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import { buildWmsTileUrl } from "../../components/viewers/map/datasets/src/urlSources";
18
+ import { layerColorByName } from "../../components/viewers/map/utils/stringToColour";
19
+ import { DatasetGroup } from "../../types/dbTypes";
20
+ import { pluginDatasetId } from "./pluginDatasetId";
21
+ const noFeatures = async () => ({ type: "FeatureCollection", features: [] });
22
+ function drawnBy(registration) {
23
+ const { source, pluginId } = registration;
24
+ if ((source == null ? void 0 : source.type) === "wms") {
25
+ const { baseUrl, layers, timeEnabled } = source;
26
+ return {
27
+ datasetType: "WMS",
28
+ type: "WMS",
29
+ url: buildWmsTileUrl(baseUrl, layers),
30
+ timeEnabled,
31
+ wms: { baseUrl, layers },
32
+ clickable: false,
33
+ getFeatures: noFeatures
34
+ };
35
+ }
36
+ if ((source == null ? void 0 : source.type) === "geojson") {
37
+ return {
38
+ datasetType: "GeoJSON",
39
+ type: "GeoJSON",
40
+ clickable: true,
41
+ getFeatures: async () => await source.getFeatures()
42
+ };
43
+ }
44
+ return { datasetType: "GeoJSON", type: "Plugin", clickable: false, drawnByPlugin: pluginId, getFeatures: noFeatures };
45
+ }
46
+ function toPluginDataset(registration, organization) {
47
+ const { pluginId, id, name, description, publisher, information, live = false } = registration;
48
+ const group = live ? DatasetGroup.National : DatasetGroup.Organizational;
49
+ return __spreadValues({
50
+ id: pluginDatasetId(pluginId, id),
51
+ name,
52
+ description,
53
+ publisher,
54
+ information,
55
+ organization: live ? void 0 : organization,
56
+ dataManagementSystem: "other",
57
+ countrySubdivision: "",
58
+ municipality: "",
59
+ group,
60
+ layerColor: layerColorByName(name),
61
+ portal: { id: -1, name: publisher != null ? publisher : name, group, dataManagementSystem: "Other", live },
62
+ getFields: async () => []
63
+ }, drawnBy(registration));
64
+ }
65
+ export {
66
+ toPluginDataset
67
+ };
68
+ //# sourceMappingURL=toPluginDataset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/toPluginDataset.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { buildWmsTileUrl } from '../../components/viewers/map/datasets/src/urlSources'\nimport { layerColorByName } from '../../components/viewers/map/utils/stringToColour'\nimport { DatasetGroup } from '../../types/dbTypes'\n\nimport { pluginDatasetId } from './pluginDatasetId'\n\nimport type { PluginContribution } from './provider'\nimport type { Dataset } from '../../types/datasetTypes'\nimport type { AllGeoJSON } from '@turf/turf'\n\nconst noFeatures = async (): Promise<AllGeoJSON> =>\n ({ type: 'FeatureCollection', features: [] }) as AllGeoJSON\n\ntype DatasetContribution = PluginContribution<'map.datasets'>\n\nfunction drawnBy(registration: DatasetContribution): Pick<Dataset, 'datasetType' | 'type' | 'url' | 'timeEnabled' | 'wms' | 'getFeatures' | 'drawnByPlugin' | 'clickable'> {\n const { source, pluginId } = registration\n\n if (source?.type === 'wms') {\n const { baseUrl, layers, timeEnabled } = source\n return {\n datasetType: 'WMS',\n type: 'WMS',\n url: buildWmsTileUrl(baseUrl, layers),\n timeEnabled,\n wms: { baseUrl, layers },\n clickable: false,\n getFeatures: noFeatures,\n }\n }\n\n if (source?.type === 'geojson') {\n return {\n datasetType: 'GeoJSON',\n type: 'GeoJSON',\n clickable: true,\n getFeatures: async () => (await source.getFeatures()) as AllGeoJSON,\n }\n }\n\n return { datasetType: 'GeoJSON', type: 'Plugin', clickable: false, drawnByPlugin: pluginId, getFeatures: noFeatures }\n}\n\n/**\n * A `map.datasets` contribution as the Datasets menu lists it. A live one goes under Live\n * Data; any other is organizational, stamped with the viewer's own organization.\n */\nexport function toPluginDataset(registration: DatasetContribution, organization?: number): Dataset {\n const { pluginId, id, name, description, publisher, information, live = false } = registration\n const group = live ? DatasetGroup.National : DatasetGroup.Organizational\n\n return {\n id: pluginDatasetId(pluginId, id),\n name,\n description,\n publisher,\n information,\n organization: live ? undefined : organization,\n dataManagementSystem: 'other',\n countrySubdivision: '',\n municipality: '',\n group,\n layerColor: layerColorByName(name),\n portal: { id: -1, name: publisher ?? name, group, dataManagementSystem: 'Other', live },\n getFields: async () => [],\n ...drawnBy(registration),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,SAAS,uBAAuB;AAMhC,MAAM,aAAa,aAChB,EAAE,MAAM,qBAAqB,UAAU,CAAC,EAAE;AAI7C,SAAS,QAAQ,cAA0J;AACzK,QAAM,EAAE,QAAQ,SAAS,IAAI;AAE7B,OAAI,iCAAQ,UAAS,OAAO;AAC1B,UAAM,EAAE,SAAS,QAAQ,YAAY,IAAI;AACzC,WAAO;AAAA,MACL,aAAa;AAAA,MACb,MAAM;AAAA,MACN,KAAK,gBAAgB,SAAS,MAAM;AAAA,MACpC;AAAA,MACA,KAAK,EAAE,SAAS,OAAO;AAAA,MACvB,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AAEA,OAAI,iCAAQ,UAAS,WAAW;AAC9B,WAAO;AAAA,MACL,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa,YAAa,MAAM,OAAO,YAAY;AAAA,IACrD;AAAA,EACF;AAEA,SAAO,EAAE,aAAa,WAAW,MAAM,UAAU,WAAW,OAAO,eAAe,UAAU,aAAa,WAAW;AACtH;AAMO,SAAS,gBAAgB,cAAmC,cAAgC;AACjG,QAAM,EAAE,UAAU,IAAI,MAAM,aAAa,WAAW,aAAa,OAAO,MAAM,IAAI;AAClF,QAAM,QAAQ,OAAO,aAAa,WAAW,aAAa;AAE1D,SAAO;AAAA,IACL,IAAI,gBAAgB,UAAU,EAAE;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,OAAO,SAAY;AAAA,IACjC,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd;AAAA,IACA,YAAY,iBAAiB,IAAI;AAAA,IACjC,QAAQ,EAAE,IAAI,IAAI,MAAM,gCAAa,MAAM,OAAO,sBAAsB,SAAS,KAAK;AAAA,IACtF,WAAW,YAAY,CAAC;AAAA,KACrB,QAAQ,YAAY;AAE3B;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePluginToolbarTools.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAK7C,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,CAAA;AAKzD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,EAAE,CAyCR"}
1
+ {"version":3,"file":"usePluginToolbarTools.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAK7C,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,CAAA;AAOzD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,EAAE,CAyCR"}
@@ -123,8 +123,12 @@ const PluginStayActivePanel = ({ children, tool }) => {
123
123
  function wrapPluginComponent(contribution, readConfig) {
124
124
  const Component = contribution.component;
125
125
  function PluginToolboxItem(_a) {
126
- var _b = _a, { tool } = _b, rest = __objRest(_b, ["tool"]);
127
- const panel = /* @__PURE__ */ jsx(PluginScopeProvider, { pluginId: contribution.pluginId, config: readConfig(), children: /* @__PURE__ */ jsx(Component, __spreadValues({ tool }, rest)) });
126
+ var _b = _a, { tool, forPlugin } = _b, rest = __objRest(_b, ["tool", "forPlugin"]);
127
+ const scoped = React.useMemo(
128
+ () => typeof forPlugin === "function" ? forPlugin(contribution.pluginId) : void 0,
129
+ [forPlugin]
130
+ );
131
+ const panel = /* @__PURE__ */ jsx(PluginScopeProvider, { pluginId: contribution.pluginId, config: readConfig(), children: /* @__PURE__ */ jsx(Component, __spreadValues(__spreadValues({ tool }, rest), scoped)) });
128
132
  if (tool.stayActive) {
129
133
  return /* @__PURE__ */ jsx(PluginStayActivePanel, { tool, children: panel });
130
134
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport * as React from 'react'\n\nimport { SubmenuContext, ToolbarSubmenu } from '../../components/ToolbarSubmenu'\nimport { Button } from '../../components/ui/Button'\n\nimport { resolvePluginIcon } from './pluginIcon'\nimport { usePluginConfigs, usePluginContributions, type PluginContribution } from './provider'\nimport { PluginScopeProvider } from './scope'\n\nimport type { CursorType } from '../../types/global'\nimport type { Tool } from '../../types/tools'\nimport type { ToolbarRegistration } from '../sdk/types'\n\nimport type { LucideProps } from 'lucide-react'\n\n/** The toolbar capabilities. All share `ToolbarRegistration`. */\nexport type ToolbarCapability = 'map.tools' | 'bim.tools'\n\n/** What `ToolbarButton` renders for a tool that supplies its own component. */\ntype ToolComponent = NonNullable<Tool['component']>\n\n/**\n * Plugin contributions for one toolbar, as `Tool` objects the toolbars already\n * render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.\n *\n * `extraProps` is spread onto the plugin's component by `ToolbarButton` — how a BIM\n * tool gets its viewer handles. Each viewer passes its own, keeping this module free\n * of viewer-engine imports that would pull three into the map bundle.\n */\nexport function usePluginToolbarTools(\n capability: ToolbarCapability,\n extraProps?: Record<string, unknown>,\n): Tool[] {\n const contributions = usePluginContributions(capability)\n const configs = usePluginConfigs()\n\n // Cached by tool id to keep component identity stable. `extraProps` changes on\n // most renders (it carries live viewer handles), and rebuilding on each would\n // remount the plugin's panel and lose its state on every camera move.\n const wrapped = React.useRef(new Map<string, ToolComponent>())\n\n return React.useMemo(() => {\n const live = new Set<string>()\n\n const tools = contributions.map(contribution => {\n const id = pluginToolId(contribution)\n live.add(id)\n\n let Component = wrapped.current.get(id)\n if (!Component) {\n Component = wrapPluginComponent(contribution, () => configs[contribution.pluginId])\n wrapped.current.set(id, Component)\n }\n\n return {\n id,\n title: contribution.label,\n icon: resolvePluginIcon(contribution.icon),\n // An invented cursor is a CSS no-op, not a crash, so it goes unvalidated.\n cursor: contribution.cursor as CursorType | undefined,\n stayActive: contribution.stayActive,\n component: Component,\n extraProps,\n } satisfies Tool\n })\n\n // Drop cache entries for plugins that have since been disabled.\n for (const id of wrapped.current.keys()) {\n if (!live.has(id)) wrapped.current.delete(id)\n }\n\n return tools\n }, [contributions, extraProps])\n}\n\nfunction pluginToolId(contribution: PluginContribution<ToolbarCapability>) {\n return `plugin:${contribution.pluginId}:${contribution.id}` as const\n}\n\n// A stay-active plugin must outlive the dropdown, which destroys its children on close.\nconst PluginStayActivePanel: React.FC<{\n children: React.ReactNode\n tool: Tool\n}> = ({ children, tool }) => {\n const { openSubmenu, setOpenSubmenu } = React.useContext(SubmenuContext)\n const isOpen = openSubmenu === tool.id\n const panelId = React.useId()\n const containerRef = React.useRef<HTMLDivElement>(null)\n\n React.useEffect(() => {\n if (!isOpen) return\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) setOpenSubmenu(null)\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') setOpenSubmenu(null)\n }\n\n // Armed while closed, this would read the press that opens the panel as an outside press.\n document.addEventListener('pointerdown', handlePointerDown)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [isOpen, setOpenSubmenu])\n\n return (\n <div ref={containerRef} className=\"relative flex items-center\">\n <Button\n size=\"default\"\n variant=\"ghost\"\n className=\"flex flex-row justify-center items-center px-1 pointer-events-auto text-primary-dark\"\n title={tool.title}\n aria-expanded={isOpen}\n aria-controls={panelId}\n onClick={() => setOpenSubmenu(isOpen ? null : tool.id)}\n >\n <tool.icon />\n <LR.ChevronDown className={`-ml-2 transition-all duration-200 scale-75 ${isOpen ? 'rotate-180' : ''}`} />\n </Button>\n {/* Opens upward because the toolbar is pinned to the bottom of the viewport. */}\n <div\n id={panelId}\n hidden={!isOpen}\n className=\"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50 min-w-[8rem] max-h-[60vh] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md pointer-events-auto\"\n >\n {children}\n </div>\n </div>\n )\n}\n\n/**\n * Wrap a plugin's component into a real toolbar entry.\n *\n * `ToolbarButton` renders `tool.component` *instead of* a button, so a plugin\n * returning a panel would render it inline and blow the strip out of the viewport.\n * `ToolbarSubmenu` gives it the same ghost button and dropdown every core tool has,\n * built from the `label` and `icon` it already declared. The wrapper also supplies\n * the plugin scope the scoped SDK hooks read.\n */\nfunction wrapPluginComponent(\n contribution: PluginContribution<ToolbarCapability>,\n // Lazily, because the component identity is cached: capturing the config by value\n // would freeze it at whatever it was on first render.\n readConfig: () => Record<string, unknown> | undefined,\n): ToolComponent {\n // Props are typed per capability at `ctx.register`. This wrapper forwards whatever\n // the hosting toolbar passed, so the shape is erased here on purpose.\n const Component = contribution.component as unknown as React.ComponentType<Record<string, unknown>>\n\n function PluginToolboxItem({ tool, ...rest }: React.ComponentProps<ToolComponent>) {\n const panel = (\n <PluginScopeProvider pluginId={contribution.pluginId} config={readConfig()}>\n <Component tool={tool} {...rest} />\n </PluginScopeProvider>\n )\n\n if (tool.stayActive) {\n return <PluginStayActivePanel tool={tool}>{panel}</PluginStayActivePanel>\n }\n\n return <ToolbarSubmenu tool={tool}>{panel}</ToolbarSubmenu>\n }\n\n PluginToolboxItem.displayName = `PluginTool(${contribution.pluginId}/${contribution.id})`\n return PluginToolboxItem\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHM,SASE,KATF;AA/GN,YAAY,QAAQ;AACpB,YAAY,WAAW;AAEvB,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,cAAc;AAEvB,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,8BAAuD;AAClF,SAAS,2BAA2B;AAsB7B,SAAS,sBACd,YACA,YACQ;AACR,QAAM,gBAAgB,uBAAuB,UAAU;AACvD,QAAM,UAAU,iBAAiB;AAKjC,QAAM,UAAU,MAAM,OAAO,oBAAI,IAA2B,CAAC;AAE7D,SAAO,MAAM,QAAQ,MAAM;AACzB,UAAM,OAAO,oBAAI,IAAY;AAE7B,UAAM,QAAQ,cAAc,IAAI,kB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iB,WAAW,aAAa;AAClD,WAAO,MAAM;AACX,eAAS,oBAAoB,eAAe,iBAAiB;AAC7D,eAAS,oBAAoB,WAAW,aAAa;AAAA,IACvD;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SACE,qBAAC,SAAI,KAAK,cAAc,WAAU,8BAChC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,OAAO,KAAK;AAAA,QACZ,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,SAAS,MAAM,eAAe,SAAS,OAAO,KAAK,EAAE;AAAA,QAErD;AAAA,8BAAC,KAAK,MAAL,EAAU;AAAA,UACX,oBAAC,GAAG,aAAH,EAAe,WAAW,8CAA8C,SAAS,eAAe,EAAE,IAAI;AAAA;AAAA;AAAA,IACzG;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,QAAQ,CAAC;AAAA,QACT,WAAU;AAAA,QAET;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;AAWA,SAAS,oBACP,cAGA,YACe;AAGf,QAAM,YAAY,aAAa;AAE/B,WAAS,kBAAkB,IAAwD;AAAxD,iBAAE,OA/J/B,IA+J6B,IAAW,iBAAX,IAAW,CAAT;AAC3B,UAAM,QACJ,oBAAC,uBAAoB,UAAU,aAAa,UAAU,QAAQ,WAAW,GACvE,8BAAC,4BAAU,QAAgB,KAAM,GACnC;AAGF,QAAI,KAAK,YAAY;AACnB,aAAO,oBAAC,yBAAsB,MAAa,iBAAM;AAAA,IACnD;AAEA,WAAO,oBAAC,kBAAe,MAAa,iBAAM;AAAA,EAC5C;AAEA,oBAAkB,cAAc,cAAc,aAAa,QAAQ,IAAI,aAAa,EAAE;AACtF,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport * as React from 'react'\n\nimport { SubmenuContext, ToolbarSubmenu } from '../../components/ToolbarSubmenu'\nimport { Button } from '../../components/ui/Button'\n\nimport { resolvePluginIcon } from './pluginIcon'\nimport { usePluginConfigs, usePluginContributions, type PluginContribution } from './provider'\nimport { PluginScopeProvider } from './scope'\n\nimport type { CursorType } from '../../types/global'\nimport type { Tool } from '../../types/tools'\nimport type { ToolbarRegistration } from '../sdk/types'\n\nimport type { LucideProps } from 'lucide-react'\n\n/** The toolbar capabilities. All share `ToolbarRegistration`. */\nexport type ToolbarCapability = 'map.tools' | 'bim.tools'\n\n/** What `ToolbarButton` renders for a tool that supplies its own component. */\ntype ToolComponent = NonNullable<Tool['component']>\n\ntype ScopedPropsFactory = (pluginId: string) => Record<string, unknown>\n\n/**\n * Plugin contributions for one toolbar, as `Tool` objects the toolbars already\n * render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.\n *\n * `extraProps` is spread onto the plugin's component by `ToolbarButton` — how a BIM\n * tool gets its viewer handles. Each viewer passes its own, keeping this module free\n * of viewer-engine imports that would pull three into the map bundle.\n */\nexport function usePluginToolbarTools(\n capability: ToolbarCapability,\n extraProps?: Record<string, unknown>,\n): Tool[] {\n const contributions = usePluginContributions(capability)\n const configs = usePluginConfigs()\n\n // Cached by tool id to keep component identity stable. `extraProps` changes on\n // most renders (it carries live viewer handles), and rebuilding on each would\n // remount the plugin's panel and lose its state on every camera move.\n const wrapped = React.useRef(new Map<string, ToolComponent>())\n\n return React.useMemo(() => {\n const live = new Set<string>()\n\n const tools = contributions.map(contribution => {\n const id = pluginToolId(contribution)\n live.add(id)\n\n let Component = wrapped.current.get(id)\n if (!Component) {\n Component = wrapPluginComponent(contribution, () => configs[contribution.pluginId])\n wrapped.current.set(id, Component)\n }\n\n return {\n id,\n title: contribution.label,\n icon: resolvePluginIcon(contribution.icon),\n // An invented cursor is a CSS no-op, not a crash, so it goes unvalidated.\n cursor: contribution.cursor as CursorType | undefined,\n stayActive: contribution.stayActive,\n component: Component,\n extraProps,\n } satisfies Tool\n })\n\n // Drop cache entries for plugins that have since been disabled.\n for (const id of wrapped.current.keys()) {\n if (!live.has(id)) wrapped.current.delete(id)\n }\n\n return tools\n }, [contributions, extraProps])\n}\n\nfunction pluginToolId(contribution: PluginContribution<ToolbarCapability>) {\n return `plugin:${contribution.pluginId}:${contribution.id}` as const\n}\n\n// A stay-active plugin must outlive the dropdown, which destroys its children on close.\nconst PluginStayActivePanel: React.FC<{\n children: React.ReactNode\n tool: Tool\n}> = ({ children, tool }) => {\n const { openSubmenu, setOpenSubmenu } = React.useContext(SubmenuContext)\n const isOpen = openSubmenu === tool.id\n const panelId = React.useId()\n const containerRef = React.useRef<HTMLDivElement>(null)\n\n React.useEffect(() => {\n if (!isOpen) return\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) setOpenSubmenu(null)\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') setOpenSubmenu(null)\n }\n\n // Armed while closed, this would read the press that opens the panel as an outside press.\n document.addEventListener('pointerdown', handlePointerDown)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [isOpen, setOpenSubmenu])\n\n return (\n <div ref={containerRef} className=\"relative flex items-center\">\n <Button\n size=\"default\"\n variant=\"ghost\"\n className=\"flex flex-row justify-center items-center px-1 pointer-events-auto text-primary-dark\"\n title={tool.title}\n aria-expanded={isOpen}\n aria-controls={panelId}\n onClick={() => setOpenSubmenu(isOpen ? null : tool.id)}\n >\n <tool.icon />\n <LR.ChevronDown className={`-ml-2 transition-all duration-200 scale-75 ${isOpen ? 'rotate-180' : ''}`} />\n </Button>\n {/* Opens upward because the toolbar is pinned to the bottom of the viewport. */}\n <div\n id={panelId}\n hidden={!isOpen}\n className=\"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50 min-w-[8rem] max-h-[60vh] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md pointer-events-auto\"\n >\n {children}\n </div>\n </div>\n )\n}\n\n/**\n * Wrap a plugin's component into a real toolbar entry.\n *\n * `ToolbarButton` renders `tool.component` *instead of* a button, so a plugin\n * returning a panel would render it inline and blow the strip out of the viewport.\n * `ToolbarSubmenu` gives it the same ghost button and dropdown every core tool has,\n * built from the `label` and `icon` it already declared. The wrapper also supplies\n * the plugin scope the scoped SDK hooks read.\n */\nfunction wrapPluginComponent(\n contribution: PluginContribution<ToolbarCapability>,\n // Lazily, because the component identity is cached: capturing the config by value\n // would freeze it at whatever it was on first render.\n readConfig: () => Record<string, unknown> | undefined,\n): ToolComponent {\n // Props are typed per capability at `ctx.register`. This wrapper forwards whatever\n // the hosting toolbar passed, so the shape is erased here on purpose.\n const Component = contribution.component as unknown as React.ComponentType<Record<string, unknown>>\n\n function PluginToolboxItem({ tool, forPlugin, ...rest }: React.ComponentProps<ToolComponent> & { forPlugin?: unknown }) {\n const scoped = React.useMemo(\n () => (typeof forPlugin === 'function' ? (forPlugin as ScopedPropsFactory)(contribution.pluginId) : undefined),\n [forPlugin],\n )\n const panel = (\n <PluginScopeProvider pluginId={contribution.pluginId} config={readConfig()}>\n <Component tool={tool} {...rest} {...scoped} />\n </PluginScopeProvider>\n )\n\n if (tool.stayActive) {\n return <PluginStayActivePanel tool={tool}>{panel}</PluginStayActivePanel>\n }\n\n return <ToolbarSubmenu tool={tool}>{panel}</ToolbarSubmenu>\n }\n\n PluginToolboxItem.displayName = `PluginTool(${contribution.pluginId}/${contribution.id})`\n return PluginToolboxItem\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHM,SASE,KATF;AAjHN,YAAY,QAAQ;AACpB,YAAY,WAAW;AAEvB,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,cAAc;AAEvB,SAAS,yBAA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AA,IACZ;AACA,UAAM,QACJ,oBAAC,uBAAoB,UAAU,aAAa,UAAU,QAAQ,WAAW,GACvE,8BAAC,2CAAU,QAAgB,OAAU,OAAQ,GAC/C;AAGF,QAAI,KAAK,YAAY;AACnB,aAAO,oBAAC,yBAAsB,MAAa,iBAAM;AAAA,IACnD;AAEA,WAAO,oBAAC,kBAAe,MAAa,iBAAM;AAAA,EAC5C;AAEA,oBAAkB,cAAc,cAAc,aAAa,QAAQ,IAAI,aAAa,EAAE;AACtF,SAAO;AACT;","names":[]}
@@ -1,5 +1,7 @@
1
+ import type { PluginFloorplan } from './floorplan';
1
2
  import type { BimItemProperties } from '../../components/viewers/bim/src/lib/bimQueries';
2
3
  import type { ModelIdMap } from '../../components/viewers/bim/src/lib/bimTree';
4
+ import type { ModelPlacementChange, ModelPlacementWatcher } from '../../components/viewers/bim/src/lib/modelPlacementWatchers';
3
5
  import type * as OBC from '@thatopen/components';
4
6
  export interface BimToolProps {
5
7
  components: OBC.Components | null;
@@ -21,11 +23,28 @@ export interface BimToolProps {
21
23
  getItemsOfCategory: (category: string) => Promise<ModelIdMap>;
22
24
  /** Attributes for the given elements. Omit `attributes` for the default set. */
23
25
  getProperties: (items: ModelIdMap, attributes?: string[]) => Promise<BimItemProperties[]>;
26
+ /** The building whose models are open, or null before one is chosen. */
27
+ buildingId: number | null;
28
+ /** Storeys, plan sketching and plan overlays, scoped to the calling plugin. */
29
+ floorplan: PluginFloorplan;
30
+ /** Element colours, scoped to the calling plugin. */
31
+ appearance: PluginBimAppearance;
32
+ /** Lets data kept in world coordinates follow a model the user moves or turns. */
33
+ modelPlacement: PluginModelPlacement;
24
34
  }
25
- /**
26
- * Thin façade over the `lib/bim*` helpers core itself uses. Colour lives in
27
- * {@link usePluginBimAppearance}, which knows the calling plugin; this cannot.
28
- */
35
+ export interface PluginModelPlacement {
36
+ /** Follows every confirmed move and turn until the returned function is called. */
37
+ watch: (watcher: ModelPlacementWatcher) => () => void;
38
+ }
39
+ type PluginScopedProps = Pick<BimToolProps, 'floorplan' | 'appearance'>;
40
+ type BimViewerBase = Omit<BimToolProps, keyof PluginScopedProps>;
41
+ /** What the BIM toolbar hands its plugin tools: `forPlugin` supplies the plugin-scoped half. */
42
+ export interface BimToolHostProps extends BimViewerBase {
43
+ forPlugin: (pluginId: string) => PluginScopedProps;
44
+ }
45
+ /** For the BIM toolbar, which renders every plugin's tool and so cannot know one plugin's id. */
46
+ export declare function useBimToolHostProps(): BimToolHostProps;
47
+ /** The BIM viewer as the calling plugin sees it. Inside a plugin component only. */
29
48
  export declare function useBimViewer(): BimToolProps;
30
49
  export interface BimAppearance {
31
50
  /** `0xRRGGBB`. Omit to keep each element's own colour. */
@@ -42,5 +61,6 @@ export interface PluginBimAppearance {
42
61
  clearAppearance: () => void;
43
62
  }
44
63
  export declare function usePluginBimAppearance(): PluginBimAppearance;
45
- export type { ModelIdMap, BimItemProperties };
64
+ export type { ModelIdMap, BimItemProperties, ModelPlacementChange, ModelPlacementWatcher };
65
+ export type { FloorplanStorey, PlanFootprint, PlanOverlayOptions, PlanOverlayShape, PlanPoint, PluginFloorplan, SketchKind } from './floorplan';
46
66
  //# sourceMappingURL=bimViewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bimViewer.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/bimViewer.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAA;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAC9E,OAAO,KAAK,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAEhD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,GAAG,CAAC,UAAU,GAAG,IAAI,CAAA;IACjC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAA;IACtC,gDAAgD;IAChD,QAAQ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;CAC5B;AAYD,wBAAgB,sBAAsB,IAAI,mBAAmB,CAM5D;AAED,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAA;AAC1F,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
@@ -1,6 +1,25 @@
1
1
  'use client'
2
2
 
3
3
  "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __defProps = Object.defineProperties;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4
23
  import * as React from "react";
5
24
  import { ElementAppearance } from "../../components/viewers/bim/src/ElementAppearance";
6
25
  import { fitToSelection } from "../../components/viewers/bim/src/lib/bimCamera";
@@ -15,12 +34,19 @@ import {
15
34
  getItemProperties,
16
35
  getItemsOfCategory
17
36
  } from "../../components/viewers/bim/src/lib/bimQueries";
37
+ import { ModelPlacementWatchers } from "../../components/viewers/bim/src/lib/modelPlacementWatchers";
18
38
  import { BimContext } from "../../store/BIM/context";
39
+ import { BuildingsContext } from "../../store/Buildings/context";
19
40
  import { usePluginId } from "../host/scope";
20
- function useBimViewer() {
41
+ import { bindPluginFloorplan, useFloorplanSource } from "./floorplan";
42
+ function useBimViewerBase() {
43
+ var _a, _b;
21
44
  const { state } = React.useContext(BimContext);
45
+ const { state: buildingsState } = React.useContext(BuildingsContext);
22
46
  const { bimComponents, world, fragments, modelIds, selection } = state.bim;
47
+ const buildingId = (_b = (_a = buildingsState.buildings.building) == null ? void 0 : _a.id) != null ? _b : null;
23
48
  return React.useMemo(() => ({
49
+ buildingId,
24
50
  components: bimComponents,
25
51
  world,
26
52
  fragments,
@@ -45,23 +71,53 @@ function useBimViewer() {
45
71
  if (bimComponents) await showAllItems(bimComponents);
46
72
  },
47
73
  getItemsOfCategory: async (category) => bimComponents ? getItemsOfCategory(bimComponents, category) : {},
48
- getProperties: async (items, attributes) => bimComponents ? getItemProperties(bimComponents, items, attributes) : []
49
- }), [bimComponents, world, fragments, modelIds, selection]);
74
+ getProperties: async (items, attributes) => bimComponents ? getItemProperties(bimComponents, items, attributes) : [],
75
+ modelPlacement: {
76
+ watch: (watcher) => bimComponents ? bimComponents.get(ModelPlacementWatchers).watch(watcher) : () => {
77
+ }
78
+ }
79
+ }), [bimComponents, world, fragments, modelIds, selection, buildingId]);
50
80
  }
51
- function usePluginBimAppearance() {
81
+ function pluginScopedProps(components, floorplan, pluginId) {
82
+ return {
83
+ floorplan: bindPluginFloorplan(floorplan, pluginId),
84
+ appearance: createAppearance(components, pluginId)
85
+ };
86
+ }
87
+ function useBimToolHostProps() {
88
+ const base = useBimViewerBase();
89
+ const floorplan = useFloorplanSource(base.components);
90
+ return React.useMemo(() => __spreadProps(__spreadValues({}, base), {
91
+ forPlugin: (pluginId) => pluginScopedProps(base.components, floorplan, pluginId)
92
+ }), [base, floorplan]);
93
+ }
94
+ function useBimViewer() {
52
95
  const pluginId = usePluginId();
53
- const { state } = React.useContext(BimContext);
54
- const { bimComponents } = state.bim;
55
- return React.useMemo(() => ({
96
+ const base = useBimViewerBase();
97
+ const floorplan = useFloorplanSource(base.components);
98
+ return React.useMemo(
99
+ () => __spreadValues(__spreadValues({}, base), pluginScopedProps(base.components, floorplan, pluginId)),
100
+ [base, floorplan, pluginId]
101
+ );
102
+ }
103
+ function createAppearance(components, pluginId) {
104
+ return {
56
105
  setAppearance: (groups) => {
57
- bimComponents == null ? void 0 : bimComponents.get(ElementAppearance).setElementAppearance(pluginId, groups);
106
+ components == null ? void 0 : components.get(ElementAppearance).setElementAppearance(pluginId, groups);
58
107
  },
59
108
  clearAppearance: () => {
60
- bimComponents == null ? void 0 : bimComponents.get(ElementAppearance).clearElementAppearance(pluginId);
109
+ components == null ? void 0 : components.get(ElementAppearance).clearElementAppearance(pluginId);
61
110
  }
62
- }), [bimComponents, pluginId]);
111
+ };
112
+ }
113
+ function usePluginBimAppearance() {
114
+ const pluginId = usePluginId();
115
+ const { state } = React.useContext(BimContext);
116
+ const { bimComponents } = state.bim;
117
+ return React.useMemo(() => createAppearance(bimComponents, pluginId), [bimComponents, pluginId]);
63
118
  }
64
119
  export {
120
+ useBimToolHostProps,
65
121
  useBimViewer,
66
122
  usePluginBimAppearance
67
123
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/bimViewer.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { ElementAppearance } from '../../components/viewers/bim/src/ElementAppearance'\nimport { fitToSelection } from '../../components/viewers/bim/src/lib/bimCamera'\nimport {\n clearSelection,\n isolateItems,\n selectItems,\n setItemsVisible,\n showAllItems,\n} from '../../components/viewers/bim/src/lib/bimItemActions'\nimport {\n getItemProperties,\n getItemsOfCategory,\n} from '../../components/viewers/bim/src/lib/bimQueries'\nimport { BimContext } from '../../store/BIM/context'\nimport { usePluginId } from '../host/scope'\n\nimport type { BimItemProperties } from '../../components/viewers/bim/src/lib/bimQueries'\nimport type { ModelIdMap } from '../../components/viewers/bim/src/lib/bimTree'\nimport type * as OBC from '@thatopen/components'\n\nexport interface BimToolProps {\n components: OBC.Components | null\n world: OBC.World | null\n fragments: OBC.FragmentsManager | null\n /** Ids of every loaded model, in load order. */\n modelIds: string[]\n\n /** The live selection, keyed by model id. Updates as the user clicks in the viewport. */\n selection: ModelIdMap\n\n // Properties, not methods, so a plugin can destructure them safely.\n select: (items: ModelIdMap) => Promise<void>\n clearSelection: () => void\n /** Frame the camera on whatever is currently selected. */\n fitToSelection: () => Promise<void>\n\n /** Hides everything except `items`, across every loaded model. */\n isolate: (items: ModelIdMap) => Promise<void>\n setItemsVisible: (items: ModelIdMap, visible: boolean) => Promise<void>\n /** The escape hatch from `isolate`: makes everything visible again. */\n showAll: () => Promise<void>\n\n getItemsOfCategory: (category: string) => Promise<ModelIdMap>\n /** Attributes for the given elements. Omit `attributes` for the default set. */\n getProperties: (items: ModelIdMap, attributes?: string[]) => Promise<BimItemProperties[]>\n}\n\n/**\n * Thin façade over the `lib/bim*` helpers core itself uses. Colour lives in\n * {@link usePluginBimAppearance}, which knows the calling plugin; this cannot.\n */\nexport function useBimViewer(): BimToolProps {\n const { state } = React.useContext(BimContext)\n const { bimComponents, world, fragments, modelIds, selection } = state.bim\n\n return React.useMemo<BimToolProps>(() => ({\n components: bimComponents,\n world,\n fragments,\n modelIds,\n selection,\n\n select: async (items: ModelIdMap) => {\n if (bimComponents) await selectItems(bimComponents, items)\n },\n clearSelection: () => {\n if (bimComponents) clearSelection(bimComponents)\n },\n fitToSelection: async () => {\n if (bimComponents) await fitToSelection(bimComponents)\n },\n\n isolate: async (items: ModelIdMap) => {\n if (bimComponents) await isolateItems(bimComponents, items)\n },\n setItemsVisible: async (items: ModelIdMap, visible: boolean) => {\n if (bimComponents) await setItemsVisible(bimComponents, items, visible)\n },\n showAll: async () => {\n if (bimComponents) await showAllItems(bimComponents)\n },\n\n getItemsOfCategory: async (category: string) =>\n bimComponents ? getItemsOfCategory(bimComponents, category) : {},\n getProperties: async (items: ModelIdMap, attributes?: string[]) =>\n bimComponents ? getItemProperties(bimComponents, items, attributes) : [],\n }), [bimComponents, world, fragments, modelIds, selection])\n}\n\nexport interface BimAppearance {\n /** `0xRRGGBB`. Omit to keep each element's own colour. */\n color?: number\n /** `0`–`1`. Omit to leave elements opaque. */\n opacity?: number\n}\n\nexport interface BimAppearanceGroup {\n items: ModelIdMap\n appearance: BimAppearance\n}\n\nexport interface PluginBimAppearance {\n setAppearance: (groups: readonly BimAppearanceGroup[]) => void\n clearAppearance: () => void\n}\nexport function usePluginBimAppearance(): PluginBimAppearance {\n const pluginId = usePluginId()\n const { state } = React.useContext(BimContext)\n const { bimComponents } = state.bim\n\n return React.useMemo<PluginBimAppearance>(() => ({\n setAppearance: (groups: readonly BimAppearanceGroup[]) => {\n bimComponents?.get(ElementAppearance).setElementAppearance(pluginId, groups)\n },\n clearAppearance: () => {\n bimComponents?.get(ElementAppearance).clearElementAppearance(pluginId)\n },\n }), [bimComponents, pluginId])\n}\n\nexport type { ModelIdMap, BimItemProperties }\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAqCrB,SAAS,eAA6B;AAC3C,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,UAAU;AAC7C,QAAM,EAAE,eAAe,OAAO,WAAW,UAAU,UAAU,IAAI,MAAM;AAEvE,SAAO,MAAM,QAAsB,OAAO;AAAA,IACxC,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,QAAQ,OAAO,UAAsB;AACnC,UAAI,cAAe,OAAM,YAAY,eAAe,KAAK;AAAA,IAC3D;AAAA,IACA,gBAAgB,MAAM;AACpB,UAAI,cAAe,gBAAe,aAAa;AAAA,IACjD;AAAA,IACA,gBAAgB,YAAY;AAC1B,UAAI,cAAe,OAAM,eAAe,aAAa;AAAA,IACvD;AAAA,IAEA,SAAS,OAAO,UAAsB;AACpC,UAAI,cAAe,OAAM,aAAa,eAAe,KAAK;AAAA,IAC5D;AAAA,IACA,iBAAiB,OAAO,OAAmB,YAAqB;AAC9D,UAAI,cAAe,OAAM,gBAAgB,eAAe,OAAO,OAAO;AAAA,IACxE;AAAA,IACA,SAAS,YAAY;AACnB,UAAI,cAAe,OAAM,aAAa,aAAa;AAAA,IACrD;AAAA,IAEA,oBAAoB,OAAO,aACzB,gBAAgB,mBAAmB,eAAe,QAAQ,IAAI,CAAC;AAAA,IACjE,eAAe,OAAO,OAAmB,eACvC,gBAAgB,kBAAkB,eAAe,OAAO,UAAU,IAAI,CAAC;AAAA,EAC3E,IAAI,CAAC,eAAe,OAAO,WAAW,UAAU,SAAS,CAAC;AAC5D;AAkBO,SAAS,yBAA8C;AAC5D,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,UAAU;AAC7C,QAAM,EAAE,cAAc,IAAI,MAAM;AAEhC,SAAO,MAAM,QAA6B,OAAO;AAAA,IAC/C,eAAe,CAAC,WAA0C;AACxD,qDAAe,IAAI,mBAAmB,qBAAqB,UAAU;AAAA,IACvE;AAAA,IACA,iBAAiB,MAAM;AACrB,qDAAe,IAAI,mBAAmB,uBAAuB;AAAA,IAC/D;AAAA,EACF,IAAI,CAAC,eAAe,QAAQ,CAAC;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/bimViewer.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { ElementAppearance } from '../../components/viewers/bim/src/ElementAppearance'\nimport { fitToSelection } from '../../components/viewers/bim/src/lib/bimCamera'\nimport {\n clearSelection,\n isolateItems,\n selectItems,\n setItemsVisible,\n showAllItems,\n} from '../../components/viewers/bim/src/lib/bimItemActions'\nimport {\n getItemProperties,\n getItemsOfCategory,\n} from '../../components/viewers/bim/src/lib/bimQueries'\nimport { ModelPlacementWatchers } from '../../components/viewers/bim/src/lib/modelPlacementWatchers'\nimport { BimContext } from '../../store/BIM/context'\nimport { BuildingsContext } from '../../store/Buildings/context'\nimport { usePluginId } from '../host/scope'\n\nimport { bindPluginFloorplan, useFloorplanSource } from './floorplan'\n\nimport type { FloorplanSource, PluginFloorplan } from './floorplan'\n\nimport type { BimItemProperties } from '../../components/viewers/bim/src/lib/bimQueries'\nimport type { ModelIdMap } from '../../components/viewers/bim/src/lib/bimTree'\nimport type { ModelPlacementChange, ModelPlacementWatcher } from '../../components/viewers/bim/src/lib/modelPlacementWatchers'\nimport type * as OBC from '@thatopen/components'\n\nexport interface BimToolProps {\n components: OBC.Components | null\n world: OBC.World | null\n fragments: OBC.FragmentsManager | null\n /** Ids of every loaded model, in load order. */\n modelIds: string[]\n\n /** The live selection, keyed by model id. Updates as the user clicks in the viewport. */\n selection: ModelIdMap\n\n // Properties, not methods, so a plugin can destructure them safely.\n select: (items: ModelIdMap) => Promise<void>\n clearSelection: () => void\n /** Frame the camera on whatever is currently selected. */\n fitToSelection: () => Promise<void>\n\n /** Hides everything except `items`, across every loaded model. */\n isolate: (items: ModelIdMap) => Promise<void>\n setItemsVisible: (items: ModelIdMap, visible: boolean) => Promise<void>\n /** The escape hatch from `isolate`: makes everything visible again. */\n showAll: () => Promise<void>\n\n getItemsOfCategory: (category: string) => Promise<ModelIdMap>\n /** Attributes for the given elements. Omit `attributes` for the default set. */\n getProperties: (items: ModelIdMap, attributes?: string[]) => Promise<BimItemProperties[]>\n\n /** The building whose models are open, or null before one is chosen. */\n buildingId: number | null\n /** Storeys, plan sketching and plan overlays, scoped to the calling plugin. */\n floorplan: PluginFloorplan\n /** Element colours, scoped to the calling plugin. */\n appearance: PluginBimAppearance\n /** Lets data kept in world coordinates follow a model the user moves or turns. */\n modelPlacement: PluginModelPlacement\n}\n\nexport interface PluginModelPlacement {\n /** Follows every confirmed move and turn until the returned function is called. */\n watch: (watcher: ModelPlacementWatcher) => () => void\n}\n\ntype PluginScopedProps = Pick<BimToolProps, 'floorplan' | 'appearance'>\ntype BimViewerBase = Omit<BimToolProps, keyof PluginScopedProps>\n\n/** What the BIM toolbar hands its plugin tools: `forPlugin` supplies the plugin-scoped half. */\nexport interface BimToolHostProps extends BimViewerBase {\n forPlugin: (pluginId: string) => PluginScopedProps\n}\n\nfunction useBimViewerBase(): BimViewerBase {\n const { state } = React.useContext(BimContext)\n const { state: buildingsState } = React.useContext(BuildingsContext)\n const { bimComponents, world, fragments, modelIds, selection } = state.bim\n const buildingId = buildingsState.buildings.building?.id ?? null\n\n return React.useMemo<BimViewerBase>(() => ({\n buildingId,\n components: bimComponents,\n world,\n fragments,\n modelIds,\n selection,\n\n select: async (items: ModelIdMap) => {\n if (bimComponents) await selectItems(bimComponents, items)\n },\n clearSelection: () => {\n if (bimComponents) clearSelection(bimComponents)\n },\n fitToSelection: async () => {\n if (bimComponents) await fitToSelection(bimComponents)\n },\n\n isolate: async (items: ModelIdMap) => {\n if (bimComponents) await isolateItems(bimComponents, items)\n },\n setItemsVisible: async (items: ModelIdMap, visible: boolean) => {\n if (bimComponents) await setItemsVisible(bimComponents, items, visible)\n },\n showAll: async () => {\n if (bimComponents) await showAllItems(bimComponents)\n },\n\n getItemsOfCategory: async (category: string) =>\n bimComponents ? getItemsOfCategory(bimComponents, category) : {},\n getProperties: async (items: ModelIdMap, attributes?: string[]) =>\n bimComponents ? getItemProperties(bimComponents, items, attributes) : [],\n\n modelPlacement: {\n watch: (watcher: ModelPlacementWatcher) =>\n bimComponents ? bimComponents.get(ModelPlacementWatchers).watch(watcher) : () => {},\n },\n }), [bimComponents, world, fragments, modelIds, selection, buildingId])\n}\n\nfunction pluginScopedProps(\n components: OBC.Components | null,\n floorplan: FloorplanSource,\n pluginId: string,\n): PluginScopedProps {\n return {\n floorplan: bindPluginFloorplan(floorplan, pluginId),\n appearance: createAppearance(components, pluginId),\n }\n}\n\n/** For the BIM toolbar, which renders every plugin's tool and so cannot know one plugin's id. */\nexport function useBimToolHostProps(): BimToolHostProps {\n const base = useBimViewerBase()\n const floorplan = useFloorplanSource(base.components)\n\n return React.useMemo(() => ({\n ...base,\n forPlugin: (pluginId: string) => pluginScopedProps(base.components, floorplan, pluginId),\n }), [base, floorplan])\n}\n\n/** The BIM viewer as the calling plugin sees it. Inside a plugin component only. */\nexport function useBimViewer(): BimToolProps {\n const pluginId = usePluginId()\n const base = useBimViewerBase()\n const floorplan = useFloorplanSource(base.components)\n\n return React.useMemo(\n () => ({ ...base, ...pluginScopedProps(base.components, floorplan, pluginId) }),\n [base, floorplan, pluginId],\n )\n}\n\nexport interface BimAppearance {\n /** `0xRRGGBB`. Omit to keep each element's own colour. */\n color?: number\n /** `0`–`1`. Omit to leave elements opaque. */\n opacity?: number\n}\n\nexport interface BimAppearanceGroup {\n items: ModelIdMap\n appearance: BimAppearance\n}\n\nexport interface PluginBimAppearance {\n setAppearance: (groups: readonly BimAppearanceGroup[]) => void\n clearAppearance: () => void\n}\nfunction createAppearance(components: OBC.Components | null, pluginId: string): PluginBimAppearance {\n return {\n setAppearance: (groups: readonly BimAppearanceGroup[]) => {\n components?.get(ElementAppearance).setElementAppearance(pluginId, groups)\n },\n clearAppearance: () => {\n components?.get(ElementAppearance).clearElementAppearance(pluginId)\n },\n }\n}\n\nexport function usePluginBimAppearance(): PluginBimAppearance {\n const pluginId = usePluginId()\n const { state } = React.useContext(BimContext)\n const { bimComponents } = state.bim\n\n return React.useMemo(() => createAppearance(bimComponents, pluginId), [bimComponents, pluginId])\n}\n\nexport type { ModelIdMap, BimItemProperties, ModelPlacementChange, ModelPlacementWatcher }\nexport type { FloorplanStorey, PlanFootprint, PlanOverlayOptions, PlanOverlayShape, PlanPoint, PluginFloorplan, SketchKind } from './floorplan'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA,YAAY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E,cAAc,IAAI,MAAM;AAEhC,SAAO,MAAM,QAAQ,MAAM,iBAAiB,eAAe,QAAQ,GAAG,CAAC,eAAe,QAAQ,CAAC;AACjG;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, } from '../../components/ui/chart';
2
+ export type { ChartConfig } from '../../components/ui/chart';
3
+ export { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Line, LineChart, Pie, PieChart, ResponsiveContainer, XAxis, YAxis, } from 'recharts';
4
+ //# sourceMappingURL=charts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/charts.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,kBAAkB,GACnB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EACL,IAAI,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,mBAAmB,EACnB,KAAK,EACL,KAAK,GACN,MAAM,UAAU,CAAA"}
@@ -0,0 +1,46 @@
1
+ 'use client'
2
+
3
+ "use client";
4
+ import {
5
+ ChartContainer,
6
+ ChartTooltip,
7
+ ChartTooltipContent,
8
+ ChartLegend,
9
+ ChartLegendContent
10
+ } from "../../components/ui/chart";
11
+ import {
12
+ Area,
13
+ AreaChart,
14
+ Bar,
15
+ BarChart,
16
+ CartesianGrid,
17
+ Cell,
18
+ Line,
19
+ LineChart,
20
+ Pie,
21
+ PieChart,
22
+ ResponsiveContainer,
23
+ XAxis,
24
+ YAxis
25
+ } from "recharts";
26
+ export {
27
+ Area,
28
+ AreaChart,
29
+ Bar,
30
+ BarChart,
31
+ CartesianGrid,
32
+ Cell,
33
+ ChartContainer,
34
+ ChartLegend,
35
+ ChartLegendContent,
36
+ ChartTooltip,
37
+ ChartTooltipContent,
38
+ Line,
39
+ LineChart,
40
+ Pie,
41
+ PieChart,
42
+ ResponsiveContainer,
43
+ XAxis,
44
+ YAxis
45
+ };
46
+ //# sourceMappingURL=charts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/charts.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// The host's Recharts, so plugin charts share one copy and the platform's chart styling.\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n} from '../../components/ui/chart'\nexport type { ChartConfig } from '../../components/ui/chart'\nexport {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n Line,\n LineChart,\n Pie,\n PieChart,\n ResponsiveContainer,\n XAxis,\n YAxis,\n} from 'recharts'\n"],"mappings":";AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -4,4 +4,5 @@ export { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Di
4
4
  export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '../../../core/components/ui/Card';
5
5
  export { Badge } from '../../../core/components/ui/Badge';
6
6
  export { Separator } from '../../../core/components/ui/Separator';
7
+ export { default as ConfirmDialog } from '../../../core/components/ConfirmDialog';
7
8
  //# sourceMappingURL=components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EACL,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EACL,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAA"}
@@ -23,6 +23,7 @@ import {
23
23
  } from "../../../core/components/ui/Card";
24
24
  import { Badge } from "../../../core/components/ui/Badge";
25
25
  import { Separator } from "../../../core/components/ui/Separator";
26
+ import { default as default2 } from "../../../core/components/ConfirmDialog";
26
27
  export {
27
28
  Badge,
28
29
  Button,
@@ -32,6 +33,7 @@ export {
32
33
  CardFooter,
33
34
  CardHeader,
34
35
  CardTitle,
36
+ default2 as ConfirmDialog,
35
37
  Dialog,
36
38
  DialogClose,
37
39
  DialogContent,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/components.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Re-export shadcn/ui primitives that plugins can use\n// This is the approved set — plugins should not import from @/src/core/components/ui directly\nexport { Button } from '../../../core/components/ui/Button'\nexport { Input } from '../../../core/components/ui/Input'\nexport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n DialogTrigger,\n DialogClose,\n} from '../../../core/components/ui/Dialog'\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '../../../core/components/ui/Card'\nexport { Badge } from '../../../core/components/ui/Badge'\nexport { Separator } from '../../../core/components/ui/Separator'\n"],"mappings":";AAOA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,iBAAiB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/components.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Re-export shadcn/ui primitives that plugins can use\n// This is the approved set — plugins should not import from @/src/core/components/ui directly\nexport { Button } from '../../../core/components/ui/Button'\nexport { Input } from '../../../core/components/ui/Input'\nexport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n DialogTrigger,\n DialogClose,\n} from '../../../core/components/ui/Dialog'\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '../../../core/components/ui/Card'\nexport { Badge } from '../../../core/components/ui/Badge'\nexport { Separator } from '../../../core/components/ui/Separator'\nexport { default as ConfirmDialog } from '../../../core/components/ConfirmDialog'\n"],"mappings":";AAOA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAoB,WAAXA,gBAAgC;","names":["default"]}
@@ -3,10 +3,14 @@ export interface PluginDatasetState {
3
3
  applied: boolean;
4
4
  /** Applied and not hidden with its eye toggle: draw it only when this is true. */
5
5
  visible: boolean;
6
+ /** What ticking it in the Datasets menu does: adds it to the map, or shows it again if hidden. */
7
+ apply: () => void;
8
+ /** What unticking it in the Datasets menu does: takes it off the map. */
9
+ remove: () => void;
6
10
  }
7
11
  /**
8
- * Whether one of this plugin's `map.datasets` is on the map, so the `map.layers` and
9
- * `viewer.legends` that draw it know when to. `id` is the registration's own id.
12
+ * Whether one of this plugin's `map.datasets` is on the map, with the Datasets menu's own
13
+ * actions for it so a plugin's controls and the menu never disagree. `id` is the registration's.
10
14
  */
11
15
  export declare function usePluginDataset(id: string): PluginDatasetState;
12
16
  //# sourceMappingURL=datasets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/datasets.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAS/D"}
1
+ {"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/datasets.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAA;IAChB,kGAAkG;IAClG,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yEAAyE;IACzE,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAuB/D"}
@@ -4,15 +4,28 @@
4
4
  import * as React from "react";
5
5
  import { DatasetsContext } from "../../store/Datasets/context";
6
6
  import { pluginDatasetId } from "../host/pluginDatasetId";
7
+ import { PluginDatasetLookupContext } from "../host/pluginDatasetLookup";
7
8
  import { usePluginId } from "../host/scope";
8
9
  function usePluginDataset(id) {
9
10
  const pluginId = usePluginId();
10
- const { state } = React.useContext(DatasetsContext);
11
+ const { state, dispatch } = React.useContext(DatasetsContext);
12
+ const findDataset = React.useContext(PluginDatasetLookupContext);
11
13
  const datasetId = pluginDatasetId(pluginId, id);
12
14
  const added = state.datasets.addedDatasets.find((dataset) => dataset.id === datasetId);
13
15
  const applied = added !== void 0;
14
16
  const visible = applied && added.visible !== false;
15
- return React.useMemo(() => ({ applied, visible }), [applied, visible]);
17
+ const apply = React.useCallback(() => {
18
+ if (applied) {
19
+ if (!visible) dispatch({ type: "TOGGLE_DATASET_VISIBILITY", payload: { datasetId } });
20
+ return;
21
+ }
22
+ const dataset = findDataset(pluginId, id);
23
+ if (dataset) dispatch({ type: "ADD_DATASET_TO_MAP", payload: { dataset } });
24
+ }, [applied, visible, findDataset, pluginId, id, datasetId, dispatch]);
25
+ const remove = React.useCallback(() => {
26
+ if (applied) dispatch({ type: "REMOVE_DATASET_FROM_MAP", payload: { datasetId } });
27
+ }, [applied, datasetId, dispatch]);
28
+ return React.useMemo(() => ({ applied, visible, apply, remove }), [applied, visible, apply, remove]);
16
29
  }
17
30
  export {
18
31
  usePluginDataset
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/datasets.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { DatasetsContext } from '../../store/Datasets/context'\nimport { pluginDatasetId } from '../host/pluginDatasetId'\nimport { usePluginId } from '../host/scope'\n\nexport interface PluginDatasetState {\n /** The user added it from the Datasets menu. */\n applied: boolean\n /** Applied and not hidden with its eye toggle: draw it only when this is true. */\n visible: boolean\n}\n\n/**\n * Whether one of this plugin's `map.datasets` is on the map, so the `map.layers` and\n * `viewer.legends` that draw it know when to. `id` is the registration's own id.\n */\nexport function usePluginDataset(id: string): PluginDatasetState {\n const pluginId = usePluginId()\n const { state } = React.useContext(DatasetsContext)\n const datasetId = pluginDatasetId(pluginId, id)\n const added = state.datasets.addedDatasets.find(dataset => dataset.id === datasetId)\n const applied = added !== undefined\n const visible = applied && added.visible !== false\n\n return React.useMemo(() => ({ applied, visible }), [applied, visible])\n}\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAarB,SAAS,iBAAiB,IAAgC;AAC/D,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,eAAe;AAClD,QAAM,YAAY,gBAAgB,UAAU,EAAE;AAC9C,QAAM,QAAQ,MAAM,SAAS,cAAc,KAAK,aAAW,QAAQ,OAAO,SAAS;AACnF,QAAM,UAAU,UAAU;AAC1B,QAAM,UAAU,WAAW,MAAM,YAAY;AAE7C,SAAO,MAAM,QAAQ,OAAO,EAAE,SAAS,QAAQ,IAAI,CAAC,SAAS,OAAO,CAAC;AACvE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/datasets.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { DatasetsContext } from '../../store/Datasets/context'\nimport { pluginDatasetId } from '../host/pluginDatasetId'\nimport { PluginDatasetLookupContext } from '../host/pluginDatasetLookup'\nimport { usePluginId } from '../host/scope'\n\nexport interface PluginDatasetState {\n /** The user added it from the Datasets menu. */\n applied: boolean\n /** Applied and not hidden with its eye toggle: draw it only when this is true. */\n visible: boolean\n /** What ticking it in the Datasets menu does: adds it to the map, or shows it again if hidden. */\n apply: () => void\n /** What unticking it in the Datasets menu does: takes it off the map. */\n remove: () => void\n}\n\n/**\n * Whether one of this plugin's `map.datasets` is on the map, with the Datasets menu's own\n * actions for it so a plugin's controls and the menu never disagree. `id` is the registration's.\n */\nexport function usePluginDataset(id: string): PluginDatasetState {\n const pluginId = usePluginId()\n const { state, dispatch } = React.useContext(DatasetsContext)\n const findDataset = React.useContext(PluginDatasetLookupContext)\n const datasetId = pluginDatasetId(pluginId, id)\n const added = state.datasets.addedDatasets.find(dataset => dataset.id === datasetId)\n const applied = added !== undefined\n const visible = applied && added.visible !== false\n\n const apply = React.useCallback(() => {\n if (applied) {\n if (!visible) dispatch({ type: 'TOGGLE_DATASET_VISIBILITY', payload: { datasetId } })\n return\n }\n const dataset = findDataset(pluginId, id)\n if (dataset) dispatch({ type: 'ADD_DATASET_TO_MAP', payload: { dataset } })\n }, [applied, visible, findDataset, pluginId, id, datasetId, dispatch])\n\n const remove = React.useCallback(() => {\n if (applied) dispatch({ type: 'REMOVE_DATASET_FROM_MAP', payload: { datasetId } })\n }, [applied, datasetId, dispatch])\n\n return React.useMemo(() => ({ applied, visible, apply, remove }), [applied, visible, apply, remove])\n}\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAiBrB,SAAS,iBAAiB,IAAgC;AAC/D,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,OAAO,SAAS,IAAI,MAAM,WAAW,eAAe;AAC5D,QAAM,cAAc,MAAM,WAAW,0BAA0B;AAC/D,QAAM,YAAY,gBAAgB,UAAU,EAAE;AAC9C,QAAM,QAAQ,MAAM,SAAS,cAAc,KAAK,aAAW,QAAQ,OAAO,SAAS;AACnF,QAAM,UAAU,UAAU;AAC1B,QAAM,UAAU,WAAW,MAAM,YAAY;AAE7C,QAAM,QAAQ,MAAM,YAAY,MAAM;AACpC,QAAI,SAAS;AACX,UAAI,CAAC,QAAS,UAAS,EAAE,MAAM,6BAA6B,SAAS,EAAE,UAAU,EAAE,CAAC;AACpF;AAAA,IACF;AACA,UAAM,UAAU,YAAY,UAAU,EAAE;AACxC,QAAI,QAAS,UAAS,EAAE,MAAM,sBAAsB,SAAS,EAAE,QAAQ,EAAE,CAAC;AAAA,EAC5E,GAAG,CAAC,SAAS,SAAS,aAAa,UAAU,IAAI,WAAW,QAAQ,CAAC;AAErE,QAAM,SAAS,MAAM,YAAY,MAAM;AACrC,QAAI,QAAS,UAAS,EAAE,MAAM,2BAA2B,SAAS,EAAE,UAAU,EAAE,CAAC;AAAA,EACnF,GAAG,CAAC,SAAS,WAAW,QAAQ,CAAC;AAEjC,SAAO,MAAM,QAAQ,OAAO,EAAE,SAAS,SAAS,OAAO,OAAO,IAAI,CAAC,SAAS,SAAS,OAAO,MAAM,CAAC;AACrG;","names":[]}
@@ -0,0 +1,64 @@
1
+ import { FloorplanTool } from '../../components/viewers/bim/src/FloorplanTool';
2
+ import type { PlanOverlayOptions, PlanOverlayShape, PlanPoint, SketchKind } from '../../components/viewers/bim/src/FloorplanTool';
3
+ import type { PlanFootprint } from '../../components/viewers/bim/src/FloorplanTool/src/spaceFootprints';
4
+ import type { ModelIdMap } from '../../components/viewers/bim/src/lib/bimTree';
5
+ import type * as OBC from '@thatopen/components';
6
+ export interface FloorplanStorey {
7
+ /** Stable for the session: `${modelId}::${storeyName}`. */
8
+ id: string;
9
+ name: string;
10
+ /** World height of the storey, in metres. */
11
+ elevation: number;
12
+ modelId: string;
13
+ }
14
+ /** The BIM floorplan as a plugin sees it. Coordinates are world metres on the horizontal plane. */
15
+ export interface PluginFloorplan {
16
+ /** False in a viewer without floorplans; every method is then a no-op. */
17
+ available: boolean;
18
+ storeys: FloorplanStorey[];
19
+ active: FloorplanStorey | null;
20
+ isDrawing: boolean;
21
+ /** True while `editShape` is waiting for the user to finish reshaping an outline. */
22
+ isEditingShape: boolean;
23
+ /** True once the open storey's vector lines exist; sketches snap to their corners. */
24
+ hasLines: boolean;
25
+ activate: (storeyId: string) => Promise<void>;
26
+ deactivate: () => Promise<void>;
27
+ /** Projects the open storey's vector lines. Slow on large models, so it is a separate step. */
28
+ generateLines: () => Promise<void>;
29
+ /** Fits the open plan's view to an outline, such as a space's, with some margin around it. */
30
+ frame: (points: readonly PlanPoint[]) => Promise<void>;
31
+ /** Resolves with the drawn outline, or null when cancelled or no plan is open. */
32
+ drawShape: (kind: SketchKind) => Promise<PlanPoint[] | null>;
33
+ /**
34
+ * Lets the user drag the outline's corners and edges; Ctrl+click adds a corner, Delete removes one.
35
+ * Resolves with the new outline on Enter or `finishEditingShape`, or null when cancelled.
36
+ */
37
+ editShape: (points: readonly PlanPoint[]) => Promise<PlanPoint[] | null>;
38
+ finishEditingShape: () => void;
39
+ /** Cancels a drawing or a shape edit in progress. */
40
+ cancelDrawing: () => void;
41
+ /** Replaces this plugin's shapes on the open plan. They follow whichever storey is open. */
42
+ setOverlay: (shapes: readonly PlanOverlayShape[], options?: PlanOverlayOptions) => void;
43
+ clearOverlay: () => void;
44
+ /** Floor outlines of elements such as IFCSPACEs, for drawing them with `setOverlay`. */
45
+ getSpaceFootprints: (items: ModelIdMap) => Promise<PlanFootprint[]>;
46
+ }
47
+ interface FloorplanSnapshot {
48
+ storeys: FloorplanStorey[];
49
+ active: FloorplanStorey | null;
50
+ isDrawing: boolean;
51
+ isEditingShape: boolean;
52
+ hasLines: boolean;
53
+ }
54
+ /** Live floorplan state plus the tool, for binding to a plugin with {@link bindPluginFloorplan}. */
55
+ export declare function useFloorplanSource(components: OBC.Components | null): {
56
+ tool: FloorplanTool;
57
+ components: OBC.Components;
58
+ state: FloorplanSnapshot;
59
+ };
60
+ export type FloorplanSource = ReturnType<typeof useFloorplanSource>;
61
+ /** The floorplan surface for one plugin; overlays are kept per `pluginId`. */
62
+ export declare function bindPluginFloorplan(source: FloorplanSource, pluginId: string): PluginFloorplan;
63
+ export type { PlanFootprint, PlanOverlayOptions, PlanOverlayShape, PlanPoint, SketchKind };
64
+ //# sourceMappingURL=floorplan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floorplan.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/floorplan.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAG9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AACjI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oEAAoE,CAAA;AACvG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAC9E,OAAO,KAAK,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAEhD,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,mGAAmG;AACnG,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC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