@collabdt/core 0.5.1 → 0.5.3

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 (219) hide show
  1. package/dist/core/components/AppSidebarContent.d.ts +2 -3
  2. package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
  3. package/dist/core/components/AppSidebarContent.js +10 -1
  4. package/dist/core/components/AppSidebarContent.js.map +1 -1
  5. package/dist/core/components/Toolbar.d.ts +2 -3
  6. package/dist/core/components/Toolbar.d.ts.map +1 -1
  7. package/dist/core/components/Toolbar.js.map +1 -1
  8. package/dist/core/components/ui/AppSidebar.d.ts +2 -2
  9. package/dist/core/components/ui/AppSidebar.d.ts.map +1 -1
  10. package/dist/core/components/ui/AppSidebar.js.map +1 -1
  11. package/dist/core/components/ui/Comments/CommentsSection.d.ts.map +1 -1
  12. package/dist/core/components/ui/Comments/CommentsSection.js +10 -9
  13. package/dist/core/components/ui/Comments/CommentsSection.js.map +1 -1
  14. package/dist/core/components/ui/Sensors/SensorsSection.d.ts.map +1 -1
  15. package/dist/core/components/ui/Sensors/SensorsSection.js +24 -23
  16. package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
  17. package/dist/core/components/ui/ViewerSidebar/Shell.js +1 -1
  18. package/dist/core/components/ui/ViewerSidebar/Shell.js.map +1 -1
  19. package/dist/core/components/ui/ViewerSidebar/TabStrip.d.ts +6 -5
  20. package/dist/core/components/ui/ViewerSidebar/TabStrip.d.ts.map +1 -1
  21. package/dist/core/components/ui/ViewerSidebar/TabStrip.js +6 -4
  22. package/dist/core/components/ui/ViewerSidebar/TabStrip.js.map +1 -1
  23. package/dist/core/components/ui/ViewerSidebar/sidebarTabs.d.ts +16 -9
  24. package/dist/core/components/ui/ViewerSidebar/sidebarTabs.d.ts.map +1 -1
  25. package/dist/core/components/ui/ViewerSidebar/sidebarTabs.js.map +1 -1
  26. package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
  27. package/dist/core/components/viewers/Viewer.js +17 -8
  28. package/dist/core/components/viewers/Viewer.js.map +1 -1
  29. package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
  30. package/dist/core/components/viewers/bim/BimViewer.js +6 -1
  31. package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
  32. package/dist/core/components/viewers/bim/src/BimSidebar/src/index.d.ts.map +1 -1
  33. package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js +5 -1
  34. package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js.map +1 -1
  35. package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts +10 -1
  36. package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts.map +1 -1
  37. package/dist/core/components/viewers/bim/src/ElementAppearance.js +36 -1
  38. package/dist/core/components/viewers/bim/src/ElementAppearance.js.map +1 -1
  39. package/dist/core/components/viewers/bim/src/ModelsSync.d.ts.map +1 -1
  40. package/dist/core/components/viewers/bim/src/ModelsSync.js +6 -5
  41. package/dist/core/components/viewers/bim/src/ModelsSync.js.map +1 -1
  42. package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts +12 -1
  43. package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts.map +1 -1
  44. package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js +18 -2
  45. package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js.map +1 -1
  46. package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
  47. package/dist/core/components/viewers/map/MapViewer.js +6 -3
  48. package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
  49. package/dist/core/components/viewers/map/src/MapSidebar/index.d.ts.map +1 -1
  50. package/dist/core/components/viewers/map/src/MapSidebar/index.js +5 -1
  51. package/dist/core/components/viewers/map/src/MapSidebar/index.js.map +1 -1
  52. package/dist/core/components/viewers/map/utils/stringToColour.d.ts +3 -0
  53. package/dist/core/components/viewers/map/utils/stringToColour.d.ts.map +1 -1
  54. package/dist/core/components/viewers/map/utils/stringToColour.js +72 -70
  55. package/dist/core/components/viewers/map/utils/stringToColour.js.map +1 -1
  56. package/dist/core/components/viewers/plugins/src/PluginCard.d.ts.map +1 -1
  57. package/dist/core/components/viewers/plugins/src/PluginCard.js +8 -4
  58. package/dist/core/components/viewers/plugins/src/PluginCard.js.map +1 -1
  59. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.d.ts.map +1 -1
  60. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.js +5 -1
  61. package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.js.map +1 -1
  62. package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts +10 -0
  63. package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts.map +1 -0
  64. package/dist/core/components/viewers/{map/legends/MapLegendHost.js → shared/legends/ViewerLegendHost.js} +48 -8
  65. package/dist/core/components/viewers/shared/legends/ViewerLegendHost.js.map +1 -0
  66. package/dist/core/components/viewers/viewerAccess.d.ts +7 -0
  67. package/dist/core/components/viewers/viewerAccess.d.ts.map +1 -0
  68. package/dist/core/components/viewers/viewerAccess.js +9 -0
  69. package/dist/core/components/viewers/viewerAccess.js.map +1 -0
  70. package/dist/core/i18n/messages/en.json +5 -0
  71. package/dist/core/i18n/messages/es.json +5 -0
  72. package/dist/core/i18n/messages/fr.json +5 -0
  73. package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts +13 -0
  74. package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts.map +1 -0
  75. package/dist/core/plugins/hello-bim/components/SpaceDialog.js +80 -0
  76. package/dist/core/plugins/hello-bim/components/SpaceDialog.js.map +1 -0
  77. package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts +11 -0
  78. package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts.map +1 -0
  79. package/dist/core/plugins/hello-bim/components/SpacesLegend.js +16 -0
  80. package/dist/core/plugins/hello-bim/components/SpacesLegend.js.map +1 -0
  81. package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts +4 -0
  82. package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts.map +1 -0
  83. package/dist/core/plugins/hello-bim/components/SpacesTab.js +211 -0
  84. package/dist/core/plugins/hello-bim/components/SpacesTab.js.map +1 -0
  85. package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts +8 -0
  86. package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts.map +1 -0
  87. package/dist/core/plugins/hello-bim/components/SpacesTool.js +68 -0
  88. package/dist/core/plugins/hello-bim/components/SpacesTool.js.map +1 -0
  89. package/dist/core/plugins/hello-bim/components/icons.d.ts +13 -0
  90. package/dist/core/plugins/hello-bim/components/icons.d.ts.map +1 -0
  91. package/dist/core/plugins/hello-bim/components/icons.js +52 -0
  92. package/dist/core/plugins/hello-bim/components/icons.js.map +1 -0
  93. package/dist/core/plugins/hello-bim/index.d.ts +2 -6
  94. package/dist/core/plugins/hello-bim/index.d.ts.map +1 -1
  95. package/dist/core/plugins/hello-bim/index.js +27 -3
  96. package/dist/core/plugins/hello-bim/index.js.map +1 -1
  97. package/dist/core/plugins/hello-bim/manifest.json +97 -31
  98. package/dist/core/plugins/hello-bim/spaces.d.ts +57 -0
  99. package/dist/core/plugins/hello-bim/spaces.d.ts.map +1 -0
  100. package/dist/core/plugins/hello-bim/spaces.js +207 -0
  101. package/dist/core/plugins/hello-bim/spaces.js.map +1 -0
  102. package/dist/core/plugins/hello-map/components/MapTool.d.ts +9 -0
  103. package/dist/core/plugins/hello-map/components/MapTool.d.ts.map +1 -0
  104. package/dist/core/plugins/hello-map/components/{HelloMapTool.js → MapTool.js} +30 -11
  105. package/dist/core/plugins/hello-map/components/MapTool.js.map +1 -0
  106. package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts +9 -0
  107. package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts.map +1 -0
  108. package/dist/core/plugins/hello-map/components/MarkerDialog.js +47 -0
  109. package/dist/core/plugins/hello-map/components/MarkerDialog.js.map +1 -0
  110. package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts +8 -0
  111. package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts.map +1 -0
  112. package/dist/core/plugins/hello-map/components/MarkersLayer.js +133 -0
  113. package/dist/core/plugins/hello-map/components/MarkersLayer.js.map +1 -0
  114. package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts +11 -0
  115. package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts.map +1 -0
  116. package/dist/core/plugins/hello-map/components/MarkersLegend.js +20 -0
  117. package/dist/core/plugins/hello-map/components/MarkersLegend.js.map +1 -0
  118. package/dist/core/plugins/hello-map/components/MarkersPage.d.ts +6 -0
  119. package/dist/core/plugins/hello-map/components/MarkersPage.d.ts.map +1 -0
  120. package/dist/core/plugins/hello-map/components/MarkersPage.js +40 -0
  121. package/dist/core/plugins/hello-map/components/MarkersPage.js.map +1 -0
  122. package/dist/core/plugins/hello-map/components/MarkersTab.d.ts +4 -0
  123. package/dist/core/plugins/hello-map/components/MarkersTab.d.ts.map +1 -0
  124. package/dist/core/plugins/hello-map/components/MarkersTab.js +275 -0
  125. package/dist/core/plugins/hello-map/components/MarkersTab.js.map +1 -0
  126. package/dist/core/plugins/hello-map/index.d.ts +2 -5
  127. package/dist/core/plugins/hello-map/index.d.ts.map +1 -1
  128. package/dist/core/plugins/hello-map/index.js +43 -3
  129. package/dist/core/plugins/hello-map/index.js.map +1 -1
  130. package/dist/core/plugins/hello-map/manifest.json +85 -12
  131. package/dist/core/plugins/hello-map/markers.d.ts +32 -0
  132. package/dist/core/plugins/hello-map/markers.d.ts.map +1 -0
  133. package/dist/core/plugins/hello-map/markers.js +143 -0
  134. package/dist/core/plugins/hello-map/markers.js.map +1 -0
  135. package/dist/core/plugins/host/PluginDataPageHost.d.ts +10 -0
  136. package/dist/core/plugins/host/PluginDataPageHost.d.ts.map +1 -0
  137. package/dist/core/plugins/host/PluginDataPageHost.js +142 -0
  138. package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -0
  139. package/dist/core/plugins/host/PluginDialogHost.d.ts +7 -0
  140. package/dist/core/plugins/host/PluginDialogHost.d.ts.map +1 -0
  141. package/dist/core/plugins/host/PluginDialogHost.js +80 -0
  142. package/dist/core/plugins/host/PluginDialogHost.js.map +1 -0
  143. package/dist/core/plugins/host/PluginMapLayerHost.d.ts +6 -0
  144. package/dist/core/plugins/host/PluginMapLayerHost.d.ts.map +1 -0
  145. package/dist/core/plugins/host/PluginMapLayerHost.js +26 -0
  146. package/dist/core/plugins/host/PluginMapLayerHost.js.map +1 -0
  147. package/dist/core/plugins/host/dialogs.d.ts +25 -0
  148. package/dist/core/plugins/host/dialogs.d.ts.map +1 -0
  149. package/dist/core/plugins/host/dialogs.js +50 -0
  150. package/dist/core/plugins/host/dialogs.js.map +1 -0
  151. package/dist/core/plugins/host/host.d.ts.map +1 -1
  152. package/dist/core/plugins/host/host.js +2 -0
  153. package/dist/core/plugins/host/host.js.map +1 -1
  154. package/dist/core/plugins/host/pluginState.d.ts +28 -0
  155. package/dist/core/plugins/host/pluginState.d.ts.map +1 -0
  156. package/dist/core/plugins/host/pluginState.js +49 -0
  157. package/dist/core/plugins/host/pluginState.js.map +1 -0
  158. package/dist/core/plugins/host/pluginViewerKey.d.ts +13 -0
  159. package/dist/core/plugins/host/pluginViewerKey.d.ts.map +1 -0
  160. package/dist/core/plugins/host/pluginViewerKey.js +18 -0
  161. package/dist/core/plugins/host/pluginViewerKey.js.map +1 -0
  162. package/dist/core/plugins/host/provider.d.ts.map +1 -1
  163. package/dist/core/plugins/host/provider.js +2 -1
  164. package/dist/core/plugins/host/provider.js.map +1 -1
  165. package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -1
  166. package/dist/core/plugins/host/runtimeShims.js +23 -1
  167. package/dist/core/plugins/host/runtimeShims.js.map +1 -1
  168. package/dist/core/plugins/host/usePluginDataPages.d.ts +15 -0
  169. package/dist/core/plugins/host/usePluginDataPages.d.ts.map +1 -0
  170. package/dist/core/plugins/host/usePluginDataPages.js +22 -0
  171. package/dist/core/plugins/host/usePluginDataPages.js.map +1 -0
  172. package/dist/core/plugins/host/usePluginViewerTabs.d.ts +11 -0
  173. package/dist/core/plugins/host/usePluginViewerTabs.d.ts.map +1 -0
  174. package/dist/core/plugins/host/usePluginViewerTabs.js +41 -0
  175. package/dist/core/plugins/host/usePluginViewerTabs.js.map +1 -0
  176. package/dist/core/plugins/sdk/bimViewer.d.ts +29 -13
  177. package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -1
  178. package/dist/core/plugins/sdk/bimViewer.js +17 -1
  179. package/dist/core/plugins/sdk/bimViewer.js.map +1 -1
  180. package/dist/core/plugins/sdk/index.d.ts +1 -0
  181. package/dist/core/plugins/sdk/index.d.ts.map +1 -1
  182. package/dist/core/plugins/sdk/index.js +4 -1
  183. package/dist/core/plugins/sdk/index.js.map +1 -1
  184. package/dist/core/plugins/sdk/messages.d.ts +6 -0
  185. package/dist/core/plugins/sdk/messages.d.ts.map +1 -1
  186. package/dist/core/plugins/sdk/messages.js +11 -0
  187. package/dist/core/plugins/sdk/messages.js.map +1 -1
  188. package/dist/core/plugins/sdk/state.d.ts +6 -0
  189. package/dist/core/plugins/sdk/state.d.ts.map +1 -0
  190. package/dist/core/plugins/sdk/state.js +30 -0
  191. package/dist/core/plugins/sdk/state.js.map +1 -0
  192. package/dist/core/plugins/sdk/types.d.ts +55 -10
  193. package/dist/core/plugins/sdk/types.d.ts.map +1 -1
  194. package/dist/core/plugins/sdk/types.js +7 -3
  195. package/dist/core/plugins/sdk/types.js.map +1 -1
  196. package/dist/core/plugins/sdk/ui.d.ts +12 -0
  197. package/dist/core/plugins/sdk/ui.d.ts.map +1 -0
  198. package/dist/core/plugins/sdk/ui.js +16 -0
  199. package/dist/core/plugins/sdk/ui.js.map +1 -0
  200. package/dist/core/store/CombineProviders.d.ts.map +1 -1
  201. package/dist/core/store/CombineProviders.js +6 -2
  202. package/dist/core/store/CombineProviders.js.map +1 -1
  203. package/dist/core/store/Menus/reducer.d.ts +5 -3
  204. package/dist/core/store/Menus/reducer.d.ts.map +1 -1
  205. package/dist/core/store/Menus/reducer.js.map +1 -1
  206. package/dist/core/types/dbTypes.d.ts +5 -0
  207. package/dist/core/types/dbTypes.d.ts.map +1 -1
  208. package/dist/core/types/dbTypes.js.map +1 -1
  209. package/package.json +3 -1
  210. package/dist/core/components/viewers/map/legends/MapLegendHost.d.ts +0 -10
  211. package/dist/core/components/viewers/map/legends/MapLegendHost.d.ts.map +0 -1
  212. package/dist/core/components/viewers/map/legends/MapLegendHost.js.map +0 -1
  213. package/dist/core/plugins/hello-bim/components/HelloBimTool.d.ts +0 -18
  214. package/dist/core/plugins/hello-bim/components/HelloBimTool.d.ts.map +0 -1
  215. package/dist/core/plugins/hello-bim/components/HelloBimTool.js +0 -142
  216. package/dist/core/plugins/hello-bim/components/HelloBimTool.js.map +0 -1
  217. package/dist/core/plugins/hello-map/components/HelloMapTool.d.ts +0 -14
  218. package/dist/core/plugins/hello-map/components/HelloMapTool.d.ts.map +0 -1
  219. package/dist/core/plugins/hello-map/components/HelloMapTool.js.map +0 -1
