@collabdt/plugin-kit 0.4.0 → 0.6.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/README.md CHANGED
@@ -63,7 +63,6 @@ import type { MapToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/
63
63
  |---|---|---|
64
64
  | `@collabdt/plugin-kit/types/map` | `map.tools` | `maplibre-gl` types |
65
65
  | `@collabdt/plugin-kit/types/bim` | `bim.tools` | `@thatopen/components` types |
66
- | `@collabdt/plugin-kit/types/pointcloud` | `pointcloud.tools` | nothing external |
67
66
  | `@collabdt/plugin-kit/types/legend` | `viewer.legends` | nothing external |
68
67
 
69
68
  Split per surface on purpose. A single combined entry would make a map plugin's typecheck fail on unresolved `@thatopen/components` references it has no reason to install, so only the map and BIM surfaces need a type-only dependency at all.
@@ -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", "pointcloud.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"];
6
6
  type PluginCapability = typeof VALID_CAPABILITIES[number];
7
7
  interface PluginManifest {
8
8
  slug: string;
@@ -12,6 +12,8 @@ interface PluginManifest {
12
12
  hostApi?: number;
13
13
  description?: string;
14
14
  author?: string;
15
+ /** A lucide icon name shown beside the plugin's name. Unset or unknown shows a puzzle piece. */
16
+ icon?: string;
15
17
  capabilities: PluginCapability[];
16
18
  requiredPermissions?: string[];
17
19
  configSchema?: Record<string, unknown>;
@@ -55,7 +57,7 @@ interface DataPageRegistration<Row = Record<string, unknown>> {
55
57
  emptyKey?: string;
56
58
  }
57
59
  /** The viewers that host a tab or a legend. Core spells them exactly this way. */
58
- type PluginViewerTarget = 'map' | 'bim' | 'pointcloud';
60
+ type PluginViewerTarget = 'map' | 'bim';
59
61
  interface ViewerTabRegistration {
60
62
  id: string;
61
63
  labelKey: string;
@@ -72,19 +74,18 @@ interface DialogRegistration<P = Record<string, unknown>> {
72
74
  close: () => void;
73
75
  }>;
74
76
  }
75
- interface CapabilityRegistry<MapProps = unknown, BimProps = unknown, PointCloudProps = unknown, Legend = unknown> {
77
+ interface CapabilityRegistry<MapProps = unknown, BimProps = unknown, Legend = unknown> {
76
78
  'data.pages': DataPageRegistration;
77
79
  'viewer.tabs': ViewerTabRegistration;
78
80
  'ui.dialogs': DialogRegistration;
79
81
  'map.tools': ToolbarRegistration<MapProps>;
80
82
  'bim.tools': ToolbarRegistration<BimProps>;
81
- 'pointcloud.tools': ToolbarRegistration<PointCloudProps>;
82
83
  'viewer.legends': Legend;
83
84
  'map.layers': MapLayerRegistration<MapProps>;
84
85
  }
85
- interface PluginContext<MapProps = unknown, BimProps = unknown, PointCloudProps = unknown, Legend = unknown> {
86
+ interface PluginContext<MapProps = unknown, BimProps = unknown, Legend = unknown> {
86
87
  pluginId: string;
87
- register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry<MapProps, BimProps, PointCloudProps, Legend>[K]): void;
88
+ register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry<MapProps, BimProps, Legend>[K]): void;
88
89
  config: Record<string, unknown>;
89
90
  }
90
91
 
@@ -6,7 +6,6 @@ var VALID_CAPABILITIES = [
6
6
  "ui.dialogs",
7
7
  "map.tools",
8
8
  "bim.tools",
9
- "pointcloud.tools",
10
9
  "viewer.legends",
11
10
  "map.layers"
12
11
  ];
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, P as PluginContext } from '../base-ClPlfxgA.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-ClPlfxgA.js';
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';
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-C7KO3OP7.js";
4
+ } from "../chunk-D2RUZAIT.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
@@ -1,5 +1,5 @@
1
1
  /** Mirrors core's `ViewerNames`, as the union the records carry. */
2
- type PluginViewerName = 'auth' | 'map' | 'bim' | 'pointcloud' | 'buildings' | 'sites' | 'files' | 'land' | 'infrastructure' | 'extensions' | 'settings' | 'users';
2
+ type PluginViewerName = 'auth' | 'map' | 'bim' | 'buildings' | 'sites' | 'files' | 'land' | 'infrastructure' | 'extensions' | 'settings' | 'users';
3
3
  interface PluginBuilding {
4
4
  id: number;
5
5
  buildingName?: string;
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, g as PluginViewerTarget, P as PluginContext } from '../base-ClPlfxgA.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-ClPlfxgA.js';
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';
4
4
  import 'react';
5
5
 
6
6
  interface LegendRow {
@@ -23,8 +23,8 @@ interface LegendRegistration {
23
23
  };
24
24
  }
25
25
  /** `CapabilityRegistry` with the legend surface bound. */
26
- type LegendCapabilityRegistry = CapabilityRegistry<unknown, unknown, unknown, LegendRegistration>;
26
+ type LegendCapabilityRegistry = CapabilityRegistry<unknown, unknown, LegendRegistration>;
27
27
  /** The `activate()` context for a plugin that contributes a map legend. */
28
- type LegendPluginContext = PluginContext<unknown, unknown, unknown, LegendRegistration>;
28
+ type LegendPluginContext = PluginContext<unknown, unknown, LegendRegistration>;
29
29
 
30
30
  export { CapabilityRegistry, type LegendCapabilityRegistry, type LegendPluginContext, type LegendRegistration, type LegendRow, PluginContext, PluginViewerTarget };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_HOST_API,
3
3
  VALID_CAPABILITIES
4
- } from "../chunk-C7KO3OP7.js";
4
+ } from "../chunk-D2RUZAIT.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-ClPlfxgA.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-ClPlfxgA.js';
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';
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-C7KO3OP7.js";
4
+ } from "../chunk-D2RUZAIT.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
@@ -1,239 +1,237 @@
1
- // SPDX-License-Identifier: AGPL-3.0-or-later
2
- // Copyright (C) 2025 Collab Digital Twins
3
-
4
- // Types for the SDK modules a plugin imports at runtime but never installs: the specifier is
5
- // marked external, and the browser resolves it through the host's import map. Shipping
6
- // declarations for implementations this package does not contain is the point.
7
- //
8
- // Module and export names come from PLUGIN_RUNTIME_SHIMS in core; signatures are copied from
9
- // core's sdk/. React's shims are absent because they have real published types.
10
- //
11
- // No top-level import or export, deliberately: that keeps this a global script, the only place
12
- // TypeScript accepts an ambient declaration for a specifier it cannot resolve.
13
-
14
- declare module '@collabdt/core/plugins-sdk' {
15
- // Only the values the shim re-exports. The SDK's types live in the surface entries, so each
16
- // shape has one definition and it is the one a plugin already imports.
17
- export const VALID_CAPABILITIES: readonly [
18
- 'data.pages',
19
- 'viewer.tabs',
20
- 'ui.dialogs',
21
- 'map.tools',
22
- 'bim.tools',
23
- 'pointcloud.tools',
24
- 'viewer.legends',
25
- 'map.layers',
26
- ]
27
-
28
- export const PLUGIN_HOST_API: 1
29
-
30
- // A value, not just a type: a `viewer.tabs` contribution names its viewers.
31
- export const ViewerNames: {
32
- auth: 'auth'
33
- map: 'map'
34
- bim: 'bim'
35
- pointcloud: 'pointcloud'
36
- buildings: 'buildings'
37
- sites: 'sites'
38
- files: 'files'
39
- land: 'land'
40
- infrastructure: 'infrastructure'
41
- extensions: 'extensions'
42
- settings: 'settings'
43
- users: 'users'
44
- }
45
-
46
- /** Map-friendly, colourblind-accessible colours. Use these rather than inventing a set. */
47
- export const MAP_COLOUR_PALETTE: readonly string[]
48
-
49
- /** A stable colour from `MAP_COLOUR_PALETTE`, chosen by hashing the string. */
50
- export function stringToColour(str: string, variant?: 'min' | 'max'): string
51
-
52
- export function validateManifest(manifest: unknown): { valid: boolean; errors: string[] }
53
-
54
- // Generic because an ambient block cannot import `PluginEntry` from the kit's own entries,
55
- // and restating it would give a plugin two definitions. The call site behaves identically.
56
- export function resolvePluginEntry<E>(entry: E | (() => Promise<E>)): Promise<E>
57
- }
58
-
59
- declare module '@collabdt/core/plugins-sdk/config' {
60
- /** The plugin's config for this organization. Generic so a plugin can type its own shape. */
61
- export function usePluginConfig<
62
- T extends Record<string, unknown> = Record<string, unknown>,
63
- >(): T
64
- /** The calling plugin's id, from the scope its capability host established. */
65
- export function usePluginId(): string
66
- }
67
-
68
- declare module '@collabdt/core/plugins-sdk/messages' {
69
- export type PluginTranslator = (key: string, fallback?: string) => string
70
-
71
- /** A `t()` scoped to the calling plugin's own namespace. */
72
- export function usePluginTranslations(): PluginTranslator
73
-
74
- /** One piece of plugin text. All three parameters are required, matching core. */
75
- export function usePluginMessage(pluginId: string, key: string, fallback: string): string
76
-
77
- // Narrowed to a plain callable: typing next-intl's translator faithfully would drag
78
- // next-intl into a plugin's dependencies.
79
- export function useCoreTranslations(
80
- namespace: string,
81
- ): (key: string, values?: Record<string, unknown>) => string
82
- }
83
-
84
- declare module '@collabdt/core/plugins-sdk/store' {
85
- /** One stored document, as the owning plugin sees it. */
86
- export interface PluginDocument<T> {
87
- /** The plugin's own stable identifier for this document. */
88
- key: string
89
- data: T
90
- updatedAt: string | Date
91
- }
92
-
93
- export interface PluginStore<T> {
94
- items: PluginDocument<T>[]
95
- isLoading: boolean
96
- isError: unknown
97
- /** One document by key, or undefined. */
98
- get: (key: string) => PluginDocument<T> | undefined
99
- /** Create or replace a document. Keyed writes are upserts, not appends. */
100
- put: (key: string, data: T) => Promise<void>
101
- remove: (key: string) => Promise<void>
102
- }
103
-
104
- /** Storage scoped by organization, plugin and collection. `T` is your declaration, not a guarantee. */
105
- export function usePluginStore<T = unknown>(collection: string): PluginStore<T>
106
- }
107
-
108
- declare module '@collabdt/core/plugins-sdk/data' {
109
- // Shapes come from `./data`, inline rather than imported at the top: an ambient module cannot carry a relative import (TS2439).
110
-
111
- export type PluginBuilding = import('./data').PluginBuilding
112
- export type PluginSite = import('./data').PluginSite
113
- export type PluginInfrastructure = import('./data').PluginInfrastructure
114
- export type PluginOrganization = import('./data').PluginOrganization
115
- export type PluginFile = import('./data').PluginFile
116
- export type PluginSensor = import('./data').PluginSensor
117
- export type PluginSensorType = import('./data').PluginSensorType
118
- export type PluginComment = import('./data').PluginComment
119
- export type PluginAbility = import('./data').PluginAbility
120
- export type PluginPermissions = import('./data').PluginPermissions
121
-
122
- export function useBuildings(): import('./data').PluginBuildingsQuery
123
- export function useBuilding(id: number | null): import('./data').PluginBuildingQuery
124
- export function useBuildingsByOsm(osmId: number | null): import('./data').PluginBuildingsQuery
125
- export function useBuildingOsmIds(): import('./data').PluginBuildingOsmIdsQuery
126
-
127
- export function useSites(): import('./data').PluginSitesQuery
128
- export function useSite(siteId: string): import('./data').PluginSiteQuery
129
-
130
- export function useInfrastructures(): import('./data').PluginInfrastructuresQuery
131
- export function useInfrastructure(
132
- infrastructureId: number,
133
- ): import('./data').PluginInfrastructureQuery
134
-
135
- export function useOrganization(id: string | null): import('./data').PluginOrganizationQuery
136
- export function useOrganizationByName(
137
- name: string | null,
138
- ): import('./data').PluginOrganizationQuery
139
-
140
- export function useFiles(): import('./data').PluginFilesQuery
141
- export function useFile(id: number | null): import('./data').PluginFileQuery
142
- export function useFilesByBuildingId(
143
- buildingId: number,
144
- tag?: string,
145
- ): import('./data').PluginFilesQuery
146
- export function useFilesBySiteId(siteId: number, tag?: string): import('./data').PluginFilesQuery
147
- export function useDownloadFile(): import('./data').PluginDownloadFile
148
-
149
- export function useSensors(): import('./data').PluginSensorsQuery
150
- export function useSensor(id: number | null): import('./data').PluginSensorQuery
151
- export function useSensorsByBuilding(buildingId: number | null): import('./data').PluginSensorsQuery
152
- export function useSensorsByAuthor(authorId: number | null): import('./data').PluginSensorsQuery
153
- export function useCreateSensor(): import('./data').PluginCreateSensor
154
-
155
- export function useSensorTypes(): import('./data').PluginSensorTypesQuery
156
- export function useSensorType(id: number): import('./data').PluginSensorTypeQuery
157
-
158
- export function useComments(): import('./data').PluginCommentsQuery
159
- export function useComment(id: number | null): import('./data').PluginCommentQuery
160
- export function useCommentsByBuilding(buildingId: number | null): import('./data').PluginCommentsQuery
161
- export function useCommentsByAuthor(authorId: number | null): import('./data').PluginCommentsQuery
162
- export function useCreateComment(): import('./data').PluginCreateComment
163
- export function useDeleteComments(): import('./data').PluginDeleteComments
164
-
165
- /** Re-exported by core's data module, so a plugin finds both here as well as at their own specifiers. */
166
- export function usePluginConfig<
167
- T extends Record<string, unknown> = Record<string, unknown>,
168
- >(): T
169
- export function usePluginPermissions(): import('./data').PluginPermissions
170
- }
171
-
172
- declare module '@collabdt/core/plugins-sdk/state' {
173
- /**
174
- * Shared state for one plugin's surfaces: in memory, scoped to the plugin, gone when it is
175
- * disabled. `usePluginStore` is the persisted counterpart.
176
- */
177
- export function usePluginState<T>(
178
- key: string,
179
- initial: T,
180
- ): [T, (next: T | ((previous: T) => T)) => void]
181
- }
182
-
183
- declare module '@collabdt/core/plugins-sdk/ui' {
184
- export interface PluginDialogs {
185
- /** Opens one of this plugin's registered dialogs. `props` reaches the component as props. */
186
- open: (dialogId: string, props?: Record<string, unknown>) => void
187
- /** Closes the topmost instance of `dialogId`, or of any of this plugin's dialogs. */
188
- close: (dialogId?: string) => void
189
- }
190
-
191
- /** Opens and closes this plugin's `ui.dialogs` contributions from any of its surfaces. */
192
- export function usePluginDialogs(): PluginDialogs
193
- }
194
-
195
- declare module '@collabdt/core/plugins-sdk/components' {
196
- // Shapes come from `./components`, a real module here, which is what lets core's
197
- // pluginKitComponents.test.ts compare these declarations against the real components.
198
- //
199
- // Inline `import('./components')` rather than a top-level import: an import declaration
200
- // inside an ambient module cannot use a relative specifier (TS2439), and skipLibCheck hides
201
- // that from everyone until a consumer turns it off.
202
-
203
- export type ButtonProps = import('./components').ButtonProps
204
- export const Button: import('./components').ButtonComponent
205
-
206
- export const Input: import('./components').InputComponent
207
-
208
- export type BadgeProps = import('./components').BadgeProps
209
- export const Badge: import('./components').BadgeComponent
210
-
211
- export type SeparatorProps = import('./components').SeparatorProps
212
- export const Separator: import('./components').SeparatorComponent
213
-
214
- export const Card: import('./components').CardComponent
215
- export const CardHeader: import('./components').CardComponent
216
- export const CardTitle: import('./components').CardComponent
217
- export const CardDescription: import('./components').CardComponent
218
- export const CardContent: import('./components').CardComponent
219
- export const CardFooter: import('./components').CardComponent
220
-
221
- export type DialogProps = import('./components').DialogProps
222
- export const Dialog: import('./components').DialogComponent
223
-
224
- export type DialogTriggerProps = import('./components').DialogTriggerProps
225
- export const DialogTrigger: import('./components').DialogTriggerComponent
226
- export const DialogClose: import('./components').DialogTriggerComponent
227
-
228
- export type DialogContentProps = import('./components').DialogContentProps
229
- export const DialogContent: import('./components').DialogContentComponent
230
-
231
- export const DialogHeader: import('./components').DialogSectionComponent
232
- export const DialogFooter: import('./components').DialogSectionComponent
233
-
234
- export type DialogTitleProps = import('./components').DialogTitleProps
235
- export const DialogTitle: import('./components').DialogTitleComponent
236
-
237
- export type DialogDescriptionProps = import('./components').DialogDescriptionProps
238
- export const DialogDescription: import('./components').DialogDescriptionComponent
239
- }
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // Copyright (C) 2025 Collab Digital Twins
3
+
4
+ // Types for the SDK modules a plugin imports at runtime but never installs: the specifier is
5
+ // marked external, and the browser resolves it through the host's import map. Shipping
6
+ // declarations for implementations this package does not contain is the point.
7
+ //
8
+ // Module and export names come from PLUGIN_RUNTIME_SHIMS in core; signatures are copied from
9
+ // core's sdk/. React's shims are absent because they have real published types.
10
+ //
11
+ // No top-level import or export, deliberately: that keeps this a global script, the only place
12
+ // TypeScript accepts an ambient declaration for a specifier it cannot resolve.
13
+
14
+ declare module '@collabdt/core/plugins-sdk' {
15
+ // Only the values the shim re-exports. The SDK's types live in the surface entries, so each
16
+ // shape has one definition and it is the one a plugin already imports.
17
+ export const VALID_CAPABILITIES: readonly [
18
+ 'data.pages',
19
+ 'viewer.tabs',
20
+ 'ui.dialogs',
21
+ 'map.tools',
22
+ 'bim.tools',
23
+ 'viewer.legends',
24
+ 'map.layers',
25
+ ]
26
+
27
+ export const PLUGIN_HOST_API: 1
28
+
29
+ // A value, not just a type: a `viewer.tabs` contribution names its viewers.
30
+ export const ViewerNames: {
31
+ auth: 'auth'
32
+ map: 'map'
33
+ bim: 'bim'
34
+ buildings: 'buildings'
35
+ sites: 'sites'
36
+ files: 'files'
37
+ land: 'land'
38
+ infrastructure: 'infrastructure'
39
+ extensions: 'extensions'
40
+ settings: 'settings'
41
+ users: 'users'
42
+ }
43
+
44
+ /** Map-friendly, colourblind-accessible colours. Use these rather than inventing a set. */
45
+ export const MAP_COLOUR_PALETTE: readonly string[]
46
+
47
+ /** A stable colour from `MAP_COLOUR_PALETTE`, chosen by hashing the string. */
48
+ export function stringToColour(str: string, variant?: 'min' | 'max'): string
49
+
50
+ export function validateManifest(manifest: unknown): { valid: boolean; errors: string[] }
51
+
52
+ // Generic because an ambient block cannot import `PluginEntry` from the kit's own entries,
53
+ // and restating it would give a plugin two definitions. The call site behaves identically.
54
+ export function resolvePluginEntry<E>(entry: E | (() => Promise<E>)): Promise<E>
55
+ }
56
+
57
+ declare module '@collabdt/core/plugins-sdk/config' {
58
+ /** The plugin's config for this organization. Generic so a plugin can type its own shape. */
59
+ export function usePluginConfig<
60
+ T extends Record<string, unknown> = Record<string, unknown>,
61
+ >(): T
62
+ /** The calling plugin's id, from the scope its capability host established. */
63
+ export function usePluginId(): string
64
+ }
65
+
66
+ declare module '@collabdt/core/plugins-sdk/messages' {
67
+ export type PluginTranslator = (key: string, fallback?: string) => string
68
+
69
+ /** A `t()` scoped to the calling plugin's own namespace. */
70
+ export function usePluginTranslations(): PluginTranslator
71
+
72
+ /** One piece of plugin text. All three parameters are required, matching core. */
73
+ export function usePluginMessage(pluginId: string, key: string, fallback: string): string
74
+
75
+ // Narrowed to a plain callable: typing next-intl's translator faithfully would drag
76
+ // next-intl into a plugin's dependencies.
77
+ export function useCoreTranslations(
78
+ namespace: string,
79
+ ): (key: string, values?: Record<string, unknown>) => string
80
+ }
81
+
82
+ declare module '@collabdt/core/plugins-sdk/store' {
83
+ /** One stored document, as the owning plugin sees it. */
84
+ export interface PluginDocument<T> {
85
+ /** The plugin's own stable identifier for this document. */
86
+ key: string
87
+ data: T
88
+ updatedAt: string | Date
89
+ }
90
+
91
+ export interface PluginStore<T> {
92
+ items: PluginDocument<T>[]
93
+ isLoading: boolean
94
+ isError: unknown
95
+ /** One document by key, or undefined. */
96
+ get: (key: string) => PluginDocument<T> | undefined
97
+ /** Create or replace a document. Keyed writes are upserts, not appends. */
98
+ put: (key: string, data: T) => Promise<void>
99
+ remove: (key: string) => Promise<void>
100
+ }
101
+
102
+ /** Storage scoped by organization, plugin and collection. `T` is your declaration, not a guarantee. */
103
+ export function usePluginStore<T = unknown>(collection: string): PluginStore<T>
104
+ }
105
+
106
+ declare module '@collabdt/core/plugins-sdk/data' {
107
+ // Shapes come from `./data`, inline rather than imported at the top: an ambient module cannot carry a relative import (TS2439).
108
+
109
+ export type PluginBuilding = import('./data').PluginBuilding
110
+ export type PluginSite = import('./data').PluginSite
111
+ export type PluginInfrastructure = import('./data').PluginInfrastructure
112
+ export type PluginOrganization = import('./data').PluginOrganization
113
+ export type PluginFile = import('./data').PluginFile
114
+ export type PluginSensor = import('./data').PluginSensor
115
+ export type PluginSensorType = import('./data').PluginSensorType
116
+ export type PluginComment = import('./data').PluginComment
117
+ export type PluginAbility = import('./data').PluginAbility
118
+ export type PluginPermissions = import('./data').PluginPermissions
119
+
120
+ export function useBuildings(): import('./data').PluginBuildingsQuery
121
+ export function useBuilding(id: number | null): import('./data').PluginBuildingQuery
122
+ export function useBuildingsByOsm(osmId: number | null): import('./data').PluginBuildingsQuery
123
+ export function useBuildingOsmIds(): import('./data').PluginBuildingOsmIdsQuery
124
+
125
+ export function useSites(): import('./data').PluginSitesQuery
126
+ export function useSite(siteId: string): import('./data').PluginSiteQuery
127
+
128
+ export function useInfrastructures(): import('./data').PluginInfrastructuresQuery
129
+ export function useInfrastructure(
130
+ infrastructureId: number,
131
+ ): import('./data').PluginInfrastructureQuery
132
+
133
+ export function useOrganization(id: string | null): import('./data').PluginOrganizationQuery
134
+ export function useOrganizationByName(
135
+ name: string | null,
136
+ ): import('./data').PluginOrganizationQuery
137
+
138
+ export function useFiles(): import('./data').PluginFilesQuery
139
+ export function useFile(id: number | null): import('./data').PluginFileQuery
140
+ export function useFilesByBuildingId(
141
+ buildingId: number,
142
+ tag?: string,
143
+ ): import('./data').PluginFilesQuery
144
+ export function useFilesBySiteId(siteId: number, tag?: string): import('./data').PluginFilesQuery
145
+ export function useDownloadFile(): import('./data').PluginDownloadFile
146
+
147
+ export function useSensors(): import('./data').PluginSensorsQuery
148
+ export function useSensor(id: number | null): import('./data').PluginSensorQuery
149
+ export function useSensorsByBuilding(buildingId: number | null): import('./data').PluginSensorsQuery
150
+ export function useSensorsByAuthor(authorId: number | null): import('./data').PluginSensorsQuery
151
+ export function useCreateSensor(): import('./data').PluginCreateSensor
152
+
153
+ export function useSensorTypes(): import('./data').PluginSensorTypesQuery
154
+ export function useSensorType(id: number): import('./data').PluginSensorTypeQuery
155
+
156
+ export function useComments(): import('./data').PluginCommentsQuery
157
+ export function useComment(id: number | null): import('./data').PluginCommentQuery
158
+ export function useCommentsByBuilding(buildingId: number | null): import('./data').PluginCommentsQuery
159
+ export function useCommentsByAuthor(authorId: number | null): import('./data').PluginCommentsQuery
160
+ export function useCreateComment(): import('./data').PluginCreateComment
161
+ export function useDeleteComments(): import('./data').PluginDeleteComments
162
+
163
+ /** Re-exported by core's data module, so a plugin finds both here as well as at their own specifiers. */
164
+ export function usePluginConfig<
165
+ T extends Record<string, unknown> = Record<string, unknown>,
166
+ >(): T
167
+ export function usePluginPermissions(): import('./data').PluginPermissions
168
+ }
169
+
170
+ declare module '@collabdt/core/plugins-sdk/state' {
171
+ /**
172
+ * Shared state for one plugin's surfaces: in memory, scoped to the plugin, gone when it is
173
+ * disabled. `usePluginStore` is the persisted counterpart.
174
+ */
175
+ export function usePluginState<T>(
176
+ key: string,
177
+ initial: T,
178
+ ): [T, (next: T | ((previous: T) => T)) => void]
179
+ }
180
+
181
+ declare module '@collabdt/core/plugins-sdk/ui' {
182
+ export interface PluginDialogs {
183
+ /** Opens one of this plugin's registered dialogs. `props` reaches the component as props. */
184
+ open: (dialogId: string, props?: Record<string, unknown>) => void
185
+ /** Closes the topmost instance of `dialogId`, or of any of this plugin's dialogs. */
186
+ close: (dialogId?: string) => void
187
+ }
188
+
189
+ /** Opens and closes this plugin's `ui.dialogs` contributions from any of its surfaces. */
190
+ export function usePluginDialogs(): PluginDialogs
191
+ }
192
+
193
+ declare module '@collabdt/core/plugins-sdk/components' {
194
+ // Shapes come from `./components`, a real module here, which is what lets core's
195
+ // pluginKitComponents.test.ts compare these declarations against the real components.
196
+ //
197
+ // Inline `import('./components')` rather than a top-level import: an import declaration
198
+ // inside an ambient module cannot use a relative specifier (TS2439), and skipLibCheck hides
199
+ // that from everyone until a consumer turns it off.
200
+
201
+ export type ButtonProps = import('./components').ButtonProps
202
+ export const Button: import('./components').ButtonComponent
203
+
204
+ export const Input: import('./components').InputComponent
205
+
206
+ export type BadgeProps = import('./components').BadgeProps
207
+ export const Badge: import('./components').BadgeComponent
208
+
209
+ export type SeparatorProps = import('./components').SeparatorProps
210
+ export const Separator: import('./components').SeparatorComponent
211
+
212
+ export const Card: import('./components').CardComponent
213
+ export const CardHeader: import('./components').CardComponent
214
+ export const CardTitle: import('./components').CardComponent
215
+ export const CardDescription: import('./components').CardComponent
216
+ export const CardContent: import('./components').CardComponent
217
+ export const CardFooter: import('./components').CardComponent
218
+
219
+ export type DialogProps = import('./components').DialogProps
220
+ export const Dialog: import('./components').DialogComponent
221
+
222
+ export type DialogTriggerProps = import('./components').DialogTriggerProps
223
+ export const DialogTrigger: import('./components').DialogTriggerComponent
224
+ export const DialogClose: import('./components').DialogTriggerComponent
225
+
226
+ export type DialogContentProps = import('./components').DialogContentProps
227
+ export const DialogContent: import('./components').DialogContentComponent
228
+
229
+ export const DialogHeader: import('./components').DialogSectionComponent
230
+ export const DialogFooter: import('./components').DialogSectionComponent
231
+
232
+ export type DialogTitleProps = import('./components').DialogTitleProps
233
+ export const DialogTitle: import('./components').DialogTitleComponent
234
+
235
+ export type DialogDescriptionProps = import('./components').DialogDescriptionProps
236
+ export const DialogDescription: import('./components').DialogDescriptionComponent
237
+ }
@@ -1,5 +1,5 @@
1
- import { C as CapabilityRegistry, P as PluginContext } from '../base-ClPlfxgA.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-ClPlfxgA.js';
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';
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-C7KO3OP7.js";
4
+ } from "../chunk-D2RUZAIT.js";
5
5
  export {
6
6
  PLUGIN_HOST_API,
7
7
  VALID_CAPABILITIES
package/package.json CHANGED
@@ -1,72 +1,68 @@
1
- {
2
- "name": "@collabdt/plugin-kit",
3
- "version": "0.4.0",
4
- "description": "Build preset and types for authoring CDT plugins.",
5
- "license": "AGPL-3.0-or-later",
6
- "type": "module",
7
- "files": [
8
- "dist"
9
- ],
10
- "main": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
12
- "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
16
- },
17
- "./types/components": {
18
- "types": "./dist/types/components.d.ts",
19
- "default": "./dist/types/components.js"
20
- },
21
- "./types/data": {
22
- "types": "./dist/types/data.d.ts",
23
- "default": "./dist/types/data.js"
24
- },
25
- "./types/map": {
26
- "types": "./dist/types/map.d.ts",
27
- "default": "./dist/types/map.js"
28
- },
29
- "./types/bim": {
30
- "types": "./dist/types/bim.d.ts",
31
- "default": "./dist/types/bim.js"
32
- },
33
- "./types/pointcloud": {
34
- "types": "./dist/types/pointcloud.d.ts",
35
- "default": "./dist/types/pointcloud.js"
36
- },
37
- "./types/legend": {
38
- "types": "./dist/types/legend.d.ts",
39
- "default": "./dist/types/legend.js"
40
- },
41
- "./types/ui": {
42
- "types": "./dist/types/ui.d.ts",
43
- "default": "./dist/types/ui.js"
44
- }
45
- },
46
- "scripts": {
47
- "build": "tsup && node scripts/shipAmbientTypes.mjs",
48
- "prepublishOnly": "npm run build",
49
- "test": "vitest run"
50
- },
51
- "peerDependencies": {
52
- "@thatopen/components": ">=3.4",
53
- "@types/react": ">=18",
54
- "maplibre-gl": ">=5",
55
- "tsup": ">=8"
56
- },
57
- "peerDependenciesMeta": {
58
- "@thatopen/components": {
59
- "optional": true
60
- },
61
- "maplibre-gl": {
62
- "optional": true
63
- }
64
- },
65
- "devDependencies": {
66
- "@thatopen/components": "~3.4.0",
67
- "maplibre-gl": "^5.24.0",
68
- "tsup": "^8.5.0",
69
- "typescript": "^5.9.3",
70
- "vitest": "^4.1.8"
71
- }
72
- }
1
+ {
2
+ "name": "@collabdt/plugin-kit",
3
+ "version": "0.6.0",
4
+ "description": "Build preset and types for authoring CDT plugins.",
5
+ "license": "AGPL-3.0-or-later",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./types/components": {
18
+ "types": "./dist/types/components.d.ts",
19
+ "default": "./dist/types/components.js"
20
+ },
21
+ "./types/data": {
22
+ "types": "./dist/types/data.d.ts",
23
+ "default": "./dist/types/data.js"
24
+ },
25
+ "./types/map": {
26
+ "types": "./dist/types/map.d.ts",
27
+ "default": "./dist/types/map.js"
28
+ },
29
+ "./types/bim": {
30
+ "types": "./dist/types/bim.d.ts",
31
+ "default": "./dist/types/bim.js"
32
+ },
33
+ "./types/legend": {
34
+ "types": "./dist/types/legend.d.ts",
35
+ "default": "./dist/types/legend.js"
36
+ },
37
+ "./types/ui": {
38
+ "types": "./dist/types/ui.d.ts",
39
+ "default": "./dist/types/ui.js"
40
+ }
41
+ },
42
+ "scripts": {
43
+ "build": "tsup && node scripts/shipAmbientTypes.mjs",
44
+ "prepublishOnly": "npm run build",
45
+ "test": "vitest run"
46
+ },
47
+ "peerDependencies": {
48
+ "@thatopen/components": ">=3.4",
49
+ "@types/react": ">=18",
50
+ "maplibre-gl": ">=5",
51
+ "tsup": ">=8"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@thatopen/components": {
55
+ "optional": true
56
+ },
57
+ "maplibre-gl": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "@thatopen/components": "~3.4.0",
63
+ "maplibre-gl": "^5.24.0",
64
+ "tsup": "^8.5.0",
65
+ "typescript": "^5.9.3",
66
+ "vitest": "^4.1.8"
67
+ }
68
+ }
@@ -1,16 +0,0 @@
1
- /// <reference path="./sdkModules.d.ts" />
2
- import { C as CapabilityRegistry, P as PluginContext } from '../base-ClPlfxgA.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-ClPlfxgA.js';
4
- import 'react';
5
-
6
- interface PointCloudToolProps {
7
- viewer: unknown;
8
- /** False until Potree has finished initialising. */
9
- ready: boolean;
10
- }
11
- /** `CapabilityRegistry` with the point-cloud surface bound. */
12
- type PointCloudCapabilityRegistry = CapabilityRegistry<unknown, unknown, PointCloudToolProps>;
13
- /** The `activate()` context for a plugin that contributes to the point-cloud toolbar. */
14
- type PointCloudPluginContext = PluginContext<unknown, unknown, PointCloudToolProps>;
15
-
16
- export { CapabilityRegistry, PluginContext, type PointCloudCapabilityRegistry, type PointCloudPluginContext, type PointCloudToolProps };
@@ -1,8 +0,0 @@
1
- import {
2
- PLUGIN_HOST_API,
3
- VALID_CAPABILITIES
4
- } from "../chunk-C7KO3OP7.js";
5
- export {
6
- PLUGIN_HOST_API,
7
- VALID_CAPABILITIES
8
- };