@collabdt/core 0.4.8 → 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.
- package/dist/core/components/AppSidebarContent.d.ts +2 -3
- package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
- package/dist/core/components/AppSidebarContent.js +12 -3
- package/dist/core/components/AppSidebarContent.js.map +1 -1
- package/dist/core/components/Toolbar.d.ts +2 -3
- package/dist/core/components/Toolbar.d.ts.map +1 -1
- package/dist/core/components/Toolbar.js.map +1 -1
- package/dist/core/components/ui/AppSidebar.d.ts +2 -2
- package/dist/core/components/ui/AppSidebar.d.ts.map +1 -1
- package/dist/core/components/ui/AppSidebar.js.map +1 -1
- package/dist/core/components/ui/Comments/CommentsSection.d.ts.map +1 -1
- package/dist/core/components/ui/Comments/CommentsSection.js +10 -9
- package/dist/core/components/ui/Comments/CommentsSection.js.map +1 -1
- package/dist/core/components/ui/Sensors/SensorsSection.d.ts.map +1 -1
- package/dist/core/components/ui/Sensors/SensorsSection.js +24 -23
- package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/Shell.js +1 -1
- package/dist/core/components/ui/ViewerSidebar/Shell.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/TabStrip.d.ts +6 -5
- package/dist/core/components/ui/ViewerSidebar/TabStrip.d.ts.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/TabStrip.js +6 -4
- package/dist/core/components/ui/ViewerSidebar/TabStrip.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/sidebarTabs.d.ts +16 -9
- package/dist/core/components/ui/ViewerSidebar/sidebarTabs.d.ts.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/sidebarTabs.js.map +1 -1
- package/dist/core/components/viewers/Data/DataMenu.js +1 -1
- package/dist/core/components/viewers/Data/DataMenu.js.map +1 -1
- package/dist/core/components/viewers/Data/utils/viewerConfig.js +1 -1
- package/dist/core/components/viewers/Data/utils/viewerConfig.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +21 -7
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.js +10 -1
- package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js +5 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts +10 -1
- package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/ElementAppearance.js +36 -1
- package/dist/core/components/viewers/bim/src/ElementAppearance.js.map +1 -1
- package/dist/core/components/viewers/bim/src/ModelsSync.d.ts +17 -0
- package/dist/core/components/viewers/bim/src/ModelsSync.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/ModelsSync.js +36 -0
- package/dist/core/components/viewers/bim/src/ModelsSync.js.map +1 -0
- package/dist/core/components/viewers/bim/src/SelectionSync.d.ts +15 -0
- package/dist/core/components/viewers/bim/src/SelectionSync.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/SelectionSync.js +24 -0
- package/dist/core/components/viewers/bim/src/SelectionSync.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts +12 -1
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js +18 -2
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/bimCamera.d.ts +17 -0
- package/dist/core/components/viewers/bim/src/lib/bimCamera.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimCamera.js +16 -0
- package/dist/core/components/viewers/bim/src/lib/bimCamera.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.d.ts +13 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.js +13 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/bimQueries.d.ts +26 -0
- package/dist/core/components/viewers/bim/src/lib/bimQueries.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimQueries.js +72 -0
- package/dist/core/components/viewers/bim/src/lib/bimQueries.js.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useFilePlacement.d.ts +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js +7 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.js +6 -3
- package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/RowActions.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/RowActions.js +90 -20
- package/dist/core/components/viewers/map/datasets/RowActions.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/index.d.ts +1 -2
- package/dist/core/components/viewers/map/datasets/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/index.js +13 -104
- package/dist/core/components/viewers/map/datasets/index.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js +5 -8
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/orgVisibility.d.ts +16 -0
- package/dist/core/components/viewers/map/datasets/src/orgVisibility.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/orgVisibility.js +21 -0
- package/dist/core/components/viewers/map/datasets/src/orgVisibility.js.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.d.ts +28 -0
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js +80 -0
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/geometryGroups.d.ts +27 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/geometryGroups.d.ts.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/geometryGroups.js +53 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/geometryGroups.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js +102 -100
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.js +5 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/LayersTab/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/src/LayersTab/index.js +2 -34
- package/dist/core/components/viewers/map/src/MapSidebar/src/LayersTab/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.d.ts +3 -11
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js +28 -13
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddToMap.d.ts +1 -2
- package/dist/core/components/viewers/map/src/tools/AddTools/AddToMap.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddToMap.js +1 -2
- package/dist/core/components/viewers/map/src/tools/AddTools/AddToMap.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/DatasetMapTool.d.ts +1 -2
- package/dist/core/components/viewers/map/src/tools/DatasetMapTool.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/DatasetMapTool.js +1 -2
- package/dist/core/components/viewers/map/src/tools/DatasetMapTool.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.js +28 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.js.map +1 -1
- package/dist/core/components/viewers/map/utils/stringToColour.d.ts +3 -0
- package/dist/core/components/viewers/map/utils/stringToColour.d.ts.map +1 -1
- package/dist/core/components/viewers/map/utils/stringToColour.js +72 -70
- package/dist/core/components/viewers/map/utils/stringToColour.js.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts +20 -0
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/PluginsManager.js +245 -0
- package/dist/core/components/viewers/plugins/PluginsManager.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginCard.d.ts +14 -0
- package/dist/core/components/viewers/plugins/src/PluginCard.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginCard.js +239 -0
- package/dist/core/components/viewers/plugins/src/PluginCard.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginStatus.d.ts +9 -0
- package/dist/core/components/viewers/plugins/src/pluginStatus.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginStatus.js +10 -0
- package/dist/core/components/viewers/plugins/src/pluginStatus.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.d.ts +14 -0
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.js +24 -0
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/usePluginEnablement.d.ts +16 -0
- package/dist/core/components/viewers/plugins/src/usePluginEnablement.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/usePluginEnablement.js +18 -0
- package/dist/core/components/viewers/plugins/src/usePluginEnablement.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/usePluginsData.d.ts +22 -0
- package/dist/core/components/viewers/plugins/src/usePluginsData.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/usePluginsData.js +81 -0
- package/dist/core/components/viewers/plugins/src/usePluginsData.js.map +1 -0
- package/dist/core/components/viewers/plugins/types.d.ts +66 -0
- package/dist/core/components/viewers/plugins/types.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/types.js +1 -0
- package/dist/core/components/viewers/plugins/types.js.map +1 -0
- package/dist/core/components/viewers/pointcloud/PointCloudToolbar.js +2 -2
- package/dist/core/components/viewers/pointcloud/PointCloudToolbar.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.js +5 -1
- package/dist/core/components/viewers/pointcloud/src/PointCloudSidebar/index.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/index.d.ts +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/index.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/index.js +3 -2
- package/dist/core/components/viewers/pointcloud/src/tools/index.js.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/pointcloudToolbarTools.d.ts +10 -1
- package/dist/core/components/viewers/pointcloud/src/tools/pointcloudToolbarTools.d.ts.map +1 -1
- package/dist/core/components/viewers/pointcloud/src/tools/pointcloudToolbarTools.js +11 -3
- package/dist/core/components/viewers/pointcloud/src/tools/pointcloudToolbarTools.js.map +1 -1
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts +10 -0
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts.map +1 -0
- package/dist/core/components/viewers/{map/legends/MapLegendHost.js → shared/legends/ViewerLegendHost.js} +48 -10
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.js.map +1 -0
- package/dist/core/components/viewers/viewerAccess.d.ts +7 -0
- package/dist/core/components/viewers/viewerAccess.d.ts.map +1 -0
- package/dist/core/components/viewers/viewerAccess.js +9 -0
- package/dist/core/components/viewers/viewerAccess.js.map +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts +40 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.js +71 -0
- package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -0
- package/dist/core/hooks/plugins/plugins.d.ts +18 -0
- package/dist/core/hooks/plugins/plugins.d.ts.map +1 -0
- package/dist/core/hooks/plugins/plugins.js +10 -0
- package/dist/core/hooks/plugins/plugins.js.map +1 -0
- package/dist/core/hooks/ports/apiAdapter.d.ts +9 -0
- package/dist/core/hooks/ports/apiAdapter.d.ts.map +1 -1
- package/dist/core/hooks/provider.d.ts +2 -0
- package/dist/core/hooks/provider.d.ts.map +1 -1
- package/dist/core/hooks/provider.js +3 -1
- package/dist/core/hooks/provider.js.map +1 -1
- package/dist/core/i18n/index.d.ts +6 -0
- package/dist/core/i18n/index.d.ts.map +1 -1
- package/dist/core/i18n/index.js +29 -1
- package/dist/core/i18n/index.js.map +1 -1
- package/dist/core/i18n/messages/en.json +86 -4
- package/dist/core/i18n/messages/es.json +87 -5
- package/dist/core/i18n/messages/fr.json +86 -4
- package/dist/core/plugins/enablement.d.ts +50 -0
- package/dist/core/plugins/enablement.d.ts.map +1 -0
- package/dist/core/plugins/enablement.js +37 -0
- package/dist/core/plugins/enablement.js.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts +13 -0
- package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpaceDialog.js +80 -0
- package/dist/core/plugins/hello-bim/components/SpaceDialog.js.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts +11 -0
- package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesLegend.js +16 -0
- package/dist/core/plugins/hello-bim/components/SpacesLegend.js.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts +4 -0
- package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesTab.js +211 -0
- package/dist/core/plugins/hello-bim/components/SpacesTab.js.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts +8 -0
- package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/SpacesTool.js +68 -0
- package/dist/core/plugins/hello-bim/components/SpacesTool.js.map +1 -0
- package/dist/core/plugins/hello-bim/components/icons.d.ts +13 -0
- package/dist/core/plugins/hello-bim/components/icons.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/icons.js +52 -0
- package/dist/core/plugins/hello-bim/components/icons.js.map +1 -0
- package/dist/core/plugins/hello-bim/index.d.ts +7 -0
- package/dist/core/plugins/hello-bim/index.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/index.js +38 -0
- package/dist/core/plugins/hello-bim/index.js.map +1 -0
- package/dist/core/plugins/hello-bim/manifest.json +127 -0
- package/dist/core/plugins/hello-bim/spaces.d.ts +57 -0
- package/dist/core/plugins/hello-bim/spaces.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/spaces.js +207 -0
- package/dist/core/plugins/hello-bim/spaces.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MapTool.d.ts +9 -0
- package/dist/core/plugins/hello-map/components/MapTool.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MapTool.js +78 -0
- package/dist/core/plugins/hello-map/components/MapTool.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts +9 -0
- package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkerDialog.js +47 -0
- package/dist/core/plugins/hello-map/components/MarkerDialog.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts +8 -0
- package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersLayer.js +133 -0
- package/dist/core/plugins/hello-map/components/MarkersLayer.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts +11 -0
- package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersLegend.js +20 -0
- package/dist/core/plugins/hello-map/components/MarkersLegend.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersPage.d.ts +6 -0
- package/dist/core/plugins/hello-map/components/MarkersPage.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersPage.js +40 -0
- package/dist/core/plugins/hello-map/components/MarkersPage.js.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersTab.d.ts +4 -0
- package/dist/core/plugins/hello-map/components/MarkersTab.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/MarkersTab.js +275 -0
- package/dist/core/plugins/hello-map/components/MarkersTab.js.map +1 -0
- package/dist/core/plugins/hello-map/index.d.ts +7 -0
- package/dist/core/plugins/hello-map/index.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/index.js +54 -0
- package/dist/core/plugins/hello-map/index.js.map +1 -0
- package/dist/core/plugins/hello-map/manifest.json +129 -0
- package/dist/core/plugins/hello-map/markers.d.ts +32 -0
- package/dist/core/plugins/hello-map/markers.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/markers.js +143 -0
- package/dist/core/plugins/hello-map/markers.js.map +1 -0
- package/dist/core/plugins/host/PluginDataPageHost.d.ts +10 -0
- package/dist/core/plugins/host/PluginDataPageHost.d.ts.map +1 -0
- package/dist/core/plugins/host/PluginDataPageHost.js +142 -0
- package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -0
- package/dist/core/plugins/host/PluginDialogHost.d.ts +7 -0
- package/dist/core/plugins/host/PluginDialogHost.d.ts.map +1 -0
- package/dist/core/plugins/host/PluginDialogHost.js +80 -0
- package/dist/core/plugins/host/PluginDialogHost.js.map +1 -0
- package/dist/core/plugins/host/PluginMapLayerHost.d.ts +6 -0
- package/dist/core/plugins/host/PluginMapLayerHost.d.ts.map +1 -0
- package/dist/core/plugins/host/PluginMapLayerHost.js +26 -0
- package/dist/core/plugins/host/PluginMapLayerHost.js.map +1 -0
- package/dist/core/plugins/host/context.d.ts.map +1 -1
- package/dist/core/plugins/host/context.js.map +1 -1
- package/dist/core/plugins/host/dialogs.d.ts +25 -0
- package/dist/core/plugins/host/dialogs.d.ts.map +1 -0
- package/dist/core/plugins/host/dialogs.js +50 -0
- package/dist/core/plugins/host/dialogs.js.map +1 -0
- package/dist/core/plugins/host/errors.d.ts +11 -0
- package/dist/core/plugins/host/errors.d.ts.map +1 -1
- package/dist/core/plugins/host/errors.js +22 -1
- package/dist/core/plugins/host/errors.js.map +1 -1
- package/dist/core/plugins/host/host.d.ts +7 -0
- package/dist/core/plugins/host/host.d.ts.map +1 -1
- package/dist/core/plugins/host/host.js +64 -8
- package/dist/core/plugins/host/host.js.map +1 -1
- package/dist/core/plugins/host/pluginKit.tsconfig.json +45 -0
- package/dist/core/plugins/host/pluginState.d.ts +28 -0
- package/dist/core/plugins/host/pluginState.d.ts.map +1 -0
- package/dist/core/plugins/host/pluginState.js +49 -0
- package/dist/core/plugins/host/pluginState.js.map +1 -0
- package/dist/core/plugins/host/pluginViewerKey.d.ts +13 -0
- package/dist/core/plugins/host/pluginViewerKey.d.ts.map +1 -0
- package/dist/core/plugins/host/pluginViewerKey.js +18 -0
- package/dist/core/plugins/host/pluginViewerKey.js.map +1 -0
- package/dist/core/plugins/host/provider.d.ts +37 -2
- package/dist/core/plugins/host/provider.d.ts.map +1 -1
- package/dist/core/plugins/host/provider.js +97 -10
- package/dist/core/plugins/host/provider.js.map +1 -1
- package/dist/core/plugins/host/registry.d.ts +14 -0
- package/dist/core/plugins/host/registry.d.ts.map +1 -1
- package/dist/core/plugins/host/registry.js +37 -4
- package/dist/core/plugins/host/registry.js.map +1 -1
- package/dist/core/plugins/host/runtimeShims.d.ts +15 -0
- package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -0
- package/dist/core/plugins/host/runtimeShims.js +132 -0
- package/dist/core/plugins/host/runtimeShims.js.map +1 -0
- package/dist/core/plugins/host/scope.d.ts +21 -0
- package/dist/core/plugins/host/scope.d.ts.map +1 -0
- package/dist/core/plugins/host/scope.js +36 -0
- package/dist/core/plugins/host/scope.js.map +1 -0
- package/dist/core/plugins/host/usePluginDataPages.d.ts +15 -0
- package/dist/core/plugins/host/usePluginDataPages.d.ts.map +1 -0
- package/dist/core/plugins/host/usePluginDataPages.js +22 -0
- package/dist/core/plugins/host/usePluginDataPages.js.map +1 -0
- package/dist/core/plugins/host/usePluginToolbarTools.d.ts +18 -0
- package/dist/core/plugins/host/usePluginToolbarTools.d.ts.map +1 -0
- package/dist/core/plugins/host/usePluginToolbarTools.js +93 -0
- package/dist/core/plugins/host/usePluginToolbarTools.js.map +1 -0
- package/dist/core/plugins/host/usePluginViewerTabs.d.ts +11 -0
- package/dist/core/plugins/host/usePluginViewerTabs.d.ts.map +1 -0
- package/dist/core/plugins/host/usePluginViewerTabs.js +41 -0
- package/dist/core/plugins/host/usePluginViewerTabs.js.map +1 -0
- package/dist/core/plugins/installed.d.ts +14 -11
- package/dist/core/plugins/installed.d.ts.map +1 -1
- package/dist/core/plugins/installed.js +10 -1
- package/dist/core/plugins/installed.js.map +1 -1
- package/dist/core/plugins/manifests.d.ts +11 -0
- package/dist/core/plugins/manifests.d.ts.map +1 -0
- package/dist/core/plugins/manifests.js +10 -0
- package/dist/core/plugins/manifests.js.map +1 -0
- package/dist/core/plugins/messages.d.ts +15 -0
- package/dist/core/plugins/messages.d.ts.map +1 -0
- package/dist/core/plugins/messages.js +20 -0
- package/dist/core/plugins/messages.js.map +1 -0
- package/dist/core/plugins/sdk/bimViewer.d.ts +64 -0
- package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -0
- package/dist/core/plugins/sdk/bimViewer.js +66 -0
- package/dist/core/plugins/sdk/bimViewer.js.map +1 -0
- package/dist/core/plugins/sdk/config.d.ts +10 -0
- package/dist/core/plugins/sdk/config.d.ts.map +1 -0
- package/dist/core/plugins/sdk/config.js +7 -0
- package/dist/core/plugins/sdk/config.js.map +1 -0
- package/dist/core/plugins/sdk/data.d.ts +22 -0
- package/dist/core/plugins/sdk/data.d.ts.map +1 -0
- package/dist/core/plugins/sdk/data.js +68 -0
- package/dist/core/plugins/sdk/data.js.map +1 -0
- package/dist/core/plugins/sdk/index.d.ts +4 -0
- package/dist/core/plugins/sdk/index.d.ts.map +1 -1
- package/dist/core/plugins/sdk/index.js +9 -0
- package/dist/core/plugins/sdk/index.js.map +1 -1
- package/dist/core/plugins/sdk/mapViewer.d.ts +14 -0
- package/dist/core/plugins/sdk/mapViewer.d.ts.map +1 -0
- package/dist/core/plugins/sdk/mapViewer.js +13 -0
- package/dist/core/plugins/sdk/mapViewer.js.map +1 -0
- package/dist/core/plugins/sdk/messages.d.ts +33 -0
- package/dist/core/plugins/sdk/messages.d.ts.map +1 -0
- package/dist/core/plugins/sdk/messages.js +58 -0
- package/dist/core/plugins/sdk/messages.js.map +1 -0
- package/dist/core/plugins/sdk/permissions.d.ts +14 -0
- package/dist/core/plugins/sdk/permissions.d.ts.map +1 -0
- package/dist/core/plugins/sdk/permissions.js +10 -0
- package/dist/core/plugins/sdk/permissions.js.map +1 -0
- package/dist/core/plugins/sdk/pointCloudViewer.d.ts +14 -0
- package/dist/core/plugins/sdk/pointCloudViewer.d.ts.map +1 -0
- package/dist/core/plugins/sdk/pointCloudViewer.js +15 -0
- package/dist/core/plugins/sdk/pointCloudViewer.js.map +1 -0
- package/dist/core/plugins/sdk/state.d.ts +6 -0
- package/dist/core/plugins/sdk/state.d.ts.map +1 -0
- package/dist/core/plugins/sdk/state.js +30 -0
- package/dist/core/plugins/sdk/state.js.map +1 -0
- package/dist/core/plugins/sdk/store.d.ts +35 -0
- package/dist/core/plugins/sdk/store.d.ts.map +1 -0
- package/dist/core/plugins/sdk/store.js +37 -0
- package/dist/core/plugins/sdk/store.js.map +1 -0
- package/dist/core/plugins/sdk/types.d.ts +91 -51
- package/dist/core/plugins/sdk/types.d.ts.map +1 -1
- package/dist/core/plugins/sdk/types.js +17 -9
- package/dist/core/plugins/sdk/types.js.map +1 -1
- package/dist/core/plugins/sdk/ui.d.ts +12 -0
- package/dist/core/plugins/sdk/ui.d.ts.map +1 -0
- package/dist/core/plugins/sdk/ui.js +16 -0
- package/dist/core/plugins/sdk/ui.js.map +1 -0
- package/dist/core/plugins/sdk/version.d.ts +10 -0
- package/dist/core/plugins/sdk/version.d.ts.map +1 -0
- package/dist/core/plugins/sdk/version.js +5 -0
- package/dist/core/plugins/sdk/version.js.map +1 -0
- package/dist/core/plugins/sdk/viewer.d.ts +16 -0
- package/dist/core/plugins/sdk/viewer.d.ts.map +1 -0
- package/dist/core/plugins/sdk/viewer.js +5 -0
- package/dist/core/plugins/sdk/viewer.js.map +1 -0
- package/dist/core/store/BIM/context.d.ts.map +1 -1
- package/dist/core/store/BIM/context.js +1 -0
- package/dist/core/store/BIM/context.js.map +1 -1
- package/dist/core/store/BIM/reducer.d.ts +22 -0
- package/dist/core/store/BIM/reducer.d.ts.map +1 -1
- package/dist/core/store/BIM/reducer.js +11 -1
- package/dist/core/store/BIM/reducer.js.map +1 -1
- package/dist/core/store/CombineProviders.d.ts +5 -2
- package/dist/core/store/CombineProviders.d.ts.map +1 -1
- package/dist/core/store/CombineProviders.js +14 -5
- package/dist/core/store/CombineProviders.js.map +1 -1
- package/dist/core/store/Menus/reducer.d.ts +5 -3
- package/dist/core/store/Menus/reducer.d.ts.map +1 -1
- package/dist/core/store/Menus/reducer.js.map +1 -1
- package/dist/core/types/dbTypes.d.ts +6 -0
- package/dist/core/types/dbTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.js.map +1 -1
- package/dist/core/types/plugins.d.ts +56 -0
- package/dist/core/types/plugins.d.ts.map +1 -0
- package/dist/core/types/plugins.js +1 -0
- package/dist/core/types/plugins.js.map +1 -0
- package/dist/core/types/tools.d.ts +9 -1
- package/dist/core/types/tools.d.ts.map +1 -1
- package/package.json +11 -1
- package/dist/core/components/viewers/map/legends/MapLegendHost.d.ts +0 -10
- package/dist/core/components/viewers/map/legends/MapLegendHost.d.ts.map +0 -1
- package/dist/core/components/viewers/map/legends/MapLegendHost.js.map +0 -1
|
@@ -2,24 +2,87 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { INSTALLED_PLUGINS } from "../installed";
|
|
5
|
+
import { resolvePluginEntry } from "../sdk/types";
|
|
6
|
+
import { PluginDialogProvider } from "./dialogs";
|
|
5
7
|
import { PluginHost } from "./host";
|
|
6
8
|
import { PluginRegistry } from "./registry";
|
|
7
9
|
const PluginHostContext = React.createContext(null);
|
|
8
|
-
function PluginHostProvider({
|
|
10
|
+
function PluginHostProvider({
|
|
11
|
+
children,
|
|
12
|
+
plugins = INSTALLED_PLUGINS,
|
|
13
|
+
enabledSlugs,
|
|
14
|
+
configs
|
|
15
|
+
}) {
|
|
9
16
|
const registry = React.useMemo(() => new PluginRegistry(), []);
|
|
17
|
+
const host = React.useMemo(() => new PluginHost(registry), [registry]);
|
|
18
|
+
const [sources, setSources] = React.useState(null);
|
|
10
19
|
const [ready, setReady] = React.useState(false);
|
|
20
|
+
const enabledKey = React.useMemo(
|
|
21
|
+
() => enabledSlugs ? [...enabledSlugs].sort().join("\0") : null,
|
|
22
|
+
[enabledSlugs]
|
|
23
|
+
);
|
|
24
|
+
const enabled = React.useMemo(
|
|
25
|
+
() => enabledKey === null ? null : new Set(enabledKey.split("\0")),
|
|
26
|
+
[enabledKey]
|
|
27
|
+
);
|
|
28
|
+
const configsKey = React.useMemo(() => configs ? JSON.stringify(configs) : "", [configs]);
|
|
29
|
+
const resolvedConfigs = React.useMemo(
|
|
30
|
+
() => configsKey ? JSON.parse(configsKey) : {},
|
|
31
|
+
[configsKey]
|
|
32
|
+
);
|
|
11
33
|
React.useEffect(() => {
|
|
12
|
-
|
|
13
|
-
async function
|
|
14
|
-
|
|
15
|
-
await
|
|
34
|
+
let cancelled = false;
|
|
35
|
+
async function resolve() {
|
|
36
|
+
try {
|
|
37
|
+
const resolved = typeof plugins === "function" ? await plugins() : plugins;
|
|
38
|
+
if (!cancelled) setSources(resolved);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error("Failed to resolve the plugin list:", err);
|
|
41
|
+
if (!cancelled) setSources([]);
|
|
16
42
|
}
|
|
17
|
-
setReady(true);
|
|
18
43
|
}
|
|
19
|
-
void
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
void resolve();
|
|
45
|
+
return () => {
|
|
46
|
+
cancelled = true;
|
|
47
|
+
};
|
|
48
|
+
}, [plugins]);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (!sources) return;
|
|
51
|
+
let cancelled = false;
|
|
52
|
+
async function sync() {
|
|
53
|
+
var _a;
|
|
54
|
+
for (const { manifest, entry } of sources != null ? sources : []) {
|
|
55
|
+
if (cancelled) return;
|
|
56
|
+
const slug = manifest == null ? void 0 : manifest.slug;
|
|
57
|
+
if (typeof slug !== "string" || !slug) {
|
|
58
|
+
await host.loadPlugin(manifest, { activate: () => {
|
|
59
|
+
} }, {});
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const shouldRun = enabled === null || enabled.has(slug);
|
|
63
|
+
const isRunning = host.getStatus(slug) === "active";
|
|
64
|
+
if (shouldRun && !isRunning) {
|
|
65
|
+
try {
|
|
66
|
+
await host.loadPlugin(manifest, await resolvePluginEntry(entry), (_a = resolvedConfigs[slug]) != null ? _a : {});
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error(`Failed to load plugin "${slug}":`, error);
|
|
69
|
+
}
|
|
70
|
+
} else if (!shouldRun && isRunning) {
|
|
71
|
+
await host.unloadPlugin(slug);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!cancelled) setReady(true);
|
|
75
|
+
}
|
|
76
|
+
void sync();
|
|
77
|
+
return () => {
|
|
78
|
+
cancelled = true;
|
|
79
|
+
};
|
|
80
|
+
}, [sources, host, enabled, resolvedConfigs]);
|
|
81
|
+
const value = React.useMemo(
|
|
82
|
+
() => ({ registry, host, ready, configs: resolvedConfigs }),
|
|
83
|
+
[registry, host, ready, resolvedConfigs]
|
|
84
|
+
);
|
|
85
|
+
return /* @__PURE__ */ jsx(PluginHostContext.Provider, { value, children: /* @__PURE__ */ jsx(PluginDialogProvider, { children }) });
|
|
23
86
|
}
|
|
24
87
|
function usePluginRegistry() {
|
|
25
88
|
const context = React.useContext(PluginHostContext);
|
|
@@ -33,8 +96,32 @@ function usePluginsReady() {
|
|
|
33
96
|
const context = React.useContext(PluginHostContext);
|
|
34
97
|
return (_a = context == null ? void 0 : context.ready) != null ? _a : false;
|
|
35
98
|
}
|
|
99
|
+
function usePluginHost() {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
return (_b = (_a = React.useContext(PluginHostContext)) == null ? void 0 : _a.host) != null ? _b : null;
|
|
102
|
+
}
|
|
103
|
+
function usePluginConfigs() {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
return (_b = (_a = React.useContext(PluginHostContext)) == null ? void 0 : _a.configs) != null ? _b : EMPTY_CONFIGS;
|
|
106
|
+
}
|
|
107
|
+
const EMPTY_CONFIGS = {};
|
|
108
|
+
function usePluginContributions(key) {
|
|
109
|
+
const registry = usePluginRegistry();
|
|
110
|
+
const subscribe = React.useCallback(
|
|
111
|
+
(onStoreChange) => registry.subscribe(onStoreChange),
|
|
112
|
+
[registry]
|
|
113
|
+
);
|
|
114
|
+
const getSnapshot = React.useCallback(
|
|
115
|
+
() => registry.getAll(key),
|
|
116
|
+
[registry, key]
|
|
117
|
+
);
|
|
118
|
+
return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
119
|
+
}
|
|
36
120
|
export {
|
|
37
121
|
PluginHostProvider,
|
|
122
|
+
usePluginConfigs,
|
|
123
|
+
usePluginContributions,
|
|
124
|
+
usePluginHost,
|
|
38
125
|
usePluginRegistry,
|
|
39
126
|
usePluginsReady
|
|
40
127
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/provider.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 { INSTALLED_PLUGINS } from '../installed'\r\n\r\nimport { PluginHost } from './host'\r\nimport { PluginRegistry } from './registry'\r\n\r\ninterface PluginHostContextValue {\r\n registry: PluginRegistry\r\n ready: boolean\r\n}\r\n\r\nconst PluginHostContext = React.createContext<PluginHostContextValue | null>(null)\r\n\r\nexport function PluginHostProvider({ children }: { children: React.ReactNode }) {\r\n const registry = React.useMemo(() => new PluginRegistry(), [])\r\n const [ready, setReady] = React.useState(false)\r\n\r\n React.useEffect(() => {\r\n const host = new PluginHost(registry)\r\n\r\n async function loadPlugins() {\r\n for (const { manifest, entry } of INSTALLED_PLUGINS) {\r\n await host.loadPlugin(manifest, entry, {})\r\n }\r\n setReady(true)\r\n }\r\n\r\n void loadPlugins()\r\n }, [registry])\r\n\r\n const value = React.useMemo(() => ({ registry, ready }), [registry, ready])\r\n\r\n return (\r\n <PluginHostContext.Provider value={value}>\r\n {children}\r\n </PluginHostContext.Provider>\r\n )\r\n}\r\n\r\nexport function usePluginRegistry(): PluginRegistry {\r\n const context = React.useContext(PluginHostContext)\r\n if (!context) {\r\n throw new Error('usePluginRegistry must be used within PluginHostProvider')\r\n }\r\n return context.registry\r\n}\r\n\r\nexport function usePluginsReady(): boolean {\r\n const context = React.useContext(PluginHostContext)\r\n return context?.ready ?? false\r\n}\r\n"],"mappings":";AAuCI;AAlCJ,YAAY,WAAW;AAEvB,SAAS,yBAAyB;AAElC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAO/B,MAAM,oBAAoB,MAAM,cAA6C,IAAI;AAE1E,SAAS,mBAAmB,EAAE,SAAS,GAAkC;AAC9E,QAAM,WAAW,MAAM,QAAQ,MAAM,IAAI,eAAe,GAAG,CAAC,CAAC;AAC7D,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,KAAK;AAE9C,QAAM,UAAU,MAAM;AACpB,UAAM,OAAO,IAAI,WAAW,QAAQ;AAEpC,mBAAe,cAAc;AAC3B,iBAAW,EAAE,UAAU,MAAM,KAAK,mBAAmB;AACnD,cAAM,KAAK,WAAW,UAAU,OAAO,CAAC,CAAC;AAAA,MAC3C;AACA,eAAS,IAAI;AAAA,IACf;AAEA,SAAK,YAAY;AAAA,EACnB,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,QAAQ,MAAM,QAAQ,OAAO,EAAE,UAAU,MAAM,IAAI,CAAC,UAAU,KAAK,CAAC;AAE1E,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OACzB,UACH;AAEJ;AAEO,SAAS,oBAAoC;AAClD,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,SAAO,QAAQ;AACjB;AAEO,SAAS,kBAA2B;AArD3C;AAsDE,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,UAAO,wCAAS,UAAT,YAAkB;AAC3B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/provider.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 { INSTALLED_PLUGINS } from '../installed'\r\n\r\nimport { resolvePluginEntry } from '../sdk/types'\r\n\r\nimport { PluginDialogProvider } from './dialogs'\r\nimport { PluginHost } from './host'\r\nimport { PluginRegistry } from './registry'\r\n\r\n\r\nimport type { CapabilityRegistry, PluginSource, PluginsInput } from '../sdk/types'\r\n\r\ninterface PluginHostContextValue {\r\n registry: PluginRegistry\r\n host: PluginHost\r\n ready: boolean\r\n configs: Record<string, Record<string, unknown>>\r\n}\r\n\r\nconst PluginHostContext = React.createContext<PluginHostContextValue | null>(null)\r\n\r\nexport interface PluginHostProviderProps {\r\n children: React.ReactNode\r\n /**\r\n * The plugins to load. Defaults to the set compiled into core. Pass a stable\r\n * reference — a module-scope array or a `useCallback` thunk — since a fresh\r\n * literal re-resolves the list on every render.\r\n */\r\n plugins?: PluginsInput\r\n /**\r\n * Slugs to activate. `undefined` activates everything, for consumers that do not\r\n * manage enablement. An array is authoritative: anything unlisted stays inactive,\r\n * and removing a slug deactivates that plugin in place, without a reload.\r\n */\r\n enabledSlugs?: string[]\r\n /** Per-plugin configuration, keyed by slug. Reaches the plugin as `ctx.config`. */\r\n configs?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function PluginHostProvider({\r\n children,\r\n plugins = INSTALLED_PLUGINS,\r\n enabledSlugs,\r\n configs,\r\n}: PluginHostProviderProps) {\r\n const registry = React.useMemo(() => new PluginRegistry(), [])\r\n const host = React.useMemo(() => new PluginHost(registry), [registry])\r\n\r\n const [sources, setSources] = React.useState<PluginSource[] | null>(null)\r\n const [ready, setReady] = React.useState(false)\r\n\r\n // Both normalized to an identity derived from their content: the props arrive as\r\n // fresh literals from a fetch, and using them as effect deps directly would reload\r\n // every plugin on every render. The JSON round-trip also drops anything\r\n // non-serializable, which is correct — config originates as JSON.\r\n const enabledKey = React.useMemo(\r\n () => (enabledSlugs ? [...enabledSlugs].sort().join('\\u0000') : null),\r\n [enabledSlugs],\r\n )\r\n const enabled = React.useMemo(\r\n () => (enabledKey === null ? null : new Set(enabledKey.split('\\u0000'))),\r\n [enabledKey],\r\n )\r\n\r\n const configsKey = React.useMemo(() => (configs ? JSON.stringify(configs) : ''), [configs])\r\n const resolvedConfigs = React.useMemo<Record<string, Record<string, unknown>>>(\r\n () => (configsKey ? JSON.parse(configsKey) : {}),\r\n [configsKey],\r\n )\r\n\r\n // Resolve the list first: for runtime-loaded plugins that is a fetch plus a\r\n // dynamic import per bundle, so it cannot happen during render.\r\n React.useEffect(() => {\r\n let cancelled = false\r\n\r\n async function resolve() {\r\n try {\r\n const resolved = typeof plugins === 'function' ? await plugins() : plugins\r\n if (!cancelled) setSources(resolved)\r\n } catch (err) {\r\n // A plugin source that cannot be resolved must not take down the app.\r\n console.error('Failed to resolve the plugin list:', err)\r\n if (!cancelled) setSources([])\r\n }\r\n }\r\n\r\n void resolve()\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [plugins])\r\n\r\n // Reconcile: activate what should be running, deactivate what should not.\r\n // Runs again whenever enablement or config changes, so the plugins page can\r\n // toggle a plugin without a page reload.\r\n React.useEffect(() => {\r\n if (!sources) return\r\n let cancelled = false\r\n\r\n async function sync() {\r\n for (const { manifest, entry } of sources ?? []) {\r\n if (cancelled) return\r\n\r\n const slug = manifest?.slug\r\n if (typeof slug !== 'string' || !slug) {\r\n // Let the host reject it, so the failure is recorded. The entry is never\r\n // resolved: no point fetching a chunk for a plugin that cannot activate.\r\n await host.loadPlugin(manifest, { activate: () => {} }, {})\r\n continue\r\n }\r\n\r\n const shouldRun = enabled === null || enabled.has(slug)\r\n const isRunning = host.getStatus(slug) === 'active'\r\n\r\n if (shouldRun && !isRunning) {\r\n // Resolving the entry is what downloads a compiled-in plugin's chunk, so it\r\n // happens here rather than at module scope.\r\n try {\r\n await host.loadPlugin(manifest, await resolvePluginEntry(entry), resolvedConfigs[slug] ?? {})\r\n } catch (error) {\r\n // A chunk that fails to load must not stop the plugins after it.\r\n console.error(`Failed to load plugin \"${slug}\":`, error)\r\n }\r\n } else if (!shouldRun && isRunning) {\r\n await host.unloadPlugin(slug)\r\n }\r\n }\r\n\r\n if (!cancelled) setReady(true)\r\n }\r\n\r\n void sync()\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [sources, host, enabled, resolvedConfigs])\r\n\r\n const value = React.useMemo(\r\n () => ({ registry, host, ready, configs: resolvedConfigs }),\r\n [registry, host, ready, resolvedConfigs],\r\n )\r\n\r\n return (\r\n <PluginHostContext.Provider value={value}>\r\n <PluginDialogProvider>\r\n {children}\r\n </PluginDialogProvider>\r\n </PluginHostContext.Provider>\r\n )\r\n}\r\n\r\nexport function usePluginRegistry(): PluginRegistry {\r\n const context = React.useContext(PluginHostContext)\r\n if (!context) {\r\n throw new Error('usePluginRegistry must be used within PluginHostProvider')\r\n }\r\n return context.registry\r\n}\r\n\r\nexport function usePluginsReady(): boolean {\r\n const context = React.useContext(PluginHostContext)\r\n return context?.ready ?? false\r\n}\r\n\r\n/** The host itself. Only the plugins page needs this; capability consumers do not. */\r\nexport function usePluginHost(): PluginHost | null {\r\n return React.useContext(PluginHostContext)?.host ?? null\r\n}\r\n\r\n/**\r\n * Every plugin's configuration, keyed by slug, for capability hosts to pass into\r\n * `PluginScopeProvider`. Plugins use `usePluginConfig()` from the SDK instead — a plugin\r\n * component importing this module puts `installed.ts` and the host in a cycle.\r\n */\r\nexport function usePluginConfigs(): Record<string, Record<string, unknown>> {\r\n return React.useContext(PluginHostContext)?.configs ?? EMPTY_CONFIGS\r\n}\r\n\r\nconst EMPTY_CONFIGS: Record<string, Record<string, unknown>> = {}\r\n\r\nexport type PluginContribution<K extends keyof CapabilityRegistry> =\r\n CapabilityRegistry[K] & { pluginId: string }\r\n\r\n/**\r\n * Read a capability's contributions and re-render when they change — the one way a host\r\n * component should consume the registry. `registry.getAll()` during render only works\r\n * when plugins load before first paint; a runtime-loaded plugin registers after the\r\n * consumer rendered, with nothing to tell it to look again.\r\n */\r\nexport function usePluginContributions<K extends keyof CapabilityRegistry>(\r\n key: K,\r\n): PluginContribution<K>[] {\r\n const registry = usePluginRegistry()\r\n\r\n const subscribe = React.useCallback(\r\n (onStoreChange: () => void) => registry.subscribe(onStoreChange),\r\n [registry],\r\n )\r\n\r\n // Copy-on-write in the registry makes this a stable reference between changes, which is\r\n // what lets useSyncExternalStore skip consumers of untouched capabilities.\r\n const getSnapshot = React.useCallback(\r\n () => registry.getAll(key) as unknown as PluginContribution<K>[],\r\n [registry, key],\r\n )\r\n\r\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\r\n}\r\n"],"mappings":";AAsJM;AAjJN,YAAY,WAAW;AAEvB,SAAS,yBAAyB;AAElC,SAAS,0BAA0B;AAEnC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAY/B,MAAM,oBAAoB,MAAM,cAA6C,IAAI;AAoB1E,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAA4B;AAC1B,QAAM,WAAW,MAAM,QAAQ,MAAM,IAAI,eAAe,GAAG,CAAC,CAAC;AAC7D,QAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,WAAW,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAErE,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAgC,IAAI;AACxE,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,KAAK;AAM9C,QAAM,aAAa,MAAM;AAAA,IACvB,MAAO,eAAe,CAAC,GAAG,YAAY,EAAE,KAAK,EAAE,KAAK,IAAQ,IAAI;AAAA,IAChE,CAAC,YAAY;AAAA,EACf;AACA,QAAM,UAAU,MAAM;AAAA,IACpB,MAAO,eAAe,OAAO,OAAO,IAAI,IAAI,WAAW,MAAM,IAAQ,CAAC;AAAA,IACtE,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,aAAa,MAAM,QAAQ,MAAO,UAAU,KAAK,UAAU,OAAO,IAAI,IAAK,CAAC,OAAO,CAAC;AAC1F,QAAM,kBAAkB,MAAM;AAAA,IAC5B,MAAO,aAAa,KAAK,MAAM,UAAU,IAAI,CAAC;AAAA,IAC9C,CAAC,UAAU;AAAA,EACb;AAIA,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAEhB,mBAAe,UAAU;AACvB,UAAI;AACF,cAAM,WAAW,OAAO,YAAY,aAAa,MAAM,QAAQ,IAAI;AACnE,YAAI,CAAC,UAAW,YAAW,QAAQ;AAAA,MACrC,SAAS,KAAK;AAEZ,gBAAQ,MAAM,sCAAsC,GAAG;AACvD,YAAI,CAAC,UAAW,YAAW,CAAC,CAAC;AAAA,MAC/B;AAAA,IACF;AAEA,SAAK,QAAQ;AACb,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAKZ,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,QAAS;AACd,QAAI,YAAY;AAEhB,mBAAe,OAAO;AAzG1B;AA0GM,iBAAW,EAAE,UAAU,MAAM,KAAK,4BAAW,CAAC,GAAG;AAC/C,YAAI,UAAW;AAEf,cAAM,OAAO,qCAAU;AACvB,YAAI,OAAO,SAAS,YAAY,CAAC,MAAM;AAGrC,gBAAM,KAAK,WAAW,UAAU,EAAE,UAAU,MAAM;AAAA,UAAC,EAAE,GAAG,CAAC,CAAC;AAC1D;AAAA,QACF;AAEA,cAAM,YAAY,YAAY,QAAQ,QAAQ,IAAI,IAAI;AACtD,cAAM,YAAY,KAAK,UAAU,IAAI,MAAM;AAE3C,YAAI,aAAa,CAAC,WAAW;AAG3B,cAAI;AACF,kBAAM,KAAK,WAAW,UAAU,MAAM,mBAAmB,KAAK,IAAG,qBAAgB,IAAI,MAApB,YAAyB,CAAC,CAAC;AAAA,UAC9F,SAAS,OAAO;AAEd,oBAAQ,MAAM,0BAA0B,IAAI,MAAM,KAAK;AAAA,UACzD;AAAA,QACF,WAAW,CAAC,aAAa,WAAW;AAClC,gBAAM,KAAK,aAAa,IAAI;AAAA,QAC9B;AAAA,MACF;AAEA,UAAI,CAAC,UAAW,UAAS,IAAI;AAAA,IAC/B;AAEA,SAAK,KAAK;AACV,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,SAAS,MAAM,SAAS,eAAe,CAAC;AAE5C,QAAM,QAAQ,MAAM;AAAA,IAClB,OAAO,EAAE,UAAU,MAAM,OAAO,SAAS,gBAAgB;AAAA,IACzD,CAAC,UAAU,MAAM,OAAO,eAAe;AAAA,EACzC;AAEA,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAC1B,8BAAC,wBACE,UACH,GACF;AAEJ;AAEO,SAAS,oBAAoC;AAClD,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,SAAO,QAAQ;AACjB;AAEO,SAAS,kBAA2B;AArK3C;AAsKE,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,UAAO,wCAAS,UAAT,YAAkB;AAC3B;AAGO,SAAS,gBAAmC;AA3KnD;AA4KE,UAAO,iBAAM,WAAW,iBAAiB,MAAlC,mBAAqC,SAArC,YAA6C;AACtD;AAOO,SAAS,mBAA4D;AApL5E;AAqLE,UAAO,iBAAM,WAAW,iBAAiB,MAAlC,mBAAqC,YAArC,YAAgD;AACzD;AAEA,MAAM,gBAAyD,CAAC;AAWzD,SAAS,uBACd,KACyB;AACzB,QAAM,WAAW,kBAAkB;AAEnC,QAAM,YAAY,MAAM;AAAA,IACtB,CAAC,kBAA8B,SAAS,UAAU,aAAa;AAAA,IAC/D,CAAC,QAAQ;AAAA,EACX;AAIA,QAAM,cAAc,MAAM;AAAA,IACxB,MAAM,SAAS,OAAO,GAAG;AAAA,IACzB,CAAC,UAAU,GAAG;AAAA,EAChB;AAEA,SAAO,MAAM,qBAAqB,WAAW,aAAa,WAAW;AACvE;","names":[]}
|
|
@@ -6,9 +6,23 @@ export interface RegistryEntry {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class PluginRegistry {
|
|
8
8
|
private entries;
|
|
9
|
+
private listeners;
|
|
10
|
+
private version;
|
|
11
|
+
/**
|
|
12
|
+
* Copy-on-write: a mutation replaces the array rather than pushing into it.
|
|
13
|
+
* Consumers read through `useSyncExternalStore`, which bails out when the snapshot
|
|
14
|
+
* is `Object.is`-equal, so an in-place push would notify and then be discarded.
|
|
15
|
+
* Copying also leaves untouched extension points at their old identity, so
|
|
16
|
+
* registering a map tool does not re-render the BIM toolbar.
|
|
17
|
+
*/
|
|
9
18
|
register(extensionPoint: PluginCapability | string, entry: RegistryEntry): void;
|
|
10
19
|
getAll<T extends RegistryEntry = RegistryEntry>(extensionPoint: string): T[];
|
|
11
20
|
deregisterAll(pluginId: string): void;
|
|
12
21
|
clear(): void;
|
|
22
|
+
/** Subscribe to contribution changes. Returns the unsubscribe function. */
|
|
23
|
+
subscribe(listener: () => void): () => void;
|
|
24
|
+
/** Monotonic counter, bumped on every actual change. Useful in tests and debug UI. */
|
|
25
|
+
getVersion(): number;
|
|
26
|
+
private bump;
|
|
13
27
|
}
|
|
14
28
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAKD,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,OAAO,CAAI;IAEnB;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,gBAAgB,GAAG,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAY/E,MAAM,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC,EAAE;IAI5E,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAcrC,KAAK,IAAI,IAAI;IAMb,2EAA2E;IAC3E,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C,sFAAsF;IACtF,UAAU,IAAI,MAAM;IAIpB,OAAO,CAAC,IAAI;CAIb"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
const EMPTY = Object.freeze([]);
|
|
1
2
|
class PluginRegistry {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.entries = /* @__PURE__ */ new Map();
|
|
5
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
this.version = 0;
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Copy-on-write: a mutation replaces the array rather than pushing into it.
|
|
10
|
+
* Consumers read through `useSyncExternalStore`, which bails out when the snapshot
|
|
11
|
+
* is `Object.is`-equal, so an in-place push would notify and then be discarded.
|
|
12
|
+
* Copying also leaves untouched extension points at their old identity, so
|
|
13
|
+
* registering a map tool does not re-render the BIM toolbar.
|
|
14
|
+
*/
|
|
5
15
|
register(extensionPoint, entry) {
|
|
6
16
|
var _a;
|
|
7
17
|
const list = (_a = this.entries.get(extensionPoint)) != null ? _a : [];
|
|
@@ -9,20 +19,43 @@ class PluginRegistry {
|
|
|
9
19
|
const exists = list.some((e) => e.pluginId === entry.pluginId && e.id === entry.id);
|
|
10
20
|
if (exists) return;
|
|
11
21
|
}
|
|
12
|
-
|
|
13
|
-
this.
|
|
22
|
+
this.entries.set(extensionPoint, [...list, entry]);
|
|
23
|
+
this.bump();
|
|
14
24
|
}
|
|
15
25
|
getAll(extensionPoint) {
|
|
16
26
|
var _a;
|
|
17
|
-
return (_a = this.entries.get(extensionPoint)) != null ? _a :
|
|
27
|
+
return (_a = this.entries.get(extensionPoint)) != null ? _a : EMPTY;
|
|
18
28
|
}
|
|
19
29
|
deregisterAll(pluginId) {
|
|
30
|
+
let changed = false;
|
|
20
31
|
for (const [point, entries] of this.entries) {
|
|
21
|
-
|
|
32
|
+
const remaining = entries.filter((e) => e.pluginId !== pluginId);
|
|
33
|
+
if (remaining.length !== entries.length) {
|
|
34
|
+
this.entries.set(point, remaining);
|
|
35
|
+
changed = true;
|
|
36
|
+
}
|
|
22
37
|
}
|
|
38
|
+
if (changed) this.bump();
|
|
23
39
|
}
|
|
24
40
|
clear() {
|
|
41
|
+
if (this.entries.size === 0) return;
|
|
25
42
|
this.entries.clear();
|
|
43
|
+
this.bump();
|
|
44
|
+
}
|
|
45
|
+
/** Subscribe to contribution changes. Returns the unsubscribe function. */
|
|
46
|
+
subscribe(listener) {
|
|
47
|
+
this.listeners.add(listener);
|
|
48
|
+
return () => {
|
|
49
|
+
this.listeners.delete(listener);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Monotonic counter, bumped on every actual change. Useful in tests and debug UI. */
|
|
53
|
+
getVersion() {
|
|
54
|
+
return this.version;
|
|
55
|
+
}
|
|
56
|
+
bump() {
|
|
57
|
+
this.version++;
|
|
58
|
+
for (const listener of this.listeners) listener();
|
|
26
59
|
}
|
|
27
60
|
}
|
|
28
61
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/registry.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { PluginCapability } from '../sdk/types'\r\n\r\nexport interface RegistryEntry {\r\n pluginId: string\r\n id?: string\r\n [key: string]: unknown\r\n}\r\n\r\nexport class PluginRegistry {\r\n private entries: Map<string, RegistryEntry[]> = new Map()\r\n\r\n register(extensionPoint: PluginCapability | string, entry: RegistryEntry): void {\r\n const list = this.entries.get(extensionPoint) ?? []\r\n\r\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/registry.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { PluginCapability } from '../sdk/types'\r\n\r\nexport interface RegistryEntry {\r\n pluginId: string\r\n id?: string\r\n [key: string]: unknown\r\n}\r\n\r\n/** Shared identity for \"nothing registered here\", so getAll() is snapshot-stable. */\r\nconst EMPTY: readonly RegistryEntry[] = Object.freeze([])\r\n\r\nexport class PluginRegistry {\r\n private entries: Map<string, RegistryEntry[]> = new Map()\r\n private listeners: Set<() => void> = new Set()\r\n private version = 0\r\n\r\n /**\r\n * Copy-on-write: a mutation replaces the array rather than pushing into it.\r\n * Consumers read through `useSyncExternalStore`, which bails out when the snapshot\r\n * is `Object.is`-equal, so an in-place push would notify and then be discarded.\r\n * Copying also leaves untouched extension points at their old identity, so\r\n * registering a map tool does not re-render the BIM toolbar.\r\n */\r\n register(extensionPoint: PluginCapability | string, entry: RegistryEntry): void {\r\n const list = this.entries.get(extensionPoint) ?? []\r\n\r\n if (entry.id) {\r\n const exists = list.some(e => e.pluginId === entry.pluginId && e.id === entry.id)\r\n if (exists) return\r\n }\r\n\r\n this.entries.set(extensionPoint, [...list, entry])\r\n this.bump()\r\n }\r\n\r\n getAll<T extends RegistryEntry = RegistryEntry>(extensionPoint: string): T[] {\r\n return (this.entries.get(extensionPoint) ?? EMPTY) as T[]\r\n }\r\n\r\n deregisterAll(pluginId: string): void {\r\n let changed = false\r\n\r\n for (const [point, entries] of this.entries) {\r\n const remaining = entries.filter(e => e.pluginId !== pluginId)\r\n if (remaining.length !== entries.length) {\r\n this.entries.set(point, remaining)\r\n changed = true\r\n }\r\n }\r\n\r\n if (changed) this.bump()\r\n }\r\n\r\n clear(): void {\r\n if (this.entries.size === 0) return\r\n this.entries.clear()\r\n this.bump()\r\n }\r\n\r\n /** Subscribe to contribution changes. Returns the unsubscribe function. */\r\n subscribe(listener: () => void): () => void {\r\n this.listeners.add(listener)\r\n return () => {\r\n this.listeners.delete(listener)\r\n }\r\n }\r\n\r\n /** Monotonic counter, bumped on every actual change. Useful in tests and debug UI. */\r\n getVersion(): number {\r\n return this.version\r\n }\r\n\r\n private bump(): void {\r\n this.version++\r\n for (const listener of this.listeners) listener()\r\n }\r\n}\r\n"],"mappings":"AAYA,MAAM,QAAkC,OAAO,OAAO,CAAC,CAAC;AAEjD,MAAM,eAAe;AAAA,EAArB;AACL,SAAQ,UAAwC,oBAAI,IAAI;AACxD,SAAQ,YAA6B,oBAAI,IAAI;AAC7C,SAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlB,SAAS,gBAA2C,OAA4B;AA1BlF;AA2BI,UAAM,QAAO,UAAK,QAAQ,IAAI,cAAc,MAA/B,YAAoC,CAAC;AAElD,QAAI,MAAM,IAAI;AACZ,YAAM,SAAS,KAAK,KAAK,OAAK,EAAE,aAAa,MAAM,YAAY,EAAE,OAAO,MAAM,EAAE;AAChF,UAAI,OAAQ;AAAA,IACd;AAEA,SAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,MAAM,KAAK,CAAC;AACjD,SAAK,KAAK;AAAA,EACZ;AAAA,EAEA,OAAgD,gBAA6B;AAtC/E;AAuCI,YAAQ,UAAK,QAAQ,IAAI,cAAc,MAA/B,YAAoC;AAAA,EAC9C;AAAA,EAEA,cAAc,UAAwB;AACpC,QAAI,UAAU;AAEd,eAAW,CAAC,OAAO,OAAO,KAAK,KAAK,SAAS;AAC3C,YAAM,YAAY,QAAQ,OAAO,OAAK,EAAE,aAAa,QAAQ;AAC7D,UAAI,UAAU,WAAW,QAAQ,QAAQ;AACvC,aAAK,QAAQ,IAAI,OAAO,SAAS;AACjC,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,QAAS,MAAK,KAAK;AAAA,EACzB;AAAA,EAEA,QAAc;AACZ,QAAI,KAAK,QAAQ,SAAS,EAAG;AAC7B,SAAK,QAAQ,MAAM;AACnB,SAAK,KAAK;AAAA,EACZ;AAAA;AAAA,EAGA,UAAU,UAAkC;AAC1C,SAAK,UAAU,IAAI,QAAQ;AAC3B,WAAO,MAAM;AACX,WAAK,UAAU,OAAO,QAAQ;AAAA,IAChC;AAAA,EACF;AAAA;AAAA,EAGA,aAAqB;AACnB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAa;AACnB,SAAK;AACL,eAAW,YAAY,KAAK,UAAW,UAAS;AAAA,EAClD;AACF;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */
|
|
2
|
+
export interface RuntimeShim {
|
|
3
|
+
/** Filename served under `/plugin-runtime/`. */
|
|
4
|
+
file: string;
|
|
5
|
+
/** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */
|
|
6
|
+
bridge: string;
|
|
7
|
+
/** The bare specifier the plugin writes. */
|
|
8
|
+
specifier: string;
|
|
9
|
+
/** Re-exported by name, because an import map cannot rewrite a namespace. */
|
|
10
|
+
exports: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[];
|
|
13
|
+
/** Just the specifiers, which is what a bundler's `external` option wants. */
|
|
14
|
+
export declare const PLUGIN_EXTERNALS: readonly string[];
|
|
15
|
+
//# sourceMappingURL=runtimeShims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeShims.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"names":[],"mappings":"AAGA,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAUD,eAAO,MAAM,oBAAoB,EAAE,SAAS,WAAW,EAgFtD,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAA"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const PLUGIN_RUNTIME_SHIMS = [
|
|
2
|
+
{
|
|
3
|
+
file: "react.js",
|
|
4
|
+
bridge: "react",
|
|
5
|
+
specifier: "react",
|
|
6
|
+
exports: [
|
|
7
|
+
"Children",
|
|
8
|
+
"Component",
|
|
9
|
+
"Fragment",
|
|
10
|
+
"Profiler",
|
|
11
|
+
"PureComponent",
|
|
12
|
+
"StrictMode",
|
|
13
|
+
"Suspense",
|
|
14
|
+
"cloneElement",
|
|
15
|
+
"createContext",
|
|
16
|
+
"createElement",
|
|
17
|
+
"createRef",
|
|
18
|
+
"forwardRef",
|
|
19
|
+
"isValidElement",
|
|
20
|
+
"lazy",
|
|
21
|
+
"memo",
|
|
22
|
+
"startTransition",
|
|
23
|
+
"useCallback",
|
|
24
|
+
"useContext",
|
|
25
|
+
"useDebugValue",
|
|
26
|
+
"useDeferredValue",
|
|
27
|
+
"useEffect",
|
|
28
|
+
"useId",
|
|
29
|
+
"useImperativeHandle",
|
|
30
|
+
"useInsertionEffect",
|
|
31
|
+
"useLayoutEffect",
|
|
32
|
+
"useMemo",
|
|
33
|
+
"useReducer",
|
|
34
|
+
"useRef",
|
|
35
|
+
"useState",
|
|
36
|
+
"useSyncExternalStore",
|
|
37
|
+
"useTransition",
|
|
38
|
+
"version"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
file: "react-dom.js",
|
|
43
|
+
bridge: "reactDom",
|
|
44
|
+
specifier: "react-dom",
|
|
45
|
+
exports: ["createPortal", "flushSync", "version"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
file: "jsx-runtime.js",
|
|
49
|
+
bridge: "jsxRuntime",
|
|
50
|
+
specifier: "react/jsx-runtime",
|
|
51
|
+
exports: ["Fragment", "jsx", "jsxs"]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
file: "sdk.js",
|
|
55
|
+
bridge: "sdk",
|
|
56
|
+
specifier: "@collabdt/core/plugins-sdk",
|
|
57
|
+
exports: [
|
|
58
|
+
"VALID_CAPABILITIES",
|
|
59
|
+
"validateManifest",
|
|
60
|
+
"PLUGIN_HOST_API",
|
|
61
|
+
"resolvePluginEntry",
|
|
62
|
+
// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.
|
|
63
|
+
"ViewerNames",
|
|
64
|
+
// So a plugin colouring something on the map uses the platform's palette.
|
|
65
|
+
"MAP_COLOUR_PALETTE",
|
|
66
|
+
"stringToColour"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
file: "sdk-config.js",
|
|
71
|
+
bridge: "sdkConfig",
|
|
72
|
+
specifier: "@collabdt/core/plugins-sdk/config",
|
|
73
|
+
exports: ["usePluginConfig", "usePluginId"]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
file: "sdk-messages.js",
|
|
77
|
+
bridge: "sdkMessages",
|
|
78
|
+
specifier: "@collabdt/core/plugins-sdk/messages",
|
|
79
|
+
exports: ["usePluginMessage", "usePluginTranslations", "useCoreTranslations"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
file: "sdk-store.js",
|
|
83
|
+
bridge: "sdkStore",
|
|
84
|
+
specifier: "@collabdt/core/plugins-sdk/store",
|
|
85
|
+
exports: ["usePluginStore"]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
file: "sdk-state.js",
|
|
89
|
+
bridge: "sdkState",
|
|
90
|
+
specifier: "@collabdt/core/plugins-sdk/state",
|
|
91
|
+
exports: ["usePluginState"]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
file: "sdk-ui.js",
|
|
95
|
+
bridge: "sdkUi",
|
|
96
|
+
specifier: "@collabdt/core/plugins-sdk/ui",
|
|
97
|
+
exports: ["usePluginDialogs"]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
file: "sdk-components.js",
|
|
101
|
+
bridge: "sdkComponents",
|
|
102
|
+
specifier: "@collabdt/core/plugins-sdk/components",
|
|
103
|
+
exports: [
|
|
104
|
+
"Badge",
|
|
105
|
+
"Button",
|
|
106
|
+
"Input",
|
|
107
|
+
"Separator",
|
|
108
|
+
"Card",
|
|
109
|
+
"CardContent",
|
|
110
|
+
"CardDescription",
|
|
111
|
+
"CardFooter",
|
|
112
|
+
"CardHeader",
|
|
113
|
+
"CardTitle",
|
|
114
|
+
"Dialog",
|
|
115
|
+
"DialogClose",
|
|
116
|
+
"DialogContent",
|
|
117
|
+
"DialogDescription",
|
|
118
|
+
"DialogFooter",
|
|
119
|
+
"DialogHeader",
|
|
120
|
+
"DialogTitle",
|
|
121
|
+
"DialogTrigger"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
const PLUGIN_EXTERNALS = PLUGIN_RUNTIME_SHIMS.map(
|
|
126
|
+
(shim) => shim.specifier
|
|
127
|
+
);
|
|
128
|
+
export {
|
|
129
|
+
PLUGIN_EXTERNALS,
|
|
130
|
+
PLUGIN_RUNTIME_SHIMS
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=runtimeShims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */\r\nexport interface RuntimeShim {\r\n /** Filename served under `/plugin-runtime/`. */\r\n file: string\r\n /** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */\r\n bridge: string\r\n /** The bare specifier the plugin writes. */\r\n specifier: string\r\n /** Re-exported by name, because an import map cannot rewrite a namespace. */\r\n exports: string[]\r\n}\r\n\r\n// Part of the host contract, so it lives beside `PLUGIN_HOST_API` rather than in the\r\n// app. Three consumers derive from it — the app's shim generator, the published import\r\n// map, and `@collabdt/plugin-kit`'s build preset — and when they disagree a plugin\r\n// either bundles a second copy of a singleton or dies on an unmapped specifier.\r\n//\r\n// Absent on purpose: `@thatopen/components`, `three`, `maplibre-gl`, `lucide-react`. A\r\n// plugin gets viewer instances as props and names icons by string, so it never imports\r\n// those at runtime — which is what stops a second copy of three.js loading.\r\nexport const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[] = [\r\n {\r\n file: 'react.js',\r\n bridge: 'react',\r\n specifier: 'react',\r\n exports: [\r\n 'Children', 'Component', 'Fragment', 'Profiler', 'PureComponent',\r\n 'StrictMode', 'Suspense', 'cloneElement', 'createContext',\r\n 'createElement', 'createRef', 'forwardRef', 'isValidElement', 'lazy',\r\n 'memo', 'startTransition', 'useCallback', 'useContext', 'useDebugValue',\r\n 'useDeferredValue', 'useEffect', 'useId', 'useImperativeHandle',\r\n 'useInsertionEffect', 'useLayoutEffect', 'useMemo', 'useReducer',\r\n 'useRef', 'useState', 'useSyncExternalStore', 'useTransition', 'version',\r\n ],\r\n },\r\n {\r\n file: 'react-dom.js',\r\n bridge: 'reactDom',\r\n specifier: 'react-dom',\r\n exports: ['createPortal', 'flushSync', 'version'],\r\n },\r\n {\r\n file: 'jsx-runtime.js',\r\n bridge: 'jsxRuntime',\r\n specifier: 'react/jsx-runtime',\r\n exports: ['Fragment', 'jsx', 'jsxs'],\r\n },\r\n {\r\n file: 'sdk.js',\r\n bridge: 'sdk',\r\n specifier: '@collabdt/core/plugins-sdk',\r\n exports: [\r\n 'VALID_CAPABILITIES', 'validateManifest', 'PLUGIN_HOST_API', 'resolvePluginEntry',\r\n // A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\r\n 'ViewerNames',\r\n // So a plugin colouring something on the map uses the platform's palette.\r\n 'MAP_COLOUR_PALETTE', 'stringToColour',\r\n ],\r\n },\r\n {\r\n file: 'sdk-config.js',\r\n bridge: 'sdkConfig',\r\n specifier: '@collabdt/core/plugins-sdk/config',\r\n exports: ['usePluginConfig', 'usePluginId'],\r\n },\r\n {\r\n file: 'sdk-messages.js',\r\n bridge: 'sdkMessages',\r\n specifier: '@collabdt/core/plugins-sdk/messages',\r\n exports: ['usePluginMessage', 'usePluginTranslations', 'useCoreTranslations'],\r\n },\r\n {\r\n file: 'sdk-store.js',\r\n bridge: 'sdkStore',\r\n specifier: '@collabdt/core/plugins-sdk/store',\r\n exports: ['usePluginStore'],\r\n },\r\n {\r\n file: 'sdk-state.js',\r\n bridge: 'sdkState',\r\n specifier: '@collabdt/core/plugins-sdk/state',\r\n exports: ['usePluginState'],\r\n },\r\n {\r\n file: 'sdk-ui.js',\r\n bridge: 'sdkUi',\r\n specifier: '@collabdt/core/plugins-sdk/ui',\r\n exports: ['usePluginDialogs'],\r\n },\r\n {\r\n file: 'sdk-components.js',\r\n bridge: 'sdkComponents',\r\n specifier: '@collabdt/core/plugins-sdk/components',\r\n exports: [\r\n 'Badge', 'Button', 'Input', 'Separator',\r\n 'Card', 'CardContent', 'CardDescription', 'CardFooter', 'CardHeader', 'CardTitle',\r\n 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription',\r\n 'DialogFooter', 'DialogHeader', 'DialogTitle', 'DialogTrigger',\r\n ],\r\n },\r\n]\r\n\r\n/** Just the specifiers, which is what a bundler's `external` option wants. */\r\nexport const PLUGIN_EXTERNALS: readonly string[] = PLUGIN_RUNTIME_SHIMS.map(\r\n shim => shim.specifier,\r\n)\r\n"],"mappings":"AAuBO,MAAM,uBAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAY;AAAA,MAAa;AAAA,MAAY;AAAA,MAAY;AAAA,MACjD;AAAA,MAAc;AAAA,MAAY;AAAA,MAAgB;AAAA,MAC1C;AAAA,MAAiB;AAAA,MAAa;AAAA,MAAc;AAAA,MAAkB;AAAA,MAC9D;AAAA,MAAQ;AAAA,MAAmB;AAAA,MAAe;AAAA,MAAc;AAAA,MACxD;AAAA,MAAoB;AAAA,MAAa;AAAA,MAAS;AAAA,MAC1C;AAAA,MAAsB;AAAA,MAAmB;AAAA,MAAW;AAAA,MACpD;AAAA,MAAU;AAAA,MAAY;AAAA,MAAwB;AAAA,MAAiB;AAAA,IACjE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB,aAAa,SAAS;AAAA,EAClD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,YAAY,OAAO,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAsB;AAAA,MAAoB;AAAA,MAAmB;AAAA;AAAA,MAE7D;AAAA;AAAA,MAEA;AAAA,MAAsB;AAAA,IACxB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,mBAAmB,aAAa;AAAA,EAC5C;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,oBAAoB,yBAAyB,qBAAqB;AAAA,EAC9E;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAS;AAAA,MAAU;AAAA,MAAS;AAAA,MAC5B;AAAA,MAAQ;AAAA,MAAe;AAAA,MAAmB;AAAA,MAAc;AAAA,MAAc;AAAA,MACtE;AAAA,MAAU;AAAA,MAAe;AAAA,MAAiB;AAAA,MAC1C;AAAA,MAAgB;AAAA,MAAgB;AAAA,MAAe;AAAA,IACjD;AAAA,EACF;AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Names the plugin that owns the subtree, and carries its configuration. Every
|
|
4
|
+
* capability host wraps what it renders from the registry in one of these, which is
|
|
5
|
+
* how the SDK hooks are scoped without a plugin passing its own id around.
|
|
6
|
+
* `pluginId` comes from the registry entry, never from the plugin.
|
|
7
|
+
*
|
|
8
|
+
* Holds no reference to the host or `installed.ts`: plugin components import from
|
|
9
|
+
* here and `installed.ts` imports plugin components, so reaching back would make the
|
|
10
|
+
* module graph a cycle and leave the bindings undefined at render time.
|
|
11
|
+
*/
|
|
12
|
+
export declare function PluginScopeProvider({ pluginId, config, children, }: {
|
|
13
|
+
pluginId: string;
|
|
14
|
+
config?: Record<string, unknown>;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
/** The owning plugin's id. Throws outside a plugin subtree: a shared fallback would mix plugins' data. */
|
|
18
|
+
export declare function usePluginId(): string;
|
|
19
|
+
/** The org's config for this plugin, layered with per-user overrides. Shaped by the manifest's `configSchema`. */
|
|
20
|
+
export declare function usePluginConfig<T extends Record<string, unknown> = Record<string, unknown>>(): T;
|
|
21
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/scope.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,qBAWA;AAED,0GAA0G;AAC1G,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,kHAAkH;AAClH,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACxD,CAAC,CAEL"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
const PluginScopeContext = React.createContext(null);
|
|
5
|
+
function PluginScopeProvider({
|
|
6
|
+
pluginId,
|
|
7
|
+
config,
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const value = React.useMemo(
|
|
11
|
+
() => ({ pluginId, config: config != null ? config : {} }),
|
|
12
|
+
[pluginId, config]
|
|
13
|
+
);
|
|
14
|
+
return /* @__PURE__ */ jsx(PluginScopeContext.Provider, { value, children });
|
|
15
|
+
}
|
|
16
|
+
function usePluginId() {
|
|
17
|
+
return usePluginScope().pluginId;
|
|
18
|
+
}
|
|
19
|
+
function usePluginConfig() {
|
|
20
|
+
return usePluginScope().config;
|
|
21
|
+
}
|
|
22
|
+
function usePluginScope() {
|
|
23
|
+
const scope = React.useContext(PluginScopeContext);
|
|
24
|
+
if (scope === null) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"This hook is only available inside a plugin component. It must be rendered by a plugin capability host, which supplies the plugin scope."
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return scope;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
PluginScopeProvider,
|
|
33
|
+
usePluginConfig,
|
|
34
|
+
usePluginId
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/scope.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\ninterface PluginScope {\r\n pluginId: string\r\n config: Record<string, unknown>\r\n}\r\n\r\nconst PluginScopeContext = React.createContext<PluginScope | null>(null)\r\n\r\n/**\r\n * Names the plugin that owns the subtree, and carries its configuration. Every\r\n * capability host wraps what it renders from the registry in one of these, which is\r\n * how the SDK hooks are scoped without a plugin passing its own id around.\r\n * `pluginId` comes from the registry entry, never from the plugin.\r\n *\r\n * Holds no reference to the host or `installed.ts`: plugin components import from\r\n * here and `installed.ts` imports plugin components, so reaching back would make the\r\n * module graph a cycle and leave the bindings undefined at render time.\r\n */\r\nexport function PluginScopeProvider({\r\n pluginId,\r\n config,\r\n children,\r\n}: {\r\n pluginId: string\r\n config?: Record<string, unknown>\r\n children: React.ReactNode\r\n}) {\r\n const value = React.useMemo(\r\n () => ({ pluginId, config: config ?? {} }),\r\n [pluginId, config],\r\n )\r\n\r\n return (\r\n <PluginScopeContext.Provider value={value}>\r\n {children}\r\n </PluginScopeContext.Provider>\r\n )\r\n}\r\n\r\n/** The owning plugin's id. Throws outside a plugin subtree: a shared fallback would mix plugins' data. */\r\nexport function usePluginId(): string {\r\n return usePluginScope().pluginId\r\n}\r\n\r\n/** The org's config for this plugin, layered with per-user overrides. Shaped by the manifest's `configSchema`. */\r\nexport function usePluginConfig<\r\n T extends Record<string, unknown> = Record<string, unknown>,\r\n>(): T {\r\n return usePluginScope().config as T\r\n}\r\n\r\nfunction usePluginScope(): PluginScope {\r\n const scope = React.useContext(PluginScopeContext)\r\n if (scope === null) {\r\n throw new Error(\r\n 'This hook is only available inside a plugin component. It must be rendered by a plugin capability host, which supplies the plugin scope.',\r\n )\r\n }\r\n return scope\r\n}\r\n"],"mappings":";AAuCI;AAlCJ,YAAY,WAAW;AAOvB,MAAM,qBAAqB,MAAM,cAAkC,IAAI;AAYhE,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,QAAQ,MAAM;AAAA,IAClB,OAAO,EAAE,UAAU,QAAQ,0BAAU,CAAC,EAAE;AAAA,IACxC,CAAC,UAAU,MAAM;AAAA,EACnB;AAEA,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAC1B,UACH;AAEJ;AAGO,SAAS,cAAsB;AACpC,SAAO,eAAe,EAAE;AAC1B;AAGO,SAAS,kBAET;AACL,SAAO,eAAe,EAAE;AAC1B;AAEA,SAAS,iBAA8B;AACrC,QAAM,QAAQ,MAAM,WAAW,kBAAkB;AACjD,MAAI,UAAU,MAAM;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ViewerKey } from '../../types/dbTypes';
|
|
3
|
+
import type { LucideProps } from 'lucide-react';
|
|
4
|
+
export interface PluginNavItem {
|
|
5
|
+
/** The `viewer` key this item switches to. */
|
|
6
|
+
id: ViewerKey;
|
|
7
|
+
title: string;
|
|
8
|
+
icon: React.ComponentType<LucideProps>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The `data.pages` contributions as nav items. They sit in Datasets beside Buildings, so a
|
|
12
|
+
* contributed page reads as part of the platform.
|
|
13
|
+
*/
|
|
14
|
+
export declare function usePluginDataPages(): PluginNavItem[];
|
|
15
|
+
//# sourceMappingURL=usePluginDataPages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePluginDataPages.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginDataPages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,EAAE,EAAE,SAAS,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;CACvC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,EAAE,CAYpD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { usePluginMessageLookup } from "../sdk/messages";
|
|
4
|
+
import { pluginViewerKey } from "./pluginViewerKey";
|
|
5
|
+
import { usePluginContributions } from "./provider";
|
|
6
|
+
import { resolvePluginIcon } from "./usePluginToolbarTools";
|
|
7
|
+
function usePluginDataPages() {
|
|
8
|
+
const registrations = usePluginContributions("data.pages");
|
|
9
|
+
const message = usePluginMessageLookup();
|
|
10
|
+
return React.useMemo(
|
|
11
|
+
() => registrations.map((registration) => ({
|
|
12
|
+
id: pluginViewerKey(registration.pluginId, registration.id),
|
|
13
|
+
title: message(registration.pluginId, registration.titleKey, registration.titleKey),
|
|
14
|
+
icon: resolvePluginIcon(registration.icon)
|
|
15
|
+
})),
|
|
16
|
+
[registrations, message]
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
usePluginDataPages
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=usePluginDataPages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/usePluginDataPages.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 { usePluginMessageLookup } from '../sdk/messages'\r\n\r\nimport { pluginViewerKey } from './pluginViewerKey'\r\nimport { usePluginContributions } from './provider'\r\nimport { resolvePluginIcon } from './usePluginToolbarTools'\r\n\r\nimport type { ViewerKey } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\nexport interface PluginNavItem {\r\n /** The `viewer` key this item switches to. */\r\n id: ViewerKey\r\n title: string\r\n icon: React.ComponentType<LucideProps>\r\n}\r\n\r\n/**\r\n * The `data.pages` contributions as nav items. They sit in Datasets beside Buildings, so a\r\n * contributed page reads as part of the platform.\r\n */\r\nexport function usePluginDataPages(): PluginNavItem[] {\r\n const registrations = usePluginContributions('data.pages')\r\n const message = usePluginMessageLookup()\r\n\r\n return React.useMemo(\r\n () => registrations.map(registration => ({\r\n id: pluginViewerKey(registration.pluginId, registration.id),\r\n title: message(registration.pluginId, registration.titleKey, registration.titleKey),\r\n icon: resolvePluginIcon(registration.icon),\r\n })),\r\n [registrations, message],\r\n )\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AAEvC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAgB3B,SAAS,qBAAsC;AACpD,QAAM,gBAAgB,uBAAuB,YAAY;AACzD,QAAM,UAAU,uBAAuB;AAEvC,SAAO,MAAM;AAAA,IACX,MAAM,cAAc,IAAI,mBAAiB;AAAA,MACvC,IAAI,gBAAgB,aAAa,UAAU,aAAa,EAAE;AAAA,MAC1D,OAAO,QAAQ,aAAa,UAAU,aAAa,UAAU,aAAa,QAAQ;AAAA,MAClF,MAAM,kBAAkB,aAAa,IAAI;AAAA,IAC3C,EAAE;AAAA,IACF,CAAC,eAAe,OAAO;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Tool } from '../../types/tools';
|
|
3
|
+
import type { ToolbarRegistration } from '../sdk/types';
|
|
4
|
+
import type { LucideProps } from 'lucide-react';
|
|
5
|
+
/** The three toolbar capabilities. All share `ToolbarRegistration`. */
|
|
6
|
+
export type ToolbarCapability = 'map.tools' | 'bim.tools' | 'pointcloud.tools';
|
|
7
|
+
/** A plugin may pass a lucide component, or its name as a string — JSON manifests only carry the string. */
|
|
8
|
+
export declare function resolvePluginIcon(icon: ToolbarRegistration['icon']): React.ComponentType<LucideProps>;
|
|
9
|
+
/**
|
|
10
|
+
* Plugin contributions for one toolbar, as `Tool` objects the toolbars already
|
|
11
|
+
* render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.
|
|
12
|
+
*
|
|
13
|
+
* `extraProps` is spread onto the plugin's component by `ToolbarButton` — how a BIM
|
|
14
|
+
* tool gets its viewer handles. Each viewer passes its own, keeping this module free
|
|
15
|
+
* of viewer-engine imports that would pull three into the map bundle.
|
|
16
|
+
*/
|
|
17
|
+
export declare function usePluginToolbarTools(capability: ToolbarCapability, extraProps?: Record<string, unknown>): Tool[];
|
|
18
|
+
//# sourceMappingURL=usePluginToolbarTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePluginToolbarTools.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAQ9E,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAChC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAKlC;AASD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,EAAE,CAyCR"}
|