@collabdt/plugin-kit 0.1.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 ADDED
@@ -0,0 +1,131 @@
1
+ <div align="center">
2
+ <br />
3
+ <img src="https://github.com/collabdt/docs/raw/main/static/img/cdt-logo.svg" alt="Collab Digital Twins Logo" height="72" />
4
+ <br /><br />
5
+
6
+ <h1>@collabdt/plugin-kit</h1>
7
+
8
+ <p><strong>Build preset and SDK types for CDT platform plugins</strong></p>
9
+
10
+ <p>
11
+ <a href="https://docs.collabdt.org/docs/plugins/overview">Plugin Docs</a> ·
12
+ <a href="https://docs.collabdt.org/docs/plugins/all-capabilities">Capabilities</a> ·
13
+ <a href="https://www.npmjs.com/package/create-cdt-plugin">create-cdt-plugin</a> ·
14
+ <a href="https://collabdt.org">Website</a>
15
+ </p>
16
+
17
+ <br />
18
+
19
+ <a href="https://www.npmjs.com/package/@collabdt/plugin-kit"><img src="https://img.shields.io/npm/v/@collabdt/plugin-kit?style=flat-square&color=orange&label=%40collabdt%2Fplugin-kit" alt="npm version" /></a>
20
+ <img src="https://img.shields.io/badge/license-AGPL%203.0-orange?style=flat-square" alt="License" />
21
+ <img src="https://img.shields.io/badge/dependencies-zero-orange?style=flat-square" alt="Zero runtime dependencies" />
22
+
23
+ <br /><br />
24
+
25
+ <img src="https://img.shields.io/badge/TypeScript-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" />
26
+ <img src="https://img.shields.io/badge/tsup-black?style=flat-square" alt="tsup" />
27
+ <img src="https://img.shields.io/badge/Node-22%2B-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node 22+" />
28
+
29
+ <br /><br />
30
+ <hr />
31
+ <br />
32
+ </div>
33
+
34
+ ## What is this?
35
+
36
+ The build half of the plugin toolchain for the [CDT platform](https://collabdt.org). It gives a plugin author two things and no runtime dependencies:
37
+
38
+ - **`pluginPreset()`** — the [tsup](https://tsup.egoist.dev) configuration a plugin needs, plus a post-build guard that fails if the plugin imports anything the platform cannot resolve.
39
+ - **Per-surface SDK types** — the shapes a plugin's component receives, without installing `@collabdt/core`.
40
+
41
+ Most people never install this directly. [`create-cdt-plugin`](https://www.npmjs.com/package/create-cdt-plugin) scaffolds a plugin that already depends on it and is already configured.
42
+
43
+ ---
44
+
45
+ ## Usage
46
+
47
+ The whole build configuration:
48
+
49
+ ```ts
50
+ // tsup.config.ts
51
+ import { pluginPreset } from '@collabdt/plugin-kit'
52
+
53
+ export default pluginPreset()
54
+ ```
55
+
56
+ That emits a single ESM `dist/index.js`, marks the platform's shared modules external, and then checks the emitted bundle. Types come from the entry matching your surface:
57
+
58
+ ```ts
59
+ import type { MapToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/map'
60
+ ```
61
+
62
+ | Entry | For | Names |
63
+ |---|---|---|
64
+ | `@collabdt/plugin-kit/types/map` | `map.tools` | `maplibre-gl` types |
65
+ | `@collabdt/plugin-kit/types/bim` | `bim.tools` | `@thatopen/components` types |
66
+ | `@collabdt/plugin-kit/types/pointcloud` | `pointcloud.tools` | nothing external |
67
+ | `@collabdt/plugin-kit/types/legend` | `map.legends` | nothing external |
68
+
69
+ 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.
70
+
71
+ Your `tsconfig.json` needs `"moduleResolution": "bundler"`, since these are reached through `exports` subpaths. It needs no `paths` mapping: importing from a surface entry pulls in ambient declarations for `@collabdt/core/plugins-sdk*`, which is what lets a plugin typecheck the SDK's real exports without installing core.
72
+
73
+ ---
74
+
75
+ ## Why the guard exists
76
+
77
+ Marking the platform's modules external is only half the contract. The other half is importing nothing else, and getting that wrong does not fail loudly:
78
+
79
+ - **Bundle too much** and the plugin ships a second copy of React or three.js. A second React breaks hooks outright; a second three.js crashes the BIM viewer. Both are runtime crashes in someone else's browser, attributed to the plugin rather than to the duplicate.
80
+ - **Bundle too little** and a bare specifier survives into the bundle with no import map entry, dying at load with a message that blames the plugin rather than the missing shim.
81
+
82
+ The guard turns both into a build failure at the moment the import is written. It reads esbuild's metafile rather than scanning the bundle text, because a string literal containing `from 'three'` would fool a regex, and it makes two separate checks:
83
+
84
+ 1. **External imports** catch a specifier the platform publishes no shim for.
85
+ 2. **Bundled packages** catch a forbidden library that was *inlined*. esbuild only marks an import external if it is on the external list, so an author who has `three` installed and imports it gets a bundle with three.js baked in and no external import to inspect. Check 1 alone would report that bundle clean, which is why it is not the only check.
86
+
87
+ A plugin may import `react`, `react-dom`, `react/jsx-runtime`, and `@collabdt/core/plugins-sdk` with its `/config`, `/messages`, `/store` and `/components` entries. Nothing else. Viewer instances arrive as props and icons are named by string, so `three`, `@thatopen/components`, `maplibre-gl` and `lucide-react` are never needed at runtime.
88
+
89
+ ---
90
+
91
+ ## What the preset refuses
92
+
93
+ `pluginPreset()` takes overrides, but rejects the ones that would quietly break delivery or switch the guard off:
94
+
95
+ | Override | Why it is refused |
96
+ |---|---|
97
+ | `entry`, `outDir` | The platform serves `dist/index.js` from `src/index.ts` and nothing else. |
98
+ | `splitting: true` | A code-split chunk beside `index.js` would not resolve. |
99
+ | `format` other than ESM | The browser imports the bundle directly and resolves its bare specifiers through the platform's import map. |
100
+ | `external` | It is what the guard checks against. A plugin cannot widen the allowlist. |
101
+ | `onSuccess` | It is what runs the guard. Call `assertBundleImports()` from your own step instead. |
102
+
103
+ Refusing loudly matters more than it sounds: each of these would otherwise produce a build that passes and a plugin that fails later, somewhere less obvious.
104
+
105
+ ---
106
+
107
+ ## Also exported
108
+
109
+ For a stricter or more forgiving check of your own: `assertBundleImports`, `checkImports`, `checkBundled`, `collectExternalImports`, `collectBundledPackages`, `canVerifyBundled`, `PLUGIN_EXTERNALS`, `KNOWN_FORBIDDEN`, `PLUGIN_METAFILE`, `PLUGIN_OUT_FILE`.
110
+
111
+ ---
112
+
113
+ ## Requirements
114
+
115
+ Node 22 or newer, and `tsup` 8 or newer as a peer. `@types/react` is a required peer; `maplibre-gl` and `@thatopen/components` are optional peers, needed only for the surface that names them and only as types.
116
+
117
+ This package has **no runtime dependencies**. Scaffolding a legend plugin should not install three.js to read a config object, which is also why the allowlist is a literal here rather than an import from `@collabdt/core`. A test in core fails if the two ever disagree.
118
+
119
+ ---
120
+
121
+ ## Licensing
122
+
123
+ Free and open source under the **GNU Affero General Public License, version 3.0** ([full text](LICENSE) · [summary](https://www.gnu.org/licenses/agpl-3.0.en.html)). For commercial licensing, contact **[info@collabdt.org](mailto:info@collabdt.org)**.
124
+
125
+ > Copyright © 2025 Collab Digital Twins. Distributed under AGPL-3.0.
126
+
127
+ ---
128
+
129
+ <div align="center">
130
+ <sub>Stewarded by a Canadian not-for-profit organization for long-term public benefit.</sub>
131
+ </div>
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+
3
+ /** Declare as `hostApi` in your manifest. The host refuses a plugin that declares another value. */
4
+ declare const PLUGIN_HOST_API = 1;
5
+ declare const VALID_CAPABILITIES: readonly ["sidebar.items", "viewer.panels", "map.tools", "bim.tools", "pointcloud.tools", "map.legends"];
6
+ type PluginCapability = typeof VALID_CAPABILITIES[number];
7
+ interface PluginManifest {
8
+ slug: string;
9
+ name: string;
10
+ version: string;
11
+ /** Omitting this is allowed but warned about, which defers a version mismatch to render time. */
12
+ hostApi?: number;
13
+ description?: string;
14
+ author?: string;
15
+ capabilities: PluginCapability[];
16
+ requiredPermissions?: string[];
17
+ configSchema?: Record<string, unknown>;
18
+ /** Strings by locale then key, folded into the app's tree under `plugins.<slug>`. May nest. */
19
+ messages?: Record<string, Record<string, unknown>>;
20
+ }
21
+ /** Every toolbar component receives the toolbar entry core built for it. */
22
+ interface ToolbarToolProps {
23
+ tool: unknown;
24
+ }
25
+ interface ToolbarRegistration<P = Record<string, unknown>> {
26
+ id: string;
27
+ label: string;
28
+ icon: string;
29
+ component: React.ComponentType<ToolbarToolProps & P>;
30
+ cursor?: string;
31
+ stayActive?: boolean;
32
+ }
33
+ interface CapabilityRegistry<MapProps = unknown, BimProps = unknown, PointCloudProps = unknown, Legend = unknown> {
34
+ 'map.tools': ToolbarRegistration<MapProps>;
35
+ 'bim.tools': ToolbarRegistration<BimProps>;
36
+ 'pointcloud.tools': ToolbarRegistration<PointCloudProps>;
37
+ 'map.legends': Legend;
38
+ }
39
+ interface PluginContext<MapProps = unknown, BimProps = unknown, PointCloudProps = unknown, Legend = unknown> {
40
+ pluginId: string;
41
+ register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry<MapProps, BimProps, PointCloudProps, Legend>[K]): void;
42
+ config: Record<string, unknown>;
43
+ }
44
+
45
+ export { type CapabilityRegistry as C, type PluginContext as P, type ToolbarRegistration as T, VALID_CAPABILITIES as V, PLUGIN_HOST_API as a, type PluginCapability as b, type PluginManifest as c, type ToolbarToolProps as d };
@@ -0,0 +1,15 @@
1
+ // src/types/base.ts
2
+ var PLUGIN_HOST_API = 1;
3
+ var VALID_CAPABILITIES = [
4
+ "sidebar.items",
5
+ "viewer.panels",
6
+ "map.tools",
7
+ "bim.tools",
8
+ "pointcloud.tools",
9
+ "map.legends"
10
+ ];
11
+
12
+ export {
13
+ PLUGIN_HOST_API,
14
+ VALID_CAPABILITIES
15
+ };
@@ -0,0 +1,37 @@
1
+ import { Options } from 'tsup';
2
+
3
+ declare const PLUGIN_EXTERNALS: readonly string[];
4
+ declare const KNOWN_FORBIDDEN: readonly string[];
5
+
6
+ /** The slice of esbuild's metafile this needs. */
7
+ interface Metafile {
8
+ outputs: Record<string, {
9
+ imports?: {
10
+ path: string;
11
+ kind: string;
12
+ external?: boolean;
13
+ }[];
14
+ }>;
15
+ /** Every module esbuild read, keyed by resolved path — the keys are what reveal an inlined package. */
16
+ inputs?: Record<string, unknown>;
17
+ }
18
+ declare function collectExternalImports(metafile: Metafile, outFile: string): string[];
19
+ /** Returns the specifiers that are not allowed. Empty means the bundle is clean. */
20
+ declare function checkImports(imports: string[]): string[];
21
+ declare function collectBundledPackages(metafile: Metafile): string[];
22
+ type BundleScanVerdict = {
23
+ verifiable: true;
24
+ } | {
25
+ verifiable: false;
26
+ reason: string;
27
+ };
28
+ declare function canVerifyBundled(metafile: Metafile): BundleScanVerdict;
29
+ /** Only `BUNDLED_FORBIDDEN` entries; an ordinary bundled utility such as `date-fns` is legitimate. */
30
+ declare function checkBundled(packages: string[]): string[];
31
+ declare function assertBundleImports(metafilePath: string, outFile: string): Promise<void>;
32
+
33
+ declare const PLUGIN_OUT_FILE = "dist/index.js";
34
+ declare const PLUGIN_METAFILE = "dist/metafile-esm.json";
35
+ declare function pluginPreset(overrides?: Partial<Options>): Options;
36
+
37
+ export { type BundleScanVerdict, KNOWN_FORBIDDEN, type Metafile, PLUGIN_EXTERNALS, PLUGIN_METAFILE, PLUGIN_OUT_FILE, assertBundleImports, canVerifyBundled, checkBundled, checkImports, collectBundledPackages, collectExternalImports, pluginPreset };
package/dist/index.js ADDED
@@ -0,0 +1,191 @@
1
+ // src/externals.ts
2
+ var PLUGIN_EXTERNALS = [
3
+ "react",
4
+ "react-dom",
5
+ "react/jsx-runtime",
6
+ "@collabdt/core/plugins-sdk",
7
+ "@collabdt/core/plugins-sdk/config",
8
+ "@collabdt/core/plugins-sdk/messages",
9
+ "@collabdt/core/plugins-sdk/store",
10
+ "@collabdt/core/plugins-sdk/components"
11
+ ];
12
+ var KNOWN_FORBIDDEN = [
13
+ "three",
14
+ "@thatopen/components",
15
+ "@thatopen/components-front",
16
+ "@thatopen/fragments",
17
+ "maplibre-gl",
18
+ "lucide-react"
19
+ ];
20
+
21
+ // src/importGuard.ts
22
+ import { readFile } from "fs/promises";
23
+ var NODE_MODULES_PACKAGE = /node_modules\/((?:@[^/]+\/)?[^/]+)\//g;
24
+ function packageOf(input) {
25
+ let name;
26
+ for (const match of input.matchAll(NODE_MODULES_PACKAGE)) {
27
+ name = match[1];
28
+ }
29
+ return name;
30
+ }
31
+ function isPluginOwnSource(input) {
32
+ return !input.startsWith("../") && !input.startsWith("/") && !/^[a-zA-Z]:\//.test(input);
33
+ }
34
+ function collectExternalImports(metafile, outFile) {
35
+ const output = metafile.outputs[outFile];
36
+ if (!output) {
37
+ throw new Error(
38
+ `Plugin build check could not find "${outFile}" in the esbuild metafile. Outputs present: ${Object.keys(metafile.outputs).join(", ") || "none"}.`
39
+ );
40
+ }
41
+ return (output.imports ?? []).filter((entry) => entry.external).map((entry) => entry.path);
42
+ }
43
+ function checkImports(imports) {
44
+ return imports.filter((specifier) => !PLUGIN_EXTERNALS.includes(specifier));
45
+ }
46
+ function collectBundledPackages(metafile) {
47
+ const packages = /* @__PURE__ */ new Set();
48
+ for (const path of Object.keys(metafile.inputs ?? {})) {
49
+ const name = packageOf(path);
50
+ if (name) {
51
+ packages.add(name);
52
+ }
53
+ }
54
+ return [...packages];
55
+ }
56
+ var MAX_LISTED_INPUTS = 5;
57
+ function canVerifyBundled(metafile) {
58
+ const inputs = Object.keys(metafile.inputs ?? {});
59
+ if (inputs.length === 0) {
60
+ return {
61
+ verifiable: false,
62
+ reason: "the esbuild metafile records no inputs, so there is no way to tell what the bundle inlined. esbuild always lists at least the entry point, so an empty list means the metafile is not the one this build produced \u2014 check that `metafile: true` is still set and that nothing overwrote dist/."
63
+ };
64
+ }
65
+ const unattributable = inputs.filter(
66
+ (input) => packageOf(input) === void 0 && !isPluginOwnSource(input)
67
+ );
68
+ if (unattributable.length > 0) {
69
+ const listed = unattributable.slice(0, MAX_LISTED_INPUTS);
70
+ const rest = unattributable.length - listed.length;
71
+ return {
72
+ verifiable: false,
73
+ reason: `${unattributable.length} module(s) in this bundle sit outside the plugin directory and outside any node_modules, so there is no package name to check them against:
74
+ ` + listed.map((input) => ` ${input}`).join("\n") + (rest > 0 ? `
75
+ \u2026and ${rest} more` : "") + "\n Build the plugin from an install layout that puts dependencies under node_modules (npm, yarn classic, or pnpm) so the check can name what it is looking at. Passing this unchecked is not an option: an inlined React or three.js arriving this way would read as a clean bundle."
76
+ };
77
+ }
78
+ return { verifiable: true };
79
+ }
80
+ var BUNDLED_FORBIDDEN = [...KNOWN_FORBIDDEN, "react", "react-dom"];
81
+ function checkBundled(packages) {
82
+ return packages.filter((name) => BUNDLED_FORBIDDEN.includes(name));
83
+ }
84
+ function explainExternal(specifier) {
85
+ if (KNOWN_FORBIDDEN.includes(specifier)) {
86
+ return ` ${specifier} \u2014 a plugin must never bundle this. A second copy breaks the app at runtime. Viewer instances arrive as props and icons are named by string, so you do not need to import it.`;
87
+ }
88
+ return ` ${specifier} \u2014 the CDT host does not publish a shim for this, so the browser cannot resolve it. A plugin may only import: ${PLUGIN_EXTERNALS.join(", ")}.`;
89
+ }
90
+ function explainBundled(name) {
91
+ return ` ${name} \u2014 inlined into the bundle instead of imported as an external. A second copy breaks the app at runtime just as if it had been imported directly. Do not bundle it; rely on the host's copy instead.`;
92
+ }
93
+ async function assertBundleImports(metafilePath, outFile) {
94
+ const metafile = JSON.parse(await readFile(metafilePath, "utf8"));
95
+ const offendingImports = checkImports(collectExternalImports(metafile, outFile));
96
+ const verdict = canVerifyBundled(metafile);
97
+ const offendingBundled = verdict.verifiable ? checkBundled(collectBundledPackages(metafile)) : [];
98
+ const sections = [];
99
+ if (offendingImports.length > 0) {
100
+ sections.push(
101
+ `Imports outside the allowlist (${offendingImports.length}):
102
+ ` + offendingImports.map(explainExternal).join("\n")
103
+ );
104
+ }
105
+ if (offendingBundled.length > 0) {
106
+ sections.push(
107
+ `Forbidden libraries bundled instead of left external (${offendingBundled.length}):
108
+ ` + offendingBundled.map(explainBundled).join("\n")
109
+ );
110
+ }
111
+ if (!verdict.verifiable) {
112
+ sections.push(`Cannot check what this bundle inlined:
113
+ ${verdict.reason}`);
114
+ }
115
+ if (sections.length === 0) {
116
+ return;
117
+ }
118
+ const problems = offendingImports.length + offendingBundled.length + (verdict.verifiable ? 0 : 1);
119
+ throw new Error(
120
+ `This plugin bundle has ${problems} problem(s):
121
+
122
+ ` + sections.join("\n\n")
123
+ );
124
+ }
125
+
126
+ // src/preset.ts
127
+ var OUT_DIR = "dist";
128
+ var PLUGIN_OUT_FILE = `${OUT_DIR}/index.js`;
129
+ var PLUGIN_METAFILE = `${OUT_DIR}/metafile-esm.json`;
130
+ var ENTRY = "src/index.{ts,tsx}";
131
+ function pluginPreset(overrides = {}) {
132
+ if (overrides.splitting === true) {
133
+ throw new Error(
134
+ "A CDT plugin must build to a single file: the host serves only dist/index.js, so a code-split chunk would 404 in the browser. Remove `splitting: true`."
135
+ );
136
+ }
137
+ if (overrides.format !== void 0) {
138
+ const formats = Array.isArray(overrides.format) ? overrides.format : [overrides.format];
139
+ if (!(formats.length === 1 && formats[0] === "esm")) {
140
+ throw new Error(
141
+ "A CDT plugin must be ESM. The browser imports it directly and resolves its bare specifiers through the host import map. Remove the `format` override."
142
+ );
143
+ }
144
+ }
145
+ if ("outDir" in overrides || "entry" in overrides) {
146
+ throw new Error(
147
+ "A CDT plugin builds to dist/index.js from src/index.ts or src/index.tsx. The host serves that exact path and nothing else, so `outDir` and `entry` are fixed by the delivery contract rather than by preference."
148
+ );
149
+ }
150
+ if ("onSuccess" in overrides) {
151
+ throw new Error(
152
+ "Overriding `onSuccess` would switch off the CDT plugin import guard, which is what stops a plugin bundling a second copy of React or three.js. If you need your own post-build step, call assertBundleImports() from it."
153
+ );
154
+ }
155
+ if ("external" in overrides) {
156
+ throw new Error(
157
+ "Overriding `external` would switch off the CDT plugin import guard by changing what it checks against. The allowlist is fixed by what the host publishes a shim for; a plugin cannot widen it. If you need your own post-build step, call assertBundleImports() from it."
158
+ );
159
+ }
160
+ return {
161
+ entry: [ENTRY],
162
+ format: ["esm"],
163
+ outDir: OUT_DIR,
164
+ splitting: false,
165
+ treeshake: true,
166
+ clean: true,
167
+ target: "es2022",
168
+ metafile: true,
169
+ external: [...PLUGIN_EXTERNALS],
170
+ esbuildOptions(options) {
171
+ options.jsx = "automatic";
172
+ },
173
+ async onSuccess() {
174
+ await assertBundleImports(PLUGIN_METAFILE, PLUGIN_OUT_FILE);
175
+ },
176
+ ...overrides
177
+ };
178
+ }
179
+ export {
180
+ KNOWN_FORBIDDEN,
181
+ PLUGIN_EXTERNALS,
182
+ PLUGIN_METAFILE,
183
+ PLUGIN_OUT_FILE,
184
+ assertBundleImports,
185
+ canVerifyBundled,
186
+ checkBundled,
187
+ checkImports,
188
+ collectBundledPackages,
189
+ collectExternalImports,
190
+ pluginPreset
191
+ };
@@ -0,0 +1,40 @@
1
+ /// <reference path="./sdkModules.d.ts" />
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BljPi_dT.js';
3
+ export { a as PLUGIN_HOST_API, b as PluginCapability, c as PluginManifest, T as ToolbarRegistration, d as ToolbarToolProps, V as VALID_CAPABILITIES } from '../base-BljPi_dT.js';
4
+ import * as OBC from '@thatopen/components';
5
+ import 'react';
6
+
7
+ /** Elements keyed by model. Restated here because core reaches this alias through an internal path. */
8
+ type ModelIdMap = Record<string, Set<number>>;
9
+ /** One element's attributes. `modelId` and `localId` are always present; the rest is what was asked for. */
10
+ interface BimItemProperties extends Record<string, unknown> {
11
+ modelId: string;
12
+ localId: number;
13
+ }
14
+ interface BimToolProps {
15
+ components: OBC.Components | null;
16
+ world: OBC.World | null;
17
+ fragments: OBC.FragmentsManager | null;
18
+ /** Ids of every loaded model, in load order. */
19
+ modelIds: string[];
20
+ /** The live selection, keyed by model id. Updates as the user clicks in the viewport. */
21
+ selection: ModelIdMap;
22
+ select: (items: ModelIdMap) => Promise<void>;
23
+ clearSelection: () => void;
24
+ /** Frame the camera on whatever is currently selected. */
25
+ fitToSelection: () => Promise<void>;
26
+ /** Hides everything except `items`, across every loaded model. */
27
+ isolate: (items: ModelIdMap) => Promise<void>;
28
+ setItemsVisible: (items: ModelIdMap, visible: boolean) => Promise<void>;
29
+ /** The escape hatch from `isolate`: makes everything visible again. */
30
+ showAll: () => Promise<void>;
31
+ getItemsOfCategory: (category: string) => Promise<ModelIdMap>;
32
+ /** Attributes for the given elements. Omit `attributes` for the default set. */
33
+ getProperties: (items: ModelIdMap, attributes?: string[]) => Promise<BimItemProperties[]>;
34
+ }
35
+ /** `CapabilityRegistry` with the BIM surface bound. */
36
+ type BimCapabilityRegistry = CapabilityRegistry<unknown, BimToolProps>;
37
+ /** The `activate()` context for a plugin that contributes to the BIM toolbar. */
38
+ type BimPluginContext = PluginContext<unknown, BimToolProps>;
39
+
40
+ export { type BimCapabilityRegistry, type BimItemProperties, type BimPluginContext, type BimToolProps, CapabilityRegistry, type ModelIdMap, PluginContext };
@@ -0,0 +1,8 @@
1
+ import {
2
+ PLUGIN_HOST_API,
3
+ VALID_CAPABILITIES
4
+ } from "../chunk-CVHASC2D.js";
5
+ export {
6
+ PLUGIN_HOST_API,
7
+ VALID_CAPABILITIES
8
+ };
@@ -0,0 +1,53 @@
1
+ import * as React from 'react';
2
+
3
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
+ asChild?: boolean;
5
+ active?: boolean;
6
+ variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
7
+ size?: 'default' | 'sm' | 'lg' | 'icon';
8
+ }
9
+ type ButtonComponent = React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
+ type InputProps = React.ComponentPropsWithoutRef<'input'>;
11
+ type InputComponent = React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
12
+ interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
13
+ variant?: 'default' | 'secondary' | 'destructive' | 'outline';
14
+ }
15
+ type BadgeComponent = (props: BadgeProps) => React.ReactElement;
16
+ interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
17
+ orientation?: 'horizontal' | 'vertical';
18
+ /** False announces the separator to assistive technology. */
19
+ decorative?: boolean;
20
+ }
21
+ type SeparatorComponent = React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
22
+ /** Every part of Card is a plain div that forwards its ref. */
23
+ type CardProps = React.HTMLAttributes<HTMLDivElement>;
24
+ type CardComponent = React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
25
+ interface DialogProps {
26
+ open?: boolean;
27
+ defaultOpen?: boolean;
28
+ onOpenChange?: (open: boolean) => void;
29
+ modal?: boolean;
30
+ children?: React.ReactNode;
31
+ }
32
+ type DialogComponent = (props: DialogProps) => React.ReactElement;
33
+ interface DialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
34
+ asChild?: boolean;
35
+ }
36
+ type DialogTriggerComponent = React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
37
+ interface DialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
38
+ asChild?: boolean;
39
+ closeClass?: string;
40
+ }
41
+ type DialogContentComponent = React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
42
+ type DialogSectionProps = React.HTMLAttributes<HTMLDivElement>;
43
+ type DialogSectionComponent = (props: DialogSectionProps) => React.ReactElement;
44
+ interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
45
+ asChild?: boolean;
46
+ }
47
+ type DialogTitleComponent = React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
48
+ interface DialogDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
49
+ asChild?: boolean;
50
+ }
51
+ type DialogDescriptionComponent = React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
52
+
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 };
File without changes
@@ -0,0 +1,28 @@
1
+ /// <reference path="./sdkModules.d.ts" />
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BljPi_dT.js';
3
+ export { a as PLUGIN_HOST_API, b as PluginCapability, c as PluginManifest, T as ToolbarRegistration, d as ToolbarToolProps, V as VALID_CAPABILITIES } from '../base-BljPi_dT.js';
4
+ import 'react';
5
+
6
+ interface LegendRow {
7
+ label: string;
8
+ color: string;
9
+ count?: number;
10
+ }
11
+ interface LegendRegistration {
12
+ id: string;
13
+ title: string;
14
+ useLegend: () => {
15
+ /** False omits the section entirely, which is what a legend with nothing to say should do. */
16
+ active: boolean;
17
+ /** Overrides `title` when set, for a scoped label. */
18
+ title?: string;
19
+ unavailable?: boolean;
20
+ rows: LegendRow[];
21
+ };
22
+ }
23
+ /** `CapabilityRegistry` with the legend surface bound. */
24
+ type LegendCapabilityRegistry = CapabilityRegistry<unknown, unknown, unknown, LegendRegistration>;
25
+ /** The `activate()` context for a plugin that contributes a map legend. */
26
+ type LegendPluginContext = PluginContext<unknown, unknown, unknown, LegendRegistration>;
27
+
28
+ export { CapabilityRegistry, type LegendCapabilityRegistry, type LegendPluginContext, type LegendRegistration, type LegendRow, PluginContext };
@@ -0,0 +1,8 @@
1
+ import {
2
+ PLUGIN_HOST_API,
3
+ VALID_CAPABILITIES
4
+ } from "../chunk-CVHASC2D.js";
5
+ export {
6
+ PLUGIN_HOST_API,
7
+ VALID_CAPABILITIES
8
+ };
@@ -0,0 +1,16 @@
1
+ /// <reference path="./sdkModules.d.ts" />
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BljPi_dT.js';
3
+ export { a as PLUGIN_HOST_API, b as PluginCapability, c as PluginManifest, T as ToolbarRegistration, d as ToolbarToolProps, V as VALID_CAPABILITIES } from '../base-BljPi_dT.js';
4
+ import { Map } from 'maplibre-gl';
5
+ import 'react';
6
+
7
+ interface MapToolProps {
8
+ /** Null until the map has finished initialising, and in non-map viewers. */
9
+ map: Map | null;
10
+ }
11
+ /** `CapabilityRegistry` with the map surface bound. */
12
+ type MapCapabilityRegistry = CapabilityRegistry<MapToolProps>;
13
+ /** The `activate()` context for a plugin that contributes to the map toolbar. */
14
+ type MapPluginContext = PluginContext<MapToolProps>;
15
+
16
+ export { CapabilityRegistry, type MapCapabilityRegistry, type MapPluginContext, type MapToolProps, PluginContext };
@@ -0,0 +1,8 @@
1
+ import {
2
+ PLUGIN_HOST_API,
3
+ VALID_CAPABILITIES
4
+ } from "../chunk-CVHASC2D.js";
5
+ export {
6
+ PLUGIN_HOST_API,
7
+ VALID_CAPABILITIES
8
+ };
@@ -0,0 +1,16 @@
1
+ /// <reference path="./sdkModules.d.ts" />
2
+ import { C as CapabilityRegistry, P as PluginContext } from '../base-BljPi_dT.js';
3
+ export { a as PLUGIN_HOST_API, b as PluginCapability, c as PluginManifest, T as ToolbarRegistration, d as ToolbarToolProps, V as VALID_CAPABILITIES } from '../base-BljPi_dT.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 };
@@ -0,0 +1,8 @@
1
+ import {
2
+ PLUGIN_HOST_API,
3
+ VALID_CAPABILITIES
4
+ } from "../chunk-CVHASC2D.js";
5
+ export {
6
+ PLUGIN_HOST_API,
7
+ VALID_CAPABILITIES
8
+ };