@collabdt/plugin-kit 0.10.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 +25 -0
- package/dist/{base-BafRl1jG.d.ts → base-DqrDbWmp.d.ts} +14 -2
- package/dist/index.js +2 -1
- package/dist/types/bim.d.ts +118 -3
- package/dist/types/charts.d.ts +27 -0
- package/dist/types/charts.js +0 -0
- package/dist/types/components.d.ts +18 -1
- package/dist/types/data.d.ts +5 -1
- package/dist/types/legend.d.ts +2 -2
- package/dist/types/map.d.ts +2 -2
- package/dist/types/sdkModules.d.ts +288 -252
- package/dist/types/ui.d.ts +2 -2
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,9 +9,34 @@ repository root.
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
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
|
+
|
|
15
|
+
## [0.11.0] - 2026-10-09
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- `BimToolProps.floorplan` (`PluginFloorplan`, `FloorplanStorey`, `PlanPoint`, `SketchKind`, `PlanOverlayShape`,
|
|
19
|
+
`PlanOverlayOptions`, `PlanFootprint`): storeys, opening plans, projecting their lines (`generateLines`,
|
|
20
|
+
`hasLines`), drawing (`drawShape`) and reshaping (`editShape`, `finishEditingShape`, `isEditingShape`) outlines,
|
|
21
|
+
fitting the view to one (`frame`), reading IFCSPACE floor outlines (`getSpaceFootprints`), and per-plugin
|
|
22
|
+
overlays (`setOverlay` with `onShapeClick` and `replacesSpaces`, `clearOverlay`). `cancelDrawing()` ends a
|
|
23
|
+
drawing or a shape edit.
|
|
24
|
+
- `BimToolProps.modelPlacement` (`PluginModelPlacement`, `ModelPlacementWatcher`, `ModelPlacementChange`), to keep
|
|
25
|
+
world-coordinate data on a model the user moves or turns.
|
|
26
|
+
- `BimToolProps.buildingId` and `BimToolProps.appearance` (`PluginBimAppearance`, `BimAppearanceGroup`,
|
|
27
|
+
`BimAppearance`).
|
|
28
|
+
- `DataPageTable` and `DataPageCustom`: a `data.pages` registration may pass its own `component` instead of
|
|
29
|
+
`useRows` / `columns`.
|
|
30
|
+
- `@collabdt/core/plugins-sdk/charts` in `PLUGIN_EXTERNALS` and its ambient declarations, with `ChartConfig` and
|
|
31
|
+
the chart prop types under `@collabdt/plugin-kit/types/charts`.
|
|
32
|
+
- `ConfirmDialog` (`ConfirmDialogProps`) in the `@collabdt/core/plugins-sdk/components` declarations and `toast` in
|
|
33
|
+
the `@collabdt/core/plugins-sdk/ui` ones.
|
|
12
34
|
- `apply()` and `remove()` on `PluginDatasetState` in the `@collabdt/core/plugins-sdk/data` declarations.
|
|
13
35
|
They need a platform running `@collabdt/core` with the same addition.
|
|
14
36
|
|
|
37
|
+
### Changed
|
|
38
|
+
- `DataPageRegistration` is now `DataPageTable | DataPageCustom`.
|
|
39
|
+
|
|
15
40
|
## [0.9.0] - 2026-10-03
|
|
16
41
|
|
|
17
42
|
### Added
|
|
@@ -87,15 +87,27 @@ interface DataPageRows<Row> {
|
|
|
87
87
|
/** From the hook, not the registration, so it can close over `usePluginDialogs`. */
|
|
88
88
|
onRowClick?: (row: Row) => void;
|
|
89
89
|
}
|
|
90
|
-
interface
|
|
90
|
+
interface DataPageBase {
|
|
91
91
|
id: string;
|
|
92
92
|
titleKey: string;
|
|
93
93
|
icon: string;
|
|
94
|
+
}
|
|
95
|
+
/** Core renders a searchable table from the plugin's rows and columns. */
|
|
96
|
+
interface DataPageTable<Row = Record<string, unknown>> extends DataPageBase {
|
|
94
97
|
useRows: () => DataPageRows<Row>;
|
|
95
98
|
columns: DataPageColumn<Row>[];
|
|
99
|
+
/** Column keys the search box filters on. Omit to search every column. */
|
|
96
100
|
searchKeys?: string[];
|
|
97
101
|
emptyKey?: string;
|
|
102
|
+
component?: never;
|
|
103
|
+
}
|
|
104
|
+
/** Core keeps the page frame and title; the plugin renders everything below them. */
|
|
105
|
+
interface DataPageCustom extends DataPageBase {
|
|
106
|
+
component: React.ComponentType;
|
|
107
|
+
useRows?: never;
|
|
108
|
+
columns?: never;
|
|
98
109
|
}
|
|
110
|
+
type DataPageRegistration<Row = Record<string, unknown>> = DataPageTable<Row> | DataPageCustom;
|
|
99
111
|
/** The viewers that host a tab or a legend. Core spells them exactly this way. */
|
|
100
112
|
type PluginViewerTarget = 'map' | 'bim';
|
|
101
113
|
interface ViewerTabRegistration {
|
|
@@ -130,4 +142,4 @@ interface PluginContext<MapProps = unknown, BimProps = unknown, Legend = unknown
|
|
|
130
142
|
config: Record<string, unknown>;
|
|
131
143
|
}
|
|
132
144
|
|
|
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
|
|
145
|
+
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 DataPageCustom as a, type DataPageRegistration as b, type DataPageRows as c, type DataPageTable as d, type DatasetRegistration as e, type DialogRegistration as f, PLUGIN_HOST_API as g, type PluginCapability as h, type PluginDatasetSource as i, type PluginFeatureCollection as j, type PluginManifest as k, type PluginNode as l, type PluginViewerTarget as m, type ToolbarToolProps as n, type ViewerTabRegistration as o };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,8 @@ var PLUGIN_EXTERNALS = [
|
|
|
10
10
|
"@collabdt/core/plugins-sdk/data",
|
|
11
11
|
"@collabdt/core/plugins-sdk/state",
|
|
12
12
|
"@collabdt/core/plugins-sdk/ui",
|
|
13
|
-
"@collabdt/core/plugins-sdk/components"
|
|
13
|
+
"@collabdt/core/plugins-sdk/components",
|
|
14
|
+
"@collabdt/core/plugins-sdk/charts"
|
|
14
15
|
];
|
|
15
16
|
var KNOWN_FORBIDDEN = [
|
|
16
17
|
"three",
|
package/dist/types/bim.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./sdkModules.d.ts" />
|
|
2
|
-
import { C as CapabilityRegistry, P as PluginContext } from '../base-
|
|
3
|
-
export { D as DataPageColumn, a as
|
|
2
|
+
import { C as CapabilityRegistry, P as PluginContext } from '../base-DqrDbWmp.js';
|
|
3
|
+
export { D as DataPageColumn, a as DataPageCustom, b as DataPageRegistration, c as DataPageRows, d as DataPageTable, e as DatasetRegistration, f as DialogRegistration, M as MapLayerRegistration, g as PLUGIN_HOST_API, h as PluginCapability, i as PluginDatasetSource, j as PluginFeatureCollection, k as PluginManifest, l as PluginNode, m as PluginViewerTarget, T as ToolbarRegistration, n as ToolbarToolProps, V as VALID_CAPABILITIES, o as ViewerTabRegistration } from '../base-DqrDbWmp.js';
|
|
4
4
|
import * as OBC from '@thatopen/components';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
@@ -31,10 +31,125 @@ interface BimToolProps {
|
|
|
31
31
|
getItemsOfCategory: (category: string) => Promise<ModelIdMap>;
|
|
32
32
|
/** Attributes for the given elements. Omit `attributes` for the default set. */
|
|
33
33
|
getProperties: (items: ModelIdMap, attributes?: string[]) => Promise<BimItemProperties[]>;
|
|
34
|
+
/** The building whose models are open, or null before one is chosen. */
|
|
35
|
+
buildingId: number | null;
|
|
36
|
+
/** Storeys, plan sketching and plan overlays, scoped to this plugin. */
|
|
37
|
+
floorplan: PluginFloorplan;
|
|
38
|
+
/** Element colours, scoped to this plugin. */
|
|
39
|
+
appearance: PluginBimAppearance;
|
|
40
|
+
/** Lets data kept in world coordinates follow a model the user moves or turns. */
|
|
41
|
+
modelPlacement: PluginModelPlacement;
|
|
42
|
+
}
|
|
43
|
+
/** A confirmed move or turn of a model, for data a plugin keeps in world plan coordinates on it. */
|
|
44
|
+
interface ModelPlacementChange {
|
|
45
|
+
modelId: string;
|
|
46
|
+
/** True when the model turned, not only moved. */
|
|
47
|
+
rotated: boolean;
|
|
48
|
+
mapPoint: (point: PlanPoint) => PlanPoint;
|
|
49
|
+
/** Metres the model rose; negative when it dropped. */
|
|
50
|
+
elevationChange: number;
|
|
51
|
+
}
|
|
52
|
+
/** What a plugin tells core about the data it keeps on a model, so a move or turn can carry it along. */
|
|
53
|
+
interface ModelPlacementWatcher {
|
|
54
|
+
/** Shown before the model turns; null when none of the plugin's data sits on it. */
|
|
55
|
+
turnWarning: (modelId: string) => string | null;
|
|
56
|
+
onPlacementChanged: (change: ModelPlacementChange) => void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
interface PluginModelPlacement {
|
|
59
|
+
/** Follows every confirmed move and turn until the returned function is called. */
|
|
60
|
+
watch: (watcher: ModelPlacementWatcher) => () => void;
|
|
61
|
+
}
|
|
62
|
+
interface BimAppearance {
|
|
63
|
+
/** `0xRRGGBB`. Omit to keep each element's own colour. */
|
|
64
|
+
color?: number;
|
|
65
|
+
/** `0`–`1`. Omit to leave elements opaque. */
|
|
66
|
+
opacity?: number;
|
|
67
|
+
}
|
|
68
|
+
interface BimAppearanceGroup {
|
|
69
|
+
items: ModelIdMap;
|
|
70
|
+
appearance: BimAppearance;
|
|
71
|
+
}
|
|
72
|
+
interface PluginBimAppearance {
|
|
73
|
+
setAppearance: (groups: readonly BimAppearanceGroup[]) => void;
|
|
74
|
+
clearAppearance: () => void;
|
|
75
|
+
}
|
|
76
|
+
/** A point on a horizontal plan, in world metres: `x` east, `z` south. */
|
|
77
|
+
interface PlanPoint {
|
|
78
|
+
x: number;
|
|
79
|
+
z: number;
|
|
80
|
+
}
|
|
81
|
+
type SketchKind = 'rectangle' | 'polygon';
|
|
82
|
+
interface FloorplanStorey {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
/** World height of the storey, in metres. */
|
|
86
|
+
elevation: number;
|
|
87
|
+
modelId: string;
|
|
88
|
+
}
|
|
89
|
+
/** One filled, optionally outlined and labelled polygon drawn on the open plan. */
|
|
90
|
+
interface PlanOverlayShape {
|
|
91
|
+
id: string;
|
|
92
|
+
points: readonly PlanPoint[];
|
|
93
|
+
/** `0xRRGGBB`. */
|
|
94
|
+
fill: number;
|
|
95
|
+
/** `0`–`1`, default 0.45. */
|
|
96
|
+
opacity?: number;
|
|
97
|
+
stroke?: number;
|
|
98
|
+
label?: string;
|
|
99
|
+
}
|
|
100
|
+
interface PlanOverlayOptions {
|
|
101
|
+
/** Makes the shapes clickable: hovering one brightens it and shows a pointer. */
|
|
102
|
+
onShapeClick?: (shapeId: string) => void;
|
|
103
|
+
/** IFC spaces these shapes stand in for; the plan hides their own room fill, X and tag while the overlay is set, even with no shapes. */
|
|
104
|
+
replacesSpaces?: ModelIdMap;
|
|
105
|
+
}
|
|
106
|
+
/** An element's floor outline in world plan coordinates, read from its lowest flat face. */
|
|
107
|
+
interface PlanFootprint {
|
|
108
|
+
modelId: string;
|
|
109
|
+
localId: number;
|
|
110
|
+
outline: PlanPoint[];
|
|
111
|
+
/** Square metres. */
|
|
112
|
+
area: number;
|
|
113
|
+
centroid: PlanPoint;
|
|
114
|
+
/** World height of the footprint, for matching it to a storey. */
|
|
115
|
+
elevation: number;
|
|
116
|
+
}
|
|
117
|
+
/** The BIM floorplan as a plugin sees it. Coordinates are world metres on the horizontal plane. */
|
|
118
|
+
interface PluginFloorplan {
|
|
119
|
+
/** False in a viewer without floorplans; every method is then a no-op. */
|
|
120
|
+
available: boolean;
|
|
121
|
+
storeys: FloorplanStorey[];
|
|
122
|
+
active: FloorplanStorey | null;
|
|
123
|
+
isDrawing: boolean;
|
|
124
|
+
/** True while `editShape` is waiting for the user to finish reshaping an outline. */
|
|
125
|
+
isEditingShape: boolean;
|
|
126
|
+
/** True once the open storey's vector lines exist; sketches snap to their corners. */
|
|
127
|
+
hasLines: boolean;
|
|
128
|
+
activate: (storeyId: string) => Promise<void>;
|
|
129
|
+
deactivate: () => Promise<void>;
|
|
130
|
+
/** Projects the open storey's vector lines. Slow on large models, so it is a separate step. */
|
|
131
|
+
generateLines: () => Promise<void>;
|
|
132
|
+
/** Fits the open plan's view to an outline, such as a space's, with some margin around it. */
|
|
133
|
+
frame: (points: readonly PlanPoint[]) => Promise<void>;
|
|
134
|
+
/** Resolves with the drawn outline, or null when cancelled or no plan is open. */
|
|
135
|
+
drawShape: (kind: SketchKind) => Promise<PlanPoint[] | null>;
|
|
136
|
+
/**
|
|
137
|
+
* Lets the user drag the outline's corners and edges; Ctrl+click adds a corner, Delete removes one.
|
|
138
|
+
* Resolves with the new outline on Enter or `finishEditingShape`, or null when cancelled.
|
|
139
|
+
*/
|
|
140
|
+
editShape: (points: readonly PlanPoint[]) => Promise<PlanPoint[] | null>;
|
|
141
|
+
finishEditingShape: () => void;
|
|
142
|
+
/** Cancels a drawing or a shape edit in progress. */
|
|
143
|
+
cancelDrawing: () => void;
|
|
144
|
+
/** Replaces this plugin's shapes on the open plan. They follow whichever storey is open. */
|
|
145
|
+
setOverlay: (shapes: readonly PlanOverlayShape[], options?: PlanOverlayOptions) => void;
|
|
146
|
+
clearOverlay: () => void;
|
|
147
|
+
/** Floor outlines of elements such as IFCSPACEs, for drawing them with `setOverlay`. */
|
|
148
|
+
getSpaceFootprints: (items: ModelIdMap) => Promise<PlanFootprint[]>;
|
|
34
149
|
}
|
|
35
150
|
/** `CapabilityRegistry` with the BIM surface bound. */
|
|
36
151
|
type BimCapabilityRegistry = CapabilityRegistry<unknown, BimToolProps>;
|
|
37
152
|
/** The `activate()` context for a plugin that contributes to the BIM toolbar. */
|
|
38
153
|
type BimPluginContext = PluginContext<unknown, BimToolProps>;
|
|
39
154
|
|
|
40
|
-
export { type BimCapabilityRegistry, type BimItemProperties, type BimPluginContext, type BimToolProps, CapabilityRegistry, type ModelIdMap, PluginContext };
|
|
155
|
+
export { type BimAppearance, type BimAppearanceGroup, type BimCapabilityRegistry, type BimItemProperties, type BimPluginContext, type BimToolProps, CapabilityRegistry, type FloorplanStorey, type ModelIdMap, type ModelPlacementChange, type ModelPlacementWatcher, type PlanFootprint, type PlanOverlayOptions, type PlanOverlayShape, type PlanPoint, type PluginBimAppearance, PluginContext, type PluginFloorplan, type PluginModelPlacement, type SketchKind };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Series styling keyed by data key, as the shadcn chart wrapper reads it. */
|
|
4
|
+
type ChartConfig = Record<string, {
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
icon?: React.ComponentType;
|
|
7
|
+
} & ({
|
|
8
|
+
color?: string;
|
|
9
|
+
theme?: never;
|
|
10
|
+
} | {
|
|
11
|
+
color?: never;
|
|
12
|
+
theme: {
|
|
13
|
+
light: string;
|
|
14
|
+
dark: string;
|
|
15
|
+
};
|
|
16
|
+
})>;
|
|
17
|
+
interface ChartContainerProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
18
|
+
config: ChartConfig;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
type ChartContainerComponent = React.ComponentType<ChartContainerProps>;
|
|
22
|
+
/** A Recharts component, typed by what a plugin may pass rather than by Recharts' own declarations. */
|
|
23
|
+
type RechartsComponent = React.ComponentType<Record<string, unknown> & {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
export type { ChartConfig, ChartContainerComponent, ChartContainerProps, RechartsComponent };
|
|
File without changes
|
|
@@ -22,6 +22,23 @@ type SeparatorComponent = React.ForwardRefExoticComponent<SeparatorProps & React
|
|
|
22
22
|
/** Every part of Card is a plain div that forwards its ref. */
|
|
23
23
|
type CardProps = React.HTMLAttributes<HTMLDivElement>;
|
|
24
24
|
type CardComponent = React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
interface ConfirmDialogProps {
|
|
26
|
+
isOpen: boolean;
|
|
27
|
+
/** Shows a spinner on the confirm button and disables it. */
|
|
28
|
+
isDeleting?: boolean;
|
|
29
|
+
onOpenChange: (open: boolean) => void;
|
|
30
|
+
handleConfirm: (e: React.MouseEvent) => void | Promise<void>;
|
|
31
|
+
itemName?: string;
|
|
32
|
+
dataType?: string;
|
|
33
|
+
/** Copy for a question that is not a delete. Each falls back to the delete wording. */
|
|
34
|
+
title?: string;
|
|
35
|
+
description?: React.ReactNode;
|
|
36
|
+
confirmLabel?: string;
|
|
37
|
+
cancelLabel?: string;
|
|
38
|
+
/** 'destructive' paints the confirm red; a question that destroys nothing passes 'default'. */
|
|
39
|
+
tone?: 'destructive' | 'default';
|
|
40
|
+
}
|
|
41
|
+
type ConfirmDialogComponent = (props: ConfirmDialogProps) => React.ReactElement;
|
|
25
42
|
interface DialogProps {
|
|
26
43
|
open?: boolean;
|
|
27
44
|
defaultOpen?: boolean;
|
|
@@ -50,4 +67,4 @@ interface DialogDescriptionProps extends React.HTMLAttributes<HTMLParagraphEleme
|
|
|
50
67
|
}
|
|
51
68
|
type DialogDescriptionComponent = React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
52
69
|
|
|
53
|
-
export type { BadgeComponent, BadgeProps, ButtonComponent, ButtonProps, CardComponent, CardProps, DialogComponent, DialogContentComponent, DialogContentProps, DialogDescriptionComponent, DialogDescriptionProps, DialogProps, DialogSectionComponent, DialogSectionProps, DialogTitleComponent, DialogTitleProps, DialogTriggerComponent, DialogTriggerProps, InputComponent, InputProps, SeparatorComponent, SeparatorProps };
|
|
70
|
+
export type { BadgeComponent, BadgeProps, ButtonComponent, ButtonProps, CardComponent, CardProps, ConfirmDialogComponent, ConfirmDialogProps, DialogComponent, DialogContentComponent, DialogContentProps, DialogDescriptionComponent, DialogDescriptionProps, DialogProps, DialogSectionComponent, DialogSectionProps, DialogTitleComponent, DialogTitleProps, DialogTriggerComponent, DialogTriggerProps, InputComponent, InputProps, SeparatorComponent, SeparatorProps };
|
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 };
|
package/dist/types/legend.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./sdkModules.d.ts" />
|
|
2
|
-
import { C as CapabilityRegistry,
|
|
3
|
-
export { D as DataPageColumn, a as
|
|
2
|
+
import { C as CapabilityRegistry, m as PluginViewerTarget, l as PluginNode, P as PluginContext } from '../base-DqrDbWmp.js';
|
|
3
|
+
export { D as DataPageColumn, a as DataPageCustom, b as DataPageRegistration, c as DataPageRows, d as DataPageTable, e as DatasetRegistration, f as DialogRegistration, M as MapLayerRegistration, g as PLUGIN_HOST_API, h as PluginCapability, i as PluginDatasetSource, j as PluginFeatureCollection, k as PluginManifest, T as ToolbarRegistration, n as ToolbarToolProps, V as VALID_CAPABILITIES, o as ViewerTabRegistration } from '../base-DqrDbWmp.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface LegendRow {
|
package/dist/types/map.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./sdkModules.d.ts" />
|
|
2
|
-
import { C as CapabilityRegistry, P as PluginContext } from '../base-
|
|
3
|
-
export { D as DataPageColumn, a as
|
|
2
|
+
import { C as CapabilityRegistry, P as PluginContext } from '../base-DqrDbWmp.js';
|
|
3
|
+
export { D as DataPageColumn, a as DataPageCustom, b as DataPageRegistration, c as DataPageRows, d as DataPageTable, e as DatasetRegistration, f as DialogRegistration, M as MapLayerRegistration, g as PLUGIN_HOST_API, h as PluginCapability, i as PluginDatasetSource, j as PluginFeatureCollection, k as PluginManifest, l as PluginNode, m as PluginViewerTarget, T as ToolbarRegistration, n as ToolbarToolProps, V as VALID_CAPABILITIES, o as ViewerTabRegistration } from '../base-DqrDbWmp.js';
|
|
4
4
|
import { Map } from 'maplibre-gl';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
@@ -1,252 +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
|
-
export
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
export const
|
|
229
|
-
|
|
230
|
-
export
|
|
231
|
-
export const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
export
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
export
|
|
238
|
-
|
|
239
|
-
export const
|
|
240
|
-
|
|
241
|
-
export
|
|
242
|
-
export const
|
|
243
|
-
|
|
244
|
-
export const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
export
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
export
|
|
251
|
-
export const
|
|
252
|
-
|
|
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
|
+
}
|
package/dist/types/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CapabilityRegistry, P as PluginContext } from '../base-
|
|
2
|
-
export { D as DataPageColumn, a as
|
|
1
|
+
import { C as CapabilityRegistry, P as PluginContext } from '../base-DqrDbWmp.js';
|
|
2
|
+
export { D as DataPageColumn, a as DataPageCustom, b as DataPageRegistration, c as DataPageRows, d as DataPageTable, e as DatasetRegistration, f as DialogRegistration, M as MapLayerRegistration, g as PLUGIN_HOST_API, h as PluginCapability, i as PluginDatasetSource, j as PluginFeatureCollection, k as PluginManifest, l as PluginNode, m as PluginViewerTarget, T as ToolbarRegistration, n as ToolbarToolProps, V as VALID_CAPABILITIES, o as ViewerTabRegistration } from '../base-DqrDbWmp.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
/** `CapabilityRegistry` for the surfaces that bind no viewer props. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collabdt/plugin-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Build preset and types for authoring CDT plugins.",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"types": "./dist/types/components.d.ts",
|
|
20
20
|
"default": "./dist/types/components.js"
|
|
21
21
|
},
|
|
22
|
+
"./types/charts": {
|
|
23
|
+
"types": "./dist/types/charts.d.ts",
|
|
24
|
+
"default": "./dist/types/charts.js"
|
|
25
|
+
},
|
|
22
26
|
"./types/data": {
|
|
23
27
|
"types": "./dist/types/data.d.ts",
|
|
24
28
|
"default": "./dist/types/data.js"
|