@collabdt/core 0.13.0 → 0.13.2
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/organizationConfig/src/organizationConfigContent.d.ts.map +1 -1
- package/dist/core/components/organizationConfig/src/organizationConfigContent.js +5 -11
- package/dist/core/components/organizationConfig/src/organizationConfigContent.js.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/map/MapViewer.js +0 -4
- package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetDetails.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetDetails.js +6 -4
- package/dist/core/components/viewers/map/datasets/DatasetDetails.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.js +100 -53
- package/dist/core/components/viewers/map/datasets/DatasetManager/index.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/DatasetManager/src/WmsDatasetControls.d.ts +8 -0
- package/dist/core/components/viewers/map/datasets/DatasetManager/src/WmsDatasetControls.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/DatasetManager/src/WmsDatasetControls.js +45 -0
- package/dist/core/components/viewers/map/datasets/DatasetManager/src/WmsDatasetControls.js.map +1 -0
- package/dist/core/components/viewers/map/datasets/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/datasets/index.js +4 -4
- package/dist/core/components/viewers/map/datasets/index.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/wmsActiveTime.d.ts +5 -0
- package/dist/core/components/viewers/map/datasets/src/wmsActiveTime.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/wmsActiveTime.js +33 -0
- package/dist/core/components/viewers/map/datasets/src/wmsActiveTime.js.map +1 -0
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.d.ts +5 -4
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.js +55 -76
- package/dist/core/components/viewers/map/src/MapLayers/src/OpenDataLayer/src/WmsTimeControl.js.map +1 -1
- 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 +7 -43
- 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 +9 -4
- package/dist/core/components/viewers/map/src/MapSidebar/src/LayersTab/index.js.map +1 -1
- package/dist/core/components/viewers/shared/legends/PluginLegendSection.d.ts +16 -0
- package/dist/core/components/viewers/shared/legends/PluginLegendSection.d.ts.map +1 -0
- package/dist/core/components/viewers/shared/legends/PluginLegendSection.js +86 -0
- package/dist/core/components/viewers/shared/legends/PluginLegendSection.js.map +1 -0
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts +1 -1
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.d.ts.map +1 -1
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.js +10 -82
- package/dist/core/components/viewers/shared/legends/ViewerLegendHost.js.map +1 -1
- package/dist/core/components/viewers/shared/legends/usePluginLegends.d.ts +13 -0
- package/dist/core/components/viewers/shared/legends/usePluginLegends.d.ts.map +1 -0
- package/dist/core/components/viewers/shared/legends/usePluginLegends.js +57 -0
- package/dist/core/components/viewers/shared/legends/usePluginLegends.js.map +1 -0
- package/dist/core/components/viewers/viewerAccess.d.ts.map +1 -1
- package/dist/core/components/viewers/viewerAccess.js +2 -0
- package/dist/core/components/viewers/viewerAccess.js.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.d.ts +2 -10
- package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.js +1 -2
- package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -1
- package/dist/core/i18n/messages/en.json +2 -2
- package/dist/core/i18n/messages/es.json +2 -2
- package/dist/core/i18n/messages/fr.json +2 -2
- package/dist/core/plugins/host/pluginDatasetId.d.ts +3 -0
- package/dist/core/plugins/host/pluginDatasetId.d.ts.map +1 -0
- package/dist/core/plugins/host/pluginDatasetId.js +7 -0
- package/dist/core/plugins/host/pluginDatasetId.js.map +1 -0
- package/dist/core/plugins/host/pluginDatasets.d.ts +12 -0
- package/dist/core/plugins/host/pluginDatasets.d.ts.map +1 -0
- package/dist/core/plugins/host/pluginDatasets.js +81 -0
- package/dist/core/plugins/host/pluginDatasets.js.map +1 -0
- package/dist/core/plugins/host/runtimeShims.d.ts.map +1 -1
- package/dist/core/plugins/host/runtimeShims.js +2 -1
- package/dist/core/plugins/host/runtimeShims.js.map +1 -1
- package/dist/core/plugins/sdk/data.d.ts +2 -0
- package/dist/core/plugins/sdk/data.d.ts.map +1 -1
- package/dist/core/plugins/sdk/data.js +2 -0
- package/dist/core/plugins/sdk/data.js.map +1 -1
- package/dist/core/plugins/sdk/datasets.d.ts +12 -0
- package/dist/core/plugins/sdk/datasets.d.ts.map +1 -0
- package/dist/core/plugins/sdk/datasets.js +20 -0
- package/dist/core/plugins/sdk/datasets.js.map +1 -0
- package/dist/core/plugins/sdk/types.d.ts +47 -1
- package/dist/core/plugins/sdk/types.d.ts.map +1 -1
- package/dist/core/plugins/sdk/types.js +2 -1
- package/dist/core/plugins/sdk/types.js.map +1 -1
- package/dist/core/types/datasetTypes.d.ts +1 -0
- package/dist/core/types/datasetTypes.d.ts.map +1 -1
- package/dist/core/utils/appContent.d.ts +4 -7
- package/dist/core/utils/appContent.d.ts.map +1 -1
- package/dist/core/utils/appContent.js +8 -3
- package/dist/core/utils/appContent.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.d.ts +0 -4
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.d.ts.map +0 -1
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.js +0 -43
- package/dist/core/components/viewers/map/datasets/src/builtinLiveDatasets.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
/** Every enabled plugin's datasets, for the lists in the Datasets menu and the Layers tab. */
|
|
10
|
+
export declare function usePluginDatasets(organization?: number): Dataset[];
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=pluginDatasets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginDatasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginDatasets.ts"],"names":[],"mappings":"AAcA,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;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,CAOlE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
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
|
+
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
|
+
import { usePluginContributions } from "./provider";
|
|
26
|
+
const noFeatures = async () => ({ type: "FeatureCollection", features: [] });
|
|
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
|
+
}
|
|
70
|
+
function usePluginDatasets(organization) {
|
|
71
|
+
const registrations = usePluginContributions("map.datasets");
|
|
72
|
+
return React.useMemo(
|
|
73
|
+
() => registrations.map((registration) => toPluginDataset(registration, organization)),
|
|
74
|
+
[registrations, organization]
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
toPluginDataset,
|
|
79
|
+
usePluginDatasets
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=pluginDatasets.js.map
|
|
@@ -0,0 +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 { buildWmsTileUrl } from '../../components/viewers/map/datasets/src/urlSources'\nimport { layerColorByName } from '../../components/viewers/map/utils/stringToColour'\nimport { DatasetGroup } from '../../types/dbTypes'\n\nimport { pluginDatasetId } from './pluginDatasetId'\nimport { usePluginContributions } from './provider'\n\nimport type { PluginContribution } from './provider'\nimport type { Dataset } from '../../types/datasetTypes'\nimport type { AllGeoJSON } from '@turf/turf'\n\nconst noFeatures = async (): Promise<AllGeoJSON> =>\n ({ type: 'FeatureCollection', features: [] }) as AllGeoJSON\n\ntype DatasetContribution = PluginContribution<'map.datasets'>\n\nfunction drawnBy(registration: DatasetContribution): Pick<Dataset, 'datasetType' | 'type' | 'url' | 'timeEnabled' | 'wms' | 'getFeatures' | 'drawnByPlugin' | 'clickable'> {\n const { source, pluginId } = registration\n\n if (source?.type === 'wms') {\n const { baseUrl, layers, timeEnabled } = source\n return {\n datasetType: 'WMS',\n type: 'WMS',\n url: buildWmsTileUrl(baseUrl, layers),\n timeEnabled,\n wms: { baseUrl, layers },\n clickable: false,\n getFeatures: noFeatures,\n }\n }\n\n if (source?.type === 'geojson') {\n return {\n datasetType: 'GeoJSON',\n type: 'GeoJSON',\n clickable: true,\n getFeatures: async () => (await source.getFeatures()) as AllGeoJSON,\n }\n }\n\n return { datasetType: 'GeoJSON', type: 'Plugin', clickable: false, drawnByPlugin: pluginId, getFeatures: noFeatures }\n}\n\n/**\n * A `map.datasets` contribution as the Datasets menu lists it. A live one goes under Live\n * Data; any other is organizational, stamped with the viewer's own organization.\n */\nexport function toPluginDataset(registration: DatasetContribution, organization?: number): Dataset {\n const { pluginId, id, name, description, publisher, information, live = false } = registration\n const group = live ? DatasetGroup.National : DatasetGroup.Organizational\n\n return {\n id: pluginDatasetId(pluginId, id),\n name,\n description,\n publisher,\n information,\n organization: live ? undefined : organization,\n dataManagementSystem: 'other',\n countrySubdivision: '',\n municipality: '',\n group,\n layerColor: layerColorByName(name),\n portal: { id: -1, name: publisher ?? name, group, dataManagementSystem: 'Other', live },\n getFields: async () => [],\n ...drawnBy(registration),\n }\n}\n\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,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAMvC,MAAM,aAAa,aAChB,EAAE,MAAM,qBAAqB,UAAU,CAAC,EAAE;AAI7C,SAAS,QAAQ,cAA0J;AACzK,QAAM,EAAE,QAAQ,SAAS,IAAI;AAE7B,OAAI,iCAAQ,UAAS,OAAO;AAC1B,UAAM,EAAE,SAAS,QAAQ,YAAY,IAAI;AACzC,WAAO;AAAA,MACL,aAAa;AAAA,MACb,MAAM;AAAA,MACN,KAAK,gBAAgB,SAAS,MAAM;AAAA,MACpC;AAAA,MACA,KAAK,EAAE,SAAS,OAAO;AAAA,MACvB,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AAEA,OAAI,iCAAQ,UAAS,WAAW;AAC9B,WAAO;AAAA,MACL,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa,YAAa,MAAM,OAAO,YAAY;AAAA,IACrD;AAAA,EACF;AAEA,SAAO,EAAE,aAAa,WAAW,MAAM,UAAU,WAAW,OAAO,eAAe,UAAU,aAAa,WAAW;AACtH;AAMO,SAAS,gBAAgB,cAAmC,cAAgC;AACjG,QAAM,EAAE,UAAU,IAAI,MAAM,aAAa,WAAW,aAAa,OAAO,MAAM,IAAI;AAClF,QAAM,QAAQ,OAAO,aAAa,WAAW,aAAa;AAE1D,SAAO;AAAA,IACL,IAAI,gBAAgB,UAAU,EAAE;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,OAAO,SAAY;AAAA,IACjC,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd;AAAA,IACA,YAAY,iBAAiB,IAAI;AAAA,IACjC,QAAQ,EAAE,IAAI,IAAI,MAAM,gCAAa,MAAM,OAAO,sBAAsB,SAAS,KAAK;AAAA,IACtF,WAAW,YAAY,CAAC;AAAA,KACrB,QAAQ,YAAY;AAE3B;AAGO,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":"runtimeShims.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"names":[],"mappings":"AAGA,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAUD,eAAO,MAAM,oBAAoB,EAAE,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"runtimeShims.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"names":[],"mappings":"AAGA,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAUD,eAAO,MAAM,oBAAoB,EAAE,SAAS,WAAW,EAmGtD,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAA"}
|
|
@@ -119,7 +119,8 @@ const PLUGIN_RUNTIME_SHIMS = [
|
|
|
119
119
|
"useDeleteComments",
|
|
120
120
|
// Re-exported by the module, so a plugin reaching for data finds both here too.
|
|
121
121
|
"usePluginConfig",
|
|
122
|
-
"usePluginPermissions"
|
|
122
|
+
"usePluginPermissions",
|
|
123
|
+
"usePluginDataset"
|
|
123
124
|
]
|
|
124
125
|
},
|
|
125
126
|
{
|
|
@@ -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 ],\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":"AAuBO,MAAM,uBAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAY;AAAA,MAAa;AAAA,MAAY;AAAA,MAAY;AAAA,MACjD;AAAA,MAAc;AAAA,MAAY;AAAA,MAAgB;AAAA,MAC1C;AAAA,MAAiB;AAAA,MAAa;AAAA,MAAc;AAAA,MAAkB;AAAA,MAC9D;AAAA,MAAQ;AAAA,MAAmB;AAAA,MAAe;AAAA,MAAc;AAAA,MACxD;AAAA,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,MAAc;AAAA,MAAa;AAAA,MAAwB;AAAA,MAAsB;AAAA,MACzE;AAAA,MAAkB;AAAA,MAClB;AAAA,MAAe;AAAA,MAAc;AAAA,MAAyB;AAAA,MACtD;AAAA,MAAoB;AAAA;AAAA,MAEpB;AAAA,MAAmB;AAAA,
|
|
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":"AAuBO,MAAM,uBAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAY;AAAA,MAAa;AAAA,MAAY;AAAA,MAAY;AAAA,MACjD;AAAA,MAAc;AAAA,MAAY;AAAA,MAAgB;AAAA,MAC1C;AAAA,MAAiB;AAAA,MAAa;AAAA,MAAc;AAAA,MAAkB;AAAA,MAC9D;AAAA,MAAQ;AAAA,MAAmB;AAAA,MAAe;AAAA,MAAc;AAAA,MACxD;AAAA,MAAoB;AAAA,MAAa;AAAA,MAAS;AAAA,MAC1C;AAAA,MAAsB;AAAA,MAAmB;AAAA,MAAW;AAAA,MACpD;AAAA,MAAU;AAAA,MAAY;AAAA,MAAwB;AAAA,MAAiB;AAAA,IACjE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB,aAAa,SAAS;AAAA,EAClD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,I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AA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAS;AAAA,MAAU;AAAA,MAAS;AAAA,MAC5B;AAAA,MAAQ;AAAA,MAAe;AAAA,MAAmB;AAAA,MAAc;AAAA,MAAc;AAAA,MACtE;AAAA,MAAU;AAAA,MAAe;AAAA,MAAiB;AAAA,MAC1C;AAAA,MAAgB;AAAA,MAAgB;AAAA,MAAe;AAAA,IACjD;AAAA,EACF;AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
|
|
@@ -19,4 +19,6 @@ export { useComments, useComment, useCommentsByBuilding, useCommentsByAuthor, us
|
|
|
19
19
|
/** The plugin's config for this organization, shaped by the manifest's `configSchema`. */
|
|
20
20
|
export { usePluginConfig } from './config';
|
|
21
21
|
export { usePluginPermissions } from './permissions';
|
|
22
|
+
export { usePluginDataset } from './datasets';
|
|
23
|
+
export type { PluginDatasetState } from './datasets';
|
|
22
24
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/data.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AAGH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAGnG,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAChG,OAAO,EACL,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAGnF,OAAO,EACL,WAAW,EACX,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,+BAA+B,CAAA;AAItC,0FAA0F;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/data.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AAGH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAGnG,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAChG,OAAO,EACL,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAGnF,OAAO,EACL,WAAW,EACX,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,+BAA+B,CAAA;AAItC,0FAA0F;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
} from "../../hooks/comments/comments";
|
|
36
36
|
import { usePluginConfig } from "./config";
|
|
37
37
|
import { usePluginPermissions } from "./permissions";
|
|
38
|
+
import { usePluginDataset } from "./datasets";
|
|
38
39
|
export {
|
|
39
40
|
useBuilding,
|
|
40
41
|
useBuildingOsmIds,
|
|
@@ -57,6 +58,7 @@ export {
|
|
|
57
58
|
useOrganization,
|
|
58
59
|
useOrganizationByName,
|
|
59
60
|
usePluginConfig,
|
|
61
|
+
usePluginDataset,
|
|
60
62
|
usePluginPermissions,
|
|
61
63
|
useSensor,
|
|
62
64
|
useSensorType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/sdk/data.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/**\n * Data access for plugins: core's own bound hooks, re-exported. A plugin goes\n * through the same `ApiAdapter` as everything else and inherits its auth, org\n * scoping and SWR cache — no second data path, and no way past the tenant boundary.\n *\n * Read-only where the write belongs to core: buildings and sites are canonical asset\n * records, so changing them is a core change. Sensors and comments are read-write,\n * being the domains plugins are expected to author. A plugin's own data goes in\n * `plugins-sdk/store`.\n */\n\n// --- Read: assets -----------------------------------------------------------\nexport {\n useBuildings,\n useBuilding,\n useBuildingsByOsm,\n useBuildingOsmIds,\n} from '../../hooks/buildings/buildings'\nexport { useSites, useSite } from '../../hooks/sites/sites'\nexport { useInfrastructures, useInfrastructure } from '../../hooks/infrastructures/infrastructures'\n\n// --- Read: organization and files ------------------------------------------\nexport { useOrganization, useOrganizationByName } from '../../hooks/organizations/organizations'\nexport {\n useFiles,\n useFile,\n useFilesByBuildingId,\n useFilesBySiteId,\n useDownloadFile,\n} from '../../hooks/files/files'\n\n// --- Read/write: sensors ----------------------------------------------------\nexport {\n useSensors,\n useSensor,\n useSensorsByBuilding,\n useSensorsByAuthor,\n useCreateSensor,\n} from '../../hooks/sensors/sensors'\nexport { useSensorTypes, useSensorType } from '../../hooks/sensorTypes/sensorTypes'\n\n// --- Read/write: comments ---------------------------------------------------\nexport {\n useComments,\n useComment,\n useCommentsByBuilding,\n useCommentsByAuthor,\n useCreateComment,\n useDeleteComments,\n} from '../../hooks/comments/comments'\n\n// --- Plugin context ---------------------------------------------------------\n\n/** The plugin's config for this organization, shaped by the manifest's `configSchema`. */\nexport { usePluginConfig } from './config'\n\nexport { usePluginPermissions } from './permissions'\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
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/data.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/**\n * Data access for plugins: core's own bound hooks, re-exported. A plugin goes\n * through the same `ApiAdapter` as everything else and inherits its auth, org\n * scoping and SWR cache — no second data path, and no way past the tenant boundary.\n *\n * Read-only where the write belongs to core: buildings and sites are canonical asset\n * records, so changing them is a core change. Sensors and comments are read-write,\n * being the domains plugins are expected to author. A plugin's own data goes in\n * `plugins-sdk/store`.\n */\n\n// --- Read: assets -----------------------------------------------------------\nexport {\n useBuildings,\n useBuilding,\n useBuildingsByOsm,\n useBuildingOsmIds,\n} from '../../hooks/buildings/buildings'\nexport { useSites, useSite } from '../../hooks/sites/sites'\nexport { useInfrastructures, useInfrastructure } from '../../hooks/infrastructures/infrastructures'\n\n// --- Read: organization and files ------------------------------------------\nexport { useOrganization, useOrganizationByName } from '../../hooks/organizations/organizations'\nexport {\n useFiles,\n useFile,\n useFilesByBuildingId,\n useFilesBySiteId,\n useDownloadFile,\n} from '../../hooks/files/files'\n\n// --- Read/write: sensors ----------------------------------------------------\nexport {\n useSensors,\n useSensor,\n useSensorsByBuilding,\n useSensorsByAuthor,\n useCreateSensor,\n} from '../../hooks/sensors/sensors'\nexport { useSensorTypes, useSensorType } from '../../hooks/sensorTypes/sensorTypes'\n\n// --- Read/write: comments ---------------------------------------------------\nexport {\n useComments,\n useComment,\n useCommentsByBuilding,\n useCommentsByAuthor,\n useCreateComment,\n useDeleteComments,\n} from '../../hooks/comments/comments'\n\n// --- Plugin context ---------------------------------------------------------\n\n/** The plugin's config for this organization, shaped by the manifest's `configSchema`. */\nexport { usePluginConfig } from './config'\n\nexport { usePluginPermissions } from './permissions'\n\nexport { usePluginDataset } from './datasets'\nexport type { PluginDatasetState } from './datasets'\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;AAErC,SAAS,wBAAwB;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PluginDatasetState {
|
|
2
|
+
/** The user added it from the Datasets menu. */
|
|
3
|
+
applied: boolean;
|
|
4
|
+
/** Applied and not hidden with its eye toggle: draw it only when this is true. */
|
|
5
|
+
visible: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether one of this plugin's `map.datasets` is on the map, so the `map.layers` and
|
|
9
|
+
* `viewer.legends` that draw it know when to. `id` is the registration's own id.
|
|
10
|
+
*/
|
|
11
|
+
export declare function usePluginDataset(id: string): PluginDatasetState;
|
|
12
|
+
//# sourceMappingURL=datasets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/datasets.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAS/D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { DatasetsContext } from "../../store/Datasets/context";
|
|
6
|
+
import { pluginDatasetId } from "../host/pluginDatasetId";
|
|
7
|
+
import { usePluginId } from "../host/scope";
|
|
8
|
+
function usePluginDataset(id) {
|
|
9
|
+
const pluginId = usePluginId();
|
|
10
|
+
const { state } = React.useContext(DatasetsContext);
|
|
11
|
+
const datasetId = pluginDatasetId(pluginId, id);
|
|
12
|
+
const added = state.datasets.addedDatasets.find((dataset) => dataset.id === datasetId);
|
|
13
|
+
const applied = added !== void 0;
|
|
14
|
+
const visible = applied && added.visible !== false;
|
|
15
|
+
return React.useMemo(() => ({ applied, visible }), [applied, visible]);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
usePluginDataset
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/datasets.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { DatasetsContext } from '../../store/Datasets/context'\nimport { pluginDatasetId } from '../host/pluginDatasetId'\nimport { usePluginId } from '../host/scope'\n\nexport interface PluginDatasetState {\n /** The user added it from the Datasets menu. */\n applied: boolean\n /** Applied and not hidden with its eye toggle: draw it only when this is true. */\n visible: boolean\n}\n\n/**\n * Whether one of this plugin's `map.datasets` is on the map, so the `map.layers` and\n * `viewer.legends` that draw it know when to. `id` is the registration's own id.\n */\nexport function usePluginDataset(id: string): PluginDatasetState {\n const pluginId = usePluginId()\n const { state } = React.useContext(DatasetsContext)\n const datasetId = pluginDatasetId(pluginId, id)\n const added = state.datasets.addedDatasets.find(dataset => dataset.id === datasetId)\n const applied = added !== undefined\n const visible = applied && added.visible !== false\n\n return React.useMemo(() => ({ applied, visible }), [applied, visible])\n}\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAarB,SAAS,iBAAiB,IAAgC;AAC/D,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,MAAM,IAAI,MAAM,WAAW,eAAe;AAClD,QAAM,YAAY,gBAAgB,UAAU,EAAE;AAC9C,QAAM,QAAQ,MAAM,SAAS,cAAc,KAAK,aAAW,QAAQ,OAAO,SAAS;AACnF,QAAM,UAAU,UAAU;AAC1B,QAAM,UAAU,WAAW,MAAM,YAAY;AAE7C,SAAO,MAAM,QAAQ,OAAO,EAAE,SAAS,QAAQ,IAAI,CAAC,SAAS,OAAO,CAAC;AACvE;","names":[]}
|
|
@@ -8,7 +8,7 @@ import type { ViewerNames } from '../../types/dbTypes';
|
|
|
8
8
|
*/
|
|
9
9
|
export type PluginViewerTarget = `${ViewerNames.map | ViewerNames.bim}`;
|
|
10
10
|
import type { LucideProps } from 'lucide-react';
|
|
11
|
-
export declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "viewer.legends", "map.layers"];
|
|
11
|
+
export declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "viewer.legends", "map.layers", "map.datasets"];
|
|
12
12
|
export type PluginCapability = typeof VALID_CAPABILITIES[number];
|
|
13
13
|
export interface PluginManifest {
|
|
14
14
|
slug: string;
|
|
@@ -105,21 +105,66 @@ export interface MapLayerRegistration {
|
|
|
105
105
|
id: string;
|
|
106
106
|
component: React.ComponentType<MapToolProps>;
|
|
107
107
|
}
|
|
108
|
+
/** The least of a GeoJSON FeatureCollection core needs, so a typed `geojson` one satisfies it. */
|
|
109
|
+
export interface PluginFeatureCollection {
|
|
110
|
+
type: 'FeatureCollection';
|
|
111
|
+
features: Array<{
|
|
112
|
+
type: 'Feature';
|
|
113
|
+
id?: string | number;
|
|
114
|
+
geometry: {
|
|
115
|
+
type: string;
|
|
116
|
+
coordinates?: unknown;
|
|
117
|
+
geometries?: unknown;
|
|
118
|
+
} | null;
|
|
119
|
+
properties: Record<string, unknown> | null;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
|
122
|
+
/** How core draws a plugin dataset. Absent, the plugin draws it from its own `map.layers`. */
|
|
123
|
+
export type PluginDatasetSource = {
|
|
124
|
+
type: 'wms';
|
|
125
|
+
baseUrl: string;
|
|
126
|
+
layers: string;
|
|
127
|
+
timeEnabled?: boolean;
|
|
128
|
+
} | {
|
|
129
|
+
type: 'geojson';
|
|
130
|
+
getFeatures: () => Promise<PluginFeatureCollection>;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* A dataset listed in the Datasets menu: under Live Data when `live`, otherwise under
|
|
134
|
+
* Organizational. Applying it is the user's choice; `usePluginDataset(id)` reports it.
|
|
135
|
+
*/
|
|
136
|
+
export interface DatasetRegistration {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
publisher?: string;
|
|
141
|
+
/** A link to the dataset's documentation, shown in its details. */
|
|
142
|
+
information?: string;
|
|
143
|
+
live?: boolean;
|
|
144
|
+
source?: PluginDatasetSource;
|
|
145
|
+
}
|
|
108
146
|
export interface LegendRow {
|
|
109
147
|
label: string;
|
|
110
148
|
color: string;
|
|
111
149
|
count?: number;
|
|
150
|
+
/** With `onVisibleChange`, the row gets a switch; false dims it. */
|
|
151
|
+
visible?: boolean;
|
|
152
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
112
153
|
}
|
|
113
154
|
export interface LegendRegistration {
|
|
114
155
|
id: string;
|
|
115
156
|
title: string;
|
|
116
157
|
/** Which viewers this legend appears in. Omit for all of them. */
|
|
117
158
|
viewers?: Array<PluginViewerTarget | ViewerNames>;
|
|
159
|
+
/** A `map.datasets` id of the same plugin: the map nests this legend under that applied dataset. */
|
|
160
|
+
dataset?: string;
|
|
118
161
|
useLegend: () => {
|
|
119
162
|
active: boolean;
|
|
120
163
|
title?: string;
|
|
121
164
|
unavailable?: boolean;
|
|
122
165
|
rows: LegendRow[];
|
|
166
|
+
/** The plugin's own inputs under the rows, such as a date slider filtering what is drawn. */
|
|
167
|
+
controls?: React.ReactNode;
|
|
123
168
|
};
|
|
124
169
|
}
|
|
125
170
|
export interface CapabilityRegistry {
|
|
@@ -130,6 +175,7 @@ export interface CapabilityRegistry {
|
|
|
130
175
|
'bim.tools': ToolbarRegistration<BimToolProps>;
|
|
131
176
|
'viewer.legends': LegendRegistration;
|
|
132
177
|
'map.layers': MapLayerRegistration;
|
|
178
|
+
'map.datasets': DatasetRegistration;
|
|
133
179
|
}
|
|
134
180
|
export interface PluginContext {
|
|
135
181
|
pluginId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAM/C,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAM/C,eAAO,MAAM,kBAAkB,gIASrB,CAAA;AAEV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SAAS,MAAM,kBAAkB,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACvF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAID,MAAM,WAAW,WAAW;IAE1B,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,UAAU,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,WAAW,GAAG,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;CAClD;AAED,kEAAkE;AAClE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,YAAY,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\n// out of the host's module graph.\nimport type { BimToolProps } from './bimViewer'\nimport type { MapToolProps } from './mapViewer'\n// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\nexport { ViewerNames } from '../../types/dbTypes'\n\nimport type { ViewerNames } from '../../types/dbTypes'\n\n/**\n * The viewers that can host a tab or a legend, spelled as plain strings. Derived from\n * `ViewerNames` so the two cannot drift, and the form `@collabdt/plugin-kit` publishes.\n */\nexport type PluginViewerTarget = `${ViewerNames.map | ViewerNames.bim}`\nimport type { LucideProps } from 'lucide-react'\n\n// --- Capability definitions ---\n\n// Only capabilities core actually renders. One with no consumer registers fine,\n// shows nothing, and leaves nothing to debug.\nexport const VALID_CAPABILITIES = [\n 'data.pages',\n 'viewer.tabs',\n 'ui.dialogs',\n 'map.tools',\n 'bim.tools',\n 'viewer.legends',\n 'map.layers',\n] as const\n\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\n\n// --- Manifest ---\n\nexport interface PluginManifest {\n slug: string\n name: string\n version: string\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\n hostApi?: number\n description?: string\n author?: string\n /** A lucide icon name shown beside the plugin's name. Unset or unknown shows a puzzle piece. */\n icon?: string\n capabilities: PluginCapability[]\n requiredPermissions?: string[]\n configSchema?: Record<string, unknown>\n /**\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\n */\n messages?: Record<string, Record<string, unknown>>\n}\n\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\n const errors: string[] = []\n\n if (typeof manifest !== 'object' || manifest === null) {\n return { valid: false, errors: ['manifest must be an object'] }\n }\n\n const m = manifest as Record<string, unknown>\n\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\n\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\n errors.push('hostApi must be an integer when present')\n }\n\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\n errors.push('at least one capability is required')\n } else {\n for (const cap of m.capabilities) {\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\n errors.push(`invalid capability: \"${cap}\"`)\n }\n }\n }\n\n return { valid: errors.length === 0, errors }\n}\n\n// --- Registration shapes (one per capability) ---\n\nexport interface DataPageColumn<Row> {\n key: string\n /** Resolved in the plugin's own namespace, falling back to the literal string. */\n labelKey: string\n render?: (row: Row) => React.ReactNode\n}\n\n/**\n * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a\n * row click opens one of its own `ui.dialogs` rather than a detail view of its own.\n */\nexport interface DataPageRows<Row> {\n rows: Row[]\n isLoading?: boolean\n /** From the hook, not the registration, so it can close over `usePluginDialogs`. */\n onRowClick?: (row: Row) => void\n}\n\nexport interface DataPageRegistration<Row = Record<string, unknown>> {\n id: string\n titleKey: string\n icon: string | React.ComponentType<LucideProps>\n useRows: () => DataPageRows<Row>\n columns: DataPageColumn<Row>[]\n /** Column keys the search box filters on. Omit to search every column. */\n searchKeys?: string[]\n emptyKey?: string\n}\n\n/** Every toolbar component receives the toolbar entry core built for it. */\nexport interface ToolbarToolProps {\n tool: unknown\n}\n\n/**\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\n * registered under `map.tools` is a compile error.\n */\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\n id: string\n label: string\n icon: string | React.ComponentType<LucideProps>\n component: React.ComponentType<ToolbarToolProps & P>\n cursor?: string\n stayActive?: boolean\n}\n\nexport interface ViewerTabRegistration {\n id: string\n labelKey: string\n icon: string | React.ComponentType<LucideProps>\n component: React.ComponentType\n /** Which viewers this tab appears in. Omit for all of them. */\n viewers?: Array<PluginViewerTarget | ViewerNames>\n}\n\n/**\n * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via\n * `usePluginDialogs()`, so it outlives whichever one opened it.\n */\nexport interface DialogRegistration<P = Record<string, unknown>> {\n id: string\n titleKey: string\n size?: 'sm' | 'md' | 'lg' | 'xl'\n component: React.ComponentType<P & { close: () => void }>\n}\n\n/**\n * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,\n * whose panel unmounts when its dropdown closes and would take the layer with it.\n */\nexport interface MapLayerRegistration {\n id: string\n component: React.ComponentType<MapToolProps>\n}\n\nexport interface LegendRow {\n label: string\n color: string\n count?: number\n}\n\nexport interface LegendRegistration {\n id: string\n title: string\n /** Which viewers this legend appears in. Omit for all of them. */\n viewers?: Array<PluginViewerTarget | ViewerNames>\n // Called by <MapLegendHost> on each render; active:false omits the section.\n useLegend: () => {\n active: boolean\n // Overrides registration.title when set, e.g. a city-scoped label.\n title?: string\n unavailable?: boolean\n rows: LegendRow[]\n }\n}\n\n// --- Capability → registration type map ---\n// A new contribution point needs one entry here, its type above, and a consumer\n// calling `registry.getAll('your.key')`. No host changes.\n\nexport interface CapabilityRegistry {\n 'data.pages': DataPageRegistration\n 'viewer.tabs': ViewerTabRegistration\n 'ui.dialogs': DialogRegistration\n 'map.tools': ToolbarRegistration<MapToolProps>\n 'bim.tools': ToolbarRegistration<BimToolProps>\n 'viewer.legends': LegendRegistration\n 'map.layers': MapLayerRegistration\n}\n\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\ntype _CapabilityParity =\n PluginCapability extends keyof CapabilityRegistry\n ? keyof CapabilityRegistry extends PluginCapability\n ? true\n : never\n : never\nconst _capabilityParity: _CapabilityParity = true\nvoid _capabilityParity\n\n// --- Plugin Context ---\n\nexport interface PluginContext {\n pluginId: string\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\n config: Record<string, unknown>\n}\n\n// --- Plugin entry point type ---\n\nexport interface PluginEntry {\n // `any`: each plugin binds only the slots it uses, so no one context type fits them all.\n activate(ctx: any): void | Promise<void>\n deactivate?(ctx: any): void | Promise<void>\n}\n\n/**\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\n * Prefer the thunk when compiled in — a static import pulls the plugin's\n * components into every route that reaches `installed.ts`.\n */\nexport interface PluginSource {\n manifest: PluginManifest\n entry: PluginEntry | (() => Promise<PluginEntry>)\n}\n\n/** Resolves either form of `PluginSource.entry` to the module. */\nexport async function resolvePluginEntry(\n entry: PluginSource['entry'],\n): Promise<PluginEntry> {\n return typeof entry === 'function' ? entry() : entry\n}\n\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\n"],"mappings":"AAQA,SAAS,mBAAmB;AAerB,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA2BO,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;AA2HA,MAAM,oBAAuC;AAC7C,KAAK;AA6BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\n// out of the host's module graph.\nimport type { BimToolProps } from './bimViewer'\nimport type { MapToolProps } from './mapViewer'\n// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\nexport { ViewerNames } from '../../types/dbTypes'\n\nimport type { ViewerNames } from '../../types/dbTypes'\n\n/**\n * The viewers that can host a tab or a legend, spelled as plain strings. Derived from\n * `ViewerNames` so the two cannot drift, and the form `@collabdt/plugin-kit` publishes.\n */\nexport type PluginViewerTarget = `${ViewerNames.map | ViewerNames.bim}`\nimport type { LucideProps } from 'lucide-react'\n\n// --- Capability definitions ---\n\n// Only capabilities core actually renders. One with no consumer registers fine,\n// shows nothing, and leaves nothing to debug.\nexport const VALID_CAPABILITIES = [\n 'data.pages',\n 'viewer.tabs',\n 'ui.dialogs',\n 'map.tools',\n 'bim.tools',\n 'viewer.legends',\n 'map.layers',\n 'map.datasets',\n] as const\n\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\n\n// --- Manifest ---\n\nexport interface PluginManifest {\n slug: string\n name: string\n version: string\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\n hostApi?: number\n description?: string\n author?: string\n /** A lucide icon name shown beside the plugin's name. Unset or unknown shows a puzzle piece. */\n icon?: string\n capabilities: PluginCapability[]\n requiredPermissions?: string[]\n configSchema?: Record<string, unknown>\n /**\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\n */\n messages?: Record<string, Record<string, unknown>>\n}\n\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\n const errors: string[] = []\n\n if (typeof manifest !== 'object' || manifest === null) {\n return { valid: false, errors: ['manifest must be an object'] }\n }\n\n const m = manifest as Record<string, unknown>\n\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\n\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\n errors.push('hostApi must be an integer when present')\n }\n\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\n errors.push('at least one capability is required')\n } else {\n for (const cap of m.capabilities) {\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\n errors.push(`invalid capability: \"${cap}\"`)\n }\n }\n }\n\n return { valid: errors.length === 0, errors }\n}\n\n// --- Registration shapes (one per capability) ---\n\nexport interface DataPageColumn<Row> {\n key: string\n /** Resolved in the plugin's own namespace, falling back to the literal string. */\n labelKey: string\n render?: (row: Row) => React.ReactNode\n}\n\n/**\n * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a\n * row click opens one of its own `ui.dialogs` rather than a detail view of its own.\n */\nexport interface DataPageRows<Row> {\n rows: Row[]\n isLoading?: boolean\n /** From the hook, not the registration, so it can close over `usePluginDialogs`. */\n onRowClick?: (row: Row) => void\n}\n\nexport interface DataPageRegistration<Row = Record<string, unknown>> {\n id: string\n titleKey: string\n icon: string | React.ComponentType<LucideProps>\n useRows: () => DataPageRows<Row>\n columns: DataPageColumn<Row>[]\n /** Column keys the search box filters on. Omit to search every column. */\n searchKeys?: string[]\n emptyKey?: string\n}\n\n/** Every toolbar component receives the toolbar entry core built for it. */\nexport interface ToolbarToolProps {\n tool: unknown\n}\n\n/**\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\n * registered under `map.tools` is a compile error.\n */\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\n id: string\n label: string\n icon: string | React.ComponentType<LucideProps>\n component: React.ComponentType<ToolbarToolProps & P>\n cursor?: string\n stayActive?: boolean\n}\n\nexport interface ViewerTabRegistration {\n id: string\n labelKey: string\n icon: string | React.ComponentType<LucideProps>\n component: React.ComponentType\n /** Which viewers this tab appears in. Omit for all of them. */\n viewers?: Array<PluginViewerTarget | ViewerNames>\n}\n\n/**\n * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via\n * `usePluginDialogs()`, so it outlives whichever one opened it.\n */\nexport interface DialogRegistration<P = Record<string, unknown>> {\n id: string\n titleKey: string\n size?: 'sm' | 'md' | 'lg' | 'xl'\n component: React.ComponentType<P & { close: () => void }>\n}\n\n/**\n * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,\n * whose panel unmounts when its dropdown closes and would take the layer with it.\n */\nexport interface MapLayerRegistration {\n id: string\n component: React.ComponentType<MapToolProps>\n}\n\n/** The least of a GeoJSON FeatureCollection core needs, so a typed `geojson` one satisfies it. */\nexport interface PluginFeatureCollection {\n type: 'FeatureCollection'\n features: Array<{\n type: 'Feature'\n id?: string | number\n geometry: { type: string; coordinates?: unknown; geometries?: unknown } | null\n properties: Record<string, unknown> | null\n }>\n}\n\n/** How core draws a plugin dataset. Absent, the plugin draws it from its own `map.layers`. */\nexport type PluginDatasetSource =\n | { type: 'wms'; baseUrl: string; layers: string; timeEnabled?: boolean }\n | { type: 'geojson'; getFeatures: () => Promise<PluginFeatureCollection> }\n\n/**\n * A dataset listed in the Datasets menu: under Live Data when `live`, otherwise under\n * Organizational. Applying it is the user's choice; `usePluginDataset(id)` reports it.\n */\nexport interface DatasetRegistration {\n id: string\n name: string\n description?: string\n publisher?: string\n /** A link to the dataset's documentation, shown in its details. */\n information?: string\n live?: boolean\n source?: PluginDatasetSource\n}\n\nexport interface LegendRow {\n label: string\n color: string\n count?: number\n /** With `onVisibleChange`, the row gets a switch; false dims it. */\n visible?: boolean\n onVisibleChange?: (visible: boolean) => void\n}\n\nexport interface LegendRegistration {\n id: string\n title: string\n /** Which viewers this legend appears in. Omit for all of them. */\n viewers?: Array<PluginViewerTarget | ViewerNames>\n /** A `map.datasets` id of the same plugin: the map nests this legend under that applied dataset. */\n dataset?: string\n // Called by the legend host on each render; active:false omits the section.\n useLegend: () => {\n active: boolean\n // Overrides registration.title when set, e.g. a city-scoped label.\n title?: string\n unavailable?: boolean\n rows: LegendRow[]\n /** The plugin's own inputs under the rows, such as a date slider filtering what is drawn. */\n controls?: React.ReactNode\n }\n}\n\n// --- Capability → registration type map ---\n// A new contribution point needs one entry here, its type above, and a consumer\n// calling `registry.getAll('your.key')`. No host changes.\n\nexport interface CapabilityRegistry {\n 'data.pages': DataPageRegistration\n 'viewer.tabs': ViewerTabRegistration\n 'ui.dialogs': DialogRegistration\n 'map.tools': ToolbarRegistration<MapToolProps>\n 'bim.tools': ToolbarRegistration<BimToolProps>\n 'viewer.legends': LegendRegistration\n 'map.layers': MapLayerRegistration\n 'map.datasets': DatasetRegistration\n}\n\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\ntype _CapabilityParity =\n PluginCapability extends keyof CapabilityRegistry\n ? keyof CapabilityRegistry extends PluginCapability\n ? true\n : never\n : never\nconst _capabilityParity: _CapabilityParity = true\nvoid _capabilityParity\n\n// --- Plugin Context ---\n\nexport interface PluginContext {\n pluginId: string\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\n config: Record<string, unknown>\n}\n\n// --- Plugin entry point type ---\n\nexport interface PluginEntry {\n // `any`: each plugin binds only the slots it uses, so no one context type fits them all.\n activate(ctx: any): void | Promise<void>\n deactivate?(ctx: any): void | Promise<void>\n}\n\n/**\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\n * Prefer the thunk when compiled in — a static import pulls the plugin's\n * components into every route that reaches `installed.ts`.\n */\nexport interface PluginSource {\n manifest: PluginManifest\n entry: PluginEntry | (() => Promise<PluginEntry>)\n}\n\n/** Resolves either form of `PluginSource.entry` to the module. */\nexport async function resolvePluginEntry(\n entry: PluginSource['entry'],\n): Promise<PluginEntry> {\n return typeof entry === 'function' ? entry() : entry\n}\n\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\n"],"mappings":"AAQA,SAAS,mBAAmB;AAerB,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA2BO,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;AAkKA,MAAM,oBAAuC;AAC7C,KAAK;AA6BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
|
|
@@ -91,6 +91,7 @@ export interface Dataset {
|
|
|
91
91
|
layers: string;
|
|
92
92
|
};
|
|
93
93
|
viewport?: DatasetViewport;
|
|
94
|
+
drawnByPlugin?: string;
|
|
94
95
|
}
|
|
95
96
|
/** Marks a dataset too large to load whole: features are fetched per map view, and only at or above `minZoom`. */
|
|
96
97
|
export interface DatasetViewport {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasetTypes.d.ts","sourceRoot":"","sources":["../../../src/core/types/datasetTypes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,EAAE,cAAc,EAAI,MAAM,WAAW,CAAA;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,mBAAmB,EAAE,kBAAkB,EAAE,CAAA;CAC1C;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,cAAc,EAAE,YAAY,EAAE,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,WAAW,CAAA;CACnB;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,OAAO;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MA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AC,EAAE,WAAW,CAAA;CACzB;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,SAAU,SAAQ,oBAAoB,EAAE,IAAI;CAAG"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { ViewerNames } from '../types/dbTypes';
|
|
2
2
|
import type { Organization } from '../types/dbTypes';
|
|
3
|
+
/** Viewers every organization has, whatever its `appContent` says, so they are never stored in it. */
|
|
4
|
+
export declare const ALWAYS_AVAILABLE_VIEWERS: readonly ViewerNames[];
|
|
3
5
|
/**
|
|
4
|
-
* The viewers an organization
|
|
5
|
-
*
|
|
6
|
-
* An empty `appContent` means "not configured", which grants everything rather than nothing, so
|
|
7
|
-
* an organization that never set the field keeps the full app. The map is always included.
|
|
8
|
-
*
|
|
9
|
-
* Shared so every entry point into a viewer agrees: the sidebar and the map popover's tool row
|
|
10
|
-
* were drifting, and a tool that navigates somewhere the sidebar hides is a dead end.
|
|
6
|
+
* The viewers an organization can reach. An empty `appContent` means "not configured" and grants
|
|
7
|
+
* every optional viewer; the always-available ones are included either way.
|
|
11
8
|
*/
|
|
12
9
|
export declare function resolveAppContent(organization?: Organization | null): ViewerNames[];
|
|
13
10
|
/** Whether an organization can reach a viewer at all. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appContent.d.ts","sourceRoot":"","sources":["../../../src/core/utils/appContent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"appContent.d.ts","sourceRoot":"","sources":["../../../src/core/utils/appContent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,sGAAsG;AACtG,eAAO,MAAM,wBAAwB,EAAE,SAAS,WAAW,EAI1D,CAAA;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,WAAW,EAAE,CAInF;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAC3B,YAAY,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EAC7C,MAAM,EAAE,WAAW,GAClB,OAAO,CAET"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ViewerNames } from "../types/dbTypes";
|
|
2
|
-
const
|
|
2
|
+
const ALWAYS_AVAILABLE_VIEWERS = [
|
|
3
|
+
ViewerNames.map,
|
|
3
4
|
ViewerNames.plugins,
|
|
5
|
+
ViewerNames.settings
|
|
6
|
+
];
|
|
7
|
+
const OPTIONAL_VIEWERS = [
|
|
4
8
|
ViewerNames.bim,
|
|
5
9
|
ViewerNames.sites,
|
|
6
10
|
ViewerNames.infrastructure,
|
|
@@ -10,13 +14,14 @@ const OPTIONAL_VIEWERS = [
|
|
|
10
14
|
function resolveAppContent(organization) {
|
|
11
15
|
var _a;
|
|
12
16
|
const configured = (_a = organization == null ? void 0 : organization.appContent) != null ? _a : [];
|
|
13
|
-
|
|
14
|
-
return [
|
|
17
|
+
const optional = configured.length === 0 ? OPTIONAL_VIEWERS : configured;
|
|
18
|
+
return [.../* @__PURE__ */ new Set([...ALWAYS_AVAILABLE_VIEWERS, ...optional])];
|
|
15
19
|
}
|
|
16
20
|
function hasAppContent(organization, viewer) {
|
|
17
21
|
return resolveAppContent(organization).includes(viewer);
|
|
18
22
|
}
|
|
19
23
|
export {
|
|
24
|
+
ALWAYS_AVAILABLE_VIEWERS,
|
|
20
25
|
hasAppContent,
|
|
21
26
|
resolveAppContent
|
|
22
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/utils/appContent.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { ViewerNames } from '../types/dbTypes'\n\nimport type { Organization } from '../types/dbTypes'\n\n/**
|
|
1
|
+
{"version":3,"sources":["../../../src/core/utils/appContent.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { ViewerNames } from '../types/dbTypes'\n\nimport type { Organization } from '../types/dbTypes'\n\n/** Viewers every organization has, whatever its `appContent` says, so they are never stored in it. */\nexport const ALWAYS_AVAILABLE_VIEWERS: readonly ViewerNames[] = [\n ViewerNames.map,\n ViewerNames.plugins,\n ViewerNames.settings,\n]\n\nconst OPTIONAL_VIEWERS: ViewerNames[] = [\n ViewerNames.bim,\n ViewerNames.sites,\n ViewerNames.infrastructure,\n ViewerNames.buildings,\n ViewerNames.files,\n]\n\n/**\n * The viewers an organization can reach. An empty `appContent` means \"not configured\" and grants\n * every optional viewer; the always-available ones are included either way.\n */\nexport function resolveAppContent(organization?: Organization | null): ViewerNames[] {\n const configured = organization?.appContent ?? []\n const optional = configured.length === 0 ? OPTIONAL_VIEWERS : (configured as ViewerNames[])\n return [...new Set([...ALWAYS_AVAILABLE_VIEWERS, ...optional])]\n}\n\n/** Whether an organization can reach a viewer at all. */\nexport function hasAppContent(\n organization: Organization | null | undefined,\n viewer: ViewerNames,\n): boolean {\n return resolveAppContent(organization).includes(viewer)\n}\n"],"mappings":"AAGA,SAAS,mBAAmB;AAKrB,MAAM,2BAAmD;AAAA,EAC9D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd;AAEA,MAAM,mBAAkC;AAAA,EACtC,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd;AAMO,SAAS,kBAAkB,cAAmD;AA1BrF;AA2BE,QAAM,cAAa,kDAAc,eAAd,YAA4B,CAAC;AAChD,QAAM,WAAW,WAAW,WAAW,IAAI,mBAAoB;AAC/D,SAAO,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,0BAA0B,GAAG,QAAQ,CAAC,CAAC;AAChE;AAGO,SAAS,cACd,cACA,QACS;AACT,SAAO,kBAAkB,YAAY,EAAE,SAAS,MAAM;AACxD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtinLiveDatasets.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/map/datasets/src/builtinLiveDatasets.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAyDhE,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,EAAE,OAAO,EAAmB,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { DatasetGroup } from "../../../../../types/dbTypes";
|
|
2
|
-
import { layerColorByName } from "../../utils/stringToColour";
|
|
3
|
-
import { buildWmsTileUrl } from "./urlSources";
|
|
4
|
-
const GEOMET_WMS_URL = process.env.NEXT_PUBLIC_GEOMET_WMS_URL || "https://geo.weather.gc.ca/geomet";
|
|
5
|
-
const liveWeatherPortal = {
|
|
6
|
-
id: -1001,
|
|
7
|
-
// synthetic — built-in, never persisted
|
|
8
|
-
name: "ECCC \xB7 MSC GeoMet",
|
|
9
|
-
group: DatasetGroup.National,
|
|
10
|
-
dataManagementSystem: "Other",
|
|
11
|
-
apiUrl: GEOMET_WMS_URL,
|
|
12
|
-
country: "Canada",
|
|
13
|
-
live: true
|
|
14
|
-
};
|
|
15
|
-
const emptyFeatures = async () => ({ type: "FeatureCollection", features: [] });
|
|
16
|
-
const weatherRadar = {
|
|
17
|
-
id: "live-weather-radar",
|
|
18
|
-
name: "Live Weather Radar (Canada)",
|
|
19
|
-
publisher: "Environment and Climate Change Canada \xB7 MSC GeoMet",
|
|
20
|
-
description: "Live precipitation radar (RADAR_1KM_RRAI) \u2014 rain rate, latest frame served ~every 6 minutes.",
|
|
21
|
-
dataManagementSystem: "other",
|
|
22
|
-
datasetType: "WMS",
|
|
23
|
-
type: "WMS",
|
|
24
|
-
countrySubdivision: "",
|
|
25
|
-
municipality: "",
|
|
26
|
-
group: DatasetGroup.National,
|
|
27
|
-
clickable: false,
|
|
28
|
-
// MapLibre raster tile template; {bbox-epsg-3857} stays literal (substituted per tile).
|
|
29
|
-
url: buildWmsTileUrl(GEOMET_WMS_URL, "RADAR_1KM_RRAI"),
|
|
30
|
-
// Time-enabled: WMSDatasetLayer animates the WMS TIME dimension via the scrub/play control.
|
|
31
|
-
timeEnabled: true,
|
|
32
|
-
wms: { baseUrl: GEOMET_WMS_URL, layers: "RADAR_1KM_RRAI" },
|
|
33
|
-
information: "https://eccc-msc.github.io/open-data/msc-geomet/readme_en/",
|
|
34
|
-
portal: liveWeatherPortal,
|
|
35
|
-
layerColor: layerColorByName("Live Weather Radar"),
|
|
36
|
-
getFields: async () => [],
|
|
37
|
-
getFeatures: emptyFeatures
|
|
38
|
-
};
|
|
39
|
-
const builtinLiveDatasets = [weatherRadar];
|
|
40
|
-
export {
|
|
41
|
-
builtinLiveDatasets
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=builtinLiveDatasets.js.map
|