@collabdt/plugin-kit 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,7 +6,14 @@ The format is based on Keep a Changelog, and this package adheres to Semantic Ve
6
6
  It versions and publishes independently of `@collabdt/core`; the core changelog is at the
7
7
  repository root.
8
8
 
9
- ## [Unreleased]
9
+ ## [0.9.0] - 2026-10-03
10
+
11
+ ### Added
12
+ - **`map.datasets` capability** with `DatasetRegistration`, `PluginDatasetSource` and `PluginFeatureCollection`,
13
+ for a dataset listed in the platform's Datasets menu under Organizational or Live Data.
14
+ - `usePluginDataset(id)` and `PluginDatasetState` in the `@collabdt/core/plugins-sdk/data` declarations.
15
+ - `LegendRegistration.dataset`, `LegendRow.visible` / `onVisibleChange`, `controls` in the `useLegend` result,
16
+ and `PluginNode`.
10
17
 
11
18
  ## [0.8.0] - 2026-10-02
12
19
 
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
 
3
3
  /** Declare as `hostApi` in your manifest. The host refuses a plugin that declares another value. */
4
4
  declare const PLUGIN_HOST_API = 1;
5
- declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "viewer.legends", "map.layers"];
5
+ declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "viewer.legends", "map.layers", "map.datasets"];
6
6
  type PluginCapability = typeof VALID_CAPABILITIES[number];
7
7
  interface PluginManifest {
8
8
  slug: string;
@@ -20,6 +20,8 @@ interface PluginManifest {
20
20
  /** Strings by locale then key, folded into the app's tree under `plugins.<slug>`. May nest. */
21
21
  messages?: Record<string, Record<string, unknown>>;
22
22
  }
23
+ /** Anything React renders, named here so the surface files need no import of their own. */
24
+ type PluginNode = React.ReactNode;
23
25
  /** Every toolbar component receives the toolbar entry core built for it. */
24
26
  interface ToolbarToolProps {
25
27
  tool: unknown;
@@ -36,6 +38,44 @@ interface MapLayerRegistration<P = unknown> {
36
38
  id: string;
37
39
  component: React.ComponentType<P>;
38
40
  }
41
+ /** The least of a GeoJSON FeatureCollection core needs, so a typed `geojson` one satisfies it. */
42
+ interface PluginFeatureCollection {
43
+ type: 'FeatureCollection';
44
+ features: Array<{
45
+ type: 'Feature';
46
+ id?: string | number;
47
+ geometry: {
48
+ type: string;
49
+ coordinates?: unknown;
50
+ geometries?: unknown;
51
+ } | null;
52
+ properties: Record<string, unknown> | null;
53
+ }>;
54
+ }
55
+ /** How core draws a plugin dataset. Absent, the plugin draws it from its own `map.layers`. */
56
+ type PluginDatasetSource = {
57
+ type: 'wms';
58
+ baseUrl: string;
59
+ layers: string;
60
+ timeEnabled?: boolean;
61
+ } | {
62
+ type: 'geojson';
63
+ getFeatures: () => Promise<PluginFeatureCollection>;
64
+ };
65
+ /**
66
+ * A dataset listed in the Datasets menu: under Live Data when `live`, otherwise under
67
+ * Organizational. Applying it is the user's choice; `usePluginDataset(id)` reports it.
68
+ */
69
+ interface DatasetRegistration {
70
+ id: string;
71
+ name: string;
72
+ description?: string;
73
+ publisher?: string;
74
+ /** A link to the dataset's documentation, shown in its details. */
75
+ information?: string;
76
+ live?: boolean;
77
+ source?: PluginDatasetSource;
78
+ }
39
79
  interface DataPageColumn<Row> {
40
80
  key: string;
41
81
  labelKey: string;
@@ -82,6 +122,7 @@ interface CapabilityRegistry<MapProps = unknown, BimProps = unknown, Legend = un
82
122
  'bim.tools': ToolbarRegistration<BimProps>;
83
123
  'viewer.legends': Legend;
84
124
  'map.layers': MapLayerRegistration<MapProps>;
125
+ 'map.datasets': DatasetRegistration;
85
126
  }
86
127
  interface PluginContext<MapProps = unknown, BimProps = unknown, Legend = unknown> {
87
128
  pluginId: string;
@@ -89,4 +130,4 @@ interface PluginContext<MapProps = unknown, BimProps = unknown, Legend = unknown
89
130
  config: Record<string, unknown>;
90
131
  }
91
132
 
92
- export { type CapabilityRegistry as C, type DataPageColumn as D, type MapLayerRegistration as M, type PluginContext as P, type ToolbarRegistration as T, VALID_CAPABILITIES as V, type DataPageRegistration as a, type DataPageRows as b, type DialogRegistration as c, PLUGIN_HOST_API as d, type PluginCapability as e, type PluginManifest as f, type PluginViewerTarget as g, type ToolbarToolProps as h, type ViewerTabRegistration as i };
133
+ export { type CapabilityRegistry as C, type DataPageColumn as D, type MapLayerRegistration as M, type PluginContext as P, type ToolbarRegistration as T, VALID_CAPABILITIES as V, type DataPageRegistration as a, type DataPageRows as b, type DatasetRegistration as c, type DialogRegistration as d, PLUGIN_HOST_API as e, type PluginCapability as f, type PluginDatasetSource as g, type PluginFeatureCollection as h, type PluginManifest as i, type PluginNode as j, type PluginViewerTarget as k, type ToolbarToolProps as l, type ViewerTabRegistration as m };
@@ -7,7 +7,8 @@ var VALID_CAPABILITIES = [
7
7
  "map.tools",
8
8
  "bim.tools",
9
9
  "viewer.legends",
10
- "map.layers"
10
+ "map.layers",
11
+ "map.datasets"
11
12
  ];
12
13
 
13
14
  export {
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, P as PluginContext } from '../base-7_4mmLJ8.js';
3
- export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DialogRegistration, M as MapLayerRegistration, d as PLUGIN_HOST_API, e as PluginCapability, f as PluginManifest, g as PluginViewerTarget, T as ToolbarRegistration, h as ToolbarToolProps, V as VALID_CAPABILITIES, i as ViewerTabRegistration } from '../base-7_4mmLJ8.js';
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BgsLG-7Z.js';
3
+ export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DatasetRegistration, d as DialogRegistration, M as MapLayerRegistration, e as PLUGIN_HOST_API, f as PluginCapability, g as PluginDatasetSource, h as PluginFeatureCollection, i as PluginManifest, j as PluginNode, k as PluginViewerTarget, T as ToolbarRegistration, l as ToolbarToolProps, V as VALID_CAPABILITIES, m as ViewerTabRegistration } from '../base-BgsLG-7Z.js';
4
4
  import * as OBC from '@thatopen/components';
