@collabdt/core 0.13.1 → 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/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/i18n/messages/en.json +2 -1
- package/dist/core/i18n/messages/es.json +2 -1
- package/dist/core/i18n/messages/fr.json +2 -1
- 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/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
|
@@ -1,67 +1,17 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
"use client";
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defProps = Object.defineProperties;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
var __objRest = (source, exclude) => {
|
|
24
|
-
var target = {};
|
|
25
|
-
for (var prop in source)
|
|
26
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
-
target[prop] = source[prop];
|
|
28
|
-
if (source != null && __getOwnPropSymbols)
|
|
29
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
-
target[prop] = source[prop];
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
};
|
|
35
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
5
|
import { useTranslations } from "next-intl";
|
|
37
|
-
import * as React from "react";
|
|
38
|
-
import { usePluginConfigs, usePluginContributions } from "../../../../plugins/host/provider";
|
|
39
|
-
import { PluginScopeProvider } from "../../../../plugins/host/scope";
|
|
40
6
|
import { LegendCard } from "../../../ui/LegendCard";
|
|
7
|
+
import { legendKey, PluginLegendSection } from "./PluginLegendSection";
|
|
8
|
+
import { usePluginLegends } from "./usePluginLegends";
|
|
41
9
|
function ViewerLegendHost({ viewer }) {
|
|
42
|
-
const all = usePluginContributions("viewer.legends");
|
|
43
|
-
const configs = usePluginConfigs();
|
|
44
|
-
const registrations = React.useMemo(
|
|
45
|
-
() => all.filter((entry) => !entry.viewers || entry.viewers.includes(viewer)),
|
|
46
|
-
[all, viewer]
|
|
47
|
-
);
|
|
48
10
|
const t = useTranslations("MapLegend");
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
setActiveMap((prev) => prev[id] === active ? prev : __spreadProps(__spreadValues({}, prev), { [id]: active }));
|
|
52
|
-
}, []);
|
|
53
|
-
const activeCount = registrations.filter((r) => activeMap[r.id]).length;
|
|
11
|
+
const { registrations, configs, isActive, probes } = usePluginLegends(viewer);
|
|
12
|
+
const activeCount = registrations.filter(isActive).length;
|
|
54
13
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
-
|
|
56
|
-
ScopedLegendSection,
|
|
57
|
-
{
|
|
58
|
-
registration: r,
|
|
59
|
-
config: configs[r.pluginId],
|
|
60
|
-
onActiveChange: reportActive,
|
|
61
|
-
renderBody: false
|
|
62
|
-
},
|
|
63
|
-
`probe-${r.id}`
|
|
64
|
-
)) }),
|
|
14
|
+
probes,
|
|
65
15
|
activeCount > 0 && /* @__PURE__ */ jsx(
|
|
66
16
|
LegendCard,
|
|
67
17
|
{
|
|
@@ -69,40 +19,18 @@ function ViewerLegendHost({ viewer }) {
|
|
|
69
19
|
count: activeCount,
|
|
70
20
|
testId: "map-legend-card",
|
|
71
21
|
countTestId: "map-legend-count",
|
|
72
|
-
children: registrations.map((
|
|
73
|
-
|
|
22
|
+
children: registrations.map((registration) => /* @__PURE__ */ jsx(
|
|
23
|
+
PluginLegendSection,
|
|
74
24
|
{
|
|
75
|
-
registration
|
|
76
|
-
config: configs[
|
|
77
|
-
onActiveChange: reportActive,
|
|
78
|
-
renderBody: true
|
|
25
|
+
registration,
|
|
26
|
+
config: configs[registration.pluginId]
|
|
79
27
|
},
|
|
80
|
-
|
|
28
|
+
legendKey(registration)
|
|
81
29
|
))
|
|
82
30
|
}
|
|
83
31
|
)
|
|
84
32
|
] });
|
|
85
33
|
}
|
|
86
|
-
function ScopedLegendSection(_a) {
|
|
87
|
-
var _b = _a, { registration, config } = _b, rest = __objRest(_b, ["registration", "config"]);
|
|
88
|
-
return /* @__PURE__ */ jsx(PluginScopeProvider, { pluginId: registration.pluginId, config, children: /* @__PURE__ */ jsx(LegendSection, __spreadValues({ registration }, rest)) });
|
|
89
|
-
}
|
|
90
|
-
function LegendSection({ registration, onActiveChange, renderBody }) {
|
|
91
|
-
const t = useTranslations("MapLegend");
|
|
92
|
-
const { active, title, unavailable, rows } = registration.useLegend();
|
|
93
|
-
React.useEffect(() => {
|
|
94
|
-
onActiveChange(registration.id, active);
|
|
95
|
-
}, [active, registration.id, onActiveChange]);
|
|
96
|
-
if (!renderBody || !active) return null;
|
|
97
|
-
return /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-t first:border-t-0", children: [
|
|
98
|
-
/* @__PURE__ */ jsx("div", { className: "font-semibold text-xs mb-1", children: title != null ? title : registration.title }),
|
|
99
|
-
unavailable ? /* @__PURE__ */ jsx("div", { className: "rounded bg-red-100 text-red-800 px-2 py-1 text-[11px] font-medium", children: t("feedUnavailable") }) : /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: rows.map((row) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 text-xs", children: [
|
|
100
|
-
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-block h-3 w-3 rounded-sm shrink-0", style: { backgroundColor: row.color } }),
|
|
101
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1", children: row.label }),
|
|
102
|
-
row.count !== void 0 && /* @__PURE__ */ jsx("span", { className: "tabular-nums opacity-70", children: row.count })
|
|
103
|
-
] }, row.label)) })
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
34
|
export {
|
|
107
35
|
ViewerLegendHost
|
|
108
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/core/components/viewers/shared/legends/ViewerLegendHost.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/core/components/viewers/shared/legends/ViewerLegendHost.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { LegendCard } from '../../../ui/LegendCard'\n\nimport { legendKey, PluginLegendSection } from './PluginLegendSection'\nimport { usePluginLegends } from './usePluginLegends'\n\nimport type { ViewerNames } from '../../../../types/dbTypes'\n\n/**\n * One shared legend card per viewer, with a titled section per active `viewer.legends`\n * registration. The map stacks its legends in the applied-layers card instead.\n */\nexport function ViewerLegendHost({ viewer }: { viewer: ViewerNames }) {\n const t = useTranslations('MapLegend')\n const { registrations, configs, isActive, probes } = usePluginLegends(viewer)\n\n const activeCount = registrations.filter(isActive).length\n\n return (\n <>\n {probes}\n\n {activeCount > 0 && (\n <LegendCard\n title={activeCount === 1 ? t('title') : t('titlePlural')}\n count={activeCount}\n testId=\"map-legend-card\"\n countTestId=\"map-legend-count\"\n >\n {registrations.map(registration => (\n <PluginLegendSection\n key={legendKey(registration)}\n registration={registration}\n config={configs[registration.pluginId]}\n />\n ))}\n </LegendCard>\n )}\n </>\n )\n}\n"],"mappings":";AA0BI,mBAWQ,KAXR;AArBJ,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB;AAE3B,SAAS,WAAW,2BAA2B;AAC/C,SAAS,wBAAwB;AAQ1B,SAAS,iBAAiB,EAAE,OAAO,GAA4B;AACpE,QAAM,IAAI,gBAAgB,WAAW;AACrC,QAAM,EAAE,eAAe,SAAS,UAAU,OAAO,IAAI,iBAAiB,MAAM;AAE5E,QAAM,cAAc,cAAc,OAAO,QAAQ,EAAE;AAEnD,SACE,iCACG;AAAA;AAAA,IAEA,cAAc,KACb;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,gBAAgB,IAAI,EAAE,OAAO,IAAI,EAAE,aAAa;AAAA,QACvD,OAAO;AAAA,QACP,QAAO;AAAA,QACP,aAAY;AAAA,QAEX,wBAAc,IAAI,kBACjB;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA,QAAQ,QAAQ,aAAa,QAAQ;AAAA;AAAA,UAFhC,UAAU,YAAY;AAAA,QAG7B,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { LegendContribution } from './PluginLegendSection';
|
|
3
|
+
import type { ViewerNames } from '../../../../types/dbTypes';
|
|
4
|
+
export interface PluginLegends {
|
|
5
|
+
registrations: LegendContribution[];
|
|
6
|
+
configs: Record<string, Record<string, unknown>>;
|
|
7
|
+
isActive: (registration: LegendContribution) => boolean;
|
|
8
|
+
/** Render once: keeps every legend's hook running, and its `active` known, while no card shows it. */
|
|
9
|
+
probes: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** The `viewer.legends` that belong in `viewer`, and which of them currently have something to say. */
|
|
12
|
+
export declare function usePluginLegends(viewer: ViewerNames): PluginLegends;
|
|
13
|
+
//# sourceMappingURL=usePluginLegends.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePluginLegends.d.ts","sourceRoot":"","sources":["../../../../../../src/core/components/viewers/shared/legends/usePluginLegends.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAChD,QAAQ,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,CAAA;IACvD,sGAAsG;IACtG,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;CACxB;AAED,uGAAuG;AACvG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAmCnE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
import { jsx } from "react/jsx-runtime";
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
import { usePluginConfigs, usePluginContributions } from "../../../../plugins/host/provider";
|
|
26
|
+
import { legendKey, PluginLegendSection } from "./PluginLegendSection";
|
|
27
|
+
function usePluginLegends(viewer) {
|
|
28
|
+
const all = usePluginContributions("viewer.legends");
|
|
29
|
+
const configs = usePluginConfigs();
|
|
30
|
+
const registrations = React.useMemo(
|
|
31
|
+
() => all.filter((entry) => !entry.viewers || entry.viewers.includes(viewer)),
|
|
32
|
+
[all, viewer]
|
|
33
|
+
);
|
|
34
|
+
const [activeMap, setActiveMap] = React.useState({});
|
|
35
|
+
const reportActive = React.useCallback((key, active) => {
|
|
36
|
+
setActiveMap((previous) => previous[key] === active ? previous : __spreadProps(__spreadValues({}, previous), { [key]: active }));
|
|
37
|
+
}, []);
|
|
38
|
+
const isActive = React.useCallback(
|
|
39
|
+
(registration) => Boolean(activeMap[legendKey(registration)]),
|
|
40
|
+
[activeMap]
|
|
41
|
+
);
|
|
42
|
+
const probes = /* @__PURE__ */ jsx("div", { className: "hidden", children: registrations.map((registration) => /* @__PURE__ */ jsx(
|
|
43
|
+
PluginLegendSection,
|
|
44
|
+
{
|
|
45
|
+
registration,
|
|
46
|
+
config: configs[registration.pluginId],
|
|
47
|
+
onActiveChange: reportActive,
|
|
48
|
+
renderBody: false
|
|
49
|
+
},
|
|
50
|
+
`probe-${legendKey(registration)}`
|
|
51
|
+
)) });
|
|
52
|
+
return { registrations, configs, isActive, probes };
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
usePluginLegends
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=usePluginLegends.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/core/components/viewers/shared/legends/usePluginLegends.tsx"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from 'react'\n\nimport { usePluginConfigs, usePluginContributions } from '../../../../plugins/host/provider'\n\nimport { legendKey, PluginLegendSection } from './PluginLegendSection'\n\nimport type { LegendContribution } from './PluginLegendSection'\nimport type { ViewerNames } from '../../../../types/dbTypes'\n\nexport interface PluginLegends {\n registrations: LegendContribution[]\n configs: Record<string, Record<string, unknown>>\n isActive: (registration: LegendContribution) => boolean\n /** Render once: keeps every legend's hook running, and its `active` known, while no card shows it. */\n probes: React.ReactNode\n}\n\n/** The `viewer.legends` that belong in `viewer`, and which of them currently have something to say. */\nexport function usePluginLegends(viewer: ViewerNames): PluginLegends {\n const all = usePluginContributions('viewer.legends')\n const configs = usePluginConfigs()\n\n const registrations = React.useMemo(\n () => all.filter(entry => !entry.viewers || entry.viewers.includes(viewer)),\n [all, viewer],\n )\n\n const [activeMap, setActiveMap] = React.useState<Record<string, boolean>>({})\n\n const reportActive = React.useCallback((key: string, active: boolean) => {\n setActiveMap(previous => (previous[key] === active ? previous : { ...previous, [key]: active }))\n }, [])\n\n const isActive = React.useCallback(\n (registration: LegendContribution) => Boolean(activeMap[legendKey(registration)]),\n [activeMap],\n )\n\n const probes = (\n <div className=\"hidden\">\n {registrations.map(registration => (\n <PluginLegendSection\n key={`probe-${legendKey(registration)}`}\n registration={registration}\n config={configs[registration.pluginId]}\n onActiveChange={reportActive}\n renderBody={false}\n />\n ))}\n </div>\n )\n\n return { registrations, configs, isActive, probes }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8CQ;AAzCR,YAAY,WAAW;AAEvB,SAAS,kBAAkB,8BAA8B;AAEzD,SAAS,WAAW,2BAA2B;AAcxC,SAAS,iBAAiB,QAAoC;AACnE,QAAM,MAAM,uBAAuB,gBAAgB;AACnD,QAAM,UAAU,iBAAiB;AAEjC,QAAM,gBAAgB,MAAM;AAAA,IAC1B,MAAM,IAAI,OAAO,WAAS,CAAC,MAAM,WAAW,MAAM,QAAQ,SAAS,MAAM,CAAC;AAAA,IAC1E,CAAC,KAAK,MAAM;AAAA,EACd;AAEA,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAkC,CAAC,CAAC;AAE5E,QAAM,eAAe,MAAM,YAAY,CAAC,KAAa,WAAoB;AACvE,iBAAa,cAAa,SAAS,GAAG,MAAM,SAAS,WAAW,iCAAK,WAAL,EAAe,CAAC,GAAG,GAAG,OAAO,EAAE;AAAA,EACjG,GAAG,CAAC,CAAC;AAEL,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,iBAAqC,QAAQ,UAAU,UAAU,YAAY,CAAC,CAAC;AAAA,IAChF,CAAC,SAAS;AAAA,EACZ;AAEA,QAAM,SACJ,oBAAC,SAAI,WAAU,UACZ,wBAAc,IAAI,kBACjB;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA,QAAQ,QAAQ,aAAa,QAAQ;AAAA,MACrC,gBAAgB;AAAA,MAChB,YAAY;AAAA;AAAA,IAJP,SAAS,UAAU,YAAY,CAAC;AAAA,EAKvC,CACD,GACH;AAGF,SAAO,EAAE,eAAe,SAAS,UAAU,OAAO;AACpD;","names":[]}
|
|
@@ -447,7 +447,8 @@
|
|
|
447
447
|
"MapLegend": {
|
|
448
448
|
"title": "Legend",
|
|
449
449
|
"titlePlural": "Legends",
|
|
450
|
-
"feedUnavailable": "Feed unavailable"
|
|
450
|
+
"feedUnavailable": "Feed unavailable",
|
|
451
|
+
"feedUnavailableToast": "{title}: the live feed is unreachable right now, so the layer may be missing or out of date."
|
|
451
452
|
},
|
|
452
453
|
"Datasets": {
|
|
453
454
|
"failedFetchError": "Failed to fetch datasets.",
|
|
@@ -447,7 +447,8 @@
|
|
|
447
447
|
"MapLegend": {
|
|
448
448
|
"title": "Leyenda",
|
|
449
449
|
"titlePlural": "Leyendas",
|
|
450
|
-
"feedUnavailable": "Fuente no disponible"
|
|
450
|
+
"feedUnavailable": "Fuente no disponible",
|
|
451
|
+
"feedUnavailableToast": "{title}: la fuente en vivo no está disponible en este momento; la capa puede faltar o estar desactualizada."
|
|
451
452
|
},
|
|
452
453
|
"Datasets": {
|
|
453
454
|
"failedFetchError": "Error al obtener conjuntos de datos.",
|
|
@@ -447,7 +447,8 @@
|
|
|
447
447
|
"MapLegend": {
|
|
448
448
|
"title": "Légende",
|
|
449
449
|
"titlePlural": "Légendes",
|
|
450
|
-
"feedUnavailable": "Flux indisponible"
|
|
450
|
+
"feedUnavailable": "Flux indisponible",
|
|
451
|
+
"feedUnavailableToast": "{title} : le flux en direct est inaccessible pour le moment; la couche peut être absente ou périmée."
|
|
451
452
|
},
|
|
452
453
|
"Datasets": {
|
|
453
454
|
"failedFetchError": "Échec de la récupération des ensembles de données.",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginDatasetId.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginDatasetId.ts"],"names":[],"mappings":"AAGA,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/plugins/host/pluginDatasetId.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/** The id a plugin dataset carries in the Datasets store, namespaced so no two plugins collide. */\nexport function pluginDatasetId(pluginId: string, id: string): string {\n return `plugin:${pluginId}:${id}`\n}\n"],"mappings":"AAIO,SAAS,gBAAgB,UAAkB,IAAoB;AACpE,SAAO,UAAU,QAAQ,IAAI,EAAE;AACjC;","names":[]}
|
|
@@ -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,MAAoB;AAAA,MAAa;AAAA,MAAS;AAAA,MAC1C;AAAA,MAAsB;AAAA,MAAmB;AAAA,MAAW;AAAA,MACpD;AAAA,MAAU;AAAA,MAAY;AAAA,MAAwB;AAAA,MAAiB;AAAA,IACjE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB,aAAa,SAAS;AAAA,EAClD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,YAAY,OAAO,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAsB;AAAA,MAAoB;AAAA,MAAmB;AAAA;AAAA,MAE7D;AAAA;AAAA,MAEA;AAAA,MAAsB;AAAA,IACxB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,mBAAmB,aAAa;AAAA,EAC5C;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,oBAAoB,yBAAyB,qBAAqB;AAAA,EAC9E;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAgB;AAAA,MAAe;AAAA,MAAqB;AAAA,MACpD;AAAA,MAAY;AAAA,MACZ;AAAA,MAAsB;AAAA,MACtB;AAAA,MAAmB;AAAA,MACnB;AAAA,MAAY;AAAA,MAAW;AAAA,MAAwB;AAAA,MAAoB;AAAA,MACnE;AAAA,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,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,YAAY,OAAO,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAsB;AAAA,MAAoB;AAAA,MAAmB;AAAA;AAAA,MAE7D;AAAA;AAAA,MAEA;AAAA,MAAsB;AAAA,IACxB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,mBAAmB,aAAa;AAAA,EAC5C;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,oBAAoB,yBAAyB,qBAAqB;AAAA,EAC9E;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAgB;AAAA,MAAe;AAAA,MAAqB;AAAA,MACpD;AAAA,MAAY;AAAA,MACZ;AAAA,MAAsB;AAAA,MACtB;AAAA,MAAmB;AAAA,MACnB;AAAA,MAAY;AAAA,MAAW;AAAA,MAAwB;AAAA,MAAoB;AAAA,MACnE;AAAA,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,MACnB;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAS;AAAA,MAAU;AAAA,MAAS;AAAA,MAC5B;AAAA,MAAQ;AAAA,MAAe;AAAA,MAAmB;AAAA,MAAc;AAAA,MAAc;AAAA,MACtE;AAAA,MAAU;AAAA,MAAe;AAAA,MAAiB;AAAA,MAC1C;AAAA,MAAgB;AAAA,MAAgB;AAAA,MAAe;AAAA,IACjD;AAAA,EACF;AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
|
|
@@ -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":[]}
|