@collabdt/core 0.4.8 → 0.5.1
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.js +2 -2
- package/dist/core/components/AppSidebarContent.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 +6 -1
- 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 +4 -0
- package/dist/core/components/viewers/bim/BimViewer.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 +35 -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/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/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/legends/MapLegendHost.d.ts.map +1 -1
- package/dist/core/components/viewers/map/legends/MapLegendHost.js +2 -4
- package/dist/core/components/viewers/map/legends/MapLegendHost.js.map +1 -1
- 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/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/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 +235 -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/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/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 +81 -4
- package/dist/core/i18n/messages/es.json +82 -5
- package/dist/core/i18n/messages/fr.json +81 -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/HelloBimTool.d.ts +18 -0
- package/dist/core/plugins/hello-bim/components/HelloBimTool.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/components/HelloBimTool.js +142 -0
- package/dist/core/plugins/hello-bim/components/HelloBimTool.js.map +1 -0
- package/dist/core/plugins/hello-bim/index.d.ts +11 -0
- package/dist/core/plugins/hello-bim/index.d.ts.map +1 -0
- package/dist/core/plugins/hello-bim/index.js +14 -0
- package/dist/core/plugins/hello-bim/index.js.map +1 -0
- package/dist/core/plugins/hello-bim/manifest.json +61 -0
- package/dist/core/plugins/hello-map/components/HelloMapTool.d.ts +14 -0
- package/dist/core/plugins/hello-map/components/HelloMapTool.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/components/HelloMapTool.js +59 -0
- package/dist/core/plugins/hello-map/components/HelloMapTool.js.map +1 -0
- package/dist/core/plugins/hello-map/index.d.ts +10 -0
- package/dist/core/plugins/hello-map/index.d.ts.map +1 -0
- package/dist/core/plugins/hello-map/index.js +14 -0
- package/dist/core/plugins/hello-map/index.js.map +1 -0
- package/dist/core/plugins/hello-map/manifest.json +56 -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/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 +62 -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/provider.d.ts +37 -2
- package/dist/core/plugins/host/provider.d.ts.map +1 -1
- package/dist/core/plugins/host/provider.js +95 -9
- 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 +110 -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/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/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 +48 -0
- package/dist/core/plugins/sdk/bimViewer.d.ts.map +1 -0
- package/dist/core/plugins/sdk/bimViewer.js +50 -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 +3 -0
- package/dist/core/plugins/sdk/index.d.ts.map +1 -1
- package/dist/core/plugins/sdk/index.js +6 -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 +27 -0
- package/dist/core/plugins/sdk/messages.d.ts.map +1 -0
- package/dist/core/plugins/sdk/messages.js +47 -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/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 +42 -47
- package/dist/core/plugins/sdk/types.d.ts.map +1 -1
- package/dist/core/plugins/sdk/types.js +10 -6
- package/dist/core/plugins/sdk/types.js.map +1 -1
- 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 +9 -4
- package/dist/core/store/CombineProviders.js.map +1 -1
- package/dist/core/types/dbTypes.d.ts +1 -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 +9 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/data.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\n/**\r\n * Data access for plugins: core's own bound hooks, re-exported. A plugin goes\r\n * through the same `ApiAdapter` as everything else and inherits its auth, org\r\n * scoping and SWR cache — no second data path, and no way past the tenant boundary.\r\n *\r\n * Read-only where the write belongs to core: buildings and sites are canonical asset\r\n * records, so changing them is a core change. Sensors and comments are read-write,\r\n * being the domains plugins are expected to author. A plugin's own data goes in\r\n * `plugins-sdk/store`.\r\n */\r\n\r\n// --- Read: assets -----------------------------------------------------------\r\nexport {\r\n useBuildings,\r\n useBuilding,\r\n useBuildingsByOsm,\r\n useBuildingOsmIds,\r\n} from '../../hooks/buildings/buildings'\r\nexport { useSites, useSite } from '../../hooks/sites/sites'\r\nexport { useInfrastructures, useInfrastructure } from '../../hooks/infrastructures/infrastructures'\r\n\r\n// --- Read: organization and files ------------------------------------------\r\nexport { useOrganization, useOrganizationByName } from '../../hooks/organizations/organizations'\r\nexport {\r\n useFiles,\r\n useFile,\r\n useFilesByBuildingId,\r\n useFilesBySiteId,\r\n useDownloadFile,\r\n} from '../../hooks/files/files'\r\n\r\n// --- Read/write: sensors ----------------------------------------------------\r\nexport {\r\n useSensors,\r\n useSensor,\r\n useSensorsByBuilding,\r\n useSensorsByAuthor,\r\n useCreateSensor,\r\n} from '../../hooks/sensors/sensors'\r\nexport { useSensorTypes, useSensorType } from '../../hooks/sensorTypes/sensorTypes'\r\n\r\n// --- Read/write: comments ---------------------------------------------------\r\nexport {\r\n useComments,\r\n useComment,\r\n useCommentsByBuilding,\r\n useCommentsByAuthor,\r\n useCreateComment,\r\n useDeleteComments,\r\n} from '../../hooks/comments/comments'\r\n\r\n// --- Plugin context ---------------------------------------------------------\r\n\r\n/** The plugin's config for this organization, shaped by the manifest's `configSchema`. */\r\nexport { usePluginConfig } from './config'\r\n\r\nexport { usePluginPermissions } from './permissions'\r\n"],"mappings":";AAiBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,eAAe;AAClC,SAAS,oBAAoB,yBAAyB;AAGtD,SAAS,iBAAiB,6BAA6B;AACvD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB,qBAAqB;AAG9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,uBAAuB;AAEhC,SAAS,4BAA4B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/index.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAI5B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/sdk/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nexport * from './types'\r\nexport * from './version'\r\nexport * from './components'\r\n\r\n// The single source the app's shim generator, the import map it publishes and\r\n// @collabdt/plugin-kit's build preset all derive from.\r\nexport { PLUGIN_RUNTIME_SHIMS, PLUGIN_EXTERNALS } from '../host/runtimeShims'\r\nexport type { RuntimeShim } from '../host/runtimeShims'\r\n"],"mappings":"AAGA,cAAc;AACd,cAAc;AACd,cAAc;AAId,SAAS,sBAAsB,wBAAwB;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* The GIS map, as a plugin sees it.
|
|
4
|
+
*
|
|
5
|
+
* Kept separate from `bimViewer` so core's own map toolbar can consume it without
|
|
6
|
+
* pulling `@thatopen` and three into the eager map-route bundle. Plugins can
|
|
7
|
+
* import either this module or the `viewer` barrel.
|
|
8
|
+
*/
|
|
9
|
+
export interface MapToolProps {
|
|
10
|
+
/** Null until the map has finished initialising, and in non-map viewers. */
|
|
11
|
+
map: MapLibreMap | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function useMapViewer(): MapToolProps;
|
|
14
|
+
//# sourceMappingURL=mapViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapViewer.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/mapViewer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,aAAa,CAAA;AAErD;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,GAAG,EAAE,WAAW,GAAG,IAAI,CAAA;CACxB;AAED,wBAAgB,YAAY,IAAI,YAAY,CAK3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { MapContext } from "../../store/Map/context";
|
|
4
|
+
function useMapViewer() {
|
|
5
|
+
var _a;
|
|
6
|
+
const { state } = React.useContext(MapContext);
|
|
7
|
+
const map = (_a = state.map.map) != null ? _a : null;
|
|
8
|
+
return React.useMemo(() => ({ map }), [map]);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
useMapViewer
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=mapViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/mapViewer.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 { MapContext } from '../../store/Map/context'\r\n\r\nimport type { Map as MapLibreMap } from 'maplibre-gl'\r\n\r\n/**\r\n * The GIS map, as a plugin sees it.\r\n *\r\n * Kept separate from `bimViewer` so core's own map toolbar can consume it without\r\n * pulling `@thatopen` and three into the eager map-route bundle. Plugins can\r\n * import either this module or the `viewer` barrel.\r\n */\r\n\r\nexport interface MapToolProps {\r\n /** Null until the map has finished initialising, and in non-map viewers. */\r\n map: MapLibreMap | null\r\n}\r\n\r\nexport function useMapViewer(): MapToolProps {\r\n const { state } = React.useContext(MapContext)\r\n const map = (state.map.map as MapLibreMap | null) ?? null\r\n\r\n return React.useMemo(() => ({ map }), [map])\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,kBAAkB;AAiBpB,SAAS,eAA6B;AAxB7C;AAyBE,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,UAAU;AAC7C,QAAM,OAAO,WAAM,IAAI,QAAV,YAAwC;AAErD,SAAO,MAAM,QAAQ,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC;AAC7C;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translations for plugin-supplied text.
|
|
3
|
+
*
|
|
4
|
+
* A plugin's catalog is merged under `plugins.<pluginId>`, giving the locale
|
|
5
|
+
* fallbacks for free. What this module adds is the last one: a plugin may ship no
|
|
6
|
+
* catalog, or one missing the key, and the manifest's own string is shown rather
|
|
7
|
+
* than `plugins.foo.name`. An untranslated plugin stays usable.
|
|
8
|
+
*/
|
|
9
|
+
/** Reads `plugins.<pluginId>.<key>` out of the merged catalog, if it is there. */
|
|
10
|
+
declare function lookupPluginMessage(messages: Record<string, unknown> | undefined, pluginId: string, key: string): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* One piece of plugin-supplied text, with the manifest string as the fallback.
|
|
13
|
+
* For anything core renders on a plugin's behalf — its name, description, a
|
|
14
|
+
* contributed tool's label.
|
|
15
|
+
*/
|
|
16
|
+
export declare function usePluginMessage(pluginId: string, key: string, fallback: string): string;
|
|
17
|
+
export type PluginTranslator = (key: string, fallback?: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* A `t()` scoped to the calling plugin's namespace. Only valid inside a plugin
|
|
20
|
+
* subtree, so a plugin cannot read another's strings. Without a `fallback`, a
|
|
21
|
+
* missing key renders as `plugins.<pluginId>.<key>` rather than throwing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function usePluginTranslations(): PluginTranslator;
|
|
24
|
+
/** Core's own strings, kept a separate call so plugin and core text differ at the point of use. */
|
|
25
|
+
export declare function useCoreTranslations(namespace: string): import("use-intl")._Translator<Record<string, any>, string>;
|
|
26
|
+
export { lookupPluginMessage as __lookupPluginMessage };
|
|
27
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/messages.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AAEH,kFAAkF;AAClF,iBAAS,mBAAmB,CAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOxF;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAWxD;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,+DAEpD;AAED,OAAO,EAAE,mBAAmB,IAAI,qBAAqB,EAAE,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMessages, useTranslations } from "next-intl";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { usePluginId } from "../host/scope";
|
|
5
|
+
function lookupPluginMessage(messages, pluginId, key) {
|
|
6
|
+
const plugins = messages == null ? void 0 : messages.plugins;
|
|
7
|
+
if (typeof plugins !== "object" || plugins === null) return void 0;
|
|
8
|
+
const own = plugins[pluginId];
|
|
9
|
+
if (typeof own !== "object" || own === null) return void 0;
|
|
10
|
+
let node = own;
|
|
11
|
+
for (const part of key.split(".")) {
|
|
12
|
+
if (typeof node !== "object" || node === null) return void 0;
|
|
13
|
+
node = node[part];
|
|
14
|
+
}
|
|
15
|
+
return typeof node === "string" && node.length > 0 ? node : void 0;
|
|
16
|
+
}
|
|
17
|
+
function usePluginMessage(pluginId, key, fallback) {
|
|
18
|
+
const messages = useMessages();
|
|
19
|
+
return React.useMemo(
|
|
20
|
+
() => {
|
|
21
|
+
var _a;
|
|
22
|
+
return (_a = lookupPluginMessage(messages, pluginId, key)) != null ? _a : fallback;
|
|
23
|
+
},
|
|
24
|
+
[messages, pluginId, key, fallback]
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function usePluginTranslations() {
|
|
28
|
+
const pluginId = usePluginId();
|
|
29
|
+
const messages = useMessages();
|
|
30
|
+
return React.useCallback(
|
|
31
|
+
(key, fallback) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return (_b = (_a = lookupPluginMessage(messages, pluginId, key)) != null ? _a : fallback) != null ? _b : `plugins.${pluginId}.${key}`;
|
|
34
|
+
},
|
|
35
|
+
[messages, pluginId]
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function useCoreTranslations(namespace) {
|
|
39
|
+
return useTranslations(namespace);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
lookupPluginMessage as __lookupPluginMessage,
|
|
43
|
+
useCoreTranslations,
|
|
44
|
+
usePluginMessage,
|
|
45
|
+
usePluginTranslations
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/messages.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { useMessages, useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\nimport { usePluginId } from '../host/scope'\r\n\r\n/**\r\n * Translations for plugin-supplied text.\r\n *\r\n * A plugin's catalog is merged under `plugins.<pluginId>`, giving the locale\r\n * fallbacks for free. What this module adds is the last one: a plugin may ship no\r\n * catalog, or one missing the key, and the manifest's own string is shown rather\r\n * than `plugins.foo.name`. An untranslated plugin stays usable.\r\n */\r\n\r\n/** Reads `plugins.<pluginId>.<key>` out of the merged catalog, if it is there. */\r\nfunction lookupPluginMessage(\r\n messages: Record<string, unknown> | undefined,\r\n pluginId: string,\r\n key: string,\r\n): string | undefined {\r\n const plugins = messages?.plugins\r\n if (typeof plugins !== 'object' || plugins === null) return undefined\r\n\r\n const own = (plugins as Record<string, unknown>)[pluginId]\r\n if (typeof own !== 'object' || own === null) return undefined\r\n\r\n // Dotted keys address nested groups, e.g. 'spaces.title'.\r\n let node: unknown = own\r\n for (const part of key.split('.')) {\r\n if (typeof node !== 'object' || node === null) return undefined\r\n node = (node as Record<string, unknown>)[part]\r\n }\r\n\r\n return typeof node === 'string' && node.length > 0 ? node : undefined\r\n}\r\n\r\n/**\r\n * One piece of plugin-supplied text, with the manifest string as the fallback.\r\n * For anything core renders on a plugin's behalf — its name, description, a\r\n * contributed tool's label.\r\n */\r\nexport function usePluginMessage(pluginId: string, key: string, fallback: string): string {\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useMemo(\r\n () => lookupPluginMessage(messages, pluginId, key) ?? fallback,\r\n [messages, pluginId, key, fallback],\r\n )\r\n}\r\n\r\nexport type PluginTranslator = (key: string, fallback?: string) => string\r\n\r\n/**\r\n * A `t()` scoped to the calling plugin's namespace. Only valid inside a plugin\r\n * subtree, so a plugin cannot read another's strings. Without a `fallback`, a\r\n * missing key renders as `plugins.<pluginId>.<key>` rather than throwing.\r\n */\r\nexport function usePluginTranslations(): PluginTranslator {\r\n const pluginId = usePluginId()\r\n const messages = useMessages() as Record<string, unknown> | undefined\r\n\r\n return React.useCallback(\r\n (key: string, fallback?: string) =>\r\n lookupPluginMessage(messages, pluginId, key)\r\n ?? fallback\r\n ?? `plugins.${pluginId}.${key}`,\r\n [messages, pluginId],\r\n )\r\n}\r\n\r\n/** Core's own strings, kept a separate call so plugin and core text differ at the point of use. */\r\nexport function useCoreTranslations(namespace: string) {\r\n return useTranslations(namespace)\r\n}\r\n\r\nexport { lookupPluginMessage as __lookupPluginMessage }\r\n"],"mappings":";AAKA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAY5B,SAAS,oBACP,UACA,UACA,KACoB;AACpB,QAAM,UAAU,qCAAU;AAC1B,MAAI,OAAO,YAAY,YAAY,YAAY,KAAM,QAAO;AAE5D,QAAM,MAAO,QAAoC,QAAQ;AACzD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AAGpD,MAAI,OAAgB;AACpB,aAAW,QAAQ,IAAI,MAAM,GAAG,GAAG;AACjC,QAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,WAAQ,KAAiC,IAAI;AAAA,EAC/C;AAEA,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO;AAC9D;AAOO,SAAS,iBAAiB,UAAkB,KAAa,UAA0B;AACxF,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,MAAG;AAlDP;AAkDU,uCAAoB,UAAU,UAAU,GAAG,MAA3C,YAAgD;AAAA;AAAA,IACtD,CAAC,UAAU,UAAU,KAAK,QAAQ;AAAA,EACpC;AACF;AASO,SAAS,wBAA0C;AACxD,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,YAAY;AAE7B,SAAO,MAAM;AAAA,IACX,CAAC,KAAa,aAAmB;AAnErC;AAoEM,6CAAoB,UAAU,UAAU,GAAG,MAA3C,YACG,aADH,YAEG,WAAW,QAAQ,IAAI,GAAG;AAAA;AAAA,IAC/B,CAAC,UAAU,QAAQ;AAAA,EACrB;AACF;AAGO,SAAS,oBAAoB,WAAmB;AACrD,SAAO,gBAAgB,SAAS;AAClC;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MongoAbility } from '@casl/ability';
|
|
2
|
+
export interface PluginPermissions {
|
|
3
|
+
/**
|
|
4
|
+
* The signed-in user's CASL ability, e.g. `can('update', 'Sensor')`.
|
|
5
|
+
*
|
|
6
|
+
* Read this to hide UI the user cannot use. It is **not** a security boundary:
|
|
7
|
+
* the API routes re-check every action server-side, which is what actually
|
|
8
|
+
* enforces it. A plugin skipping this check gets a 403, not access.
|
|
9
|
+
*/
|
|
10
|
+
ability: MongoAbility;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function usePluginPermissions(): PluginPermissions;
|
|
14
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/permissions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,OAAO,EAAE,YAAY,CAAA;IACrB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAGxD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePermissions } from "../../store/Permissions/context";
|
|
3
|
+
function usePluginPermissions() {
|
|
4
|
+
const { ability, isLoading } = usePermissions();
|
|
5
|
+
return { ability, isLoading };
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
usePluginPermissions
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/permissions.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 { usePermissions } from '../../store/Permissions/context'\r\n\r\nimport type { MongoAbility } from '@casl/ability'\r\n\r\nexport interface PluginPermissions {\r\n /**\r\n * The signed-in user's CASL ability, e.g. `can('update', 'Sensor')`.\r\n *\r\n * Read this to hide UI the user cannot use. It is **not** a security boundary:\r\n * the API routes re-check every action server-side, which is what actually\r\n * enforces it. A plugin skipping this check gets a 403, not access.\r\n */\r\n ability: MongoAbility\r\n isLoading: boolean\r\n}\r\n\r\nexport function usePluginPermissions(): PluginPermissions {\r\n const { ability, isLoading } = usePermissions()\r\n return { ability, isLoading }\r\n}\r\n"],"mappings":";AAKA,SAAS,sBAAsB;AAgBxB,SAAS,uBAA0C;AACxD,QAAM,EAAE,SAAS,UAAU,IAAI,eAAe;AAC9C,SAAO,EAAE,SAAS,UAAU;AAC9B;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The point-cloud viewer, as a plugin sees it.
|
|
3
|
+
*
|
|
4
|
+
* Potree ships no type declarations, so `viewer` is deliberately `unknown`: a
|
|
5
|
+
* plugin narrows it itself rather than core inventing a type that could drift from
|
|
6
|
+
* the library.
|
|
7
|
+
*/
|
|
8
|
+
export interface PointCloudToolProps {
|
|
9
|
+
viewer: unknown;
|
|
10
|
+
/** False until Potree has finished initialising. */
|
|
11
|
+
ready: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function usePointCloudViewer(): PointCloudToolProps;
|
|
14
|
+
//# sourceMappingURL=pointCloudViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointCloudViewer.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/pointCloudViewer.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AAEH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAA;IACf,oDAAoD;IACpD,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAgB,mBAAmB,IAAI,mBAAmB,CAQzD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { PointCloudContext } from "../../store/PointCloud/context";
|
|
4
|
+
function usePointCloudViewer() {
|
|
5
|
+
const { state } = React.useContext(PointCloudContext);
|
|
6
|
+
const { viewer, ready } = state.pointcloud;
|
|
7
|
+
return React.useMemo(
|
|
8
|
+
() => ({ viewer: viewer != null ? viewer : null, ready: Boolean(ready) }),
|
|
9
|
+
[viewer, ready]
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
usePointCloudViewer
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=pointCloudViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/pointCloudViewer.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 { PointCloudContext } from '../../store/PointCloud/context'\r\n\r\n/**\r\n * The point-cloud viewer, as a plugin sees it.\r\n *\r\n * Potree ships no type declarations, so `viewer` is deliberately `unknown`: a\r\n * plugin narrows it itself rather than core inventing a type that could drift from\r\n * the library.\r\n */\r\n\r\nexport interface PointCloudToolProps {\r\n viewer: unknown\r\n /** False until Potree has finished initialising. */\r\n ready: boolean\r\n}\r\n\r\nexport function usePointCloudViewer(): PointCloudToolProps {\r\n const { state } = React.useContext(PointCloudContext)\r\n const { viewer, ready } = state.pointcloud\r\n\r\n return React.useMemo(\r\n () => ({ viewer: viewer ?? null, ready: Boolean(ready) }),\r\n [viewer, ready],\r\n )\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,yBAAyB;AAgB3B,SAAS,sBAA2C;AACzD,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,iBAAiB;AACpD,QAAM,EAAE,QAAQ,MAAM,IAAI,MAAM;AAEhC,SAAO,MAAM;AAAA,IACX,OAAO,EAAE,QAAQ,0BAAU,MAAM,OAAO,QAAQ,KAAK,EAAE;AAAA,IACvD,CAAC,QAAQ,KAAK;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** One stored document, as the owning plugin sees it. */
|
|
2
|
+
export interface PluginDocument<T> {
|
|
3
|
+
/** The plugin's own stable identifier for this document. */
|
|
4
|
+
key: string;
|
|
5
|
+
data: T;
|
|
6
|
+
updatedAt: string | Date;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginStore<T> {
|
|
9
|
+
items: PluginDocument<T>[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
isError: unknown;
|
|
12
|
+
/** One document by key, or undefined. */
|
|
13
|
+
get: (key: string) => PluginDocument<T> | undefined;
|
|
14
|
+
/** Create or replace a document. Keyed writes are upserts, not appends. */
|
|
15
|
+
put: (key: string, data: T) => Promise<void>;
|
|
16
|
+
remove: (key: string) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Storage a plugin owns, without a change to CDT's database.
|
|
20
|
+
*
|
|
21
|
+
* Scoped by organization (from the session, server-side), by plugin (from the plugin
|
|
22
|
+
* scope, never a parameter, so no plugin can name another's namespace) and by
|
|
23
|
+
* collection, which the plugin picks. `key` is the plugin's own identifier — use
|
|
24
|
+
* something durable like an IFC GlobalId, since writing the same key replaces.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const spaces = usePluginStore<{ programme: string; capacity: number }>('spaces')
|
|
28
|
+
* await spaces.put(globalId, { programme: 'Office', capacity: 4 })
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Core never inspects `data`, so `T` is a declaration rather than a guarantee —
|
|
32
|
+
* read defensively if an older version of the plugin wrote a different shape.
|
|
33
|
+
*/
|
|
34
|
+
export declare function usePluginStore<T = unknown>(collection: string): PluginStore<T>;
|
|
35
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/store.ts"],"names":[],"mappings":"AAUA,yDAAyD;AACzD,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,CAAC,CAAA;IACP,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1B,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,yCAAyC;IACzC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IACnD,2EAA2E;IAC3E,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAgC9E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useCoreHooks } from "../../hooks/provider";
|
|
4
|
+
import { usePluginId } from "../host/scope";
|
|
5
|
+
function usePluginStore(collection) {
|
|
6
|
+
const pluginId = usePluginId();
|
|
7
|
+
const { plugin } = useCoreHooks();
|
|
8
|
+
const { records, isLoading, isError, put, remove } = plugin.usePluginRecords(pluginId, collection);
|
|
9
|
+
const items = React.useMemo(
|
|
10
|
+
() => records.map((record) => ({
|
|
11
|
+
key: record.key,
|
|
12
|
+
data: record.data,
|
|
13
|
+
updatedAt: record.updatedAt
|
|
14
|
+
})),
|
|
15
|
+
[records]
|
|
16
|
+
);
|
|
17
|
+
const byKey = React.useMemo(
|
|
18
|
+
() => new Map(items.map((item) => [item.key, item])),
|
|
19
|
+
[items]
|
|
20
|
+
);
|
|
21
|
+
return React.useMemo(() => ({
|
|
22
|
+
items,
|
|
23
|
+
isLoading,
|
|
24
|
+
isError,
|
|
25
|
+
get: (key) => byKey.get(key),
|
|
26
|
+
put: async (key, data) => {
|
|
27
|
+
await put(key, data);
|
|
28
|
+
},
|
|
29
|
+
remove: async (key) => {
|
|
30
|
+
await remove(key);
|
|
31
|
+
}
|
|
32
|
+
}), [items, byKey, isLoading, isError, put, remove]);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
usePluginStore
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/store.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 { useCoreHooks } from '../../hooks/provider'\r\nimport { usePluginId } from '../host/scope'\r\n\r\n/** One stored document, as the owning plugin sees it. */\r\nexport interface PluginDocument<T> {\r\n /** The plugin's own stable identifier for this document. */\r\n key: string\r\n data: T\r\n updatedAt: string | Date\r\n}\r\n\r\nexport interface PluginStore<T> {\r\n items: PluginDocument<T>[]\r\n isLoading: boolean\r\n isError: unknown\r\n /** One document by key, or undefined. */\r\n get: (key: string) => PluginDocument<T> | undefined\r\n /** Create or replace a document. Keyed writes are upserts, not appends. */\r\n put: (key: string, data: T) => Promise<void>\r\n remove: (key: string) => Promise<void>\r\n}\r\n\r\n/**\r\n * Storage a plugin owns, without a change to CDT's database.\r\n *\r\n * Scoped by organization (from the session, server-side), by plugin (from the plugin\r\n * scope, never a parameter, so no plugin can name another's namespace) and by\r\n * collection, which the plugin picks. `key` is the plugin's own identifier — use\r\n * something durable like an IFC GlobalId, since writing the same key replaces.\r\n *\r\n * ```tsx\r\n * const spaces = usePluginStore<{ programme: string; capacity: number }>('spaces')\r\n * await spaces.put(globalId, { programme: 'Office', capacity: 4 })\r\n * ```\r\n *\r\n * Core never inspects `data`, so `T` is a declaration rather than a guarantee —\r\n * read defensively if an older version of the plugin wrote a different shape.\r\n */\r\nexport function usePluginStore<T = unknown>(collection: string): PluginStore<T> {\r\n const pluginId = usePluginId()\r\n const { plugin } = useCoreHooks()\r\n\r\n const { records, isLoading, isError, put, remove } = plugin.usePluginRecords(pluginId, collection)\r\n\r\n const items = React.useMemo<PluginDocument<T>[]>(\r\n () => records.map(record => ({\r\n key: record.key,\r\n data: record.data as T,\r\n updatedAt: record.updatedAt,\r\n })),\r\n [records],\r\n )\r\n\r\n const byKey = React.useMemo(\r\n () => new Map(items.map(item => [item.key, item])),\r\n [items],\r\n )\r\n\r\n return React.useMemo<PluginStore<T>>(() => ({\r\n items,\r\n isLoading,\r\n isError,\r\n get: key => byKey.get(key),\r\n put: async (key, data) => {\r\n await put(key, data)\r\n },\r\n remove: async key => {\r\n await remove(key)\r\n },\r\n }), [items, byKey, isLoading, isError, put, remove])\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAqCrB,SAAS,eAA4B,YAAoC;AAC9E,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,OAAO,IAAI,aAAa;AAEhC,QAAM,EAAE,SAAS,WAAW,SAAS,KAAK,OAAO,IAAI,OAAO,iBAAiB,UAAU,UAAU;AAEjG,QAAM,QAAQ,MAAM;AAAA,IAClB,MAAM,QAAQ,IAAI,aAAW;AAAA,MAC3B,KAAK,OAAO;AAAA,MACZ,MAAM,OAAO;AAAA,MACb,WAAW,OAAO;AAAA,IACpB,EAAE;AAAA,IACF,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,QAAQ,MAAM;AAAA,IAClB,MAAM,IAAI,IAAI,MAAM,IAAI,UAAQ,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AAAA,IACjD,CAAC,KAAK;AAAA,EACR;AAEA,SAAO,MAAM,QAAwB,OAAO;AAAA,IAC1C;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,SAAO,MAAM,IAAI,GAAG;AAAA,IACzB,KAAK,OAAO,KAAK,SAAS;AACxB,YAAM,IAAI,KAAK,IAAI;AAAA,IACrB;AAAA,IACA,QAAQ,OAAM,QAAO;AACnB,YAAM,OAAO,GAAG;AAAA,IAClB;AAAA,EACF,IAAI,CAAC,OAAO,OAAO,WAAW,SAAS,KAAK,MAAM,CAAC;AACrD;","names":[]}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
+
import type { BimToolProps } from './bimViewer';
|
|
2
|
+
import type { MapToolProps } from './mapViewer';
|
|
3
|
+
import type { PointCloudToolProps } from './pointCloudViewer';
|
|
4
|
+
import type { ViewerNames } from '../../types/dbTypes';
|
|
1
5
|
import type { LucideProps } from 'lucide-react';
|
|
2
|
-
export declare const VALID_CAPABILITIES: readonly ["sidebar.items", "viewer.panels", "map.tools", "bim.tools", "pointcloud.tools", "map.
|
|
6
|
+
export declare const VALID_CAPABILITIES: readonly ["sidebar.items", "viewer.panels", "map.tools", "bim.tools", "pointcloud.tools", "map.legends"];
|
|
3
7
|
export type PluginCapability = typeof VALID_CAPABILITIES[number];
|
|
4
8
|
export interface PluginManifest {
|
|
5
9
|
slug: string;
|
|
6
10
|
name: string;
|
|
7
11
|
version: string;
|
|
12
|
+
/** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */
|
|
13
|
+
hostApi?: number;
|
|
8
14
|
description?: string;
|
|
9
15
|
author?: string;
|
|
10
16
|
capabilities: PluginCapability[];
|
|
11
17
|
requiredPermissions?: string[];
|
|
12
18
|
configSchema?: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.
|
|
21
|
+
* Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin
|
|
22
|
+
* can collide with another. Values may nest, addressed as `t('spaces.title')`.
|
|
23
|
+
*/
|
|
24
|
+
messages?: Record<string, Record<string, unknown>>;
|
|
13
25
|
}
|
|
14
26
|
export declare function validateManifest(manifest: unknown): {
|
|
15
27
|
valid: boolean;
|
|
@@ -21,13 +33,20 @@ export interface SidebarRegistration {
|
|
|
21
33
|
icon: string | React.ComponentType<LucideProps>;
|
|
22
34
|
component: React.ComponentType;
|
|
23
35
|
}
|
|
24
|
-
|
|
36
|
+
/** Every toolbar component receives the toolbar entry core built for it. */
|
|
37
|
+
export interface ToolbarToolProps {
|
|
38
|
+
tool: unknown;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as
|
|
42
|
+
* props, bound per capability by `CapabilityRegistry` — so a BIM component
|
|
43
|
+
* registered under `map.tools` is a compile error.
|
|
44
|
+
*/
|
|
45
|
+
export interface ToolbarRegistration<P = Record<string, unknown>> {
|
|
25
46
|
id: string;
|
|
26
47
|
label: string;
|
|
27
48
|
icon: string | React.ComponentType<LucideProps>;
|
|
28
|
-
component: React.ComponentType<
|
|
29
|
-
tool: unknown;
|
|
30
|
-
}>;
|
|
49
|
+
component: React.ComponentType<ToolbarToolProps & P>;
|
|
31
50
|
cursor?: string;
|
|
32
51
|
stayActive?: boolean;
|
|
33
52
|
}
|
|
@@ -36,39 +55,8 @@ export interface ViewerRegistration {
|
|
|
36
55
|
label: string;
|
|
37
56
|
icon: string | React.ComponentType<LucideProps>;
|
|
38
57
|
component: React.ComponentType;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
id: string;
|
|
42
|
-
label: string;
|
|
43
|
-
[key: string]: unknown;
|
|
44
|
-
}
|
|
45
|
-
export interface DataCollectionRegistration {
|
|
46
|
-
id: string;
|
|
47
|
-
label: string;
|
|
48
|
-
listComponent: React.ComponentType;
|
|
49
|
-
detailComponent?: React.ComponentType;
|
|
50
|
-
}
|
|
51
|
-
export interface ColumnRegistration {
|
|
52
|
-
id: string;
|
|
53
|
-
target: string;
|
|
54
|
-
[key: string]: unknown;
|
|
55
|
-
}
|
|
56
|
-
export interface JobRegistration {
|
|
57
|
-
id: string;
|
|
58
|
-
cron: string;
|
|
59
|
-
handler: () => Promise<void> | void;
|
|
60
|
-
}
|
|
61
|
-
export interface CommandRegistration {
|
|
62
|
-
id: string;
|
|
63
|
-
label?: string;
|
|
64
|
-
handler: (...args: unknown[]) => unknown;
|
|
65
|
-
}
|
|
66
|
-
export interface WidgetRegistration {
|
|
67
|
-
id: string;
|
|
68
|
-
label: string;
|
|
69
|
-
component: React.ComponentType;
|
|
70
|
-
width?: string;
|
|
71
|
-
height?: string;
|
|
58
|
+
/** Which viewers this panel appears in. Omit for all of them. */
|
|
59
|
+
viewers?: ViewerNames[];
|
|
72
60
|
}
|
|
73
61
|
export interface LegendRow {
|
|
74
62
|
label: string;
|
|
@@ -88,15 +76,9 @@ export interface LegendRegistration {
|
|
|
88
76
|
export interface CapabilityRegistry {
|
|
89
77
|
'sidebar.items': SidebarRegistration;
|
|
90
78
|
'viewer.panels': ViewerRegistration;
|
|
91
|
-
'map.tools': ToolbarRegistration
|
|
92
|
-
'bim.tools': ToolbarRegistration
|
|
93
|
-
'pointcloud.tools': ToolbarRegistration
|
|
94
|
-
'map.layers': LayerRegistration;
|
|
95
|
-
'data.collections': DataCollectionRegistration;
|
|
96
|
-
'data.columns': ColumnRegistration;
|
|
97
|
-
'jobs': JobRegistration;
|
|
98
|
-
'commands': CommandRegistration;
|
|
99
|
-
'widgets': WidgetRegistration;
|
|
79
|
+
'map.tools': ToolbarRegistration<MapToolProps>;
|
|
80
|
+
'bim.tools': ToolbarRegistration<BimToolProps>;
|
|
81
|
+
'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>;
|
|
100
82
|
'map.legends': LegendRegistration;
|
|
101
83
|
}
|
|
102
84
|
export interface PluginContext {
|
|
@@ -108,4 +90,17 @@ export interface PluginEntry {
|
|
|
108
90
|
activate(ctx: PluginContext): void | Promise<void>;
|
|
109
91
|
deactivate?(ctx: PluginContext): void | Promise<void>;
|
|
110
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* One loadable plugin: its manifest plus its module, or a thunk returning it.
|
|
95
|
+
* Prefer the thunk when compiled in — a static import pulls the plugin's
|
|
96
|
+
* components into every route that reaches `installed.ts`.
|
|
97
|
+
*/
|
|
98
|
+
export interface PluginSource {
|
|
99
|
+
manifest: PluginManifest;
|
|
100
|
+
entry: PluginEntry | (() => Promise<PluginEntry>);
|
|
101
|
+
}
|
|
102
|
+
/** Resolves either form of `PluginSource.entry` to the module. */
|
|
103
|
+
export declare function resolvePluginEntry(entry: PluginSource['entry']): Promise<PluginEntry>;
|
|
104
|
+
/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */
|
|
105
|
+
export type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>);
|
|
111
106
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,20 +4,20 @@ const VALID_CAPABILITIES = [
|
|
|
4
4
|
"map.tools",
|
|
5
5
|
"bim.tools",
|
|
6
6
|
"pointcloud.tools",
|
|
7
|
-
"map.layers",
|
|
8
|
-
"data.collections",
|
|
9
|
-
"data.columns",
|
|
10
|
-
"jobs",
|
|
11
|
-
"commands",
|
|
12
|
-
"widgets",
|
|
13
7
|
"map.legends"
|
|
14
8
|
];
|
|
15
9
|
function validateManifest(manifest) {
|
|
16
10
|
const errors = [];
|
|
11
|
+
if (typeof manifest !== "object" || manifest === null) {
|
|
12
|
+
return { valid: false, errors: ["manifest must be an object"] };
|
|
13
|
+
}
|
|
17
14
|
const m = manifest;
|
|
18
15
|
if (!m.slug || typeof m.slug !== "string") errors.push("slug is required");
|
|
19
16
|
if (!m.name || typeof m.name !== "string") errors.push("name is required");
|
|
20
17
|
if (!m.version || typeof m.version !== "string") errors.push("version is required");
|
|
18
|
+
if (m.hostApi !== void 0 && !Number.isInteger(m.hostApi)) {
|
|
19
|
+
errors.push("hostApi must be an integer when present");
|
|
20
|
+
}
|
|
21
21
|
if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {
|
|
22
22
|
errors.push("at least one capability is required");
|
|
23
23
|
} else {
|
|
@@ -31,8 +31,12 @@ function validateManifest(manifest) {
|
|
|
31
31
|
}
|
|
32
32
|
const _capabilityParity = true;
|
|
33
33
|
void _capabilityParity;
|
|
34
|
+
async function resolvePluginEntry(entry) {
|
|
35
|
+
return typeof entry === "function" ? entry() : entry;
|
|
36
|
+
}
|
|
34
37
|
export {
|
|
35
38
|
VALID_CAPABILITIES,
|
|
39
|
+
resolvePluginEntry,
|
|
36
40
|
validateManifest
|
|
37
41
|
};
|
|
38
42
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\nexport const VALID_CAPABILITIES = [\r\n 'sidebar.items',\r\n 'viewer.panels',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'map.
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\r\n// out of the host's module graph.\r\nimport type { BimToolProps } from './bimViewer'\r\nimport type { MapToolProps } from './mapViewer'\r\nimport type { PointCloudToolProps } from './pointCloudViewer'\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\n// Only capabilities core actually renders. One with no consumer registers fine,\r\n// shows nothing, and leaves nothing to debug.\r\nexport const VALID_CAPABILITIES = [\r\n 'sidebar.items',\r\n 'viewer.panels',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'map.legends',\r\n] as const\r\n\r\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\r\n\r\n// --- Manifest ---\r\n\r\nexport interface PluginManifest {\r\n slug: string\r\n name: string\r\n version: string\r\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\r\n hostApi?: number\r\n description?: string\r\n author?: string\r\n capabilities: PluginCapability[]\r\n requiredPermissions?: string[]\r\n configSchema?: Record<string, unknown>\r\n /**\r\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\r\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\r\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\r\n */\r\n messages?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\r\n const errors: string[] = []\r\n\r\n if (typeof manifest !== 'object' || manifest === null) {\r\n return { valid: false, errors: ['manifest must be an object'] }\r\n }\r\n\r\n const m = manifest as Record<string, unknown>\r\n\r\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\r\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\r\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\r\n\r\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\r\n errors.push('hostApi must be an integer when present')\r\n }\r\n\r\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\r\n errors.push('at least one capability is required')\r\n } else {\r\n for (const cap of m.capabilities) {\r\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\r\n errors.push(`invalid capability: \"${cap}\"`)\r\n }\r\n }\r\n }\r\n\r\n return { valid: errors.length === 0, errors }\r\n}\r\n\r\n// --- Registration shapes (one per capability) ---\r\n\r\nexport interface SidebarRegistration {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n}\r\n\r\n/** Every toolbar component receives the toolbar entry core built for it. */\r\nexport interface ToolbarToolProps {\r\n tool: unknown\r\n}\r\n\r\n/**\r\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\r\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\r\n * registered under `map.tools` is a compile error.\r\n */\r\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType<ToolbarToolProps & P>\r\n cursor?: string\r\n stayActive?: boolean\r\n}\r\n\r\nexport interface ViewerRegistration {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n /** Which viewers this panel appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n}\r\n\r\nexport interface LegendRow {\r\n label: string\r\n color: string\r\n count?: number\r\n}\r\n\r\nexport interface LegendRegistration {\r\n id: string\r\n title: string\r\n // Called by <MapLegendHost> on each render; active:false omits the section.\r\n useLegend: () => {\r\n active: boolean\r\n // Overrides registration.title when set, e.g. a city-scoped label.\r\n title?: string\r\n unavailable?: boolean\r\n rows: LegendRow[]\r\n }\r\n}\r\n\r\n// --- Capability → registration type map ---\r\n// A new contribution point needs one entry here, its type above, and a consumer\r\n// calling `registry.getAll('your.key')`. No host changes.\r\n\r\nexport interface CapabilityRegistry {\r\n 'sidebar.items': SidebarRegistration\r\n 'viewer.panels': ViewerRegistration\r\n 'map.tools': ToolbarRegistration<MapToolProps>\r\n 'bim.tools': ToolbarRegistration<BimToolProps>\r\n 'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>\r\n 'map.legends': LegendRegistration\r\n}\r\n\r\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\r\ntype _CapabilityParity =\r\n PluginCapability extends keyof CapabilityRegistry\r\n ? keyof CapabilityRegistry extends PluginCapability\r\n ? true\r\n : never\r\n : never\r\nconst _capabilityParity: _CapabilityParity = true\r\nvoid _capabilityParity\r\n\r\n// --- Plugin Context ---\r\n\r\nexport interface PluginContext {\r\n pluginId: string\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\r\n config: Record<string, unknown>\r\n}\r\n\r\n// --- Plugin entry point type ---\r\n\r\nexport interface PluginEntry {\r\n activate(ctx: PluginContext): void | Promise<void>\r\n deactivate?(ctx: PluginContext): void | Promise<void>\r\n}\r\n\r\n/**\r\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\r\n * Prefer the thunk when compiled in — a static import pulls the plugin's\r\n * components into every route that reaches `installed.ts`.\r\n */\r\nexport interface PluginSource {\r\n manifest: PluginManifest\r\n entry: PluginEntry | (() => Promise<PluginEntry>)\r\n}\r\n\r\n/** Resolves either form of `PluginSource.entry` to the module. */\r\nexport async function resolvePluginEntry(\r\n entry: PluginSource['entry'],\r\n): Promise<PluginEntry> {\r\n return typeof entry === 'function' ? entry() : entry\r\n}\r\n\r\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\r\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\r\n"],"mappings":"AAeO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAyBO,SAAS,iBAAiB,UAAyD;AACxF,QAAM,SAAmB,CAAC;AAE1B,MAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AACrD,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,4BAA4B,EAAE;AAAA,EAChE;AAEA,QAAM,IAAI;AAEV,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,WAAW,OAAO,EAAE,YAAY,SAAU,QAAO,KAAK,qBAAqB;AAElF,MAAI,EAAE,YAAY,UAAa,CAAC,OAAO,UAAU,EAAE,OAAO,GAAG;AAC3D,WAAO,KAAK,yCAAyC;AAAA,EACvD;AAEA,MAAI,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,WAAW,GAAG;AACjE,WAAO,KAAK,qCAAqC;AAAA,EACnD,OAAO;AACL,eAAW,OAAO,EAAE,cAAc;AAChC,UAAI,CAAC,mBAAmB,SAAS,GAAuB,GAAG;AACzD,eAAO,KAAK,wBAAwB,GAAG,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAC9C;AA8EA,MAAM,oBAAuC;AAC7C,KAAK;AA4BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plugin host contract version — the compatibility promise, kept separate from
|
|
3
|
+
* the package version so core can ship releases without moving it.
|
|
4
|
+
*
|
|
5
|
+
* Bump only on a change that breaks a correctly-written plugin: a removed capability,
|
|
6
|
+
* a changed registration shape, a changed SDK export. Additions do not bump it. The
|
|
7
|
+
* host refuses to activate a plugin whose manifest declares a different `hostApi`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PLUGIN_HOST_API = 1;
|
|
10
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/version.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/version.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n/**\r\n * The plugin host contract version — the compatibility promise, kept separate from\r\n * the package version so core can ship releases without moving it.\r\n *\r\n * Bump only on a change that breaks a correctly-written plugin: a removed capability,\r\n * a changed registration shape, a changed SDK export. Additions do not bump it. The\r\n * host refuses to activate a plugin whose manifest declares a different `hostApi`.\r\n */\r\nexport const PLUGIN_HOST_API = 1\r\n"],"mappings":"AAWO,MAAM,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer access for plugins — one import for all three engines.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately **not** re-exported from the `plugins-sdk` barrel: `bimViewer`
|
|
5
|
+
* carries a runtime dependency on `@thatopen/components` and three, which the BIM
|
|
6
|
+
* viewer is code-split away from the eager bundle to avoid. Importing this barrel
|
|
7
|
+
* accepts that weight, which is fine for a plugin (its bundle is loaded
|
|
8
|
+
* separately) but not for core's map route — core imports the narrow modules.
|
|
9
|
+
*
|
|
10
|
+
* A plugin that only touches the map should import `plugins-sdk/mapViewer`
|
|
11
|
+
* instead, and stay light.
|
|
12
|
+
*/
|
|
13
|
+
export * from './mapViewer';
|
|
14
|
+
export * from './bimViewer';
|
|
15
|
+
export * from './pointCloudViewer';
|
|
16
|
+
//# sourceMappingURL=viewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/viewer.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA"}
|