5
5
  import 'react';
6
6
 
package/dist/types/bim.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_HOST_API,
3
3
  VALID_CAPABILITIES
4
- } from "../chunk-D2RUZAIT.js";
4
+ } from "../chunk-LY2G66D2.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
@@ -1,18 +1,23 @@
1
1
  /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, g as PluginViewerTarget, P as PluginContext } from '../base-7_4mmLJ8.js';
3
- export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DialogRegistration, M as MapLayerRegistration, d as PLUGIN_HOST_API, e as PluginCapability, f as PluginManifest, T as ToolbarRegistration, h as ToolbarToolProps, V as VALID_CAPABILITIES, i as ViewerTabRegistration } from '../base-7_4mmLJ8.js';
2
+ import { C as CapabilityRegistry, k as PluginViewerTarget, j as PluginNode, P as PluginContext } from '../base-BgsLG-7Z.js';
3
+ export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DatasetRegistration, d as DialogRegistration, M as MapLayerRegistration, e as PLUGIN_HOST_API, f as PluginCapability, g as PluginDatasetSource, h as PluginFeatureCollection, i as PluginManifest, T as ToolbarRegistration, l as ToolbarToolProps, V as VALID_CAPABILITIES, m as ViewerTabRegistration } from '../base-BgsLG-7Z.js';
4
4
  import 'react';
5
5
 
6
6
  interface LegendRow {
7
7
  label: string;
8
8
  color: string;
9
9
  count?: number;
10
+ /** With `onVisibleChange`, the row gets a switch; false dims it. */
11
+ visible?: boolean;
12
+ onVisibleChange?: (visible: boolean) => void;
10
13
  }