@@ -1,9 +1,12 @@
1
1
  export * from "./types";
2
2
  export * from "./version";
3
3
  export * from "./components";
4
+ import { MAP_COLOUR_PALETTE, stringToColour } from "../../components/viewers/map/utils/stringToColour";
4
5
  import { PLUGIN_RUNTIME_SHIMS, PLUGIN_EXTERNALS } from "../host/runtimeShims";
5
6
  export {
7
+ MAP_COLOUR_PALETTE,
6
8
  PLUGIN_EXTERNALS,
7
- PLUGIN_RUNTIME_SHIMS
9
+ PLUGIN_RUNTIME_SHIMS,
10
+ stringToColour
8
11
  };
9
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nexport * from './types'\r\nexport * from './version'\r\nexport * from './components'\r\n\r\n// The single source the app's shim generator, the import map it publishes and\r\n// @collabdt/plugin-kit's build preset all derive from.\r\nexport { PLUGIN_RUNTIME_SHIMS, PLUGIN_EXTERNALS } from '../host/runtimeShims'\r\nexport type { RuntimeShim } from '../host/runtimeShims'\r\n"],"mappings":"AAGA,cAAc;AACd,cAAc;AACd,cAAc;AAId,SAAS,sBAAsB,wBAAwB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nexport * from './types'\r\nexport * from './version'\r\nexport * from './components'\r\n\r\n// Colours for anything a plugin draws: a pure function and an array, no viewer library.\r\nexport { MAP_COLOUR_PALETTE, stringToColour } from '../../components/viewers/map/utils/stringToColour'\r\n\r\n// The single source the app's shim generator, the import map it publishes and\r\n// @collabdt/plugin-kit's build preset all derive from.\r\nexport { PLUGIN_RUNTIME_SHIMS, PLUGIN_EXTERNALS } from '../host/runtimeShims'\r\nexport type { RuntimeShim } from '../host/runtimeShims'\r\n"],"mappings":"AAGA,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,oBAAoB,sBAAsB;AAInD,SAAS,sBAAsB,wBAAwB;","names":[]}
@@ -21,6 +21,12 @@ export type PluginTranslator = (key: string, fallback?: string) => string;
21
21
  * missing key renders as `plugins.<pluginId>.<key>` rather than throwing.
22
22
  */
23
23
  export declare function usePluginTranslations(): PluginTranslator;
24
+ export type PluginMessageLookup = (pluginId: string, key: string, fallback: string) => string;
25
+ /**
26
+ * Text for several plugins at once, for a host rendering a list of contributions — a hook
27
+ * cannot be called per row. Host-side only; a plugin has `usePluginTranslations`.
28
+ */
29
+ export declare function usePluginMessageLookup(): PluginMessageLookup;
24
30
  /** Core's own strings, kept a separate call so plugin and core text differ at the point of use. */
25
31
  export declare function useCoreTranslations(namespace: string): import("use-intl")._Translator<Record<string, any>, string>;
26
32
  export { lookupPluginMessage as __lookupPluginMessage };
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/messages.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AAEH,kFAAkF;AAClF,iBAAS,mBAAmB,CAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOxF;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAWxD;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,+DAEpD;AAED,OAAO,EAAE,mBAAmB,IAAI,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/messages.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AAEH,kFAAkF;AAClF,iBAAS,mBAAmB,CAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOxF;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAWxD;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;AAE7F;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,mBAAmB,CAQ5D;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,+DAEpD;AAED,OAAO,EAAE,mBAAmB,IAAI,qBAAqB,EAAE,CAAA"}
@@ -35,6 +35,16 @@ function usePluginTranslations() {
35
35
  [messages, pluginId]
36
36
  );
37
37
  }
38
+ function usePluginMessageLookup() {
39
+ const messages = useMessages();
40
+ return React.useCallback(
41
+ (pluginId, key, fallback) => {
42
+ var _a;
43
+ return (_a = lookupPluginMessage(messages, pluginId, key)) != null ? _a : fallback;
44
+ },
45
+ [messages]
46
+ );
47
+ }
38
48
  function useCoreTranslations(namespace) {
39
49
  return useTranslations(namespace);
40
50
  }
@@ -42,6 +52,7 @@ export {
42
52
  lookupPluginMessage as __lookupPluginMessage,
43
53
  useCoreTranslations,
44
54
  usePluginMessage,
55
+ usePluginMessageLookup,
45
56
  usePluginTranslations
46
57
  };
