@collabdt/core 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/ConfirmDialog.d.ts +3 -3
- package/dist/core/components/ConfirmDialog.d.ts.map +1 -1
- package/dist/core/components/ConfirmDialog.js +1 -1
- package/dist/core/components/ConfirmDialog.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js +13 -0
- package/dist/core/components/ui/FilesManager/src/FileItemComponent.js.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts +2 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.d.ts.map +1 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.js +4 -1
- package/dist/core/components/ui/FilesManager/src/useFileActions.js.map +1 -1
- package/dist/core/components/ui/chart.js +3 -3
- package/dist/core/components/ui/chart.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +15 -3
- 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 +2 -1
- package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js +1 -6
- package/dist/core/components/viewers/bim/src/BimLoadingState/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js +1 -6
- package/dist/core/components/viewers/bim/src/BimMeasurements/BimMeasurementManager.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js +5 -2
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/BimSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js +24 -15
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/CameraNavigation.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/CameraNavigation.js +2 -7
- package/dist/core/components/viewers/bim/src/CameraNavigation.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts +37 -129
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js +193 -395
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts +1 -12
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js +3 -5
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/FloorplanRenderer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts +15 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js +61 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanCutFill.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts +37 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js +264 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanShapeEditor.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts +56 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js +337 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PlanSketch.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts +51 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js +238 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/PluginPlanOverlay.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts +1 -6
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js +9 -18
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts +6 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js +91 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/footprintOutline.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts +38 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js +77 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planPointer.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts +15 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js +34 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/planScene.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts +17 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js +75 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/shapeEditing.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts +16 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js +41 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/spaceFootprints.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts +5 -5
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js +12 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts +14 -6
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js +76 -12
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/utils.js.map +1 -1
- package/dist/core/components/viewers/bim/src/LoadModels.d.ts +3 -1
- package/dist/core/components/viewers/bim/src/LoadModels.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/LoadModels.js +10 -14
- package/dist/core/components/viewers/bim/src/LoadModels.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts +7 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js +78 -0
- package/dist/core/components/viewers/bim/src/Placement/ModelTurnConfirm.js.map +1 -0
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js +18 -14
- package/dist/core/components/viewers/bim/src/Placement/PlacementEditorHost.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js +19 -0
- package/dist/core/components/viewers/bim/src/Placement/targets/useModelTarget.js.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js +22 -3
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts +7 -17
- package/dist/core/components/viewers/bim/src/lib/CameraController.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/CameraController.js +26 -14
- package/dist/core/components/viewers/bim/src/lib/CameraController.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts +7 -8
- package/dist/core/components/viewers/bim/src/lib/ChromeController.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/ChromeController.js +22 -3
- package/dist/core/components/viewers/bim/src/lib/ChromeController.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts +4 -12
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js +2 -2
- package/dist/core/components/viewers/bim/src/lib/TrueNorthPopover.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts +3 -2
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js +6 -2
- package/dist/core/components/viewers/bim/src/lib/applyModelPlacement.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.js +2 -0
- package/dist/core/components/viewers/bim/src/lib/createBimWorld.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts +3 -25
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.js +2 -35
- package/dist/core/components/viewers/bim/src/lib/drawingProjection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts +38 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js +58 -0
- package/dist/core/components/viewers/bim/src/lib/modelPlacementWatchers.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts +14 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js +126 -0
- package/dist/core/components/viewers/bim/src/lib/pickModelEdge.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts +19 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js +41 -0
- package/dist/core/components/viewers/bim/src/lib/placedClipEdges.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts +10 -34
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js +83 -53
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts +8 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js +81 -0
- package/dist/core/components/viewers/bim/src/lib/useProjectNorth.js.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js +1 -0
- package/dist/core/components/viewers/bim/src/tools/AddToBim/src/FileMarkerUtils.js.map +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 +2 -14
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.js +7 -4
- package/dist/core/components/viewers/plugins/PluginsManager.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts +9 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.js +33 -0
- package/dist/core/components/viewers/plugins/src/InstallHereButton.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js +11 -6
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js +20 -7
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js.map +1 -1
- package/dist/core/components/viewers/plugins/types.d.ts +11 -1
- package/dist/core/components/viewers/plugins/types.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.d.ts +2 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/objectTarget.js +6 -3
- package/dist/core/components/viewers/shared/placement/objectTarget.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementCore.d.ts +1 -0
- package/dist/core/components/viewers/shared/placement/placementCore.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementCore.js +12 -1
- package/dist/core/components/viewers/shared/placement/placementCore.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementTarget.d.ts +2 -0
- package/dist/core/components/viewers/shared/placement/placementTarget.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/placement/placementTarget.js.map +1 -1
- package/dist/core/components/viewers/shared/placement/projectNorth.d.ts +22 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.d.ts.map +1 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.js +39 -0
- package/dist/core/components/viewers/shared/placement/projectNorth.js.map +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts +1 -0
- package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.js +5 -4
- package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -1
- package/dist/core/hooks/useUndoRedoShortcuts.d.ts.map +1 -1
- package/dist/core/hooks/useUndoRedoShortcuts.js +1 -6
- package/dist/core/hooks/useUndoRedoShortcuts.js.map +1 -1
- package/dist/core/i18n/messages/en.json +16 -4
- package/dist/core/i18n/messages/es.json +16 -4
- package/dist/core/i18n/messages/fr.json +16 -4
- package/dist/core/plugins/host/PluginDataPageHost.d.ts.map +1 -1
- package/dist/core/plugins/host/PluginDataPageHost.js +30 -25
- package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -1
- package/dist/core/plugins/host/pluginDatasetLookup.d.ts +6 -0
- package/dist/core/plugins/host/pluginDatasetLookup.d.ts.map +1 -0
- package/dist/core/plugins/host/pluginDatasetLookup.js +9 -0
- package/dist/core/plugins/host/pluginDatasetLookup.js.map +1 -0
- package/dist/core/plugins/host/pluginDatasets.d.ts +0 -8
- package/dist/core/plugins/host/pluginDatasets.d.ts.map +1 -1
- package/dist/core/plugins/host/pluginDatasets.js +1 -65
- package/dist/core/plugins/host/pluginDatasets.js.map +1 -1
- package/dist/core/plugins/host/provider.d.ts.map +1 -1
- package/dist/core/plugins/host/provider.js +12 -1
- package/dist/core/plugins/host/provider.js.map +1 -1
- package/dist/core/plugins/host/runtimeMessages.d.ts +13 -0
- package/dist/core/plugins/host/runtimeMessages.d.ts.map +1 -0
- package/dist/core/plugins/host/runtimeMessages.js +21 -0
- package/dist/core/plugins/host/runtimeMessages.js.map +1 -0
- package/dist/core/plugins/host/runtimeShims.d.ts +2 -0
- package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -1
- package/dist/core/plugins/host/runtimeShims.js +28 -1
- package/dist/core/plugins/host/runtimeShims.js.map +1 -1
- package/dist/core/plugins/host/toPluginDataset.d.ts +10 -0
- package/dist/core/plugins/host/toPluginDataset.d.ts.map +1 -0
- package/dist/core/plugins/host/toPluginDataset.js +68 -0
- package/dist/core/plugins/host/toPluginDataset.js.map +1 -0
- package/dist/core/plugins/host/usePluginToolbarTools.d.ts.map +1 -1
- package/dist/core/plugins/host/usePluginToolbarTools.js +6 -2
- package/dist/core/plugins/host/usePluginToolbarTools.js.map +1 -1
- package/dist/core/plugins/sdk/bimViewer.d.ts +25 -5
- package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -1
- package/dist/core/plugins/sdk/bimViewer.js +66 -10
- package/dist/core/plugins/sdk/bimViewer.js.map +1 -1
- package/dist/core/plugins/sdk/charts.d.ts +4 -0
- package/dist/core/plugins/sdk/charts.d.ts.map +1 -0
- package/dist/core/plugins/sdk/charts.js +46 -0
- package/dist/core/plugins/sdk/charts.js.map +1 -0
- package/dist/core/plugins/sdk/components.d.ts +1 -0
- package/dist/core/plugins/sdk/components.d.ts.map +1 -1
- package/dist/core/plugins/sdk/components.js +2 -0
- package/dist/core/plugins/sdk/components.js.map +1 -1
- package/dist/core/plugins/sdk/datasets.d.ts +6 -2
- package/dist/core/plugins/sdk/datasets.d.ts.map +1 -1
- package/dist/core/plugins/sdk/datasets.js +15 -2
- package/dist/core/plugins/sdk/datasets.js.map +1 -1
- package/dist/core/plugins/sdk/floorplan.d.ts +64 -0
- package/dist/core/plugins/sdk/floorplan.d.ts.map +1 -0
- package/dist/core/plugins/sdk/floorplan.js +102 -0
- package/dist/core/plugins/sdk/floorplan.js.map +1 -0
- package/dist/core/plugins/sdk/messages.d.ts.map +1 -1
- package/dist/core/plugins/sdk/messages.js +31 -15
- package/dist/core/plugins/sdk/messages.js.map +1 -1
- package/dist/core/plugins/sdk/types.d.ts +13 -2
- package/dist/core/plugins/sdk/types.d.ts.map +1 -1
- package/dist/core/plugins/sdk/types.js.map +1 -1
- package/dist/core/plugins/sdk/ui.d.ts +6 -0
- package/dist/core/plugins/sdk/ui.d.ts.map +1 -1
- package/dist/core/plugins/sdk/ui.js +13 -0
- package/dist/core/plugins/sdk/ui.js.map +1 -1
- package/dist/core/types/global.d.ts +1 -1
- package/dist/core/types/global.d.ts.map +1 -1
- package/dist/core/types/global.js.map +1 -1
- package/dist/core/utils/utils.d.ts +2 -0
- package/dist/core/utils/utils.d.ts.map +1 -1
- package/dist/core/utils/utils.js +4 -0
- package/dist/core/utils/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
return a;
|
|
21
21
|
};
|
|
22
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { useTranslations } from "next-intl";
|
|
25
25
|
import * as React from "react";
|
|
26
26
|
import {
|
|
@@ -35,6 +35,9 @@ import { resolvePluginIcon } from "./pluginIcon";
|
|
|
35
35
|
import { parsePluginViewerKey } from "./pluginViewerKey";
|
|
36
36
|
import { usePluginConfigs, usePluginContributions } from "./provider";
|
|
37
37
|
import { PluginScopeProvider } from "./scope";
|
|
38
|
+
function isCustomPage(registration) {
|
|
39
|
+
return registration.component != null;
|
|
40
|
+
}
|
|
38
41
|
function PluginDataPageHost({ viewer }) {
|
|
39
42
|
const registrations = usePluginContributions("data.pages");
|
|
40
43
|
const target = parsePluginViewerKey(viewer);
|
|
@@ -57,30 +60,32 @@ function PluginDataPage({ registration }) {
|
|
|
57
60
|
/* @__PURE__ */ jsx(Icon, { className: "h-8 w-8" }),
|
|
58
61
|
/* @__PURE__ */ jsx("h1", { className: "text-2xl text-foreground", children: title })
|
|
59
62
|
] }) }),
|
|
60
|
-
/* @__PURE__ */ jsx("div", { className: "flex
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
isCustomPage(registration) ? /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8", children: /* @__PURE__ */ jsx(PluginScopeProvider, { pluginId: registration.pluginId, config: configs[registration.pluginId], children: /* @__PURE__ */ jsx(registration.component, {}) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col sm:flex-row sm:justify-end items-stretch sm:items-center px-3 sm:px-6 py-4 gap-3 sm:gap-4", children: /* @__PURE__ */ jsx("div", { className: "w-full sm:w-96", children: /* @__PURE__ */ jsx(
|
|
65
|
+
Input,
|
|
66
|
+
{
|
|
67
|
+
placeholder: `${tData("searchPlaceholder")} ${title}...`,
|
|
68
|
+
value: searchTerm,
|
|
69
|
+
onChange: (event) => setSearchTerm(event.target.value),
|
|
70
|
+
"aria-label": `${tData("searchPlaceholder")} ${title}`
|
|
71
|
+
}
|
|
72
|
+
) }) }),
|
|
73
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8", children: /* @__PURE__ */ jsx(
|
|
74
|
+
PluginScopeProvider,
|
|
75
|
+
{
|
|
76
|
+
pluginId: registration.pluginId,
|
|
77
|
+
config: configs[registration.pluginId],
|
|
78
|
+
children: /* @__PURE__ */ jsx(
|
|
79
|
+
PluginDataTable,
|
|
80
|
+
{
|
|
81
|
+
registration,
|
|
82
|
+
searchTerm
|
|
83
|
+
},
|
|
84
|
+
`${registration.pluginId}:${registration.id}`
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
) })
|
|
88
|
+
] })
|
|
84
89
|
] }) }) });
|
|
85
90
|
}
|
|
86
91
|
function PluginDataTable({ registration, searchTerm }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/PluginDataPageHost.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbList,\n BreadcrumbPage,\n} from '../../components/ui/Breadcrumb'\nimport { Input } from '../../components/ui/Input'\nimport { usePluginMessageLookup } from '../sdk/messages'\n\nimport { resolvePluginIcon } from './pluginIcon'\nimport { parsePluginViewerKey } from './pluginViewerKey'\nimport { usePluginConfigs, usePluginContributions } from './provider'\nimport { PluginScopeProvider } from './scope'\n\nimport type { ViewerKey } from '../../types/dbTypes'\nimport type { DataPageRegistration } from '../sdk/types'\n\ntype Row = Record<string, unknown>\ntype Registration = DataPageRegistration & { pluginId: string }\n\n/**\n * Renders the `data.pages` contribution the viewer key names. The frame mirrors\n * `PluginsManager`, so a plugin page is indistinguishable from a built-in one.\n */\nexport function PluginDataPageHost({ viewer }: { viewer: ViewerKey }) {\n const registrations = usePluginContributions('data.pages')\n const target = parsePluginViewerKey(viewer)\n\n const registration = target\n ? registrations.find(\n candidate => candidate.pluginId === target.pluginId && candidate.id === target.pageId,\n )\n : undefined\n\n // The key comes from the URL, so rendering nothing lets `Viewer` fall back.\n if (!registration) return null\n\n return <PluginDataPage key={viewer} registration={registration} />\n}\n\nfunction PluginDataPage({ registration }: { registration: Registration }) {\n const tData = useTranslations('DataMenu')\n const message = usePluginMessageLookup()\n const configs = usePluginConfigs()\n const [searchTerm, setSearchTerm] = React.useState('')\n\n const title = message(registration.pluginId, registration.titleKey, registration.titleKey)\n const Icon = resolvePluginIcon(registration.icon)\n\n return (\n <div className=\"sm:p-2 overflow-hidden bg-[#fafafa] h-full\">\n <div className=\"bg-background rounded-xl shadow h-full min-h-0\">\n <div className=\"flex flex-col h-full min-h-0\">\n\n <div className=\"flex flex-row gap-2 justify-start items-center px-3 py-4 relative\">\n <Breadcrumb className=\"px-3\">\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbPage>{title}</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n </div>\n\n <div className=\"flex flex-row justify-between items-center px-6 py-6\">\n <div className=\"flex items-center gap-2\">\n <Icon className=\"h-8 w-8\" />\n <h1 className=\"text-2xl text-foreground\">{title}</h1>\n </div>\n </div>\n\n <div className=\"flex flex-col sm:flex-row sm:justify-end items-stretch sm:items-center px-3 sm:px-6 py-4 gap-3 sm:gap-4\">\n <div className=\"w-full sm:w-96\">\n <Input\n placeholder={`${tData('searchPlaceholder')} ${title}...`}\n value={searchTerm}\n onChange={event => setSearchTerm(event.target.value)}\n aria-label={`${tData('searchPlaceholder')} ${title}`}\n />\n </div>\n </div>\n\n <div className=\"flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8\">\n {/* The rows hook and the cell renderers are the plugin's, so they run inside its\n scope and can reach usePluginStore, usePluginState and the rest. */}\n <PluginScopeProvider\n pluginId={registration.pluginId}\n config={configs[registration.pluginId]}\n >\n <PluginDataTable\n key={`${registration.pluginId}:${registration.id}`}\n registration={registration}\n searchTerm={searchTerm}\n />\n </PluginScopeProvider>\n </div>\n\n </div>\n </div>\n </div>\n )\n}\n\ninterface TableProps {\n registration: Registration\n searchTerm: string\n}\n\nfunction PluginDataTable({ registration, searchTerm }: TableProps) {\n const t = useTranslations('PluginDataPage')\n const message = usePluginMessageLookup()\n const { rows, isLoading, onRowClick } = registration.useRows()\n\n const filtered = React.useMemo(\n () => filterRows(rows, registration.searchKeys, searchTerm),\n [rows, registration.searchKeys, searchTerm],\n )\n\n if (isLoading && rows.length === 0) return <Empty text={t('loading')} />\n\n if (filtered.length === 0) {\n if (searchTerm.trim()) return <Empty text={t('noResults', { query: searchTerm.trim() })} />\n\n const empty = registration.emptyKey\n ? message(registration.pluginId, registration.emptyKey, registration.emptyKey)\n : t('empty')\n\n return <Empty text={empty} />\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b text-left text-muted-foreground\">\n {registration.columns.map(column => (\n <th key={column.key} scope=\"col\" className=\"px-3 py-2 font-medium\">\n {message(registration.pluginId, column.labelKey, column.labelKey)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {filtered.map((row, index) => (\n <tr\n key={rowKey(row, index)}\n className={onRowClick ? 'border-b hover:bg-accent/50 cursor-pointer' : 'border-b'}\n // Interactive only when the plugin gave it something to do.\n {...(onRowClick\n ? {\n role: 'button' as const,\n tabIndex: 0,\n onClick: () => onRowClick(row),\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter' && event.key !== ' ') return\n event.preventDefault()\n onRowClick(row)\n },\n }\n : {})}\n >\n {registration.columns.map(column => (\n <td key={column.key} className=\"px-3 py-2\">\n {column.render ? column.render(row) : formatCell(row[column.key])}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n\n/** A plugin's own `key` when it supplied one, so a re-render does not remount every row. */\nfunction rowKey(row: Row, index: number): string {\n return typeof row.key === 'string' ? row.key : String(index)\n}\n\n// Non-primitives render empty rather than \"[object Object]\"; use a column `render` instead.\nfunction formatCell(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean') return String(value)\n return ''\n}\n\nfunction filterRows(rows: Row[], searchKeys: string[] | undefined, searchTerm: string): Row[] {\n const query = searchTerm.trim().toLowerCase()\n if (!query) return rows\n\n return rows.filter((row) => {\n const keys = searchKeys ?? Object.keys(row)\n return keys.some(key => formatCell(row[key]).toLowerCase().includes(query))\n })\n}\n\nfunction Empty({ text }: { text: string }) {\n return <p className=\"py-12 text-center text-sm text-muted-foreground\">{text}</p>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CS,cA4BG,YA5BH;AAxCT,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,8BAA8B;AAEvC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,2BAA2B;AAY7B,SAAS,mBAAmB,EAAE,OAAO,GAA0B;AACpE,QAAM,gBAAgB,uBAAuB,YAAY;AACzD,QAAM,SAAS,qBAAqB,MAAM;AAE1C,QAAM,eAAe,SACjB,cAAc;AAAA,IACd,eAAa,UAAU,aAAa,OAAO,YAAY,UAAU,OAAO,OAAO;AAAA,EACjF,IACE;AAGJ,MAAI,CAAC,aAAc,QAAO;AAE1B,SAAO,oBAAC,kBAA4B,gBAAR,MAAoC;AAClE;AAEA,SAAS,eAAe,EAAE,aAAa,GAAmC;AACxE,QAAM,QAAQ,gBAAgB,UAAU;AACxC,QAAM,UAAU,uBAAuB;AACvC,QAAM,UAAU,iBAAiB;AACjC,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,EA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GAEhB,CACD;AAAA;AAAA,MApBI,OAAO,KAAK,KAAK;AAAA,IAqBxB,CACD,GACH;AAAA,KACF,GACF;AAEJ;AAGA,SAAS,OAAO,KAAU,OAAuB;AAC/C,SAAO,OAAO,IAAI,QAAQ,WAAW,IAAI,MAAM,OAAO,KAAK;AAC7D;AAGA,SAAS,WAAW,OAAwB;AAC1C,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAW,QAAO,OAAO,KAAK;AAChF,SAAO;AACT;AAEA,SAAS,WAAW,MAAa,YAAkC,YAA2B;AAC5F,QAAM,QAAQ,WAAW,KAAK,EAAE,YAAY;AAC5C,MAAI,CAAC,MAAO,QAAO;AAEnB,SAAO,KAAK,OAAO,CAAC,QAAQ;AAC1B,UAAM,OAAO,kCAAc,OAAO,KAAK,GAAG;AAC1C,WAAO,KAAK,KAAK,SAAO,WAAW,IAAI,GAAG,CAAC,EAAE,YAAY,EAAE,SAAS,KAAK,CAAC;AAAA,EAC5E,CAAC;AACH;AAEA,SAAS,MAAM,EAAE,KAAK,GAAqB;AACzC,SAAO,oBAAC,OAAE,WAAU,mDAAmD,gBAAK;AAC9E;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/PluginDataPageHost.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbList,\n BreadcrumbPage,\n} from '../../components/ui/Breadcrumb'\nimport { Input } from '../../components/ui/Input'\nimport { usePluginMessageLookup } from '../sdk/messages'\n\nimport { resolvePluginIcon } from './pluginIcon'\nimport { parsePluginViewerKey } from './pluginViewerKey'\nimport { usePluginConfigs, usePluginContributions } from './provider'\nimport { PluginScopeProvider } from './scope'\n\nimport type { ViewerKey } from '../../types/dbTypes'\nimport type { DataPageCustom, DataPageRegistration, DataPageTable } from '../sdk/types'\n\ntype Row = Record<string, unknown>\ntype Registration = DataPageRegistration & { pluginId: string }\ntype TableRegistration = DataPageTable & { pluginId: string }\n\nfunction isCustomPage(registration: Registration): registration is DataPageCustom & { pluginId: string } {\n return registration.component != null\n}\n\n/**\n * Renders the `data.pages` contribution the viewer key names. The frame mirrors\n * `PluginsManager`, so a plugin page is indistinguishable from a built-in one.\n */\nexport function PluginDataPageHost({ viewer }: { viewer: ViewerKey }) {\n const registrations = usePluginContributions('data.pages')\n const target = parsePluginViewerKey(viewer)\n\n const registration = target\n ? registrations.find(\n candidate => candidate.pluginId === target.pluginId && candidate.id === target.pageId,\n )\n : undefined\n\n // The key comes from the URL, so rendering nothing lets `Viewer` fall back.\n if (!registration) return null\n\n return <PluginDataPage key={viewer} registration={registration} />\n}\n\nfunction PluginDataPage({ registration }: { registration: Registration }) {\n const tData = useTranslations('DataMenu')\n const message = usePluginMessageLookup()\n const configs = usePluginConfigs()\n const [searchTerm, setSearchTerm] = React.useState('')\n\n const title = message(registration.pluginId, registration.titleKey, registration.titleKey)\n const Icon = resolvePluginIcon(registration.icon)\n\n return (\n <div className=\"sm:p-2 overflow-hidden bg-[#fafafa] h-full\">\n <div className=\"bg-background rounded-xl shadow h-full min-h-0\">\n <div className=\"flex flex-col h-full min-h-0\">\n\n <div className=\"flex flex-row gap-2 justify-start items-center px-3 py-4 relative\">\n <Breadcrumb className=\"px-3\">\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbPage>{title}</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n </div>\n\n <div className=\"flex flex-row justify-between items-center px-6 py-6\">\n <div className=\"flex items-center gap-2\">\n <Icon className=\"h-8 w-8\" />\n <h1 className=\"text-2xl text-foreground\">{title}</h1>\n </div>\n </div>\n\n {isCustomPage(registration) ? (\n <div className=\"flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8\">\n <PluginScopeProvider pluginId={registration.pluginId} config={configs[registration.pluginId]}>\n <registration.component />\n </PluginScopeProvider>\n </div>\n ) : (\n <>\n <div className=\"flex flex-col sm:flex-row sm:justify-end items-stretch sm:items-center px-3 sm:px-6 py-4 gap-3 sm:gap-4\">\n <div className=\"w-full sm:w-96\">\n <Input\n placeholder={`${tData('searchPlaceholder')} ${title}...`}\n value={searchTerm}\n onChange={event => setSearchTerm(event.target.value)}\n aria-label={`${tData('searchPlaceholder')} ${title}`}\n />\n </div>\n </div>\n\n <div className=\"flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8\">\n {/* The rows hook and cell renderers are the plugin's, so they run in its scope. */}\n <PluginScopeProvider\n pluginId={registration.pluginId}\n config={configs[registration.pluginId]}\n >\n <PluginDataTable\n key={`${registration.pluginId}:${registration.id}`}\n registration={registration}\n searchTerm={searchTerm}\n />\n </PluginScopeProvider>\n </div>\n </>\n )}\n\n </div>\n </div>\n </div>\n )\n}\n\ninterface TableProps {\n registration: TableRegistration\n searchTerm: string\n}\n\nfunction PluginDataTable({ registration, searchTerm }: TableProps) {\n const t = useTranslations('PluginDataPage')\n const message = usePluginMessageLookup()\n const { rows, isLoading, onRowClick } = registration.useRows()\n\n const filtered = React.useMemo(\n () => filterRows(rows, registration.searchKeys, searchTerm),\n [rows, registration.searchKeys, searchTerm],\n )\n\n if (isLoading && rows.length === 0) return <Empty text={t('loading')} />\n\n if (filtered.length === 0) {\n if (searchTerm.trim()) return <Empty text={t('noResults', { query: searchTerm.trim() })} />\n\n const empty = registration.emptyKey\n ? message(registration.pluginId, registration.emptyKey, registration.emptyKey)\n : t('empty')\n\n return <Empty text={empty} />\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b text-left text-muted-foreground\">\n {registration.columns.map(column => (\n <th key={column.key} scope=\"col\" className=\"px-3 py-2 font-medium\">\n {message(registration.pluginId, column.labelKey, column.labelKey)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {filtered.map((row, index) => (\n <tr\n key={rowKey(row, index)}\n className={onRowClick ? 'border-b hover:bg-accent/50 cursor-pointer' : 'border-b'}\n // Interactive only when the plugin gave it something to do.\n {...(onRowClick\n ? {\n role: 'button' as const,\n tabIndex: 0,\n onClick: () => onRowClick(row),\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter' && event.key !== ' ') return\n event.preventDefault()\n onRowClick(row)\n },\n }\n : {})}\n >\n {registration.columns.map(column => (\n <td key={column.key} className=\"px-3 py-2\">\n {column.render ? column.render(row) : formatCell(row[column.key])}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n\n/** A plugin's own `key` when it supplied one, so a re-render does not remount every row. */\nfunction rowKey(row: Row, index: number): string {\n return typeof row.key === 'string' ? row.key : String(index)\n}\n\n// Non-primitives render empty rather than \"[object Object]\"; use a column `render` instead.\nfunction formatCell(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean') return String(value)\n return ''\n}\n\nfunction filterRows(rows: Row[], searchKeys: string[] | undefined, searchTerm: string): Row[] {\n const query = searchTerm.trim().toLowerCase()\n if (!query) return rows\n\n return rows.filter((row) => {\n const keys = searchKeys ?? Object.keys(row)\n return keys.some(key => formatCell(row[key]).toLowerCase().includes(query))\n })\n}\n\nfunction Empty({ text }: { text: string }) {\n return <p className=\"py-12 text-center text-sm text-muted-foreground\">{text}</p>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkDS,SAyCG,UAzCH,KA4BG,YA5BH;AA7CT,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,8BAA8B;AAEvC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,2BAA2B;AASpC,SAAS,aAAa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,WAAO,KAAK,KAAK,SAAO,WAAW,IAAI,GAAG,CAAC,EAAE,YAAY,EAAE,SAAS,KAAK,CAAC;AAAA,EAC5E,CAAC;AACH;AAEA,SAAS,MAAM,EAAE,KAAK,GAAqB;AACzC,SAAO,oBAAC,OAAE,WAAU,mDAAmD,gBAAK;AAC9E;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Dataset } from '../../types/datasetTypes';
|
|
3
|
+
export type PluginDatasetLookup = (pluginId: string, id: string) => Dataset | undefined;
|
|
4
|
+
/** How the SDK finds a plugin's own dataset without importing the host, which would close a cycle through `installed.ts`. */
|
|
5
|
+
export declare const PluginDatasetLookupContext: React.Context<PluginDatasetLookup>;
|
|
6
|
+
//# sourceMappingURL=pluginDatasetLookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginDatasetLookup.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginDatasetLookup.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAEvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAA;AAEvF,6HAA6H;AAC7H,eAAO,MAAM,0BAA0B,oCAA4D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/pluginDatasetLookup.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport type { Dataset } from '../../types/datasetTypes'\n\nexport type PluginDatasetLookup = (pluginId: string, id: string) => Dataset | undefined\n\n/** How the SDK finds a plugin's own dataset without importing the host, which would close a cycle through `installed.ts`. */\nexport const PluginDatasetLookupContext = React.createContext<PluginDatasetLookup>(() => undefined)\n"],"mappings":";AAKA,YAAY,WAAW;AAOhB,MAAM,6BAA6B,MAAM,cAAmC,MAAM,MAAS;","names":[]}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { PluginContribution } from './provider';
|
|
2
1
|
import type { Dataset } from '../../types/datasetTypes';
|
|
3
|
-
type DatasetContribution = PluginContribution<'map.datasets'>;
|
|
4
|
-
/**
|
|
5
|
-
* A `map.datasets` contribution as the Datasets menu lists it. A live one goes under Live
|
|
6
|
-
* Data; any other is organizational, stamped with the viewer's own organization.
|
|
7
|
-
*/
|
|
8
|
-
export declare function toPluginDataset(registration: DatasetContribution, organization?: number): Dataset;
|
|
9
2
|
/** Every enabled plugin's datasets, for the lists in the Datasets menu and the Layers tab. */
|
|
10
3
|
export declare function usePluginDatasets(organization?: number): Dataset[];
|
|
11
|
-
export {};
|
|
12
4
|
//# sourceMappingURL=pluginDatasets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginDatasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginDatasets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pluginDatasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginDatasets.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAEvD,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,CAOlE"}
|
|
@@ -1,72 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
"use client";
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
4
|
import * as React from "react";
|
|
21
|
-
import { buildWmsTileUrl } from "../../components/viewers/map/datasets/src/urlSources";
|
|
22
|
-
import { layerColorByName } from "../../components/viewers/map/utils/stringToColour";
|
|
23
|
-
import { DatasetGroup } from "../../types/dbTypes";
|
|
24
|
-
import { pluginDatasetId } from "./pluginDatasetId";
|
|
25
5
|
import { usePluginContributions } from "./provider";
|
|
26
|
-
|
|
27
|
-
function drawnBy(registration) {
|
|
28
|
-
const { source, pluginId } = registration;
|
|
29
|
-
if ((source == null ? void 0 : source.type) === "wms") {
|
|
30
|
-
const { baseUrl, layers, timeEnabled } = source;
|
|
31
|
-
return {
|
|
32
|
-
datasetType: "WMS",
|
|
33
|
-
type: "WMS",
|
|
34
|
-
url: buildWmsTileUrl(baseUrl, layers),
|
|
35
|
-
timeEnabled,
|
|
36
|
-
wms: { baseUrl, layers },
|
|
37
|
-
clickable: false,
|
|
38
|
-
getFeatures: noFeatures
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if ((source == null ? void 0 : source.type) === "geojson") {
|
|
42
|
-
return {
|
|
43
|
-
datasetType: "GeoJSON",
|
|
44
|
-
type: "GeoJSON",
|
|
45
|
-
clickable: true,
|
|
46
|
-
getFeatures: async () => await source.getFeatures()
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return { datasetType: "GeoJSON", type: "Plugin", clickable: false, drawnByPlugin: pluginId, getFeatures: noFeatures };
|
|
50
|
-
}
|
|
51
|
-
function toPluginDataset(registration, organization) {
|
|
52
|
-
const { pluginId, id, name, description, publisher, information, live = false } = registration;
|
|
53
|
-
const group = live ? DatasetGroup.National : DatasetGroup.Organizational;
|
|
54
|
-
return __spreadValues({
|
|
55
|
-
id: pluginDatasetId(pluginId, id),
|
|
56
|
-
name,
|
|
57
|
-
description,
|
|
58
|
-
publisher,
|
|
59
|
-
information,
|
|
60
|
-
organization: live ? void 0 : organization,
|
|
61
|
-
dataManagementSystem: "other",
|
|
62
|
-
countrySubdivision: "",
|
|
63
|
-
municipality: "",
|
|
64
|
-
group,
|
|
65
|
-
layerColor: layerColorByName(name),
|
|
66
|
-
portal: { id: -1, name: publisher != null ? publisher : name, group, dataManagementSystem: "Other", live },
|
|
67
|
-
getFields: async () => []
|
|
68
|
-
}, drawnBy(registration));
|
|
69
|
-
}
|
|
6
|
+
import { toPluginDataset } from "./toPluginDataset";
|
|
70
7
|
function usePluginDatasets(organization) {
|
|
71
8
|
const registrations = usePluginContributions("map.datasets");
|
|
72
9
|
return React.useMemo(
|
|
@@ -75,7 +12,6 @@ function usePluginDatasets(organization) {
|
|
|
75
12
|
);
|
|
76
13
|
}
|
|
77
14
|
export {
|
|
78
|
-
toPluginDataset,
|
|
79
15
|
usePluginDatasets
|
|
80
16
|
};
|
|
81
17
|
//# sourceMappingURL=pluginDatasets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/pluginDatasets.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/pluginDatasets.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { usePluginContributions } from './provider'\nimport { toPluginDataset } from './toPluginDataset'\n\nimport type { Dataset } from '../../types/datasetTypes'\n\n/** Every enabled plugin's datasets, for the lists in the Datasets menu and the Layers tab. */\nexport function usePluginDatasets(organization?: number): Dataset[] {\n const registrations = usePluginContributions('map.datasets')\n\n return React.useMemo(\n () => registrations.map(registration => toPluginDataset(registration, organization)),\n [registrations, organization],\n )\n}\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAKzB,SAAS,kBAAkB,cAAkC;AAClE,QAAM,gBAAgB,uBAAuB,cAAc;AAE3D,SAAO,MAAM;AAAA,IACX,MAAM,cAAc,IAAI,kBAAgB,gBAAgB,cAAc,YAAY,CAAC;AAAA,IACnF,CAAC,eAAe,YAAY;AAAA,EAC9B;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/provider.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/provider.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAK3C,OAAO,KAAK,EAAE,kBAAkB,EAAgB,YAAY,EAAE,MAAM,cAAc,CAAA;AAWlF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAClD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,OAA2B,EAC3B,YAAY,EACZ,OAAO,GACR,EAAE,uBAAuB,qBAuHzB;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAGzC;AAED,sFAAsF;AACtF,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE1E;AAID,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAC/D,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,kBAAkB,EACvE,GAAG,EAAE,CAAC,GACL,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAgBzB"}
|
|
@@ -7,7 +7,10 @@ import { INSTALLED_PLUGINS } from "../installed";
|
|
|
7
7
|
import { resolvePluginEntry } from "../sdk/types";
|
|
8
8
|
import { PluginDialogProvider } from "./dialogs";
|
|
9
9
|
import { PluginHost } from "./host";
|
|
10
|
+
import { PluginDatasetLookupContext } from "./pluginDatasetLookup";
|
|
10
11
|
import { PluginRegistry } from "./registry";
|
|
12
|
+
import { collectRuntimeMessages, RuntimePluginMessagesContext } from "./runtimeMessages";
|
|
13
|
+
import { toPluginDataset } from "./toPluginDataset";
|
|
11
14
|
const PluginHostContext = React.createContext(null);
|
|
12
15
|
function PluginHostProvider({
|
|
13
16
|
children,
|
|
@@ -84,7 +87,15 @@ function PluginHostProvider({
|
|
|
84
87
|
() => ({ registry, host, ready, configs: resolvedConfigs }),
|
|
85
88
|
[registry, host, ready, resolvedConfigs]
|
|
86
89
|
);
|
|
87
|
-
|
|
90
|
+
const runtimeMessages = React.useMemo(
|
|
91
|
+
() => collectRuntimeMessages((sources != null ? sources : []).map((source) => source.manifest)),
|
|
92
|
+
[sources]
|
|
93
|
+
);
|
|
94
|
+
const findDataset = React.useCallback((pluginId, id) => {
|
|
95
|
+
const registration = registry.getAll("map.datasets").find((candidate) => candidate.pluginId === pluginId && candidate.id === id);
|
|
96
|
+
return registration && toPluginDataset(registration);
|
|
97
|
+
}, [registry]);
|
|
98
|
+
return /* @__PURE__ */ jsx(PluginHostContext.Provider, { value, children: /* @__PURE__ */ jsx(RuntimePluginMessagesContext.Provider, { value: runtimeMessages, children: /* @__PURE__ */ jsx(PluginDatasetLookupContext.Provider, { value: findDataset, children: /* @__PURE__ */ jsx(PluginDialogProvider, { children }) }) }) });
|
|
88
99
|
}
|
|
89
100
|
function usePluginRegistry() {
|
|
90
101
|
const context = React.useContext(PluginHostContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/provider.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { INSTALLED_PLUGINS } from '../installed'\n\nimport { resolvePluginEntry } from '../sdk/types'\n\nimport { PluginDialogProvider } from './dialogs'\nimport { PluginHost } from './host'\nimport { PluginRegistry } from './registry'\n\n\nimport type { CapabilityRegistry, PluginSource, PluginsInput } from '../sdk/types'\n\ninterface PluginHostContextValue {\n registry: PluginRegistry\n host: PluginHost\n ready: boolean\n configs: Record<string, Record<string, unknown>>\n}\n\nconst PluginHostContext = React.createContext<PluginHostContextValue | null>(null)\n\nexport interface PluginHostProviderProps {\n children: React.ReactNode\n /**\n * The plugins to load. Defaults to the set compiled into core. Pass a stable\n * reference — a module-scope array or a `useCallback` thunk — since a fresh\n * literal re-resolves the list on every render.\n */\n plugins?: PluginsInput\n /**\n * Slugs to activate. `undefined` activates everything, for consumers that do not\n * manage enablement. An array is authoritative: anything unlisted stays inactive,\n * and removing a slug deactivates that plugin in place, without a reload.\n */\n enabledSlugs?: string[]\n /** Per-plugin configuration, keyed by slug. Reaches the plugin as `ctx.config`. */\n configs?: Record<string, Record<string, unknown>>\n}\n\nexport function PluginHostProvider({\n children,\n plugins = INSTALLED_PLUGINS,\n enabledSlugs,\n configs,\n}: PluginHostProviderProps) {\n const registry = React.useMemo(() => new PluginRegistry(), [])\n const host = React.useMemo(() => new PluginHost(registry), [registry])\n\n const [sources, setSources] = React.useState<PluginSource[] | null>(null)\n const [ready, setReady] = React.useState(false)\n\n // Both normalized to an identity derived from their content: the props arrive as\n // fresh literals from a fetch, and using them as effect deps directly would reload\n // every plugin on every render. The JSON round-trip also drops anything\n // non-serializable, which is correct — config originates as JSON.\n const enabledKey = React.useMemo(\n () => (enabledSlugs ? [...enabledSlugs].sort().join('\\u0000') : null),\n [enabledSlugs],\n )\n const enabled = React.useMemo(\n () => (enabledKey === null ? null : new Set(enabledKey.split('\\u0000'))),\n [enabledKey],\n )\n\n const configsKey = React.useMemo(() => (configs ? JSON.stringify(configs) : ''), [configs])\n const resolvedConfigs = React.useMemo<Record<string, Record<string, unknown>>>(\n () => (configsKey ? JSON.parse(configsKey) : {}),\n [configsKey],\n )\n\n // Resolve the list first: for runtime-loaded plugins that is a fetch plus a\n // dynamic import per bundle, so it cannot happen during render.\n React.useEffect(() => {\n let cancelled = false\n\n async function resolve() {\n try {\n const resolved = typeof plugins === 'function' ? await plugins() : plugins\n if (!cancelled) setSources(resolved)\n } catch (err) {\n // A plugin source that cannot be resolved must not take down the app.\n console.error('Failed to resolve the plugin list:', err)\n if (!cancelled) setSources([])\n }\n }\n\n void resolve()\n return () => {\n cancelled = true\n }\n }, [plugins])\n\n // Reconcile: activate what should be running, deactivate what should not.\n // Runs again whenever enablement or config changes, so the plugins page can\n // toggle a plugin without a page reload.\n React.useEffect(() => {\n if (!sources) return\n let cancelled = false\n\n async function sync() {\n for (const { manifest, entry } of sources ?? []) {\n if (cancelled) return\n\n const slug = manifest?.slug\n if (typeof slug !== 'string' || !slug) {\n // Let the host reject it, so the failure is recorded. The entry is never\n // resolved: no point fetching a chunk for a plugin that cannot activate.\n await host.loadPlugin(manifest, { activate: () => {} }, {})\n continue\n }\n\n const shouldRun = enabled === null || enabled.has(slug)\n const isRunning = host.getStatus(slug) === 'active'\n\n if (shouldRun && !isRunning) {\n // Resolving the entry is what downloads a compiled-in plugin's chunk, so it\n // happens here rather than at module scope.\n try {\n await host.loadPlugin(manifest, await resolvePluginEntry(entry), resolvedConfigs[slug] ?? {})\n } catch (error) {\n // A chunk that fails to load must not stop the plugins after it.\n console.error(`Failed to load plugin \"${slug}\":`, error)\n }\n } else if (!shouldRun && isRunning) {\n await host.unloadPlugin(slug)\n }\n }\n\n if (!cancelled) setReady(true)\n }\n\n void sync()\n return () => {\n cancelled = true\n }\n }, [sources, host, enabled, resolvedConfigs])\n\n const value = React.useMemo(\n () => ({ registry, host, ready, configs: resolvedConfigs }),\n [registry, host, ready, resolvedConfigs],\n )\n\n return (\n <PluginHostContext.Provider value={value}>\n <PluginDialogProvider>\n {children}\n </PluginDialogProvider>\n </PluginHostContext.Provider>\n )\n}\n\nexport function usePluginRegistry(): PluginRegistry {\n const context = React.useContext(PluginHostContext)\n if (!context) {\n throw new Error('usePluginRegistry must be used within PluginHostProvider')\n }\n return context.registry\n}\n\nexport function usePluginsReady(): boolean {\n const context = React.useContext(PluginHostContext)\n return context?.ready ?? false\n}\n\n/** The host itself. Only the plugins page needs this; capability consumers do not. */\nexport function usePluginHost(): PluginHost | null {\n return React.useContext(PluginHostContext)?.host ?? null\n}\n\n/**\n * Every plugin's configuration, keyed by slug, for capability hosts to pass into\n * `PluginScopeProvider`. Plugins use `usePluginConfig()` from the SDK instead — a plugin\n * component importing this module puts `installed.ts` and the host in a cycle.\n */\nexport function usePluginConfigs(): Record<string, Record<string, unknown>> {\n return React.useContext(PluginHostContext)?.configs ?? EMPTY_CONFIGS\n}\n\nconst EMPTY_CONFIGS: Record<string, Record<string, unknown>> = {}\n\nexport type PluginContribution<K extends keyof CapabilityRegistry> =\n CapabilityRegistry[K] & { pluginId: string }\n\n/**\n * Read a capability's contributions and re-render when they change — the one way a host\n * component should consume the registry. `registry.getAll()` during render only works\n * when plugins load before first paint; a runtime-loaded plugin registers after the\n * consumer rendered, with nothing to tell it to look again.\n */\nexport function usePluginContributions<K extends keyof CapabilityRegistry>(\n key: K,\n): PluginContribution<K>[] {\n const registry = usePluginRegistry()\n\n const subscribe = React.useCallback(\n (onStoreChange: () => void) => registry.subscribe(onStoreChange),\n [registry],\n )\n\n // Copy-on-write in the registry makes this a stable reference between changes, which is\n // what lets useSyncExternalStore skip consumers of untouched capabilities.\n const getSnapshot = React.useCallback(\n () => registry.getAll(key) as unknown as PluginContribution<K>[],\n [registry, key],\n )\n\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\n}\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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S,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":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/provider.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { INSTALLED_PLUGINS } from '../installed'\n\nimport { resolvePluginEntry } from '../sdk/types'\n\nimport { PluginDialogProvider } from './dialogs'\nimport { PluginHost } from './host'\nimport { PluginDatasetLookupContext, type PluginDatasetLookup } from './pluginDatasetLookup'\nimport { PluginRegistry } from './registry'\nimport { collectRuntimeMessages, RuntimePluginMessagesContext } from './runtimeMessages'\nimport { toPluginDataset } from './toPluginDataset'\n\n\nimport type { CapabilityRegistry, PluginSource, PluginsInput } from '../sdk/types'\n\ninterface PluginHostContextValue {\n registry: PluginRegistry\n host: PluginHost\n ready: boolean\n configs: Record<string, Record<string, unknown>>\n}\n\nconst PluginHostContext = React.createContext<PluginHostContextValue | null>(null)\n\nexport interface PluginHostProviderProps {\n children: React.ReactNode\n /**\n * The plugins to load. Defaults to the set compiled into core. Pass a stable\n * reference — a module-scope array or a `useCallback` thunk — since a fresh\n * literal re-resolves the list on every render.\n */\n plugins?: PluginsInput\n /**\n * Slugs to activate. `undefined` activates everything, for consumers that do not\n * manage enablement. An array is authoritative: anything unlisted stays inactive,\n * and removing a slug deactivates that plugin in place, without a reload.\n */\n enabledSlugs?: string[]\n /** Per-plugin configuration, keyed by slug. Reaches the plugin as `ctx.config`. */\n configs?: Record<string, Record<string, unknown>>\n}\n\nexport function PluginHostProvider({\n children,\n plugins = INSTALLED_PLUGINS,\n enabledSlugs,\n configs,\n}: PluginHostProviderProps) {\n const registry = React.useMemo(() => new PluginRegistry(), [])\n const host = React.useMemo(() => new PluginHost(registry), [registry])\n\n const [sources, setSources] = React.useState<PluginSource[] | null>(null)\n const [ready, setReady] = React.useState(false)\n\n // Both normalized to an identity derived from their content: the props arrive as\n // fresh literals from a fetch, and using them as effect deps directly would reload\n // every plugin on every render. The JSON round-trip also drops anything\n // non-serializable, which is correct — config originates as JSON.\n const enabledKey = React.useMemo(\n () => (enabledSlugs ? [...enabledSlugs].sort().join('\\u0000') : null),\n [enabledSlugs],\n )\n const enabled = React.useMemo(\n () => (enabledKey === null ? null : new Set(enabledKey.split('\\u0000'))),\n [enabledKey],\n )\n\n const configsKey = React.useMemo(() => (configs ? JSON.stringify(configs) : ''), [configs])\n const resolvedConfigs = React.useMemo<Record<string, Record<string, unknown>>>(\n () => (configsKey ? JSON.parse(configsKey) : {}),\n [configsKey],\n )\n\n // Resolve the list first: for runtime-loaded plugins that is a fetch plus a\n // dynamic import per bundle, so it cannot happen during render.\n React.useEffect(() => {\n let cancelled = false\n\n async function resolve() {\n try {\n const resolved = typeof plugins === 'function' ? await plugins() : plugins\n if (!cancelled) setSources(resolved)\n } catch (err) {\n // A plugin source that cannot be resolved must not take down the app.\n console.error('Failed to resolve the plugin list:', err)\n if (!cancelled) setSources([])\n }\n }\n\n void resolve()\n return () => {\n cancelled = true\n }\n }, [plugins])\n\n // Reconcile: activate what should be running, deactivate what should not.\n // Runs again whenever enablement or config changes, so the plugins page can\n // toggle a plugin without a page reload.\n React.useEffect(() => {\n if (!sources) return\n let cancelled = false\n\n async function sync() {\n for (const { manifest, entry } of sources ?? []) {\n if (cancelled) return\n\n const slug = manifest?.slug\n if (typeof slug !== 'string' || !slug) {\n // Let the host reject it, so the failure is recorded. The entry is never\n // resolved: no point fetching a chunk for a plugin that cannot activate.\n await host.loadPlugin(manifest, { activate: () => {} }, {})\n continue\n }\n\n const shouldRun = enabled === null || enabled.has(slug)\n const isRunning = host.getStatus(slug) === 'active'\n\n if (shouldRun && !isRunning) {\n // Resolving the entry is what downloads a compiled-in plugin's chunk, so it\n // happens here rather than at module scope.\n try {\n await host.loadPlugin(manifest, await resolvePluginEntry(entry), resolvedConfigs[slug] ?? {})\n } catch (error) {\n // A chunk that fails to load must not stop the plugins after it.\n console.error(`Failed to load plugin \"${slug}\":`, error)\n }\n } else if (!shouldRun && isRunning) {\n await host.unloadPlugin(slug)\n }\n }\n\n if (!cancelled) setReady(true)\n }\n\n void sync()\n return () => {\n cancelled = true\n }\n }, [sources, host, enabled, resolvedConfigs])\n\n const value = React.useMemo(\n () => ({ registry, host, ready, configs: resolvedConfigs }),\n [registry, host, ready, resolvedConfigs],\n )\n const runtimeMessages = React.useMemo(\n () => collectRuntimeMessages((sources ?? []).map(source => source.manifest)),\n [sources],\n )\n\n const findDataset = React.useCallback<PluginDatasetLookup>((pluginId, id) => {\n const registration = (registry.getAll('map.datasets') as unknown as PluginContribution<'map.datasets'>[])\n .find(candidate => candidate.pluginId === pluginId && candidate.id === id)\n return registration && toPluginDataset(registration)\n }, [registry])\n\n return (\n <PluginHostContext.Provider value={value}>\n <RuntimePluginMessagesContext.Provider value={runtimeMessages}>\n <PluginDatasetLookupContext.Provider value={findDataset}>\n <PluginDialogProvider>\n {children}\n </PluginDialogProvider>\n </PluginDatasetLookupContext.Provider>\n </RuntimePluginMessagesContext.Provider>\n </PluginHostContext.Provider>\n )\n}\n\nexport function usePluginRegistry(): PluginRegistry {\n const context = React.useContext(PluginHostContext)\n if (!context) {\n throw new Error('usePluginRegistry must be used within PluginHostProvider')\n }\n return context.registry\n}\n\nexport function usePluginsReady(): boolean {\n const context = React.useContext(PluginHostContext)\n return context?.ready ?? false\n}\n\n/** The host itself. Only the plugins page needs this; capability consumers do not. */\nexport function usePluginHost(): PluginHost | null {\n return React.useContext(PluginHostContext)?.host ?? null\n}\n\n/**\n * Every plugin's configuration, keyed by slug, for capability hosts to pass into\n * `PluginScopeProvider`. Plugins use `usePluginConfig()` from the SDK instead — a plugin\n * component importing this module puts `installed.ts` and the host in a cycle.\n */\nexport function usePluginConfigs(): Record<string, Record<string, unknown>> {\n return React.useContext(PluginHostContext)?.configs ?? EMPTY_CONFIGS\n}\n\nconst EMPTY_CONFIGS: Record<string, Record<string, unknown>> = {}\n\nexport type PluginContribution<K extends keyof CapabilityRegistry> =\n CapabilityRegistry[K] & { pluginId: string }\n\n/**\n * Read a capability's contributions and re-render when they change — the one way a host\n * component should consume the registry. `registry.getAll()` during render only works\n * when plugins load before first paint; a runtime-loaded plugin registers after the\n * consumer rendered, with nothing to tell it to look again.\n */\nexport function usePluginContributions<K extends keyof CapabilityRegistry>(\n key: K,\n): PluginContribution<K>[] {\n const registry = usePluginRegistry()\n\n const subscribe = React.useCallback(\n (onStoreChange: () => void) => registry.subscribe(onStoreChange),\n [registry],\n )\n\n // Copy-on-write in the registry makes this a stable reference between changes, which is\n // what lets useSyncExternalStore skip consumers of untouched capabilities.\n const getSnapshot = React.useCallback(\n () => registry.getAll(key) as unknown as PluginContribution<K>[],\n [registry, key],\n )\n\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\n}\n"],"mappings":";AAqKU;AAhKV,YAAY,WAAW;AAEvB,SAAS,yBAAyB;AAElC,SAAS,0BAA0B;AAEnC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,kCAA4D;AACrE,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB,oCAAoC;AACrE,SAAS,uBAAuB;AAYhC,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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AC1B,8BAAC,6BAA6B,UAA7B,EAAsC,OAAO,iBAC5C,8BAAC,2BAA2B,UAA3B,EAAoC,OAAO,aAC1C,8BAAC,wBACE,UACH,GACF,GACF,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;AAtL3C;AAuLE,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,UAAO,wCAAS,UAAT,YAAkB;AAC3B;AAGO,SAAS,gBAAmC;AA5LnD;AA6LE,UAAO,iBAAM,WAAW,iBAAiB,MAAlC,mBAAqC,SAArC,YAA6C;AACtD;AAOO,SAAS,mBAA4D;AArM5E;AAsME,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":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** `slug → locale → strings`, straight from each loaded manifest's `messages`. */
|
|
3
|
+
export type RuntimePluginMessages = Record<string, Record<string, Record<string, unknown>>>;
|
|
4
|
+
/**
|
|
5
|
+
* Manifests fetched at runtime arrive after the i18n catalog is built, so their strings
|
|
6
|
+
* reach lookups through this instead. Standalone so the SDK can read it without the host.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RuntimePluginMessagesContext: React.Context<RuntimePluginMessages>;
|
|
9
|
+
export declare function collectRuntimeMessages(manifests: ReadonlyArray<{
|
|
10
|
+
slug?: unknown;
|
|
11
|
+
messages?: unknown;
|
|
12
|
+
} | null | undefined>): RuntimePluginMessages;
|
|
13
|
+
//# sourceMappingURL=runtimeMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeMessages.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/runtimeMessages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,kFAAkF;AAClF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAE3F;;;GAGG;AACH,eAAO,MAAM,4BAA4B,sCAAiD,CAAA;AAE1F,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,aAAa,CAAC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GAClF,qBAAqB,CAOvB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
const RuntimePluginMessagesContext = React.createContext({});
|
|
6
|
+
function collectRuntimeMessages(manifests) {
|
|
7
|
+
const bySlug = {};
|
|
8
|
+
for (const manifest of manifests) {
|
|
9
|
+
if (typeof (manifest == null ? void 0 : manifest.slug) !== "string" || !isRecord(manifest.messages)) continue;
|
|
10
|
+
bySlug[manifest.slug] = manifest.messages;
|
|
11
|
+
}
|
|
12
|
+
return bySlug;
|
|
13
|
+
}
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
RuntimePluginMessagesContext,
|
|
19
|
+
collectRuntimeMessages
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=runtimeMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/runtimeMessages.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\n/** `slug → locale → strings`, straight from each loaded manifest's `messages`. */\nexport type RuntimePluginMessages = Record<string, Record<string, Record<string, unknown>>>\n\n/**\n * Manifests fetched at runtime arrive after the i18n catalog is built, so their strings\n * reach lookups through this instead. Standalone so the SDK can read it without the host.\n */\nexport const RuntimePluginMessagesContext = React.createContext<RuntimePluginMessages>({})\n\nexport function collectRuntimeMessages(\n manifests: ReadonlyArray<{ slug?: unknown; messages?: unknown } | null | undefined>,\n): RuntimePluginMessages {\n const bySlug: RuntimePluginMessages = {}\n for (const manifest of manifests) {\n if (typeof manifest?.slug !== 'string' || !isRecord(manifest.messages)) continue\n bySlug[manifest.slug] = manifest.messages as Record<string, Record<string, unknown>>\n }\n return bySlug\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n"],"mappings":";AAKA,YAAY,WAAW;AAShB,MAAM,+BAA+B,MAAM,cAAqC,CAAC,CAAC;AAElF,SAAS,uBACd,WACuB;AACvB,QAAM,SAAgC,CAAC;AACvC,aAAW,YAAY,WAAW;AAChC,QAAI,QAAO,qCAAU,UAAS,YAAY,CAAC,SAAS,SAAS,QAAQ,EAAG;AACxE,WAAO,SAAS,IAAI,IAAI,SAAS;AAAA,EACnC;AACA,SAAO;AACT;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;","names":[]}
|
|
@@ -8,6 +8,8 @@ export interface RuntimeShim {
|
|
|
8
8
|
specifier: string;
|
|
9
9
|
/** Re-exported by name, because an import map cannot rewrite a namespace. */
|
|
10
10
|
exports: string[];
|
|
11
|
+
/** The bridge holds a loader instead of the module, so the app loads it only when a plugin imports it. */
|
|
12
|
+
lazy?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export declare const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[];
|
|
13
15
|
/** Just the specifiers, which is what a bundler's `external` option wants. */
|
|
@@ -1 +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;
|
|
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;IACjB,0GAA0G;IAC1G,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAUD,eAAO,MAAM,oBAAoB,EAAE,SAAS,WAAW,EA8GtD,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAA"}
|
|
@@ -133,7 +133,7 @@ const PLUGIN_RUNTIME_SHIMS = [
|
|
|
133
133
|
file: "sdk-ui.js",
|
|
134
134
|
bridge: "sdkUi",
|
|
135
135
|
specifier: "@collabdt/core/plugins-sdk/ui",
|
|
136
|
-
exports: ["usePluginDialogs"]
|
|
136
|
+
exports: ["toast", "usePluginDialogs"]
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
file: "sdk-components.js",
|
|
@@ -142,6 +142,7 @@ const PLUGIN_RUNTIME_SHIMS = [
|
|
|
142
142
|
exports: [
|
|
143
143
|
"Badge",
|
|
144
144
|
"Button",
|
|
145
|
+
"ConfirmDialog",
|
|
145
146
|
"Input",
|
|
146
147
|
"Separator",
|
|
147
148
|
"Card",
|
|
@@ -159,6 +160,32 @@ const PLUGIN_RUNTIME_SHIMS = [
|
|
|
159
160
|
"DialogTitle",
|
|
160
161
|
"DialogTrigger"
|
|
161
162
|
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
file: "sdk-charts.js",
|
|
166
|
+
bridge: "sdkCharts",
|
|
167
|
+
specifier: "@collabdt/core/plugins-sdk/charts",
|
|
168
|
+
exports: [
|
|
169
|
+
"ChartContainer",
|
|
170
|
+
"ChartTooltip",
|
|
171
|
+
"ChartTooltipContent",
|
|
172
|
+
"ChartLegend",
|
|
173
|
+
"ChartLegendContent",
|
|
174
|
+
"Area",
|
|
175
|
+
"AreaChart",
|
|
176
|
+
"Bar",
|
|
177
|
+
"BarChart",
|
|
178
|
+
"CartesianGrid",
|
|
179
|
+
"Cell",
|
|
180
|
+
"Line",
|
|
181
|
+
"LineChart",
|
|
182
|
+
"Pie",
|
|
183
|
+
"PieChart",
|
|
184
|
+
"ResponsiveContainer",
|
|
185
|
+
"XAxis",
|
|
186
|
+
"YAxis"
|
|
187
|
+
],
|
|
188
|
+
lazy: true
|
|
162
189
|
}
|
|
163
190
|
];
|
|
164
191
|
const PLUGIN_EXTERNALS = PLUGIN_RUNTIME_SHIMS.map(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */\nexport interface RuntimeShim {\n /** Filename served under `/plugin-runtime/`. */\n file: string\n /** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */\n bridge: string\n /** The bare specifier the plugin writes. */\n specifier: string\n /** Re-exported by name, because an import map cannot rewrite a namespace. */\n exports: string[]\n}\n\n// Part of the host contract, so it lives beside `PLUGIN_HOST_API` rather than in the\n// app. Three consumers derive from it — the app's shim generator, the published import\n// map, and `@collabdt/plugin-kit`'s build preset — and when they disagree a plugin\n// either bundles a second copy of a singleton or dies on an unmapped specifier.\n//\n// Absent on purpose: `@thatopen/components`, `three`, `maplibre-gl`, `lucide-react`. A\n// plugin gets viewer instances as props and names icons by string, so it never imports\n// those at runtime — which is what stops a second copy of three.js loading.\nexport const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[] = [\n {\n file: 'react.js',\n bridge: 'react',\n specifier: 'react',\n exports: [\n 'Children', 'Component', 'Fragment', 'Profiler', 'PureComponent',\n 'StrictMode', 'Suspense', 'cloneElement', 'createContext',\n 'createElement', 'createRef', 'forwardRef', 'isValidElement', 'lazy',\n 'memo', 'startTransition', 'useCallback', 'useContext', 'useDebugValue',\n 'useDeferredValue', 'useEffect', 'useId', 'useImperativeHandle',\n 'useInsertionEffect', 'useLayoutEffect', 'useMemo', 'useReducer',\n 'useRef', 'useState', 'useSyncExternalStore', 'useTransition', 'version',\n ],\n },\n {\n file: 'react-dom.js',\n bridge: 'reactDom',\n specifier: 'react-dom',\n exports: ['createPortal', 'flushSync', 'version'],\n },\n {\n file: 'jsx-runtime.js',\n bridge: 'jsxRuntime',\n specifier: 'react/jsx-runtime',\n exports: ['Fragment', 'jsx', 'jsxs'],\n },\n {\n file: 'sdk.js',\n bridge: 'sdk',\n specifier: '@collabdt/core/plugins-sdk',\n exports: [\n 'VALID_CAPABILITIES', 'validateManifest', 'PLUGIN_HOST_API', 'resolvePluginEntry',\n // A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\n 'ViewerNames',\n // So a plugin colouring something on the map uses the platform's palette.\n 'MAP_COLOUR_PALETTE', 'stringToColour',\n ],\n },\n {\n file: 'sdk-config.js',\n bridge: 'sdkConfig',\n specifier: '@collabdt/core/plugins-sdk/config',\n exports: ['usePluginConfig', 'usePluginId'],\n },\n {\n file: 'sdk-messages.js',\n bridge: 'sdkMessages',\n specifier: '@collabdt/core/plugins-sdk/messages',\n exports: ['usePluginMessage', 'usePluginTranslations', 'useCoreTranslations'],\n },\n {\n file: 'sdk-store.js',\n bridge: 'sdkStore',\n specifier: '@collabdt/core/plugins-sdk/store',\n exports: ['usePluginStore'],\n },\n {\n file: 'sdk-data.js',\n bridge: 'sdkData',\n specifier: '@collabdt/core/plugins-sdk/data',\n exports: [\n 'useBuildings', 'useBuilding', 'useBuildingsByOsm', 'useBuildingOsmIds',\n 'useSites', 'useSite',\n 'useInfrastructures', 'useInfrastructure',\n 'useOrganization', 'useOrganizationByName',\n 'useFiles', 'useFile', 'useFilesByBuildingId', 'useFilesBySiteId', 'useDownloadFile',\n 'useSensors', 'useSensor', 'useSensorsByBuilding', 'useSensorsByAuthor', 'useCreateSensor',\n 'useSensorTypes', 'useSensorType',\n 'useComments', 'useComment', 'useCommentsByBuilding', 'useCommentsByAuthor',\n 'useCreateComment', 'useDeleteComments',\n // Re-exported by the module, so a plugin reaching for data finds both here too.\n 'usePluginConfig', 'usePluginPermissions',\n 'usePluginDataset',\n ],\n },\n {\n file: 'sdk-state.js',\n bridge: 'sdkState',\n specifier: '@collabdt/core/plugins-sdk/state',\n exports: ['usePluginState'],\n },\n {\n file: 'sdk-ui.js',\n bridge: 'sdkUi',\n specifier: '@collabdt/core/plugins-sdk/ui',\n exports: ['usePluginDialogs'],\n },\n {\n file: 'sdk-components.js',\n bridge: 'sdkComponents',\n specifier: '@collabdt/core/plugins-sdk/components',\n exports: [\n 'Badge', 'Button', 'Input', 'Separator',\n 'Card', 'CardContent', 'CardDescription', 'CardFooter', 'CardHeader', 'CardTitle',\n 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription',\n 'DialogFooter', 'DialogHeader', 'DialogTitle', 'DialogTrigger',\n ],\n },\n]\n\n/** Just the specifiers, which is what a bundler's `external` option wants. */\nexport const PLUGIN_EXTERNALS: readonly string[] = PLUGIN_RUNTIME_SHIMS.map(\n shim => shim.specifier,\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */\nexport interface RuntimeShim {\n /** Filename served under `/plugin-runtime/`. */\n file: string\n /** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */\n bridge: string\n /** The bare specifier the plugin writes. */\n specifier: string\n /** Re-exported by name, because an import map cannot rewrite a namespace. */\n exports: string[]\n /** The bridge holds a loader instead of the module, so the app loads it only when a plugin imports it. */\n lazy?: boolean\n}\n\n// Part of the host contract, so it lives beside `PLUGIN_HOST_API` rather than in the\n// app. Three consumers derive from it — the app's shim generator, the published import\n// map, and `@collabdt/plugin-kit`'s build preset — and when they disagree a plugin\n// either bundles a second copy of a singleton or dies on an unmapped specifier.\n//\n// Absent on purpose: `@thatopen/components`, `three`, `maplibre-gl`, `lucide-react`. A\n// plugin gets viewer instances as props and names icons by string, so it never imports\n// those at runtime — which is what stops a second copy of three.js loading.\nexport const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[] = [\n {\n file: 'react.js',\n bridge: 'react',\n specifier: 'react',\n exports: [\n 'Children', 'Component', 'Fragment', 'Profiler', 'PureComponent',\n 'StrictMode', 'Suspense', 'cloneElement', 'createContext',\n 'createElement', 'createRef', 'forwardRef', 'isValidElement', 'lazy',\n 'memo', 'startTransition', 'useCallback', 'useContext', 'useDebugValue',\n 'useDeferredValue', 'useEffect', 'useId', 'useImperativeHandle',\n 'useInsertionEffect', 'useLayoutEffect', 'useMemo', 'useReducer',\n 'useRef', 'useState', 'useSyncExternalStore', 'useTransition', 'version',\n ],\n },\n {\n file: 'react-dom.js',\n bridge: 'reactDom',\n specifier: 'react-dom',\n exports: ['createPortal', 'flushSync', 'version'],\n },\n {\n file: 'jsx-runtime.js',\n bridge: 'jsxRuntime',\n specifier: 'react/jsx-runtime',\n exports: ['Fragment', 'jsx', 'jsxs'],\n },\n {\n file: 'sdk.js',\n bridge: 'sdk',\n specifier: '@collabdt/core/plugins-sdk',\n exports: [\n 'VALID_CAPABILITIES', 'validateManifest', 'PLUGIN_HOST_API', 'resolvePluginEntry',\n // A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\n 'ViewerNames',\n // So a plugin colouring something on the map uses the platform's palette.\n 'MAP_COLOUR_PALETTE', 'stringToColour',\n ],\n },\n {\n file: 'sdk-config.js',\n bridge: 'sdkConfig',\n specifier: '@collabdt/core/plugins-sdk/config',\n exports: ['usePluginConfig', 'usePluginId'],\n },\n {\n file: 'sdk-messages.js',\n bridge: 'sdkMessages',\n specifier: '@collabdt/core/plugins-sdk/messages',\n exports: ['usePluginMessage', 'usePluginTranslations', 'useCoreTranslations'],\n },\n {\n file: 'sdk-store.js',\n bridge: 'sdkStore',\n specifier: '@collabdt/core/plugins-sdk/store',\n exports: ['usePluginStore'],\n },\n {\n file: 'sdk-data.js',\n bridge: 'sdkData',\n specifier: '@collabdt/core/plugins-sdk/data',\n exports: [\n 'useBuildings', 'useBuilding', 'useBuildingsByOsm', 'useBuildingOsmIds',\n 'useSites', 'useSite',\n 'useInfrastructures', 'useInfrastructure',\n 'useOrganization', 'useOrganizationByName',\n 'useFiles', 'useFile', 'useFilesByBuildingId', 'useFilesBySiteId', 'useDownloadFile',\n 'useSensors', 'useSensor', 'useSensorsByBuilding', 'useSensorsByAuthor', 'useCreateSensor',\n 'useSensorTypes', 'useSensorType',\n 'useComments', 'useComment', 'useCommentsByBuilding', 'useCommentsByAuthor',\n 'useCreateComment', 'useDeleteComments',\n // Re-exported by the module, so a plugin reaching for data finds both here too.\n 'usePluginConfig', 'usePluginPermissions',\n 'usePluginDataset',\n ],\n },\n {\n file: 'sdk-state.js',\n bridge: 'sdkState',\n specifier: '@collabdt/core/plugins-sdk/state',\n exports: ['usePluginState'],\n },\n {\n file: 'sdk-ui.js',\n bridge: 'sdkUi',\n specifier: '@collabdt/core/plugins-sdk/ui',\n exports: ['toast', 'usePluginDialogs'],\n },\n {\n file: 'sdk-components.js',\n bridge: 'sdkComponents',\n specifier: '@collabdt/core/plugins-sdk/components',\n exports: [\n 'Badge', 'Button', 'ConfirmDialog', 'Input', 'Separator',\n 'Card', 'CardContent', 'CardDescription', 'CardFooter', 'CardHeader', 'CardTitle',\n 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription',\n 'DialogFooter', 'DialogHeader', 'DialogTitle', 'DialogTrigger',\n ],\n },\n {\n file: 'sdk-charts.js',\n bridge: 'sdkCharts',\n specifier: '@collabdt/core/plugins-sdk/charts',\n exports: [\n 'ChartContainer', 'ChartTooltip', 'ChartTooltipContent', 'ChartLegend', 'ChartLegendContent',\n 'Area', 'AreaChart', 'Bar', 'BarChart', 'CartesianGrid', 'Cell', 'Line', 'LineChart',\n 'Pie', 'PieChart', 'ResponsiveContainer', 'XAxis', 'YAxis',\n ],\n lazy: true,\n },\n]\n\n/** Just the specifiers, which is what a bundler's `external` option wants. */\nexport const PLUGIN_EXTERNALS: readonly string[] = PLUGIN_RUNTIME_SHIMS.map(\n shim => shim.specifier,\n)\n"],"mappings":"AAyBO,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;A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AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginContribution } from './provider';
|
|
2
|
+
import type { Dataset } from '../../types/datasetTypes';
|
|
3
|
+
type DatasetContribution = PluginContribution<'map.datasets'>;
|
|
4
|
+
/**
|
|
5
|
+
* A `map.datasets` contribution as the Datasets menu lists it. A live one goes under Live
|
|
6
|
+
* Data; any other is organizational, stamped with the viewer's own organization.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toPluginDataset(registration: DatasetContribution, organization?: number): Dataset;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=toPluginDataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toPluginDataset.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/toPluginDataset.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAMvD,KAAK,mBAAmB,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAA;AA8B7D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,mBAAmB,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAoBjG"}
|