11
14
  interface LegendRegistration {
12
15
  id: string;
13
16
  title: string;
14
17
  /** Which viewers this legend appears in. Omit for all of them. */
15
18
  viewers?: PluginViewerTarget[];
19
+ /** A `map.datasets` id of the same plugin: the map nests this legend under that applied dataset. */
20
+ dataset?: string;
16
21
  useLegend: () => {
17
22
  /** False omits the section entirely, which is what a legend with nothing to say should do. */
18
23
  active: boolean;
@@ -20,6 +25,8 @@ interface LegendRegistration {
20
25
  title?: string;
21
26
  unavailable?: boolean;
22
27
  rows: LegendRow[];
28
+ /** The plugin's own inputs under the rows, such as a date slider filtering what is drawn. */
29
+ controls?: PluginNode;
23
30
  };
24
31
  }
25
32
  /** `CapabilityRegistry` with the legend surface bound. */
@@ -27,4 +34,4 @@ type LegendCapabilityRegistry = CapabilityRegistry<unknown, unknown, LegendRegis
27
34
  /** The `activate()` context for a plugin that contributes a map legend. */
28
35
  type LegendPluginContext = PluginContext<unknown, unknown, LegendRegistration>;
29
36
 
30
- export { CapabilityRegistry, type LegendCapabilityRegistry, type LegendPluginContext, type LegendRegistration, type LegendRow, PluginContext, PluginViewerTarget };
37
+ export { CapabilityRegistry, type LegendCapabilityRegistry, type LegendPluginContext, type LegendRegistration, type LegendRow, PluginContext, PluginNode, PluginViewerTarget };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_HOST_API,
3
3
  VALID_CAPABILITIES
4
- } from "../chunk-D2RUZAIT.js";
4
+ } from "../chunk-LY2G66D2.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, P as PluginContext } from '../base-7_4mmLJ8.js';
3
- export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DialogRegistration, M as MapLayerRegistration, d as PLUGIN_HOST_API, e as PluginCapability, f as PluginManifest, g as PluginViewerTarget, T as ToolbarRegistration, h as ToolbarToolProps, V as VALID_CAPABILITIES, i as ViewerTabRegistration } from '../base-7_4mmLJ8.js';
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BgsLG-7Z.js';
3
+ export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DatasetRegistration, d as DialogRegistration, M as MapLayerRegistration, e as PLUGIN_HOST_API, f as PluginCapability, g as PluginDatasetSource, h as PluginFeatureCollection, i as PluginManifest, j as PluginNode, k as PluginViewerTarget, T as ToolbarRegistration, l as ToolbarToolProps, V as VALID_CAPABILITIES, m as ViewerTabRegistration } from '../base-BgsLG-7Z.js';
4
4
  import { Map } from 'maplibre-gl';
5
5
  import 'react';
6
6
 
package/dist/types/map.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_HOST_API,
3
3
  VALID_CAPABILITIES
4
- } from "../chunk-D2RUZAIT.js";
4
+ } from "../chunk-LY2G66D2.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
@@ -22,6 +22,7 @@ declare module '@collabdt/core/plugins-sdk' {
22
22
  'bim.tools',
23
23
  'viewer.legends',
24
24
  'map.layers',
25
+ 'map.datasets',
25
26
  ]
26
27
 
27
28
  export const PLUGIN_HOST_API: 1
@@ -165,6 +166,16 @@ declare module '@collabdt/core/plugins-sdk/data' {
165
166
  T extends Record<string, unknown> = Record<string, unknown>,
166
167
  >(): T
167
168
  export function usePluginPermissions(): import('./data').PluginPermissions
169
+
170
+ export interface PluginDatasetState {
171
+ /** The user added it from the Datasets menu. */
172
+ applied: boolean
173
+ /** Applied and not hidden with its eye toggle: draw it only when this is true. */
174
+ visible: boolean
175
+ }
176
+
177
+ /** Whether one of this plugin's `map.datasets`, by its registration id, is on the map. */
178
+ export function usePluginDataset(id: string): PluginDatasetState
168
179
  }
169
180
 
170
181
  declare module '@collabdt/core/plugins-sdk/state' {
@@ -1,5 +1,5 @@
1
- import { C as CapabilityRegistry, P as PluginContext } from '../base-7_4mmLJ8.js';
2
- export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DialogRegistration, M as MapLayerRegistration, d as PLUGIN_HOST_API, e as PluginCapability, f as PluginManifest, g as PluginViewerTarget, T as ToolbarRegistration, h as ToolbarToolProps, V as VALID_CAPABILITIES, i as ViewerTabRegistration } from '../base-7_4mmLJ8.js';
1
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BgsLG-7Z.js';
2
+ export { D as DataPageColumn, a as DataPageRegistration, b as DataPageRows, c as DatasetRegistration, d as DialogRegistration, M as MapLayerRegistration, e as PLUGIN_HOST_API, f as PluginCapability, g as PluginDatasetSource, h as PluginFeatureCollection, i as PluginManifest, j as PluginNode, k as PluginViewerTarget, T as ToolbarRegistration, l as ToolbarToolProps, V as VALID_CAPABILITIES, m as ViewerTabRegistration } from '../base-BgsLG-7Z.js';
3
3
  import 'react';
4
4
 
5
5
  /** `CapabilityRegistry` for the surfaces that bind no viewer props. */
package/dist/types/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_HOST_API,
3
3
  VALID_CAPABILITIES
4
- } from "../chunk-D2RUZAIT.js";
4
+ } from "../chunk-LY2G66D2.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collabdt/plugin-kit",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Build preset and types for authoring CDT plugins.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",