@collabdt/plugin-kit 0.11.0 → 0.12.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 +4 -0
- package/dist/types/data.d.ts +5 -1
- package/dist/types/sdkModules.d.ts +288 -286
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,10 @@ repository root.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
### Added
|
|
12
|
+
- `PluginUser` and `usePluginUser()` in the `@collabdt/core/plugins-sdk/data` declarations: the signed-in user's
|
|
13
|
+
`id` and `name`, or `null` while the session loads or when signed out.
|
|
14
|
+
|
|
11
15
|
## [0.11.0] - 2026-10-09
|
|
12
16
|
|
|
13
17
|
### Added
|
package/dist/types/data.d.ts
CHANGED
|
@@ -236,5 +236,9 @@ interface PluginPermissions {
|
|
|
236
236
|
ability: PluginAbility;
|
|
237
237
|
isLoading: boolean;
|
|
238
238
|
}
|
|
239
|
+
interface PluginUser {
|
|
240
|
+
id: string;
|
|
241
|
+
name: string;
|
|
242
|
+
}
|
|
239
243
|
|
|
240
|
-
export type { PluginAbility, PluginBuilding, PluginBuildingOsmIdsQuery, PluginBuildingQuery, PluginBuildingsQuery, PluginComment, PluginCommentQuery, PluginCommentsQuery, PluginCreateComment, PluginCreateSensor, PluginDeleteComments, PluginDownloadFile, PluginFile, PluginFileQuery, PluginFilesQuery, PluginInfrastructure, PluginInfrastructureQuery, PluginInfrastructuresQuery, PluginOrganization, PluginOrganizationQuery, PluginPermissions, PluginQuery, PluginSensor, PluginSensorQuery, PluginSensorType, PluginSensorTypeQuery, PluginSensorTypesQuery, PluginSensorsQuery, PluginSite, PluginSiteQuery, PluginSitesQuery, PluginTrigger, PluginViewerName };
|
|
244
|
+
export type { PluginAbility, PluginBuilding, PluginBuildingOsmIdsQuery, PluginBuildingQuery, PluginBuildingsQuery, PluginComment, PluginCommentQuery, PluginCommentsQuery, PluginCreateComment, PluginCreateSensor, PluginDeleteComments, PluginDownloadFile, PluginFile, PluginFileQuery, PluginFilesQuery, PluginInfrastructure, PluginInfrastructureQuery, PluginInfrastructuresQuery, PluginOrganization, PluginOrganizationQuery, PluginPermissions, PluginQuery, PluginSensor, PluginSensorQuery, PluginSensorType, PluginSensorTypeQuery, PluginSensorTypesQuery, PluginSensorsQuery, PluginSite, PluginSiteQuery, PluginSitesQuery, PluginTrigger, PluginUser, PluginViewerName };
|
|
@@ -1,286 +1,288 @@
|
|
|
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
|
-
'map.datasets',
|
|
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
|
-
buildings: 'buildings'
|
|
36
|
-
sites: 'sites'
|
|
37
|
-
files: 'files'
|
|
38
|
-
land: 'land'
|
|
39
|
-
infrastructure: 'infrastructure'
|
|
40
|
-
plugins: 'plugins'
|
|
41
|
-
settings: 'settings'
|
|
42
|
-
users: 'users'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Map-friendly, colourblind-accessible colours. Use these rather than inventing a set. */
|
|
46
|
-
export const MAP_COLOUR_PALETTE: readonly string[]
|
|
47
|
-
|
|
48
|
-
/** A stable colour from `MAP_COLOUR_PALETTE`, chosen by hashing the string. */
|
|
49
|
-
export function stringToColour(str: string, variant?: 'min' | 'max'): string
|
|
50
|
-
|
|
51
|
-
export function validateManifest(manifest: unknown): { valid: boolean; errors: string[] }
|
|
52
|
-
|
|
53
|
-
// Generic because an ambient block cannot import `PluginEntry` from the kit's own entries,
|
|
54
|
-
// and restating it would give a plugin two definitions. The call site behaves identically.
|
|
55
|
-
export function resolvePluginEntry<E>(entry: E | (() => Promise<E>)): Promise<E>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare module '@collabdt/core/plugins-sdk/config' {
|
|
59
|
-
/** The plugin's config for this organization. Generic so a plugin can type its own shape. */
|
|
60
|
-
export function usePluginConfig<
|
|
61
|
-
T extends Record<string, unknown> = Record<string, unknown>,
|
|
62
|
-
>(): T
|
|
63
|
-
/** The calling plugin's id, from the scope its capability host established. */
|
|
64
|
-
export function usePluginId(): string
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare module '@collabdt/core/plugins-sdk/messages' {
|
|
68
|
-
export type PluginTranslator = (key: string, fallback?: string) => string
|
|
69
|
-
|
|
70
|
-
/** A `t()` scoped to the calling plugin's own namespace. */
|
|
71
|
-
export function usePluginTranslations(): PluginTranslator
|
|
72
|
-
|
|
73
|
-
/** One piece of plugin text. All three parameters are required, matching core. */
|
|
74
|
-
export function usePluginMessage(pluginId: string, key: string, fallback: string): string
|
|
75
|
-
|
|
76
|
-
// Narrowed to a plain callable: typing next-intl's translator faithfully would drag
|
|
77
|
-
// next-intl into a plugin's dependencies.
|
|
78
|
-
export function useCoreTranslations(
|
|
79
|
-
namespace: string,
|
|
80
|
-
): (key: string, values?: Record<string, unknown>) => string
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare module '@collabdt/core/plugins-sdk/store' {
|
|
84
|
-
/** One stored document, as the owning plugin sees it. */
|
|
85
|
-
export interface PluginDocument<T> {
|
|
86
|
-
/** The plugin's own stable identifier for this document. */
|
|
87
|
-
key: string
|
|
88
|
-
data: T
|
|
89
|
-
updatedAt: string | Date
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface PluginStore<T> {
|
|
93
|
-
items: PluginDocument<T>[]
|
|
94
|
-
isLoading: boolean
|
|
95
|
-
isError: unknown
|
|
96
|
-
/** One document by key, or undefined. */
|
|
97
|
-
get: (key: string) => PluginDocument<T> | undefined
|
|
98
|
-
/** Create or replace a document. Keyed writes are upserts, not appends. */
|
|
99
|
-
put: (key: string, data: T) => Promise<void>
|
|
100
|
-
remove: (key: string) => Promise<void>
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Storage scoped by organization, plugin and collection. `T` is your declaration, not a guarantee. */
|
|
104
|
-
export function usePluginStore<T = unknown>(collection: string): PluginStore<T>
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
declare module '@collabdt/core/plugins-sdk/data' {
|
|
108
|
-
// Shapes come from `./data`, inline rather than imported at the top: an ambient module cannot carry a relative import (TS2439).
|
|
109
|
-
|
|
110
|
-
export type PluginBuilding = import('./data').PluginBuilding
|
|
111
|
-
export type PluginSite = import('./data').PluginSite
|
|
112
|
-
export type PluginInfrastructure = import('./data').PluginInfrastructure
|
|
113
|
-
export type PluginOrganization = import('./data').PluginOrganization
|
|
114
|
-
export type PluginFile = import('./data').PluginFile
|
|
115
|
-
export type PluginSensor = import('./data').PluginSensor
|
|
116
|
-
export type PluginSensorType = import('./data').PluginSensorType
|
|
117
|
-
export type PluginComment = import('./data').PluginComment
|
|
118
|
-
export type PluginAbility = import('./data').PluginAbility
|
|
119
|
-
export type PluginPermissions = import('./data').PluginPermissions
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
export function
|
|
123
|
-
export function
|
|
124
|
-
export function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
export function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
export function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
export function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
export function
|
|
141
|
-
export function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
export function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
export function
|
|
150
|
-
export function
|
|
151
|
-
export function
|
|
152
|
-
export function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
export function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
export function
|
|
159
|
-
export function
|
|
160
|
-
export function
|
|
161
|
-
export function
|
|
162
|
-
export function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
export
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
/** What
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
export const
|
|
227
|
-
|
|
228
|
-
export
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
export
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
export
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
export const
|
|
238
|
-
|
|
239
|
-
export const
|
|
240
|
-
export const
|
|
241
|
-
export const
|
|
242
|
-
export const
|
|
243
|
-
|
|
244
|
-
export
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
export
|
|
248
|
-
|
|
249
|
-
export
|
|
250
|
-
|
|
251
|
-
export
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
export const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
export
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
export
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
export
|
|
269
|
-
export const
|
|
270
|
-
export const
|
|
271
|
-
export const
|
|
272
|
-
|
|
273
|
-
export const
|
|
274
|
-
|
|
275
|
-
export const
|
|
276
|
-
export const
|
|
277
|
-
export const
|
|
278
|
-
export const
|
|
279
|
-
export const
|
|
280
|
-
export const
|
|
281
|
-
export const
|
|
282
|
-
export const
|
|
283
|
-
export const
|
|
284
|
-
export const
|
|
285
|
-
export const
|
|
286
|
-
|
|
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
|
+
'map.datasets',
|
|
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
|
+
buildings: 'buildings'
|
|
36
|
+
sites: 'sites'
|
|
37
|
+
files: 'files'
|
|
38
|
+
land: 'land'
|
|
39
|
+
infrastructure: 'infrastructure'
|
|
40
|
+
plugins: 'plugins'
|
|
41
|
+
settings: 'settings'
|
|
42
|
+
users: 'users'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Map-friendly, colourblind-accessible colours. Use these rather than inventing a set. */
|
|
46
|
+
export const MAP_COLOUR_PALETTE: readonly string[]
|
|
47
|
+
|
|
48
|
+
/** A stable colour from `MAP_COLOUR_PALETTE`, chosen by hashing the string. */
|
|
49
|
+
export function stringToColour(str: string, variant?: 'min' | 'max'): string
|
|
50
|
+
|
|
51
|
+
export function validateManifest(manifest: unknown): { valid: boolean; errors: string[] }
|
|
52
|
+
|
|
53
|
+
// Generic because an ambient block cannot import `PluginEntry` from the kit's own entries,
|
|
54
|
+
// and restating it would give a plugin two definitions. The call site behaves identically.
|
|
55
|
+
export function resolvePluginEntry<E>(entry: E | (() => Promise<E>)): Promise<E>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module '@collabdt/core/plugins-sdk/config' {
|
|
59
|
+
/** The plugin's config for this organization. Generic so a plugin can type its own shape. */
|
|
60
|
+
export function usePluginConfig<
|
|
61
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
62
|
+
>(): T
|
|
63
|
+
/** The calling plugin's id, from the scope its capability host established. */
|
|
64
|
+
export function usePluginId(): string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare module '@collabdt/core/plugins-sdk/messages' {
|
|
68
|
+
export type PluginTranslator = (key: string, fallback?: string) => string
|
|
69
|
+
|
|
70
|
+
/** A `t()` scoped to the calling plugin's own namespace. */
|
|
71
|
+
export function usePluginTranslations(): PluginTranslator
|
|
72
|
+
|
|
73
|
+
/** One piece of plugin text. All three parameters are required, matching core. */
|
|
74
|
+
export function usePluginMessage(pluginId: string, key: string, fallback: string): string
|
|
75
|
+
|
|
76
|
+
// Narrowed to a plain callable: typing next-intl's translator faithfully would drag
|
|
77
|
+
// next-intl into a plugin's dependencies.
|
|
78
|
+
export function useCoreTranslations(
|
|
79
|
+
namespace: string,
|
|
80
|
+
): (key: string, values?: Record<string, unknown>) => string
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare module '@collabdt/core/plugins-sdk/store' {
|
|
84
|
+
/** One stored document, as the owning plugin sees it. */
|
|
85
|
+
export interface PluginDocument<T> {
|
|
86
|
+
/** The plugin's own stable identifier for this document. */
|
|
87
|
+
key: string
|
|
88
|
+
data: T
|
|
89
|
+
updatedAt: string | Date
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PluginStore<T> {
|
|
93
|
+
items: PluginDocument<T>[]
|
|
94
|
+
isLoading: boolean
|
|
95
|
+
isError: unknown
|
|
96
|
+
/** One document by key, or undefined. */
|
|
97
|
+
get: (key: string) => PluginDocument<T> | undefined
|
|
98
|
+
/** Create or replace a document. Keyed writes are upserts, not appends. */
|
|
99
|
+
put: (key: string, data: T) => Promise<void>
|
|
100
|
+
remove: (key: string) => Promise<void>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Storage scoped by organization, plugin and collection. `T` is your declaration, not a guarantee. */
|
|
104
|
+
export function usePluginStore<T = unknown>(collection: string): PluginStore<T>
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare module '@collabdt/core/plugins-sdk/data' {
|
|
108
|
+
// Shapes come from `./data`, inline rather than imported at the top: an ambient module cannot carry a relative import (TS2439).
|
|
109
|
+
|
|
110
|
+
export type PluginBuilding = import('./data').PluginBuilding
|
|
111
|
+
export type PluginSite = import('./data').PluginSite
|
|
112
|
+
export type PluginInfrastructure = import('./data').PluginInfrastructure
|
|
113
|
+
export type PluginOrganization = import('./data').PluginOrganization
|
|
114
|
+
export type PluginFile = import('./data').PluginFile
|
|
115
|
+
export type PluginSensor = import('./data').PluginSensor
|
|
116
|
+
export type PluginSensorType = import('./data').PluginSensorType
|
|
117
|
+
export type PluginComment = import('./data').PluginComment
|
|
118
|
+
export type PluginAbility = import('./data').PluginAbility
|
|
119
|
+
export type PluginPermissions = import('./data').PluginPermissions
|
|
120
|
+
export type PluginUser = import('./data').PluginUser
|
|
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
|
+
export function usePluginUser(): import('./data').PluginUser | null
|
|
171
|
+
|
|
172
|
+
export interface PluginDatasetState {
|
|
173
|
+
/** The user added it from the Datasets menu. */
|
|
174
|
+
applied: boolean
|
|
175
|
+
/** Applied and not hidden with its eye toggle: draw it only when this is true. */
|
|
176
|
+
visible: boolean
|
|
177
|
+
/** What ticking it in the Datasets menu does: adds it to the map, or shows it again if hidden. */
|
|
178
|
+
apply: () => void
|
|
179
|
+
/** What unticking it in the Datasets menu does: takes it off the map. */
|
|
180
|
+
remove: () => void
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Whether one of this plugin's `map.datasets`, by its registration id, is on the map, and the menu's actions for it. */
|
|
184
|
+
export function usePluginDataset(id: string): PluginDatasetState
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
declare module '@collabdt/core/plugins-sdk/state' {
|
|
188
|
+
/**
|
|
189
|
+
* Shared state for one plugin's surfaces: in memory, scoped to the plugin, gone when it is
|
|
190
|
+
* disabled. `usePluginStore` is the persisted counterpart.
|
|
191
|
+
*/
|
|
192
|
+
export function usePluginState<T>(
|
|
193
|
+
key: string,
|
|
194
|
+
initial: T,
|
|
195
|
+
): [T, (next: T | ((previous: T) => T)) => void]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare module '@collabdt/core/plugins-sdk/ui' {
|
|
199
|
+
export interface PluginDialogs {
|
|
200
|
+
/** Opens one of this plugin's registered dialogs. `props` reaches the component as props. */
|
|
201
|
+
open: (dialogId: string, props?: Record<string, unknown>) => void
|
|
202
|
+
/** Closes the topmost instance of `dialogId`, or of any of this plugin's dialogs. */
|
|
203
|
+
close: (dialogId?: string) => void
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Opens and closes this plugin's `ui.dialogs` contributions from any of its surfaces. */
|
|
207
|
+
export function usePluginDialogs(): PluginDialogs
|
|
208
|
+
|
|
209
|
+
/** The host's toasts, so a plugin's confirmations look like core's own. */
|
|
210
|
+
export const toast: {
|
|
211
|
+
success: (message: string) => void
|
|
212
|
+
error: (message: string) => void
|
|
213
|
+
info: (message: string) => void
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
declare module '@collabdt/core/plugins-sdk/components' {
|
|
218
|
+
// Shapes come from `./components`, a real module here, which is what lets core's
|
|
219
|
+
// pluginKitComponents.test.ts compare these declarations against the real components.
|
|
220
|
+
//
|
|
221
|
+
// Inline `import('./components')` rather than a top-level import: an import declaration
|
|
222
|
+
// inside an ambient module cannot use a relative specifier (TS2439), and skipLibCheck hides
|
|
223
|
+
// that from everyone until a consumer turns it off.
|
|
224
|
+
|
|
225
|
+
export type ButtonProps = import('./components').ButtonProps
|
|
226
|
+
export const Button: import('./components').ButtonComponent
|
|
227
|
+
|
|
228
|
+
export const Input: import('./components').InputComponent
|
|
229
|
+
|
|
230
|
+
export type BadgeProps = import('./components').BadgeProps
|
|
231
|
+
export const Badge: import('./components').BadgeComponent
|
|
232
|
+
|
|
233
|
+
export type SeparatorProps = import('./components').SeparatorProps
|
|
234
|
+
export const Separator: import('./components').SeparatorComponent
|
|
235
|
+
|
|
236
|
+
export type ConfirmDialogProps = import('./components').ConfirmDialogProps
|
|
237
|
+
export const ConfirmDialog: import('./components').ConfirmDialogComponent
|
|
238
|
+
|
|
239
|
+
export const Card: import('./components').CardComponent
|
|
240
|
+
export const CardHeader: import('./components').CardComponent
|
|
241
|
+
export const CardTitle: import('./components').CardComponent
|
|
242
|
+
export const CardDescription: import('./components').CardComponent
|
|
243
|
+
export const CardContent: import('./components').CardComponent
|
|
244
|
+
export const CardFooter: import('./components').CardComponent
|
|
245
|
+
|
|
246
|
+
export type DialogProps = import('./components').DialogProps
|
|
247
|
+
export const Dialog: import('./components').DialogComponent
|
|
248
|
+
|
|
249
|
+
export type DialogTriggerProps = import('./components').DialogTriggerProps
|
|
250
|
+
export const DialogTrigger: import('./components').DialogTriggerComponent
|
|
251
|
+
export const DialogClose: import('./components').DialogTriggerComponent
|
|
252
|
+
|
|
253
|
+
export type DialogContentProps = import('./components').DialogContentProps
|
|
254
|
+
export const DialogContent: import('./components').DialogContentComponent
|
|
255
|
+
|
|
256
|
+
export const DialogHeader: import('./components').DialogSectionComponent
|
|
257
|
+
export const DialogFooter: import('./components').DialogSectionComponent
|
|
258
|
+
|
|
259
|
+
export type DialogTitleProps = import('./components').DialogTitleProps
|
|
260
|
+
export const DialogTitle: import('./components').DialogTitleComponent
|
|
261
|
+
|
|
262
|
+
export type DialogDescriptionProps = import('./components').DialogDescriptionProps
|
|
263
|
+
export const DialogDescription: import('./components').DialogDescriptionComponent
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
declare module '@collabdt/core/plugins-sdk/charts' {
|
|
267
|
+
// Loaded on first import, so the host's Recharts never reaches a page that draws no plugin chart.
|
|
268
|
+
export type ChartConfig = import('./charts').ChartConfig
|
|
269
|
+
export const ChartContainer: import('./charts').ChartContainerComponent
|
|
270
|
+
export const ChartTooltip: import('./charts').RechartsComponent
|
|
271
|
+
export const ChartTooltipContent: import('./charts').RechartsComponent
|
|
272
|
+
export const ChartLegend: import('./charts').RechartsComponent
|
|
273
|
+
export const ChartLegendContent: import('./charts').RechartsComponent
|
|
274
|
+
|
|
275
|
+
export const Area: import('./charts').RechartsComponent
|
|
276
|
+
export const AreaChart: import('./charts').RechartsComponent
|
|
277
|
+
export const Bar: import('./charts').RechartsComponent
|
|
278
|
+
export const BarChart: import('./charts').RechartsComponent
|
|
279
|
+
export const CartesianGrid: import('./charts').RechartsComponent
|
|
280
|
+
export const Cell: import('./charts').RechartsComponent
|
|
281
|
+
export const Line: import('./charts').RechartsComponent
|
|
282
|
+
export const LineChart: import('./charts').RechartsComponent
|
|
283
|
+
export const Pie: import('./charts').RechartsComponent
|
|
284
|
+
export const PieChart: import('./charts').RechartsComponent
|
|
285
|
+
export const ResponsiveContainer: import('./charts').RechartsComponent
|
|
286
|
+
export const XAxis: import('./charts').RechartsComponent
|
|
287
|
+
export const YAxis: import('./charts').RechartsComponent
|
|
288
|
+
}
|