47
58
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/messages.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { useMessages, useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { usePluginId } from '../host/scope'\r\n\r\n/**\r\n * Translations for plugin-supplied text.\r\n *\r\n * A plugin's catalog is merged under `plugins.<pluginId>`, giving the locale\r\n * fallbacks for free. What this module adds is the last one: a plugin may ship no\r\n * catalog, or one missing the key, and the manifest's own string is shown rather\r\n * than `plugins.foo.name`. An untranslated plugin stays usable.\r\n */\r\n\r\n/** Reads `plugins.<pluginId>.<key>` out of the merged catalog, if it is there. */\r\nfunction lookupPluginMessage(\r\n messages: Record<string, unknown> | undefined,\r\n pluginId: string,\r\n key: string,\r\n): string | undefined {\r\n const plugins = messages?.plugins\r\n if (typeof plugins !== 'object' || plugins === null) return undefined\r\n\r\n const own = (plugins as Record<string, unknown>)[pluginId]\r\n if (typeof own !== 'object' || own === null) return undefined\r\n\r\n // Dotted keys address nested groups, e.g. 'spaces.title'.\r\n let node: unknown = own\r\n for (const part of key.split('.')) {\r\n if (typeof node !== 'object' || node === null) return undefined\r\n node = (node as Record<string, unknown>)[part]\r\n }\r\n\r\n return typeof node === 'string' && node.length > 0 ? node : undefined\r\n}\r\n\r\n/**\r\n * One piece of plugin-supplied text, with the manifest string as the fallback.\r\n * For anything core renders on a plugin's behalf — its name, description, a\r\n * contributed tool's label.\r\n */\r\nexport function usePluginMessage(pluginId: string, key: string, fallback: string): string {\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useMemo(\r\n () => lookupPluginMessage(messages, pluginId, key) ?? fallback,\r\n [messages, pluginId, key, fallback],\r\n )\r\n}\r\n\r\nexport type PluginTranslator = (key: string, fallback?: string) => string\r\n\r\n/**\r\n * A `t()` scoped to the calling plugin's namespace. Only valid inside a plugin\r\n * subtree, so a plugin cannot read another's strings. Without a `fallback`, a\r\n * missing key renders as `plugins.<pluginId>.<key>` rather than throwing.\r\n */\r\nexport function usePluginTranslations(): PluginTranslator {\r\n const pluginId = usePluginId()\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useCallback(\r\n (key: string, fallback?: string) =>\r\n lookupPluginMessage(messages, pluginId, key)\r\n ?? fallback\r\n ?? `plugins.${pluginId}.${key}`,\r\n [messages, pluginId],\r\n )\r\n}\r\n\r\n/** Core's own strings, kept a separate call so plugin and core text differ at the point of use. */\r\nexport function useCoreTranslations(namespace: string) {\r\n return useTranslations(namespace)\r\n}\r\n\r\nexport { lookupPluginMessage as __lookupPluginMessage }\r\n"],"mappings":";AAKA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAY5B,SAAS,oBACP,UACA,UACA,KACoB;AACpB,QAAM,UAAU,qCAAU;AAC1B,MAAI,OAAO,YAAY,YAAY,YAAY,KAAM,QAAO;AAE5D,QAAM,MAAO,QAAoC,QAAQ;AACzD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AAGpD,MAAI,OAAgB;AACpB,aAAW,QAAQ,IAAI,MAAM,GAAG,GAAG;AACjC,QAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,WAAQ,KAAiC,IAAI;AAAA,EAC/C;AAEA,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO;AAC9D;AAOO,SAAS,iBAAiB,UAAkB,KAAa,UAA0B;AACxF,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,MAAG;AAlDP;AAkDU,uCAAoB,UAAU,UAAU,GAAG,MAA3C,YAAgD;AAAA;AAAA,IACtD,CAAC,UAAU,UAAU,KAAK,QAAQ;AAAA,EACpC;AACF;AASO,SAAS,wBAA0C;AACxD,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,CAAC,KAAa,aAAmB;AAnErC;AAoEM,6CAAoB,UAAU,UAAU,GAAG,MAA3C,YACG,aADH,YAEG,WAAW,QAAQ,IAAI,GAAG;AAAA;AAAA,IAC/B,CAAC,UAAU,QAAQ;AAAA,EACrB;AACF;AAGO,SAAS,oBAAoB,WAAmB;AACrD,SAAO,gBAAgB,SAAS;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/messages.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { useMessages, useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { usePluginId } from '../host/scope'\r\n\r\n/**\r\n * Translations for plugin-supplied text.\r\n *\r\n * A plugin's catalog is merged under `plugins.<pluginId>`, giving the locale\r\n * fallbacks for free. What this module adds is the last one: a plugin may ship no\r\n * catalog, or one missing the key, and the manifest's own string is shown rather\r\n * than `plugins.foo.name`. An untranslated plugin stays usable.\r\n */\r\n\r\n/** Reads `plugins.<pluginId>.<key>` out of the merged catalog, if it is there. */\r\nfunction lookupPluginMessage(\r\n messages: Record<string, unknown> | undefined,\r\n pluginId: string,\r\n key: string,\r\n): string | undefined {\r\n const plugins = messages?.plugins\r\n if (typeof plugins !== 'object' || plugins === null) return undefined\r\n\r\n const own = (plugins as Record<string, unknown>)[pluginId]\r\n if (typeof own !== 'object' || own === null) return undefined\r\n\r\n // Dotted keys address nested groups, e.g. 'spaces.title'.\r\n let node: unknown = own\r\n for (const part of key.split('.')) {\r\n if (typeof node !== 'object' || node === null) return undefined\r\n node = (node as Record<string, unknown>)[part]\r\n }\r\n\r\n return typeof node === 'string' && node.length > 0 ? node : undefined\r\n}\r\n\r\n/**\r\n * One piece of plugin-supplied text, with the manifest string as the fallback.\r\n * For anything core renders on a plugin's behalf — its name, description, a\r\n * contributed tool's label.\r\n */\r\nexport function usePluginMessage(pluginId: string, key: string, fallback: string): string {\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useMemo(\r\n () => lookupPluginMessage(messages, pluginId, key) ?? fallback,\r\n [messages, pluginId, key, fallback],\r\n )\r\n}\r\n\r\nexport type PluginTranslator = (key: string, fallback?: string) => string\r\n\r\n/**\r\n * A `t()` scoped to the calling plugin's namespace. Only valid inside a plugin\r\n * subtree, so a plugin cannot read another's strings. Without a `fallback`, a\r\n * missing key renders as `plugins.<pluginId>.<key>` rather than throwing.\r\n */\r\nexport function usePluginTranslations(): PluginTranslator {\r\n const pluginId = usePluginId()\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useCallback(\r\n (key: string, fallback?: string) =>\r\n lookupPluginMessage(messages, pluginId, key)\r\n ?? fallback\r\n ?? `plugins.${pluginId}.${key}`,\r\n [messages, pluginId],\r\n )\r\n}\r\n\r\nexport type PluginMessageLookup = (pluginId: string, key: string, fallback: string) => string\r\n\r\n/**\r\n * Text for several plugins at once, for a host rendering a list of contributions — a hook\r\n * cannot be called per row. Host-side only; a plugin has `usePluginTranslations`.\r\n */\r\nexport function usePluginMessageLookup(): PluginMessageLookup {\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useCallback(\r\n (pluginId: string, key: string, fallback: string) =>\r\n lookupPluginMessage(messages, pluginId, key) ?? fallback,\r\n [messages],\r\n )\r\n}\r\n\r\n/** Core's own strings, kept a separate call so plugin and core text differ at the point of use. */\r\nexport function useCoreTranslations(namespace: string) {\r\n return useTranslations(namespace)\r\n}\r\n\r\nexport { lookupPluginMessage as __lookupPluginMessage }\r\n"],"mappings":";AAKA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAY5B,SAAS,oBACP,UACA,UACA,KACoB;AACpB,QAAM,UAAU,qCAAU;AAC1B,MAAI,OAAO,YAAY,YAAY,YAAY,KAAM,QAAO;AAE5D,QAAM,MAAO,QAAoC,QAAQ;AACzD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AAGpD,MAAI,OAAgB;AACpB,aAAW,QAAQ,IAAI,MAAM,GAAG,GAAG;AACjC,QAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,WAAQ,KAAiC,IAAI;AAAA,EAC/C;AAEA,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO;AAC9D;AAOO,SAAS,iBAAiB,UAAkB,KAAa,UAA0B;AACxF,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,MAAG;AAlDP;AAkDU,uCAAoB,UAAU,UAAU,GAAG,MAA3C,YAAgD;AAAA;AAAA,IACtD,CAAC,UAAU,UAAU,KAAK,QAAQ;AAAA,EACpC;AACF;AASO,SAAS,wBAA0C;AACxD,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,CAAC,KAAa,aAAmB;AAnErC;AAoEM,6CAAoB,UAAU,UAAU,GAAG,MAA3C,YACG,aADH,YAEG,WAAW,QAAQ,IAAI,GAAG;AAAA;AAAA,IAC/B,CAAC,UAAU,QAAQ;AAAA,EACrB;AACF;AAQO,SAAS,yBAA8C;AAC5D,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,CAAC,UAAkB,KAAa,aAAkB;AArFtD;AAsFM,uCAAoB,UAAU,UAAU,GAAG,MAA3C,YAAgD;AAAA;AAAA,IAClD,CAAC,QAAQ;AAAA,EACX;AACF;AAGO,SAAS,oBAAoB,WAAmB;AACrD,SAAO,gBAAgB,SAAS;AAClC;","names":[]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared state for one plugin's surfaces: in memory, scoped to the plugin, gone when it is
3
+ * disabled. `usePluginStore` is the persisted counterpart.
4
+ */
5
+ export declare function usePluginState<T>(key: string, initial: T): [T, (next: T | ((previous: T) => T)) => void];
6
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/state.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,CAAC,GACT,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CA+B/C"}
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { pluginStateStore } from "../host/pluginState";
4
+ import { usePluginId } from "../host/scope";
5
+ function usePluginState(key, initial) {
6
+ const pluginId = usePluginId();
7
+ const initialRef = React.useRef(initial);
8
+ const subscribe = React.useCallback(
9
+ (listener) => pluginStateStore.subscribe(pluginId, key, listener),
10
+ [pluginId, key]
11
+ );
12
+ const getSnapshot = React.useCallback(
13
+ () => pluginStateStore.get(pluginId, key, initialRef.current),
14
+ [pluginId, key]
15
+ );
16
+ const value = React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
17
+ const setValue = React.useCallback(
18
+ (next) => {
19
+ const previous = pluginStateStore.get(pluginId, key, initialRef.current);
20
+ const resolved = typeof next === "function" ? next(previous) : next;
21
+ pluginStateStore.set(pluginId, key, resolved);
22
+ },
23
+ [pluginId, key]
24
+ );
25
+ return [value, setValue];
26
+ }
27
+ export {
28
+ usePluginState
29
+ };
30
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/state.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { pluginStateStore } from '../host/pluginState'\r\nimport { usePluginId } from '../host/scope'\r\n\r\n/**\r\n * Shared state for one plugin's surfaces: in memory, scoped to the plugin, gone when it is\r\n * disabled. `usePluginStore` is the persisted counterpart.\r\n */\r\nexport function usePluginState<T>(\r\n key: string,\r\n initial: T,\r\n): [T, (next: T | ((previous: T) => T)) => void] {\r\n const pluginId = usePluginId()\r\n\r\n // In a ref, or a fresh `initial` literal makes getSnapshot loop.\r\n const initialRef = React.useRef(initial)\r\n\r\n const subscribe = React.useCallback(\r\n (listener: () => void) => pluginStateStore.subscribe(pluginId, key, listener),\r\n [pluginId, key],\r\n )\r\n\r\n const getSnapshot = React.useCallback(\r\n () => pluginStateStore.get(pluginId, key, initialRef.current),\r\n [pluginId, key],\r\n )\r\n\r\n const value = React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\r\n\r\n const setValue = React.useCallback(\r\n (next: T | ((previous: T) => T)) => {\r\n const previous = pluginStateStore.get(pluginId, key, initialRef.current)\r\n const resolved = typeof next === 'function'\r\n ? (next as (previous: T) => T)(previous)\r\n : next\r\n\r\n pluginStateStore.set(pluginId, key, resolved)\r\n },\r\n [pluginId, key],\r\n )\r\n\r\n return [value, setValue]\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAMrB,SAAS,eACd,KACA,SAC+C;AAC/C,QAAM,WAAW,YAAY;AAG7B,QAAM,aAAa,MAAM,OAAO,OAAO;AAEvC,QAAM,YAAY,MAAM;AAAA,IACtB,CAAC,aAAyB,iBAAiB,UAAU,UAAU,KAAK,QAAQ;AAAA,IAC5E,CAAC,UAAU,GAAG;AAAA,EAChB;AAEA,QAAM,cAAc,MAAM;AAAA,IACxB,MAAM,iBAAiB,IAAI,UAAU,KAAK,WAAW,OAAO;AAAA,IAC5D,CAAC,UAAU,GAAG;AAAA,EAChB;AAEA,QAAM,QAAQ,MAAM,qBAAqB,WAAW,aAAa,WAAW;AAE5E,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,SAAmC;AAClC,YAAM,WAAW,iBAAiB,IAAI,UAAU,KAAK,WAAW,OAAO;AACvE,YAAM,WAAW,OAAO,SAAS,aAC5B,KAA4B,QAAQ,IACrC;AAEJ,uBAAiB,IAAI,UAAU,KAAK,QAAQ;AAAA,IAC9C;AAAA,IACA,CAAC,UAAU,GAAG;AAAA,EAChB;AAEA,SAAO,CAAC,OAAO,QAAQ;AACzB;","names":[]}
@@ -1,9 +1,10 @@
1
1
  import type { BimToolProps } from './bimViewer';
2
2
  import type { MapToolProps } from './mapViewer';
3
3
  import type { PointCloudToolProps } from './pointCloudViewer';
4
+ export { ViewerNames } from '../../types/dbTypes';
4
5
  import type { ViewerNames } from '../../types/dbTypes';
5
6
  import type { LucideProps } from 'lucide-react';
6
- export declare const VALID_CAPABILITIES: readonly ["sidebar.items", "viewer.panels", "map.tools", "bim.tools", "pointcloud.tools", "map.legends"];
7
+ export declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "pointcloud.tools", "viewer.legends", "map.layers"];
7
8
  export type PluginCapability = typeof VALID_CAPABILITIES[number];
8
9
  export interface PluginManifest {
9
10
  slug: string;
@@ -27,11 +28,31 @@ export declare function validateManifest(manifest: unknown): {
27
28
  valid: boolean;
28
29
  errors: string[];
29
30
  };
30
- export interface SidebarRegistration {
31
+ export interface DataPageColumn<Row> {
32
+ key: string;
33
+ /** Resolved in the plugin's own namespace, falling back to the literal string. */
34
+ labelKey: string;
35
+ render?: (row: Row) => React.ReactNode;
36
+ }
37
+ /**
38
+ * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a
39
+ * row click opens one of its own `ui.dialogs` rather than a detail view of its own.
40
+ */
41
+ export interface DataPageRows<Row> {
42
+ rows: Row[];
43
+ isLoading?: boolean;
44
+ /** From the hook, not the registration, so it can close over `usePluginDialogs`. */
45
+ onRowClick?: (row: Row) => void;
46
+ }
47
+ export interface DataPageRegistration<Row = Record<string, unknown>> {
31
48
  id: string;
32
- label: string;
49
+ titleKey: string;
33
50
  icon: string | React.ComponentType<LucideProps>;
34
- component: React.ComponentType;
51
+ useRows: () => DataPageRows<Row>;
52
+ columns: DataPageColumn<Row>[];
53
+ /** Column keys the search box filters on. Omit to search every column. */
54
+ searchKeys?: string[];
55
+ emptyKey?: string;
35
56
  }
36
57
  /** Every toolbar component receives the toolbar entry core built for it. */
37
58
  export interface ToolbarToolProps {
@@ -50,14 +71,34 @@ export interface ToolbarRegistration<P = Record<string, unknown>> {
50
71
  cursor?: string;
51
72
  stayActive?: boolean;
52
73
  }
53
- export interface ViewerRegistration {
74
+ export interface ViewerTabRegistration {
54
75
  id: string;
55
- label: string;
76
+ labelKey: string;
56
77
  icon: string | React.ComponentType<LucideProps>;
57
78
  component: React.ComponentType;
58
- /** Which viewers this panel appears in. Omit for all of them. */
79
+ /** Which viewers this tab appears in. Omit for all of them. */
59
80
  viewers?: ViewerNames[];
60
81
  }
82
+ /**
83
+ * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via
84
+ * `usePluginDialogs()`, so it outlives whichever one opened it.
85
+ */
86
+ export interface DialogRegistration<P = Record<string, unknown>> {
87
+ id: string;
88
+ titleKey: string;
89
+ size?: 'sm' | 'md' | 'lg' | 'xl';
90
+ component: React.ComponentType<P & {
91
+ close: () => void;
92
+ }>;
93
+ }
94
+ /**
95
+ * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,
96
+ * whose panel unmounts when its dropdown closes and would take the layer with it.
97
+ */
98
+ export interface MapLayerRegistration {
99
+ id: string;
100
+ component: React.ComponentType<MapToolProps>;
101
+ }
61
102
  export interface LegendRow {
62
103
  label: string;
63
104
  color: string;
@@ -66,6 +107,8 @@ export interface LegendRow {
66
107
  export interface LegendRegistration {
67
108
  id: string;
68
109
  title: string;
110
+ /** Which viewers this legend appears in. Omit for all of them. */
111
+ viewers?: ViewerNames[];
69
112
  useLegend: () => {
70
113
  active: boolean;
71
114
  title?: string;
@@ -74,12 +117,14 @@ export interface LegendRegistration {
74
117
  };
75
118
  }
76
119
  export interface CapabilityRegistry {
77
- 'sidebar.items': SidebarRegistration;
78
- 'viewer.panels': ViewerRegistration;
120
+ 'data.pages': DataPageRegistration;
121
+ 'viewer.tabs': ViewerTabRegistration;
122
+ 'ui.dialogs': DialogRegistration;
79
123
  'map.tools': ToolbarRegistration<MapToolProps>;
80
124
  'bim.tools': ToolbarRegistration<BimToolProps>;
81
125
  'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>;
82
- 'map.legends': LegendRegistration;
126
+ 'viewer.legends': LegendRegistration;
127
+ 'map.layers': MapLayerRegistration;
83
128
  }
84
129
  export interface PluginContext {
85
130
  pluginId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plug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,mBAAmB,CAAC,CAAA;IAC5D,gBAAgB,EAAE,kBAAkB,CAAA;IACpC,YAAY,EAAE,oBAAoB,CAAA;CACnC;AAcD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,CAAC,SAAS,MAAM,kBAAkB,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACvF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAID,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,UAAU,CAAC,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtD;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,WAAW,GAAG,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;CAClD;AAED,kEAAkE;AAClE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,YAAY,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA"}
@@ -1,10 +1,13 @@
1
+ import { ViewerNames } from "../../types/dbTypes";
1
2
  const VALID_CAPABILITIES = [
2
- "sidebar.items",
3
- "viewer.panels",
3
+ "data.pages",
4
+ "viewer.tabs",
5
+ "ui.dialogs",
4
6
  "map.tools",
5
7
  "bim.tools",
6
8
  "pointcloud.tools",
7
- "map.legends"
9
+ "viewer.legends",
10
+ "map.layers"
8
11
  ];
9
12
  function validateManifest(manifest) {
10
13
  const errors = [];
@@ -36,6 +39,7 @@ async function resolvePluginEntry(entry) {
36
39
  }
37
40
  export {
38
41
  VALID_CAPABILITIES,
42
+ ViewerNames,
39
43
  resolvePluginEntry,
40
44
  validateManifest
41
45
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\r\n// out of the host's module graph.\r\nimport type { BimToolProps } from './bimViewer'\r\nimport type { MapToolProps } from './mapViewer'\r\nimport type { PointCloudToolProps } from './pointCloudViewer'\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\n// Only capabilities core actually renders. One with no consumer registers fine,\r\n// shows nothing, and leaves nothing to debug.\r\nexport const VALID_CAPABILITIES = [\r\n 'sidebar.items',\r\n 'viewer.panels',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'map.legends',\r\n] as const\r\n\r\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\r\n\r\n// --- Manifest ---\r\n\r\nexport interface PluginManifest {\r\n slug: string\r\n name: string\r\n version: string\r\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\r\n hostApi?: number\r\n description?: string\r\n author?: string\r\n capabilities: PluginCapability[]\r\n requiredPermissions?: string[]\r\n configSchema?: Record<string, unknown>\r\n /**\r\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\r\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\r\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\r\n */\r\n messages?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\r\n const errors: string[] = []\r\n\r\n if (typeof manifest !== 'object' || manifest === null) {\r\n return { valid: false, errors: ['manifest must be an object'] }\r\n }\r\n\r\n const m = manifest as Record<string, unknown>\r\n\r\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\r\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\r\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\r\n\r\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\r\n errors.push('hostApi must be an integer when present')\r\n }\r\n\r\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\r\n errors.push('at least one capability is required')\r\n } else {\r\n for (const cap of m.capabilities) {\r\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\r\n errors.push(`invalid capability: \"${cap}\"`)\r\n }\r\n }\r\n }\r\n\r\n return { valid: errors.length === 0, errors }\r\n}\r\n\r\n// --- Registration shapes (one per capability) ---\r\n\r\nexport interface SidebarRegistration {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n}\r\n\r\n/** Every toolbar component receives the toolbar entry core built for it. */\r\nexport interface ToolbarToolProps {\r\n tool: unknown\r\n}\r\n\r\n/**\r\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\r\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\r\n * registered under `map.tools` is a compile error.\r\n */\r\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType<ToolbarToolProps & P>\r\n cursor?: string\r\n stayActive?: boolean\r\n}\r\n\r\nexport interface ViewerRegistration {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n /** Which viewers this panel appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n}\r\n\r\nexport interface LegendRow {\r\n label: string\r\n color: string\r\n count?: number\r\n}\r\n\r\nexport interface LegendRegistration {\r\n id: string\r\n title: string\r\n // Called by <MapLegendHost> on each render; active:false omits the section.\r\n useLegend: () => {\r\n active: boolean\r\n // Overrides registration.title when set, e.g. a city-scoped label.\r\n title?: string\r\n unavailable?: boolean\r\n rows: LegendRow[]\r\n }\r\n}\r\n\r\n// --- Capability → registration type map ---\r\n// A new contribution point needs one entry here, its type above, and a consumer\r\n// calling `registry.getAll('your.key')`. No host changes.\r\n\r\nexport interface CapabilityRegistry {\r\n 'sidebar.items': SidebarRegistration\r\n 'viewer.panels': ViewerRegistration\r\n 'map.tools': ToolbarRegistration<MapToolProps>\r\n 'bim.tools': ToolbarRegistration<BimToolProps>\r\n 'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>\r\n 'map.legends': LegendRegistration\r\n}\r\n\r\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\r\ntype _CapabilityParity =\r\n PluginCapability extends keyof CapabilityRegistry\r\n ? keyof CapabilityRegistry extends PluginCapability\r\n ? true\r\n : never\r\n : never\r\nconst _capabilityParity: _CapabilityParity = true\r\nvoid _capabilityParity\r\n\r\n// --- Plugin Context ---\r\n\r\nexport interface PluginContext {\r\n pluginId: string\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\r\n config: Record<string, unknown>\r\n}\r\n\r\n// --- Plugin entry point type ---\r\n\r\nexport interface PluginEntry {\r\n activate(ctx: PluginContext): void | Promise<void>\r\n deactivate?(ctx: PluginContext): void | Promise<void>\r\n}\r\n\r\n/**\r\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\r\n * Prefer the thunk when compiled in — a static import pulls the plugin's\r\n * components into every route that reaches `installed.ts`.\r\n */\r\nexport interface PluginSource {\r\n manifest: PluginManifest\r\n entry: PluginEntry | (() => Promise<PluginEntry>)\r\n}\r\n\r\n/** Resolves either form of `PluginSource.entry` to the module. */\r\nexport async function resolvePluginEntry(\r\n entry: PluginSource['entry'],\r\n): Promise<PluginEntry> {\r\n return typeof entry === 'function' ? entry() : entry\r\n}\r\n\r\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\r\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\r\n"],"mappings":"AAeO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAyBO,SAAS,iBAAiB,UAAyD;AACxF,QAAM,SAAmB,CAAC;AAE1B,MAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AACrD,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,4BAA4B,EAAE;AAAA,EAChE;AAEA,QAAM,IAAI;AAEV,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,WAAW,OAAO,EAAE,YAAY,SAAU,QAAO,KAAK,qBAAqB;AAElF,MAAI,EAAE,YAAY,UAAa,CAAC,OAAO,UAAU,EAAE,OAAO,GAAG;AAC3D,WAAO,KAAK,yCAAyC;AAAA,EACvD;AAEA,MAAI,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,WAAW,GAAG;AACjE,WAAO,KAAK,qCAAqC;AAAA,EACnD,OAAO;AACL,eAAW,OAAO,EAAE,cAAc;AAChC,UAAI,CAAC,mBAAmB,SAAS,GAAuB,GAAG;AACzD,eAAO,KAAK,wBAAwB,GAAG,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAC9C;AA8EA,MAAM,oBAAuC;AAC7C,KAAK;AA4BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\r\n// out of the host's module graph.\r\nimport type { BimToolProps } from './bimViewer'\r\nimport type { MapToolProps } from './mapViewer'\r\nimport type { PointCloudToolProps } from './pointCloudViewer'\r\n// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\r\nexport { ViewerNames } from '../../types/dbTypes'\r\n\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\n// Only capabilities core actually renders. One with no consumer registers fine,\r\n// shows nothing, and leaves nothing to debug.\r\nexport const VALID_CAPABILITIES = [\r\n 'data.pages',\r\n 'viewer.tabs',\r\n 'ui.dialogs',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'viewer.legends',\r\n 'map.layers',\r\n] as const\r\n\r\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\r\n\r\n// --- Manifest ---\r\n\r\nexport interface PluginManifest {\r\n slug: string\r\n name: string\r\n version: string\r\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\r\n hostApi?: number\r\n description?: string\r\n author?: string\r\n capabilities: PluginCapability[]\r\n requiredPermissions?: string[]\r\n configSchema?: Record<string, unknown>\r\n /**\r\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\r\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\r\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\r\n */\r\n messages?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\r\n const errors: string[] = []\r\n\r\n if (typeof manifest !== 'object' || manifest === null) {\r\n return { valid: false, errors: ['manifest must be an object'] }\r\n }\r\n\r\n const m = manifest as Record<string, unknown>\r\n\r\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\r\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\r\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\r\n\r\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\r\n errors.push('hostApi must be an integer when present')\r\n }\r\n\r\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\r\n errors.push('at least one capability is required')\r\n } else {\r\n for (const cap of m.capabilities) {\r\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\r\n errors.push(`invalid capability: \"${cap}\"`)\r\n }\r\n }\r\n }\r\n\r\n return { valid: errors.length === 0, errors }\r\n}\r\n\r\n// --- Registration shapes (one per capability) ---\r\n\r\nexport interface DataPageColumn<Row> {\r\n key: string\r\n /** Resolved in the plugin's own namespace, falling back to the literal string. */\r\n labelKey: string\r\n render?: (row: Row) => React.ReactNode\r\n}\r\n\r\n/**\r\n * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a\r\n * row click opens one of its own `ui.dialogs` rather than a detail view of its own.\r\n */\r\nexport interface DataPageRows<Row> {\r\n rows: Row[]\r\n isLoading?: boolean\r\n /** From the hook, not the registration, so it can close over `usePluginDialogs`. */\r\n onRowClick?: (row: Row) => void\r\n}\r\n\r\nexport interface DataPageRegistration<Row = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n useRows: () => DataPageRows<Row>\r\n columns: DataPageColumn<Row>[]\r\n /** Column keys the search box filters on. Omit to search every column. */\r\n searchKeys?: string[]\r\n emptyKey?: string\r\n}\r\n\r\n/** Every toolbar component receives the toolbar entry core built for it. */\r\nexport interface ToolbarToolProps {\r\n tool: unknown\r\n}\r\n\r\n/**\r\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\r\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\r\n * registered under `map.tools` is a compile error.\r\n */\r\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType<ToolbarToolProps & P>\r\n cursor?: string\r\n stayActive?: boolean\r\n}\r\n\r\nexport interface ViewerTabRegistration {\r\n id: string\r\n labelKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n /** Which viewers this tab appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n}\r\n\r\n/**\r\n * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via\r\n * `usePluginDialogs()`, so it outlives whichever one opened it.\r\n */\r\nexport interface DialogRegistration<P = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n size?: 'sm' | 'md' | 'lg' | 'xl'\r\n component: React.ComponentType<P & { close: () => void }>\r\n}\r\n\r\n/**\r\n * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,\r\n * whose panel unmounts when its dropdown closes and would take the layer with it.\r\n */\r\nexport interface MapLayerRegistration {\r\n id: string\r\n component: React.ComponentType<MapToolProps>\r\n}\r\n\r\nexport interface LegendRow {\r\n label: string\r\n color: string\r\n count?: number\r\n}\r\n\r\nexport interface LegendRegistration {\r\n id: string\r\n title: string\r\n /** Which viewers this legend appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n // Called by <MapLegendHost> on each render; active:false omits the section.\r\n useLegend: () => {\r\n active: boolean\r\n // Overrides registration.title when set, e.g. a city-scoped label.\r\n title?: string\r\n unavailable?: boolean\r\n rows: LegendRow[]\r\n }\r\n}\r\n\r\n// --- Capability → registration type map ---\r\n// A new contribution point needs one entry here, its type above, and a consumer\r\n// calling `registry.getAll('your.key')`. No host changes.\r\n\r\nexport interface CapabilityRegistry {\r\n 'data.pages': DataPageRegistration\r\n 'viewer.tabs': ViewerTabRegistration\r\n 'ui.dialogs': DialogRegistration\r\n 'map.tools': ToolbarRegistration<MapToolProps>\r\n 'bim.tools': ToolbarRegistration<BimToolProps>\r\n 'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>\r\n 'viewer.legends': LegendRegistration\r\n 'map.layers': MapLayerRegistration\r\n}\r\n\r\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\r\ntype _CapabilityParity =\r\n PluginCapability extends keyof CapabilityRegistry\r\n ? keyof CapabilityRegistry extends PluginCapability\r\n ? true\r\n : never\r\n : never\r\nconst _capabilityParity: _CapabilityParity = true\r\nvoid _capabilityParity\r\n\r\n// --- Plugin Context ---\r\n\r\nexport interface PluginContext {\r\n pluginId: string\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\r\n config: Record<string, unknown>\r\n}\r\n\r\n// --- Plugin entry point type ---\r\n\r\nexport interface PluginEntry {\r\n activate(ctx: PluginContext): void | Promise<void>\r\n deactivate?(ctx: PluginContext): void | Promise<void>\r\n}\r\n\r\n/**\r\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\r\n * Prefer the thunk when compiled in — a static import pulls the plugin's\r\n * components into every route that reaches `installed.ts`.\r\n */\r\nexport interface PluginSource {\r\n manifest: PluginManifest\r\n entry: PluginEntry | (() => Promise<PluginEntry>)\r\n}\r\n\r\n/** Resolves either form of `PluginSource.entry` to the module. */\r\nexport async function resolvePluginEntry(\r\n entry: PluginSource['entry'],\r\n): Promise<PluginEntry> {\r\n return typeof entry === 'function' ? entry() : entry\r\n}\r\n\r\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\r\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\r\n"],"mappings":"AASA,SAAS,mBAAmB;AASrB,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAyBO,SAAS,iBAAiB,UAAyD;AACxF,QAAM,SAAmB,CAAC;AAE1B,MAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AACrD,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,4BAA4B,EAAE;AAAA,EAChE;AAEA,QAAM,IAAI;AAEV,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,WAAW,OAAO,EAAE,YAAY,SAAU,QAAO,KAAK,qBAAqB;AAElF,MAAI,EAAE,YAAY,UAAa,CAAC,OAAO,UAAU,EAAE,OAAO,GAAG;AAC3D,WAAO,KAAK,yCAAyC;AAAA,EACvD;AAEA,MAAI,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,WAAW,GAAG;AACjE,WAAO,KAAK,qCAAqC;AAAA,EACnD,OAAO;AACL,eAAW,OAAO,EAAE,cAAc;AAChC,UAAI,CAAC,mBAAmB,SAAS,GAAuB,GAAG;AACzD,eAAO,KAAK,wBAAwB,GAAG,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAC9C;AA4HA,MAAM,oBAAuC;AAC7C,KAAK;AA4BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
@@ -0,0 +1,12 @@
1
+ export interface PluginDialogs {
2
+ /** Opens one of this plugin's registered dialogs. `props` reaches the component as props. */
3
+ open: (dialogId: string, props?: Record<string, unknown>) => void;
4
+ /** Closes the topmost instance of `dialogId`, or of any of this plugin's dialogs. */
5
+ close: (dialogId?: string) => void;
6
+ }
7
+ /**
8
+ * Opens and closes this plugin's dialogs from any of its surfaces. The id comes from the
9
+ * scope, so a plugin can only address its own.
10
+ */
11
+ export declare function usePluginDialogs(): PluginDialogs;
12
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/ui.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,aAAa;IAC5B,6FAA6F;IAC7F,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACjE,qFAAqF;IACrF,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAQhD"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { usePluginDialogControls } from "../host/dialogs";
4
+ import { usePluginId } from "../host/scope";
5
+ function usePluginDialogs() {
6
+ const pluginId = usePluginId();
7
+ const controls = usePluginDialogControls();
8
+ return React.useMemo(() => ({
9
+ open: (dialogId, props) => controls.open(pluginId, dialogId, props),
10
+ close: (dialogId) => controls.close(pluginId, dialogId)
11
+ }), [controls, pluginId]);
12
+ }
13
+ export {
14
+ usePluginDialogs
15
+ };
16
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/ui.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { usePluginDialogControls } from '../host/dialogs'\r\nimport { usePluginId } from '../host/scope'\r\n\r\nexport interface PluginDialogs {\r\n /** Opens one of this plugin's registered dialogs. `props` reaches the component as props. */\r\n open: (dialogId: string, props?: Record<string, unknown>) => void\r\n /** Closes the topmost instance of `dialogId`, or of any of this plugin's dialogs. */\r\n close: (dialogId?: string) => void\r\n}\r\n\r\n/**\r\n * Opens and closes this plugin's dialogs from any of its surfaces. The id comes from the\r\n * scope, so a plugin can only address its own.\r\n */\r\nexport function usePluginDialogs(): PluginDialogs {\r\n const pluginId = usePluginId()\r\n const controls = usePluginDialogControls()\r\n\r\n return React.useMemo(() => ({\r\n open: (dialogId, props) => controls.open(pluginId, dialogId, props),\r\n close: dialogId => controls.close(pluginId, dialogId),\r\n }), [controls, pluginId])\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAarB,SAAS,mBAAkC;AAChD,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,wBAAwB;AAEzC,SAAO,MAAM,QAAQ,OAAO;AAAA,IAC1B,MAAM,CAAC,UAAU,UAAU,SAAS,KAAK,UAAU,UAAU,KAAK;AAAA,IAClE,OAAO,cAAY,SAAS,MAAM,UAAU,QAAQ;AAAA,EACtD,IAAI,CAAC,UAAU,QAAQ,CAAC;AAC1B;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"CombineProviders.d.ts","sourceRoot":"","sources":["../../../src/core/store/CombineProviders.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAE3F,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AA0C3E,UAAU,gBAAiB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IAC1E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,OAAO,GACR,EAAE,gBAAgB,qBAUlB"}
1
+ {"version":3,"file":"CombineProviders.d.ts","sourceRoot":"","sources":["../../../src/core/store/CombineProviders.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAE3F,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AA0C3E,UAAU,gBAAiB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IAC1E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,OAAO,GACR,EAAE,gBAAgB,qBAYlB"}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { PluginDialogHost } from "../plugins/host/PluginDialogHost";
3
4
  import { PluginHostProvider } from "../plugins/host/provider";
4
5
  import { AppConfigProvider } from "./AppConfig/context";
5
6
  import { BimProvider } from "./BIM/context";
@@ -38,7 +39,10 @@ function AppProvider({
38
39
  enabledSlugs,
39
40
  configs
40
41
  }) {
41
- return /* @__PURE__ */ jsx(AppConfigProvider, { runtimeConfig, children: /* @__PURE__ */ jsx(InnerProviders, { children: /* @__PURE__ */ jsx(PluginHostProvider, { plugins, enabledSlugs, configs, children }) }) });
42
+ return /* @__PURE__ */ jsx(AppConfigProvider, { runtimeConfig, children: /* @__PURE__ */ jsx(InnerProviders, { children: /* @__PURE__ */ jsxs(PluginHostProvider, { plugins, enabledSlugs, configs, children: [
43
+ children,
44
+ /* @__PURE__ */ jsx(PluginDialogHost, {})
45
+ ] }) }) });
42
46
  }
43
47
  export {
44
48
  AppProvider
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/store/CombineProviders.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { PluginHostProvider, type PluginHostProviderProps } from '../plugins/host/provider'\r\n\r\nimport { AppConfigProvider, type RuntimeConfig } from './AppConfig/context'\r\nimport { BimProvider } from './BIM/context'\r\nimport { BuildingsProvider } from './Buildings/context'\r\nimport { ContentProvider } from './Content/context'\r\nimport { DatasetsProvider } from './Datasets/context'\r\nimport { FilesProvider } from './Files/context'\r\nimport { MapProvider } from './Map/context'\r\nimport { MapSitesProvider } from './MapSites/context'\r\nimport { MenusProvider } from './Menus/context'\r\nimport { PermissionsProvider } from './Permissions/context'\r\nimport { PointCloudProvider } from './PointCloud/context'\r\nimport { ToolsProvider } from './Tools/context'\r\n\r\nconst compose = providers =>\r\n providers.reduce(\r\n (Prev, Curr) =>\r\n function ComposedProvider({ children }) {\r\n return (\r\n <Prev>\r\n <Curr>{children}</Curr>\r\n </Prev>\r\n )\r\n },\r\n )\r\n\r\n// PluginHostProvider is deliberately NOT in this list: it takes props, and\r\n// `compose` only threads `children`. It wraps the composed tree below instead, so\r\n// it stays the innermost provider (plugins can read every store above it).\r\nconst InnerProviders = compose([\r\n BimProvider,\r\n MapProvider,\r\n MenusProvider,\r\n ToolsProvider,\r\n ContentProvider,\r\n DatasetsProvider,\r\n MapSitesProvider,\r\n FilesProvider,\r\n BuildingsProvider,\r\n PointCloudProvider,\r\n PermissionsProvider,\r\n])\r\n\r\ninterface AppProviderProps extends Omit<PluginHostProviderProps, 'children'> {\r\n children: React.ReactNode\r\n runtimeConfig?: RuntimeConfig\r\n}\r\n\r\nexport function AppProvider({\r\n children,\r\n runtimeConfig,\r\n plugins,\r\n enabledSlugs,\r\n configs,\r\n}: AppProviderProps) {\r\n return (\r\n <AppConfigProvider runtimeConfig={runtimeConfig}>\r\n <InnerProviders>\r\n <PluginHostProvider plugins={plugins} enabledSlugs={enabledSlugs} configs={configs}>\r\n {children}\r\n </PluginHostProvider>\r\n </InnerProviders>\r\n </AppConfigProvider>\r\n )\r\n}\r\n"],"mappings":";AA4BY;AArBZ,SAAS,0BAAwD;AAEjE,SAAS,yBAA6C;AACtD,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAE9B,MAAM,UAAU,eACd,UAAU;AAAA,EACR,CAAC,MAAM,SACL,SAAS,iBAAiB,EAAE,SAAS,GAAG;AACtC,WACE,oBAAC,QACC,8BAAC,QAAM,UAAS,GAClB;AAAA,EAEJ;AACJ;AAKF,MAAM,iBAAiB,QAAQ;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOM,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,SACE,oBAAC,qBAAkB,eACjB,8BAAC,kBACC,8BAAC,sBAAmB,SAAkB,cAA4B,SAC/D,UACH,GACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/store/CombineProviders.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { PluginDialogHost } from '../plugins/host/PluginDialogHost'\r\nimport { PluginHostProvider, type PluginHostProviderProps } from '../plugins/host/provider'\r\n\r\nimport { AppConfigProvider, type RuntimeConfig } from './AppConfig/context'\r\nimport { BimProvider } from './BIM/context'\r\nimport { BuildingsProvider } from './Buildings/context'\r\nimport { ContentProvider } from './Content/context'\r\nimport { DatasetsProvider } from './Datasets/context'\r\nimport { FilesProvider } from './Files/context'\r\nimport { MapProvider } from './Map/context'\r\nimport { MapSitesProvider } from './MapSites/context'\r\nimport { MenusProvider } from './Menus/context'\r\nimport { PermissionsProvider } from './Permissions/context'\r\nimport { PointCloudProvider } from './PointCloud/context'\r\nimport { ToolsProvider } from './Tools/context'\r\n\r\nconst compose = providers =>\r\n providers.reduce(\r\n (Prev, Curr) =>\r\n function ComposedProvider({ children }) {\r\n return (\r\n <Prev>\r\n <Curr>{children}</Curr>\r\n </Prev>\r\n )\r\n },\r\n )\r\n\r\n// PluginHostProvider is deliberately NOT in this list: it takes props, and\r\n// `compose` only threads `children`. It wraps the composed tree below instead, so\r\n// it stays the innermost provider (plugins can read every store above it).\r\nconst InnerProviders = compose([\r\n BimProvider,\r\n MapProvider,\r\n MenusProvider,\r\n ToolsProvider,\r\n ContentProvider,\r\n DatasetsProvider,\r\n MapSitesProvider,\r\n FilesProvider,\r\n BuildingsProvider,\r\n PointCloudProvider,\r\n PermissionsProvider,\r\n])\r\n\r\ninterface AppProviderProps extends Omit<PluginHostProviderProps, 'children'> {\r\n children: React.ReactNode\r\n runtimeConfig?: RuntimeConfig\r\n}\r\n\r\nexport function AppProvider({\r\n children,\r\n runtimeConfig,\r\n plugins,\r\n enabledSlugs,\r\n configs,\r\n}: AppProviderProps) {\r\n return (\r\n <AppConfigProvider runtimeConfig={runtimeConfig}>\r\n <InnerProviders>\r\n <PluginHostProvider plugins={plugins} enabledSlugs={enabledSlugs} configs={configs}>\r\n {children}\r\n {/* Here, not in PluginHostProvider: importing it there would cycle. */}\r\n <PluginDialogHost />\r\n </PluginHostProvider>\r\n </InnerProviders>\r\n </AppConfigProvider>\r\n )\r\n}\r\n"],"mappings":";AA6BY,cAsCJ,YAtCI;AAtBZ,SAAS,wBAAwB;AACjC,SAAS,0BAAwD;AAEjE,SAAS,yBAA6C;AACtD,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAE9B,MAAM,UAAU,eACd,UAAU;AAAA,EACR,CAAC,MAAM,SACL,SAAS,iBAAiB,EAAE,SAAS,GAAG;AACtC,WACE,oBAAC,QACC,8BAAC,QAAM,UAAS,GAClB;AAAA,EAEJ;AACJ;AAKF,MAAM,iBAAiB,QAAQ;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOM,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,SACE,oBAAC,qBAAkB,eACjB,8BAAC,kBACC,+BAAC,sBAAmB,SAAkB,cAA4B,SAC/D;AAAA;AAAA,IAED,oBAAC,oBAAiB;AAAA,KACpB,GACF,GACF;AAEJ;","names":[]}
@@ -1,6 +1,8 @@
1
- import type { ViewerNames } from '../../types/dbTypes';
1
+ import type { ViewerKey, ViewerNames } from '../../types/dbTypes';
2
2
  import type { ActionMap } from '../ActionMap';
3
3
  export type SidebarTabType = 'file' | 'layers' | 'communication' | 'sensors' | 'settings';
4
+ /** A built-in tab or a plugin one. Separate from `SidebarTabType`, which stays exhaustive. */
5
+ export type SidebarTabKey = SidebarTabType | `plugin:${string}`;
4
6
  /** Request from a viewer marker to open a comment's editor/reply box in the sidebar. */
5
7
  export type CommentActionRequest = {
6
8
  commentId: number;
@@ -16,9 +18,9 @@ export type SensorActionRequest = {
16
18
  requestId: number;
17
19
  };
18
20
  interface MenusTypes {
19
- currentViewer: ViewerNames;
21
+ currentViewer: ViewerKey;
20
22
  rowsPerPage: number;
21
- selectedTab: SidebarTabType;
23
+ selectedTab: SidebarTabKey;
22
24
  commentsVisibleInViewer: ViewerNames[];
23
25
  currentCommentId: number | null;
24
26
  /** Comment double-clicked to zoom/focus. Drives the thick focus ring + camera move. */
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/core/store/Menus/reducer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBA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AY,eA6MnE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/store/Menus/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\nimport type { ActionMap } from '../ActionMap'\r\n\r\nexport type SidebarTabType = 'file' | 'layers' | 'communication' | 'sensors' | 'settings'\r\n\r\n/** Request from a viewer marker to open a comment's editor/reply box in the sidebar. */\r\nexport type CommentActionRequest = {\r\n commentId: number\r\n action: 'edit' | 'reply'\r\n /** Monotonic id so the same request fires again even if the target is unchanged. */\r\n requestId: number\r\n}\r\n\r\n/** Request from a viewer marker to open a sensor's editor in the sidebar. */\r\nexport type SensorActionRequest = {\r\n sensorId: number\r\n action: 'edit'\r\n /** Monotonic id so the same request fires again even if the target is unchanged. */\r\n requestId: number\r\n}\r\n\r\ninterface MenusTypes {\r\n currentViewer: ViewerNames\r\n rowsPerPage: number\r\n selectedTab: SidebarTabType\r\n commentsVisibleInViewer: ViewerNames[]\r\n currentCommentId: number | null\r\n /** Comment double-clicked to zoom/focus. Drives the thick focus ring + camera move. */\r\n focusedCommentId: number | null\r\n /** Monotonic counter bumped on every focus dispatch so re-focusing the same comment re-zooms. */\r\n focusRequestId: number\r\n pendingCommentAction: CommentActionRequest | null\r\n sensorsVisibleInViewer: ViewerNames[]\r\n visibleSensorTypes: Partial<Record<ViewerNames, number[]>>\r\n visibleSensorTags: Partial<Record<ViewerNames, string[]>>\r\n currentSensorId: number | null\r\n currentSensorTypeId: number | null\r\n /** Sensor double-clicked to zoom/focus. Drives the thick focus ring + camera move. */\r\n focusedSensorId: number | null\r\n /** Monotonic counter bumped on every sensor focus dispatch so re-focusing re-zooms. */\r\n sensorFocusRequestId: number\r\n pendingSensorAction: SensorActionRequest | null\r\n /** Legend card shown for this viewer. An absent entry means shown. */\r\n sensorLegendVisible: Partial<Record<ViewerNames, boolean>>\r\n /** Sensor type the legend is pinned to, overriding the focused sensor's own type. */\r\n sensorLegendTypeId: Partial<Record<ViewerNames, number | null>>\r\n}\r\n\r\nexport type MenusState = MenusTypes\r\n\r\nexport type MenusPayload = {\r\n ['SET_VIEWER']: Pick<MenusTypes, 'currentViewer'>\r\n ['SET_PAGINATION_ROWS_PER_PAGE']: Pick<MenusTypes, 'rowsPerPage'>\r\n ['SET_SIDEBAR_SELECTED_TAB']: Pick<MenusTypes, 'selectedTab'>\r\n ['SHOW_COMMENTS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_COMMENTS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['SET_CURRENT_COMMENT_ID']: {commentId: number | null}\r\n ['SET_FOCUSED_COMMENT_ID']: {commentId: number | null}\r\n ['REQUEST_COMMENT_ACTION']: {commentId: number; action: 'edit' | 'reply'}\r\n ['CLEAR_PENDING_COMMENT_ACTION']: undefined\r\n ['TOGGLE_SENSOR_TYPE_VISIBILITY']: { viewer: ViewerNames; sensorTypeId: number; force?: boolean }\r\n ['TOGGLE_SENSOR_TAG_VISIBILITY']: { viewer: ViewerNames; sensorTag: string; force?: boolean }\r\n ['SHOW_ALL_SENSOR_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_ALL_SENSORS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_ALL_SENSOR_TAGS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['SET_CURRENT_SENSOR_ID']: Pick<MenusTypes, 'currentSensorId'>\r\n ['SET_CURRENT_SENSOR_TYPE_ID']: Pick<MenusTypes, 'currentSensorTypeId'>\r\n ['SET_FOCUSED_SENSOR_ID']: {sensorId: number | null}\r\n ['REQUEST_SENSOR_ACTION']: {sensorId: number}\r\n ['CLEAR_PENDING_SENSOR_ACTION']: undefined\r\n /** `visible` sets explicitly; omit it to flip. Not the `force` (\"only show\") shape used by\r\n * the visibility toggles above, because the legend's close button needs an explicit hide. */\r\n ['TOGGLE_SENSOR_LEGEND']: { viewer: ViewerNames; visible?: boolean }\r\n ['SET_SENSOR_LEGEND_TYPE_ID']: { viewer: ViewerNames; sensorTypeId: number | null }\r\n}\r\n\r\nexport type MenusActions\r\n = ActionMap<MenusPayload>[keyof ActionMap<MenusPayload>]\r\n\r\nexport const MenusReducer = (state: MenusState, action: MenusActions) => {\r\n switch (action.type) {\r\n case 'SET_VIEWER':\r\n return {\r\n ...state,\r\n currentViewer: action.payload.currentViewer,\r\n }\r\n case 'SET_PAGINATION_ROWS_PER_PAGE':\r\n return {\r\n ...state,\r\n rowsPerPage: action.payload.rowsPerPage,\r\n }\r\n case 'SET_SIDEBAR_SELECTED_TAB':\r\n return {\r\n ...state,\r\n selectedTab: action.payload.selectedTab,\r\n }\r\n case 'SHOW_COMMENTS_IN_VIEWER':\r\n const viewerToShow = action.payload.viewer\r\n if (!viewerToShow) return state\r\n const commentsCurrentlyVisible = state.commentsVisibleInViewer || []\r\n return {\r\n ...state,\r\n commentsVisibleInViewer: commentsCurrentlyVisible.includes(viewerToShow)\r\n ? commentsCurrentlyVisible\r\n : [...commentsCurrentlyVisible, viewerToShow],\r\n }\r\n case 'HIDE_COMMENTS_IN_VIEWER':\r\n const viewerToHide = action.payload.viewer\r\n if (!viewerToHide) return state\r\n return {\r\n ...state,\r\n commentsVisibleInViewer: (state.commentsVisibleInViewer || []).filter(\r\n v => v !== viewerToHide\r\n ),\r\n }\r\n case 'SET_CURRENT_COMMENT_ID':\r\n return {\r\n ...state,\r\n currentCommentId: action.payload.commentId,\r\n }\r\n case 'SET_FOCUSED_COMMENT_ID':\r\n return {\r\n ...state,\r\n focusedCommentId: action.payload.commentId,\r\n focusRequestId: state.focusRequestId + 1,\r\n }\r\n case 'REQUEST_COMMENT_ACTION':\r\n return {\r\n ...state,\r\n pendingCommentAction: {\r\n commentId: action.payload.commentId,\r\n action: action.payload.action,\r\n requestId: (state.pendingCommentAction?.requestId ?? 0) + 1,\r\n },\r\n }\r\n case 'CLEAR_PENDING_COMMENT_ACTION':\r\n if (state.pendingCommentAction === null) return state\r\n return {\r\n ...state,\r\n pendingCommentAction: null,\r\n }\r\n case 'SET_CURRENT_SENSOR_ID':\r\n return {\r\n ...state,\r\n currentSensorId: action.payload.currentSensorId,\r\n }\r\n case 'SET_CURRENT_SENSOR_TYPE_ID':\r\n return {\r\n ...state,\r\n currentSensorTypeId: action.payload.currentSensorTypeId,\r\n }\r\n case 'SET_FOCUSED_SENSOR_ID':\r\n return {\r\n ...state,\r\n focusedSensorId: action.payload.sensorId,\r\n sensorFocusRequestId: state.sensorFocusRequestId + 1,\r\n // Focusing a sensor hands the legend back to that sensor's own type, in this viewer\r\n // only. Clearing on a null payload instead would undo the selection the legend dropdown\r\n // just made, since it clears the focus right after pinning a type.\r\n sensorLegendTypeId: action.payload.sensorId == null\r\n ? state.sensorLegendTypeId\r\n : { ...state.sensorLegendTypeId, [state.currentViewer]: null },\r\n }\r\n case 'REQUEST_SENSOR_ACTION':\r\n return {\r\n ...state,\r\n pendingSensorAction: {\r\n sensorId: action.payload.sensorId,\r\n // `as const`, or the literal widens to `string` and the reducer's inferred return\r\n // type stops being assignable to MenusState.\r\n action: 'edit' as const,\r\n requestId: (state.pendingSensorAction?.requestId ?? 0) + 1,\r\n },\r\n }\r\n case 'CLEAR_PENDING_SENSOR_ACTION':\r\n if (state.pendingSensorAction === null) return state\r\n return {\r\n ...state,\r\n pendingSensorAction: null,\r\n }\r\n case 'HIDE_ALL_SENSORS_IN_VIEWER':\r\n const sensorViewerToHide = action.payload.viewer\r\n if (!sensorViewerToHide) return state\r\n return {\r\n ...state,\r\n sensorsVisibleInViewer: (state.sensorsVisibleInViewer || []).filter(\r\n v => v !== sensorViewerToHide\r\n ),\r\n // Also hide all sensor types for this viewer\r\n visibleSensorTypes: {\r\n ...state.visibleSensorTypes,\r\n [sensorViewerToHide]: [],\r\n },\r\n // Nothing left for the legend to explain in this viewer.\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [sensorViewerToHide]: null,\r\n },\r\n }\r\n case 'HIDE_ALL_SENSOR_TAGS_IN_VIEWER':\r\n const tagViewerToHide = action.payload.viewer\r\n if (!tagViewerToHide) return state\r\n return {\r\n ...state,\r\n visibleSensorTags: {\r\n ...state.visibleSensorTags,\r\n [tagViewerToHide]: [],\r\n },\r\n }\r\n case 'TOGGLE_SENSOR_TYPE_VISIBILITY':\r\n const { viewer: toggleViewer, sensorTypeId, force } = action.payload\r\n if (!toggleViewer || !sensorTypeId) return state\r\n const currentTypesForViewer = state.visibleSensorTypes?.[toggleViewer] || []\r\n const isCurrentlyVisible = currentTypesForViewer.includes(sensorTypeId)\r\n // force=true → only show (idempotent); force=false/undefined → toggle\r\n if (force && isCurrentlyVisible) return state\r\n const turningOn = Boolean(force) || !isCurrentlyVisible\r\n return {\r\n ...state,\r\n visibleSensorTypes: {\r\n ...state.visibleSensorTypes,\r\n [toggleViewer]: turningOn\r\n ? [...currentTypesForViewer, sensorTypeId]\r\n : currentTypesForViewer.filter(t => t !== sensorTypeId),\r\n },\r\n // Switching a type on is also how you choose what the legend explains, so the ramp, the\r\n // marker halos and the building colours appear immediately rather than waiting for a\r\n // sensor to be focused. Switching it off releases the legend again.\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [toggleViewer]: turningOn\r\n ? sensorTypeId\r\n : state.sensorLegendTypeId?.[toggleViewer] === sensorTypeId\r\n ? null\r\n : state.sensorLegendTypeId?.[toggleViewer] ?? null,\r\n },\r\n }\r\n case 'TOGGLE_SENSOR_TAG_VISIBILITY':\r\n const { viewer: toggleTagViewer, sensorTag, force: forceTag } = action.payload\r\n if (!toggleTagViewer || !sensorTag) return state\r\n const currentTagsForViewer = state.visibleSensorTags?.[toggleTagViewer] || []\r\n const isTagCurrentlyVisible = currentTagsForViewer.includes(sensorTag)\r\n if (forceTag && isTagCurrentlyVisible) return state\r\n return {\r\n ...state,\r\n visibleSensorTags: {\r\n ...state.visibleSensorTags,\r\n [toggleTagViewer]: (forceTag || !isTagCurrentlyVisible)\r\n ? [...currentTagsForViewer, sensorTag]\r\n : currentTagsForViewer.filter(t => t !== sensorTag),\r\n },\r\n }\r\n\r\n case 'TOGGLE_SENSOR_LEGEND':\r\n const { viewer: legendViewer, visible } = action.payload\r\n if (!legendViewer) return state\r\n const legendCurrentlyVisible = state.sensorLegendVisible?.[legendViewer] !== false\r\n return {\r\n ...state,\r\n sensorLegendVisible: {\r\n ...state.sensorLegendVisible,\r\n [legendViewer]: visible ?? !legendCurrentlyVisible,\r\n },\r\n }\r\n case 'SET_SENSOR_LEGEND_TYPE_ID':\r\n const { viewer: legendTypeViewer, sensorTypeId: legendTypeId } = action.payload\r\n if (!legendTypeViewer) return state\r\n return {\r\n ...state,\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [legendTypeViewer]: legendTypeId,\r\n },\r\n }\r\n\r\n case 'SHOW_ALL_SENSOR_IN_VIEWER':\r\n const showAllViewer = action.payload.viewer\r\n if (!showAllViewer) return state\r\n // This is called when opening the add sensor tool - we don't know all types yet\r\n // So we just ensure the viewer is in sensorsVisibleInViewer\r\n return state\r\n default:\r\n return state\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkFO,MAAM,eAAe,CAAC,OAAmB,WAAyB;AAlFzE;AAmFE,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO,iCACF,QADE;AAAA,QAEL,eAAe,OAAO,QAAQ;AAAA,MAChC;AAAA,IACF,KAAK;AACH,aAAO,iCACF,QADE;AAAA,QAEL,aAAa,OAAO,QAAQ;AAAA,MAC9B;AAAA,IACF,KAAK;AACH,aAAO,iCACF,QADE;AAAA,QAEL,aAAa,OAAO,QAAQ;AAAA,MAC9B;AAAA,IACF,KAAK;AACH,YAAM,eAAe,OAAO,QAAQ;AACpC,UAAI,CAAC,aAAc,QAAO;AAC1B,YAAM,2BAA2B,MAAM,2BAA2B,CAAC;AACnE,aAAO,iCACJ,QADI;AAAA,QAEP,yBAAyB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qBADS;AAAA,UAElB,CAAC,gBAAgB,GAAG;AAAA,QACtB;AAAA,MACF;AAAA,IAEF,KAAK;AACH,YAAM,gBAAgB,OAAO,QAAQ;AACrC,UAAI,CAAC,cAAe,QAAO;AAG3B,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/store/Menus/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { ViewerKey, ViewerNames } from '../../types/dbTypes'\r\nimport type { ActionMap } from '../ActionMap'\r\n\r\nexport type SidebarTabType = 'file' | 'layers' | 'communication' | 'sensors' | 'settings'\r\n\r\n/** A built-in tab or a plugin one. Separate from `SidebarTabType`, which stays exhaustive. */\r\nexport type SidebarTabKey = SidebarTabType | `plugin:${string}`\r\n\r\n/** Request from a viewer marker to open a comment's editor/reply box in the sidebar. */\r\nexport type CommentActionRequest = {\r\n commentId: number\r\n action: 'edit' | 'reply'\r\n /** Monotonic id so the same request fires again even if the target is unchanged. */\r\n requestId: number\r\n}\r\n\r\n/** Request from a viewer marker to open a sensor's editor in the sidebar. */\r\nexport type SensorActionRequest = {\r\n sensorId: number\r\n action: 'edit'\r\n /** Monotonic id so the same request fires again even if the target is unchanged. */\r\n requestId: number\r\n}\r\n\r\ninterface MenusTypes {\r\n currentViewer: ViewerKey\r\n rowsPerPage: number\r\n selectedTab: SidebarTabKey\r\n commentsVisibleInViewer: ViewerNames[]\r\n currentCommentId: number | null\r\n /** Comment double-clicked to zoom/focus. Drives the thick focus ring + camera move. */\r\n focusedCommentId: number | null\r\n /** Monotonic counter bumped on every focus dispatch so re-focusing the same comment re-zooms. */\r\n focusRequestId: number\r\n pendingCommentAction: CommentActionRequest | null\r\n sensorsVisibleInViewer: ViewerNames[]\r\n visibleSensorTypes: Partial<Record<ViewerNames, number[]>>\r\n visibleSensorTags: Partial<Record<ViewerNames, string[]>>\r\n currentSensorId: number | null\r\n currentSensorTypeId: number | null\r\n /** Sensor double-clicked to zoom/focus. Drives the thick focus ring + camera move. */\r\n focusedSensorId: number | null\r\n /** Monotonic counter bumped on every sensor focus dispatch so re-focusing re-zooms. */\r\n sensorFocusRequestId: number\r\n pendingSensorAction: SensorActionRequest | null\r\n /** Legend card shown for this viewer. An absent entry means shown. */\r\n sensorLegendVisible: Partial<Record<ViewerNames, boolean>>\r\n /** Sensor type the legend is pinned to, overriding the focused sensor's own type. */\r\n sensorLegendTypeId: Partial<Record<ViewerNames, number | null>>\r\n}\r\n\r\nexport type MenusState = MenusTypes\r\n\r\nexport type MenusPayload = {\r\n ['SET_VIEWER']: Pick<MenusTypes, 'currentViewer'>\r\n ['SET_PAGINATION_ROWS_PER_PAGE']: Pick<MenusTypes, 'rowsPerPage'>\r\n ['SET_SIDEBAR_SELECTED_TAB']: Pick<MenusTypes, 'selectedTab'>\r\n ['SHOW_COMMENTS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_COMMENTS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['SET_CURRENT_COMMENT_ID']: {commentId: number | null}\r\n ['SET_FOCUSED_COMMENT_ID']: {commentId: number | null}\r\n ['REQUEST_COMMENT_ACTION']: {commentId: number; action: 'edit' | 'reply'}\r\n ['CLEAR_PENDING_COMMENT_ACTION']: undefined\r\n ['TOGGLE_SENSOR_TYPE_VISIBILITY']: { viewer: ViewerNames; sensorTypeId: number; force?: boolean }\r\n ['TOGGLE_SENSOR_TAG_VISIBILITY']: { viewer: ViewerNames; sensorTag: string; force?: boolean }\r\n ['SHOW_ALL_SENSOR_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_ALL_SENSORS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['HIDE_ALL_SENSOR_TAGS_IN_VIEWER']: {viewer: ViewerNames}\r\n ['SET_CURRENT_SENSOR_ID']: Pick<MenusTypes, 'currentSensorId'>\r\n ['SET_CURRENT_SENSOR_TYPE_ID']: Pick<MenusTypes, 'currentSensorTypeId'>\r\n ['SET_FOCUSED_SENSOR_ID']: {sensorId: number | null}\r\n ['REQUEST_SENSOR_ACTION']: {sensorId: number}\r\n ['CLEAR_PENDING_SENSOR_ACTION']: undefined\r\n /** `visible` sets explicitly; omit it to flip. Not the `force` (\"only show\") shape used by\r\n * the visibility toggles above, because the legend's close button needs an explicit hide. */\r\n ['TOGGLE_SENSOR_LEGEND']: { viewer: ViewerNames; visible?: boolean }\r\n ['SET_SENSOR_LEGEND_TYPE_ID']: { viewer: ViewerNames; sensorTypeId: number | null }\r\n}\r\n\r\nexport type MenusActions\r\n = ActionMap<MenusPayload>[keyof ActionMap<MenusPayload>]\r\n\r\nexport const MenusReducer = (state: MenusState, action: MenusActions) => {\r\n switch (action.type) {\r\n case 'SET_VIEWER':\r\n return {\r\n ...state,\r\n currentViewer: action.payload.currentViewer,\r\n }\r\n case 'SET_PAGINATION_ROWS_PER_PAGE':\r\n return {\r\n ...state,\r\n rowsPerPage: action.payload.rowsPerPage,\r\n }\r\n case 'SET_SIDEBAR_SELECTED_TAB':\r\n return {\r\n ...state,\r\n selectedTab: action.payload.selectedTab,\r\n }\r\n case 'SHOW_COMMENTS_IN_VIEWER':\r\n const viewerToShow = action.payload.viewer\r\n if (!viewerToShow) return state\r\n const commentsCurrentlyVisible = state.commentsVisibleInViewer || []\r\n return {\r\n ...state,\r\n commentsVisibleInViewer: commentsCurrentlyVisible.includes(viewerToShow)\r\n ? commentsCurrentlyVisible\r\n : [...commentsCurrentlyVisible, viewerToShow],\r\n }\r\n case 'HIDE_COMMENTS_IN_VIEWER':\r\n const viewerToHide = action.payload.viewer\r\n if (!viewerToHide) return state\r\n return {\r\n ...state,\r\n commentsVisibleInViewer: (state.commentsVisibleInViewer || []).filter(\r\n v => v !== viewerToHide\r\n ),\r\n }\r\n case 'SET_CURRENT_COMMENT_ID':\r\n return {\r\n ...state,\r\n currentCommentId: action.payload.commentId,\r\n }\r\n case 'SET_FOCUSED_COMMENT_ID':\r\n return {\r\n ...state,\r\n focusedCommentId: action.payload.commentId,\r\n focusRequestId: state.focusRequestId + 1,\r\n }\r\n case 'REQUEST_COMMENT_ACTION':\r\n return {\r\n ...state,\r\n pendingCommentAction: {\r\n commentId: action.payload.commentId,\r\n action: action.payload.action,\r\n requestId: (state.pendingCommentAction?.requestId ?? 0) + 1,\r\n },\r\n }\r\n case 'CLEAR_PENDING_COMMENT_ACTION':\r\n if (state.pendingCommentAction === null) return state\r\n return {\r\n ...state,\r\n pendingCommentAction: null,\r\n }\r\n case 'SET_CURRENT_SENSOR_ID':\r\n return {\r\n ...state,\r\n currentSensorId: action.payload.currentSensorId,\r\n }\r\n case 'SET_CURRENT_SENSOR_TYPE_ID':\r\n return {\r\n ...state,\r\n currentSensorTypeId: action.payload.currentSensorTypeId,\r\n }\r\n case 'SET_FOCUSED_SENSOR_ID':\r\n return {\r\n ...state,\r\n focusedSensorId: action.payload.sensorId,\r\n sensorFocusRequestId: state.sensorFocusRequestId + 1,\r\n // Focusing a sensor hands the legend back to that sensor's own type, in this viewer\r\n // only. Clearing on a null payload instead would undo the selection the legend dropdown\r\n // just made, since it clears the focus right after pinning a type.\r\n sensorLegendTypeId: action.payload.sensorId == null\r\n ? state.sensorLegendTypeId\r\n : { ...state.sensorLegendTypeId, [state.currentViewer]: null },\r\n }\r\n case 'REQUEST_SENSOR_ACTION':\r\n return {\r\n ...state,\r\n pendingSensorAction: {\r\n sensorId: action.payload.sensorId,\r\n // `as const`, or the literal widens to `string` and the reducer's inferred return\r\n // type stops being assignable to MenusState.\r\n action: 'edit' as const,\r\n requestId: (state.pendingSensorAction?.requestId ?? 0) + 1,\r\n },\r\n }\r\n case 'CLEAR_PENDING_SENSOR_ACTION':\r\n if (state.pendingSensorAction === null) return state\r\n return {\r\n ...state,\r\n pendingSensorAction: null,\r\n }\r\n case 'HIDE_ALL_SENSORS_IN_VIEWER':\r\n const sensorViewerToHide = action.payload.viewer\r\n if (!sensorViewerToHide) return state\r\n return {\r\n ...state,\r\n sensorsVisibleInViewer: (state.sensorsVisibleInViewer || []).filter(\r\n v => v !== sensorViewerToHide\r\n ),\r\n // Also hide all sensor types for this viewer\r\n visibleSensorTypes: {\r\n ...state.visibleSensorTypes,\r\n [sensorViewerToHide]: [],\r\n },\r\n // Nothing left for the legend to explain in this viewer.\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [sensorViewerToHide]: null,\r\n },\r\n }\r\n case 'HIDE_ALL_SENSOR_TAGS_IN_VIEWER':\r\n const tagViewerToHide = action.payload.viewer\r\n if (!tagViewerToHide) return state\r\n return {\r\n ...state,\r\n visibleSensorTags: {\r\n ...state.visibleSensorTags,\r\n [tagViewerToHide]: [],\r\n },\r\n }\r\n case 'TOGGLE_SENSOR_TYPE_VISIBILITY':\r\n const { viewer: toggleViewer, sensorTypeId, force } = action.payload\r\n if (!toggleViewer || !sensorTypeId) return state\r\n const currentTypesForViewer = state.visibleSensorTypes?.[toggleViewer] || []\r\n const isCurrentlyVisible = currentTypesForViewer.includes(sensorTypeId)\r\n // force=true → only show (idempotent); force=false/undefined → toggle\r\n if (force && isCurrentlyVisible) return state\r\n const turningOn = Boolean(force) || !isCurrentlyVisible\r\n return {\r\n ...state,\r\n visibleSensorTypes: {\r\n ...state.visibleSensorTypes,\r\n [toggleViewer]: turningOn\r\n ? [...currentTypesForViewer, sensorTypeId]\r\n : currentTypesForViewer.filter(t => t !== sensorTypeId),\r\n },\r\n // Switching a type on is also how you choose what the legend explains, so the ramp, the\r\n // marker halos and the building colours appear immediately rather than waiting for a\r\n // sensor to be focused. Switching it off releases the legend again.\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [toggleViewer]: turningOn\r\n ? sensorTypeId\r\n : state.sensorLegendTypeId?.[toggleViewer] === sensorTypeId\r\n ? null\r\n : state.sensorLegendTypeId?.[toggleViewer] ?? null,\r\n },\r\n }\r\n case 'TOGGLE_SENSOR_TAG_VISIBILITY':\r\n const { viewer: toggleTagViewer, sensorTag, force: forceTag } = action.payload\r\n if (!toggleTagViewer || !sensorTag) return state\r\n const currentTagsForViewer = state.visibleSensorTags?.[toggleTagViewer] || []\r\n const isTagCurrentlyVisible = currentTagsForViewer.includes(sensorTag)\r\n if (forceTag && isTagCurrentlyVisible) return state\r\n return {\r\n ...state,\r\n visibleSensorTags: {\r\n ...state.visibleSensorTags,\r\n [toggleTagViewer]: (forceTag || !isTagCurrentlyVisible)\r\n ? [...currentTagsForViewer, sensorTag]\r\n : currentTagsForViewer.filter(t => t !== sensorTag),\r\n },\r\n }\r\n\r\n case 'TOGGLE_SENSOR_LEGEND':\r\n const { viewer: legendViewer, visible } = action.payload\r\n if (!legendViewer) return state\r\n const legendCurrentlyVisible = state.sensorLegendVisible?.[legendViewer] !== false\r\n return {\r\n ...state,\r\n sensorLegendVisible: {\r\n ...state.sensorLegendVisible,\r\n [legendViewer]: visible ?? !legendCurrentlyVisible,\r\n },\r\n }\r\n case 'SET_SENSOR_LEGEND_TYPE_ID':\r\n const { viewer: legendTypeViewer, sensorTypeId: legendTypeId } = action.payload\r\n if (!legendTypeViewer) return state\r\n return {\r\n ...state,\r\n sensorLegendTypeId: {\r\n ...state.sensorLegendTypeId,\r\n [legendTypeViewer]: legendTypeId,\r\n },\r\n }\r\n\r\n case 'SHOW_ALL_SENSOR_IN_VIEWER':\r\n const showAllViewer = action.payload.viewer\r\n if (!showAllViewer) return state\r\n // This is called when opening the add sensor tool - we don't know all types yet\r\n // So we just ensure the viewer is in sensorsVisibleInViewer\r\n return state\r\n default:\r\n return state\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqFO,MAAM,eAAe,CAAC,OAAmB,WAAyB;AArFzE;AAsFE,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO,iCACF,QADE;AAAA,QAEL,eAAe,OAAO,QAAQ;AAAA,MAChC;AAAA,IACF,KAAK;AACH,aAAO,iCACF,QADE;AAAA,QAEL,aAAa,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;AAAA,QAEL,qBAAqB,iCAChB,MAAM,sBADU;AAAA,UAEnB,CAAC,YAAY,GAAG,4BAAW,CAAC;AAAA,QAC9B;AAAA,MACF;AAAA,IACF,KAAK;AACH,YAAM,EAAE,QAAQ,kBAAkB,cAAc,aAAa,IAAI,OAAO;AACxE,UAAI,CAAC,iBAAkB,QAAO;AAC9B,aAAO,iCACF,QADE;AAAA,QAEL,oBAAoB,iCACf,MAAM,qBADS;AAAA,UAElB,CAAC,gBAAgB,GAAG;AAAA,QACtB;AAAA,MACF;AAAA,IAEF,KAAK;AACH,YAAM,gBAAgB,OAAO,QAAQ;AACrC,UAAI,CAAC,cAAe,QAAO;AAG3B,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -192,6 +192,11 @@ export declare enum ViewerNames {
192
192
  settings = "settings",
193
193
  users = "users"
194
194
  }
195
+ /**
196
+ * A built-in viewer or a plugin page, as `plugin:<pluginId>:<pageId>`. Widened rather than
197
+ * adding enum members: `ViewerNames` mirrors the Prisma `appContent` enum.
198
+ */
199
+ export type ViewerKey = ViewerNames | `plugin:${string}`;
195
200
  export declare enum SensorTypes {
196
201
  Temperature = "Temperature",
197
202
  Light = "Light",