@thatopen/services 0.0.1

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.
Files changed (80) hide show
  1. package/CONTEXT.md +258 -0
  2. package/README.md +285 -0
  3. package/dist/built-in/index.d.ts +723 -0
  4. package/dist/cli/commands/create-tests.d.ts +3 -0
  5. package/dist/cli/commands/create.d.ts +3 -0
  6. package/dist/cli/commands/local-server.d.ts +3 -0
  7. package/dist/cli/commands/login.d.ts +3 -0
  8. package/dist/cli/commands/publish.d.ts +3 -0
  9. package/dist/cli/commands/run.d.ts +3 -0
  10. package/dist/cli/commands/serve-tests.d.ts +3 -0
  11. package/dist/cli/commands/serve.d.ts +3 -0
  12. package/dist/cli/index.d.ts +1 -0
  13. package/dist/cli/lib/config.d.ts +25 -0
  14. package/dist/cli/lib/declarations.d.ts +19 -0
  15. package/dist/cli/lib/engine-script.d.ts +10 -0
  16. package/dist/cli/lib/execution-manager.d.ts +52 -0
  17. package/dist/cli/lib/zip.d.ts +6 -0
  18. package/dist/cli.js +11566 -0
  19. package/dist/core/client.d.ts +682 -0
  20. package/dist/core/client.test.d.ts +1 -0
  21. package/dist/core/platform-client.d.ts +106 -0
  22. package/dist/core/platform-client.test.d.ts +1 -0
  23. package/dist/core/request-error.d.ts +25 -0
  24. package/dist/core/request-error.test.d.ts +1 -0
  25. package/dist/index.cjs.js +2 -0
  26. package/dist/index.d.ts +12 -0
  27. package/dist/index.es.js +3310 -0
  28. package/dist/types/base.d.ts +9 -0
  29. package/dist/types/context.d.ts +20 -0
  30. package/dist/types/execution.d.ts +19 -0
  31. package/dist/types/files.d.ts +19 -0
  32. package/dist/types/item.dto.d.ts +24 -0
  33. package/dist/types/items.d.ts +57 -0
  34. package/dist/types/projects.d.ts +59 -0
  35. package/dist/types/response.d.ts +10 -0
  36. package/dist/types/storage.d.ts +11 -0
  37. package/dist/vite-env.d.ts +1 -0
  38. package/package.json +100 -0
  39. package/src/built-in/index.ts +755 -0
  40. package/src/cli/templates/bim/CONTEXT.md +244 -0
  41. package/src/cli/templates/bim/package.json +26 -0
  42. package/src/cli/templates/bim/src/app.ts +16 -0
  43. package/src/cli/templates/bim/src/bim-components/CloudRunner/index.ts +91 -0
  44. package/src/cli/templates/bim/src/bim-components/CloudRunner/src/index.ts +1 -0
  45. package/src/cli/templates/bim/src/bim-components/CloudRunner/src/types.ts +5 -0
  46. package/src/cli/templates/bim/src/bim-components/index.ts +1 -0
  47. package/src/cli/templates/bim/src/globals.ts +1 -0
  48. package/src/cli/templates/bim/src/main.ts +90 -0
  49. package/src/cli/templates/bim/src/setups/cloud-runner.ts +13 -0
  50. package/src/cli/templates/bim/src/setups/index.ts +3 -0
  51. package/src/cli/templates/bim/src/setups/ui-manager.ts +27 -0
  52. package/src/cli/templates/bim/src/setups/viewports-manager.ts +22 -0
  53. package/src/cli/templates/bim/src/ui-components/app-info-section/index.ts +26 -0
  54. package/src/cli/templates/bim/src/ui-components/app-info-section/src/index.ts +1 -0
  55. package/src/cli/templates/bim/src/ui-components/app-info-section/src/types.ts +15 -0
  56. package/src/cli/templates/bim/src/ui-components/cloud-runner-section/index.ts +37 -0
  57. package/src/cli/templates/bim/src/ui-components/cloud-runner-section/src/index.ts +1 -0
  58. package/src/cli/templates/bim/src/ui-components/cloud-runner-section/src/types.ts +14 -0
  59. package/src/cli/templates/bim/src/ui-components/index.ts +2 -0
  60. package/src/cli/templates/cloud/CONTEXT.md +205 -0
  61. package/src/cli/templates/cloud/_thatopen +5 -0
  62. package/src/cli/templates/cloud/declarations.json +4 -0
  63. package/src/cli/templates/cloud/package.json +22 -0
  64. package/src/cli/templates/cloud/src/main.ts +70 -0
  65. package/src/cli/templates/cloud-test/CONTEXT.md +56 -0
  66. package/src/cli/templates/cloud-test/_thatopen +5 -0
  67. package/src/cli/templates/cloud-test/package.json +22 -0
  68. package/src/cli/templates/cloud-test/src/main.ts +565 -0
  69. package/src/cli/templates/default/CONTEXT.md +92 -0
  70. package/src/cli/templates/default/package.json +15 -0
  71. package/src/cli/templates/default/src/main.ts +62 -0
  72. package/src/cli/templates/shared/_gitignore +4 -0
  73. package/src/cli/templates/shared/app/index.html +27 -0
  74. package/src/cli/templates/shared/app/tsconfig.json +16 -0
  75. package/src/cli/templates/shared/app/vite.config.js +23 -0
  76. package/src/cli/templates/shared/cloud/tsconfig.json +16 -0
  77. package/src/cli/templates/shared/cloud/vite.config.js +27 -0
  78. package/src/cli/templates/test/CONTEXT.md +53 -0
  79. package/src/cli/templates/test/package.json +25 -0
  80. package/src/cli/templates/test/src/main.ts +955 -0
@@ -0,0 +1,755 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
+ /**
3
+ * Built-in component types and runtime stubs.
4
+ * Auto-generated by platform_builtin-components/scripts/distribute-types.mjs
5
+ */
6
+
7
+ import type * as OBC from '@thatopen/components';
8
+ import type * as BUI from '@thatopen/ui';
9
+ import type * as THREE from 'three';
10
+ type DataMap<_A = any, _B = any, _C = any, _D = any> = any;
11
+ import type { EngineServicesClient, Item, ProjectData } from '../';
12
+
13
+ export type ComponentSetup = (components: OBC.Components) => Promise<void> | void;
14
+ export type ComponentSetups = {
15
+ core?: ComponentSetup[];
16
+ lazy?: {
17
+ uuid: string;
18
+ fn: ComponentSetup;
19
+ }[];
20
+ };
21
+ /**
22
+ * Application-level configuration passed to {@link AppManager} as a generic.
23
+ * Define this interface in your app to get typed access to icons and the grid.
24
+ * - `icons`: tuple of icon key names (e.g. `["SAVE", "DELETE"]`).
25
+ * - `grid`: the exact `BUI.Grid` type this app will use (e.g. `BUI.Grid<["Split", "Viewer"], [...]>`).
26
+ */
27
+ export interface App {
28
+ icons?: readonly string[];
29
+ grid?: BUI.Grid<any, any>;
30
+ }
31
+ /** Derives a `Record<K, string>` from the icon keys tuple in `TApp`. */
32
+ export type IconsOf<TApp extends App> = TApp['icons'] extends readonly (infer K extends string)[] ? Record<K, string> : undefined;
33
+ /** Extracts the grid type from `TApp`, falling back to the base `BUI.Grid`. */
34
+ export type AppGrid<TApp extends App> = TApp['grid'] extends BUI.Grid<any, any> ? TApp['grid'] : BUI.Grid<any, any>;
35
+ /** Config object passed to {@link AppManager.init}. */
36
+ export type AppInitConfig<TApp extends App> = {
37
+ client?: EngineServicesClient;
38
+ icons: IconsOf<TApp>;
39
+ componentSetups?: ComponentSetups;
40
+ grid: (grid: AppGrid<TApp>) => void;
41
+ container?: HTMLElement;
42
+ };
43
+
44
+ export declare const SIDEBAR_STORAGE_KEY = "thatopen-sidebar-collapsed";
45
+ export interface SidebarState {
46
+ grid: BUI.Grid<any, any>;
47
+ collapsed: boolean;
48
+ }
49
+ export declare const sidebarTemplate: BUI.StatefullComponent<SidebarState>;
50
+
51
+ /**
52
+ * Built-in component that structures a ThatOpen Platform application.
53
+ *
54
+ * AppManager creates the app shell: a content grid with named element
55
+ * slots arranged by CSS grid layouts, and an optional sidebar that lets
56
+ * the user switch between layouts.
57
+ *
58
+ * Usage:
59
+ * 1. Call {@link init} with icons, a grid configuration callback, and an optional container.
60
+ * 2. Optionally set {@link showSidebar} at any point after init.
61
+ */
62
+ declare class _AppManager<TApp extends App = App> extends OBC.Component {
63
+ static readonly uuid: "2e32d873-02c9-421c-8743-d8a5ca6ad38a";
64
+ enabled: boolean;
65
+ private _icons;
66
+ private _iconsSet;
67
+ private _grid;
68
+ private _initialized;
69
+ private _sidebar;
70
+ private _client;
71
+ private _projectData;
72
+ private _lazySetups;
73
+ get icons(): IconsOf<TApp>;
74
+ /**
75
+ * The underlying `<bim-grid>` element.
76
+ * Available after {@link init} has been called.
77
+ */
78
+ get grid(): AppGrid<TApp> | null;
79
+ get client(): EngineServicesClient;
80
+ get projectData(): ProjectData;
81
+ /**
82
+ * Shows or hides the layout-switching sidebar.
83
+ * Can be set at any point after {@link init} has been called.
84
+ */
85
+ get showSidebar(): boolean;
86
+ set showSidebar(value: boolean);
87
+ /**
88
+ * Initialise the app: resolve client context, process icons, mount the DOM, and invoke the grid configuration callback.
89
+ */
90
+ init(config: AppInitConfig<TApp>): Promise<void>;
91
+ addSetup(uuid: string, fn: ComponentSetup): void;
92
+ private _registerLazySetup;
93
+ private injectStyles;
94
+ }
95
+
96
+ /**
97
+ * Built-in component that structures a ThatOpen Platform application.
98
+ *
99
+ * AppManager creates the app shell: a content grid with named element
100
+ * slots arranged by CSS grid layouts, and an optional sidebar that lets
101
+ * the user switch between layouts.
102
+ *
103
+ * Usage:
104
+ * 1. Call {@link init} with icons, a grid configuration callback, and an optional container.
105
+ * 2. Optionally set {@link showSidebar} at any point after init.
106
+ */
107
+ export type AppManager = InstanceType<typeof _AppManager>;
108
+ /**
109
+ * Built-in component that structures a ThatOpen Platform application.
110
+ *
111
+ * AppManager creates the app shell: a content grid with named element
112
+ * slots arranged by CSS grid layouts, and an optional sidebar that lets
113
+ * the user switch between layouts.
114
+ *
115
+ * Usage:
116
+ * 1. Call {@link init} with icons, a grid configuration callback, and an optional container.
117
+ * 2. Optionally set {@link showSidebar} at any point after init.
118
+ */
119
+ export const AppManager = { uuid: '2e32d873-02c9-421c-8743-d8a5ca6ad38a' } as typeof _AppManager & { uuid: '2e32d873-02c9-421c-8743-d8a5ca6ad38a' };
120
+
121
+ /**
122
+ * Which action buttons to expose per file row. All default to `true`.
123
+ */
124
+ export interface FileListActions {
125
+ download?: boolean;
126
+ rename?: boolean;
127
+ delete?: boolean;
128
+ }
129
+ /**
130
+ * Config passed to {@link FileList.create}.
131
+ */
132
+ export interface FileListConfig {
133
+ /** Services client used to list and mutate files. */
134
+ client: EngineServicesClient;
135
+ /** Optional folder ID to scope the list. If omitted, lists root files. */
136
+ folderId?: string;
137
+ /** Which action buttons to show per row. Defaults to all enabled. */
138
+ actions?: FileListActions;
139
+ /** Called when a file row is clicked (not an action button). */
140
+ onFileClick?: (file: Item) => void;
141
+ }
142
+ /**
143
+ * The result returned by {@link FileList.create}.
144
+ */
145
+ export interface FileListInstance {
146
+ /** The DOM element to mount somewhere in your layout. */
147
+ element: HTMLElement;
148
+ /** Reloads the list from the services client. */
149
+ refresh: () => Promise<void>;
150
+ /** Changes the folder scope and reloads. Pass `undefined` for the root. */
151
+ setFolder: (folderId?: string) => Promise<void>;
152
+ /** Removes the element and forgets the instance. */
153
+ dispose: () => void;
154
+ }
155
+
156
+ /**
157
+ * Built-in component that renders a file list backed by the services client,
158
+ * with built-in download / rename / delete actions.
159
+ *
160
+ * The backing data comes from {@link EngineServicesClient.listFiles}, so the
161
+ * list stays in sync with the storage service. Each call to {@link create}
162
+ * returns an independent instance with its own DOM element.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const fileList = components.get(FileList);
167
+ * const { element, refresh } = fileList.create({
168
+ * client: app.client,
169
+ * folderId: someFolderId,
170
+ * });
171
+ * container.appendChild(element);
172
+ * ```
173
+ */
174
+ declare class _FileList extends OBC.Component {
175
+ static readonly uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c";
176
+ enabled: boolean;
177
+ readonly name = "FileList";
178
+ private _instances;
179
+ /**
180
+ * Creates a new file-list instance. Returns the DOM element to mount plus a
181
+ * `refresh` handle to reload the list, a `setFolder` to change scope, and a
182
+ * `dispose` to remove it.
183
+ */
184
+ create(config: FileListConfig): FileListInstance;
185
+ /**
186
+ * Removes every instance this manager has created.
187
+ */
188
+ dispose(): void;
189
+ }
190
+
191
+ /**
192
+ * Built-in component that renders a file list backed by the services client,
193
+ * with built-in download / rename / delete actions.
194
+ *
195
+ * The backing data comes from {@link EngineServicesClient.listFiles}, so the
196
+ * list stays in sync with the storage service. Each call to {@link create}
197
+ * returns an independent instance with its own DOM element.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const fileList = components.get(FileList);
202
+ * const { element, refresh } = fileList.create({
203
+ * client: app.client,
204
+ * folderId: someFolderId,
205
+ * });
206
+ * container.appendChild(element);
207
+ * ```
208
+ */
209
+ export type FileList = InstanceType<typeof _FileList>;
210
+ /**
211
+ * Built-in component that renders a file list backed by the services client,
212
+ * with built-in download / rename / delete actions.
213
+ *
214
+ * The backing data comes from {@link EngineServicesClient.listFiles}, so the
215
+ * list stays in sync with the storage service. Each call to {@link create}
216
+ * returns an independent instance with its own DOM element.
217
+ *
218
+ * @example
219
+ * ```ts
220
+ * const fileList = components.get(FileList);
221
+ * const { element, refresh } = fileList.create({
222
+ * client: app.client,
223
+ * folderId: someFolderId,
224
+ * });
225
+ * container.appendChild(element);
226
+ * ```
227
+ */
228
+ export const FileList = { uuid: 'b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c' } as typeof _FileList & { uuid: 'b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c' };
229
+
230
+ /**
231
+ * A simple test component to validate the built-in component pipeline.
232
+ * Replace this with real components once the infrastructure is verified.
233
+ */
234
+ declare class _HelloWorld extends OBC.Component {
235
+ static readonly uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96";
236
+ enabled: boolean;
237
+ readonly name = "HelloWorld";
238
+ constructor(components: OBC.Components);
239
+ /**
240
+ * Returns a greeting message and logs it to the console.
241
+ * @param who - The name to greet. Defaults to `"World"`.
242
+ */
243
+ greet(who?: string): string;
244
+ }
245
+ /**
246
+ * PlatformComponents.import() expects a `main` variable in scope with
247
+ * a `componentDefinition` property pointing to the OBC.Component class.
248
+ * The IIFE build (name: 'main') assigns this to `var main = ...`.
249
+ */
250
+
251
+ /**
252
+ * A simple test component to validate the built-in component pipeline.
253
+ * Replace this with real components once the infrastructure is verified.
254
+ */
255
+ export type HelloWorld = InstanceType<typeof _HelloWorld>;
256
+ /**
257
+ * A simple test component to validate the built-in component pipeline.
258
+ * Replace this with real components once the infrastructure is verified.
259
+ */
260
+ export const HelloWorld = { uuid: '2c4ae432-fc24-43e9-9783-0c960c674e96' } as typeof _HelloWorld & { uuid: '2c4ae432-fc24-43e9-9783-0c960c674e96' };
261
+
262
+ /**
263
+ * Config passed to {@link TabbedNavigation.create}. All fields are optional.
264
+ */
265
+ export interface TabbedNavigationConfig {
266
+ /** Hide the text labels and show only icons. Defaults to `false`. */
267
+ iconsOnly?: boolean;
268
+ /**
269
+ * Fallback icon used when a layout doesn't declare one in its definition.
270
+ * Defaults to `"mdi:view-dashboard"`.
271
+ */
272
+ fallbackIcon?: string;
273
+ /** Called after the user switches to a different layout via the tabs. */
274
+ onLayoutChange?: (layoutName: string) => void;
275
+ }
276
+ /**
277
+ * The result returned by {@link TabbedNavigation.create}.
278
+ */
279
+ export interface TabbedNavigationInstance {
280
+ /** The tab-bar DOM element. Mount it inside an AppManager grid slot. */
281
+ element: HTMLElement;
282
+ /** Re-reads the grid's layouts and re-renders the tabs. Call after mutating `grid.layouts`. */
283
+ refresh: () => void;
284
+ /** Tears down listeners and removes the element. */
285
+ dispose: () => void;
286
+ }
287
+
288
+ /**
289
+ * Built-in tabbed navigation for a platform app. Renders one tab per layout
290
+ * declared on the `AppManager`'s grid, with the current layout highlighted.
291
+ * Clicking a tab switches `grid.layout`, which swaps the visible area set.
292
+ *
293
+ * This is the default top-of-app navigation pattern the platform proposes —
294
+ * Claude Code should use it by default when scaffolding apps with multiple
295
+ * layouts, instead of hand-rolling a custom tab bar.
296
+ *
297
+ * Must be called after `AppManager.init()` has mounted the grid.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * const app = components.get(AppManager<MyApp>);
302
+ * await app.init({ ... });
303
+ * const tabs = components.get(TabbedNavigation);
304
+ * const { element } = tabs.create();
305
+ * // Mount `element` in a grid area that sits above the main content.
306
+ * ```
307
+ */
308
+ declare class _TabbedNavigation extends OBC.Component {
309
+ static readonly uuid: "3c2a9f34-8b6c-4d1b-8f7a-1e4a5b2c9f08";
310
+ enabled: boolean;
311
+ readonly name = "TabbedNavigation";
312
+ private _instances;
313
+ /**
314
+ * Creates a new tab-bar instance bound to the current `AppManager` grid.
315
+ */
316
+ create(config?: TabbedNavigationConfig): TabbedNavigationInstance;
317
+ /** Disposes every instance this manager has created. */
318
+ dispose(): void;
319
+ }
320
+
321
+ /**
322
+ * Built-in tabbed navigation for a platform app. Renders one tab per layout
323
+ * declared on the `AppManager`'s grid, with the current layout highlighted.
324
+ * Clicking a tab switches `grid.layout`, which swaps the visible area set.
325
+ *
326
+ * This is the default top-of-app navigation pattern the platform proposes —
327
+ * Claude Code should use it by default when scaffolding apps with multiple
328
+ * layouts, instead of hand-rolling a custom tab bar.
329
+ *
330
+ * Must be called after `AppManager.init()` has mounted the grid.
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * const app = components.get(AppManager<MyApp>);
335
+ * await app.init({ ... });
336
+ * const tabs = components.get(TabbedNavigation);
337
+ * const { element } = tabs.create();
338
+ * // Mount `element` in a grid area that sits above the main content.
339
+ * ```
340
+ */
341
+ export type TabbedNavigation = InstanceType<typeof _TabbedNavigation>;
342
+ /**
343
+ * Built-in tabbed navigation for a platform app. Renders one tab per layout
344
+ * declared on the `AppManager`'s grid, with the current layout highlighted.
345
+ * Clicking a tab switches `grid.layout`, which swaps the visible area set.
346
+ *
347
+ * This is the default top-of-app navigation pattern the platform proposes —
348
+ * Claude Code should use it by default when scaffolding apps with multiple
349
+ * layouts, instead of hand-rolling a custom tab bar.
350
+ *
351
+ * Must be called after `AppManager.init()` has mounted the grid.
352
+ *
353
+ * @example
354
+ * ```ts
355
+ * const app = components.get(AppManager<MyApp>);
356
+ * await app.init({ ... });
357
+ * const tabs = components.get(TabbedNavigation);
358
+ * const { element } = tabs.create();
359
+ * // Mount `element` in a grid area that sits above the main content.
360
+ * ```
361
+ */
362
+ export const TabbedNavigation = { uuid: '3c2a9f34-8b6c-4d1b-8f7a-1e4a5b2c9f08' } as typeof _TabbedNavigation & { uuid: '3c2a9f34-8b6c-4d1b-8f7a-1e4a5b2c9f08' };
363
+
364
+ export interface ColorsPaletteState {
365
+ components: OBC.Components;
366
+ onApply: (color: string, name?: string) => void | Promise<void>;
367
+ defaultColors?: string[];
368
+ addHighlighterColors?: boolean;
369
+ }
370
+ export type ColorsPaletteComponent = BUI.StatefullComponent<ColorsPaletteState>;
371
+
372
+ export declare const colorsPaletteTemplate: ColorsPaletteComponent;
373
+
374
+ export interface LoadModelButtonState {
375
+ components: OBC.Components;
376
+ types?: {
377
+ ifc?: boolean;
378
+ fragments?: boolean;
379
+ };
380
+ onIfcProcessed?: (model: any) => void | Promise<void>;
381
+ }
382
+ export type LoadModelButtonComponent = BUI.StatefullComponent<LoadModelButtonState>;
383
+
384
+ export declare const loadModelButtonTemplate: LoadModelButtonComponent;
385
+
386
+ export type HighlightersListData = {
387
+ Name: string;
388
+ color: string;
389
+ Actions: string;
390
+ };
391
+ export interface HighlightersListState {
392
+ components: OBC.Components;
393
+ missingDataMessage?: string;
394
+ }
395
+ export type HighlightersListComponent = BUI.StatefullComponent<HighlightersListState>;
396
+
397
+ export declare const highlightersListTemplate: HighlightersListComponent;
398
+ export declare const onHighlightersListCreated: ([table, _, { getCurrentState }]: [BUI.Table<HighlightersListData>, BUI.UpdateFunction<HighlightersListState>, BUI.ComponentUtils<HighlightersListState>]) => void;
399
+
400
+ export type ClippingsListData = {
401
+ Name: string;
402
+ Actions: string;
403
+ id: string;
404
+ };
405
+ export interface ClippingsListState {
406
+ components: OBC.Components;
407
+ missingDataMessage?: string;
408
+ }
409
+ export type ClippingsListComponent = BUI.StatefullComponent<ClippingsListState>;
410
+
411
+ export declare const clippingsListTemplate: ClippingsListComponent;
412
+ export declare const onClippingsListCreated: ([table, _, { getCurrentState }]: [BUI.Table<ClippingsListData>, BUI.UpdateFunction<ClippingsListState>, BUI.ComponentUtils<ClippingsListState>]) => void;
413
+
414
+ export interface ScreenshotAnnotatorState {
415
+ components: OBC.Components;
416
+ blob: Blob;
417
+ onSend: (annotatedBlob: Blob) => Promise<void>;
418
+ onCancel: () => Promise<void>;
419
+ sendLabel?: string;
420
+ }
421
+ export type ScreenshotAnnotatorComponent = BUI.StatefullComponent<ScreenshotAnnotatorState>;
422
+
423
+ export declare const screenshotAnnotatorTemplate: ScreenshotAnnotatorComponent;
424
+
425
+ export type AreaMeasuringsListData = {
426
+ id: string;
427
+ Value: string;
428
+ Actions: string;
429
+ isTotal: boolean;
430
+ };
431
+ export interface AreaMeasuringsListState {
432
+ components: OBC.Components;
433
+ world: OBC.World;
434
+ missingDataMessage?: string;
435
+ }
436
+ export type AreaMeasuringsListComponent = BUI.StatefullComponent<AreaMeasuringsListState>;
437
+
438
+ export declare const areaMeasuringsListTemplate: AreaMeasuringsListComponent;
439
+ export declare const onAreaMeasuringsListCreated: ([table, _, { getCurrentState }]: [BUI.Table<AreaMeasuringsListData>, BUI.UpdateFunction<AreaMeasuringsListState>, BUI.ComponentUtils<AreaMeasuringsListState>]) => void;
440
+
441
+ export type ClassificationsListData = {
442
+ Name: string;
443
+ modelIdMap: string;
444
+ Actions: string;
445
+ };
446
+ export interface ClassificationsListState {
447
+ components: OBC.Components;
448
+ missingDataMessage?: string;
449
+ }
450
+ export type ClassificationsListComponent = BUI.StatefullComponent<ClassificationsListState>;
451
+
452
+ export declare const classificationsListTemplate: ClassificationsListComponent;
453
+ export declare const onClassificationsListCreated: ([table, _, { getCurrentState }]: [BUI.Table<ClassificationsListData>, BUI.UpdateFunction<ClassificationsListState>, BUI.ComponentUtils<ClassificationsListState>]) => void;
454
+
455
+ export type LengthMeasuringsListData = {
456
+ id: string;
457
+ Value: string;
458
+ Actions: string;
459
+ isTotal: boolean;
460
+ };
461
+ export interface LengthMeasuringsListState {
462
+ components: OBC.Components;
463
+ world: OBC.World;
464
+ missingDataMessage?: string;
465
+ }
466
+ export type LengthMeasuringsListComponent = BUI.StatefullComponent<LengthMeasuringsListState>;
467
+
468
+ export declare const lengthMeasuringsListTemplate: LengthMeasuringsListComponent;
469
+ export declare const onLengthMeasuringsListCreated: ([table, _, { getCurrentState }]: [BUI.Table<LengthMeasuringsListData>, BUI.UpdateFunction<LengthMeasuringsListState>, BUI.ComponentUtils<LengthMeasuringsListState>]) => void;
470
+
471
+ export type QueriesHierarchyData = {
472
+ Name: string;
473
+ queries: string;
474
+ Actions: string;
475
+ };
476
+ export interface QueriesHierarchyState {
477
+ components: OBC.Components;
478
+ queryHierarchy: string[][];
479
+ missingDataMessage?: string;
480
+ }
481
+ export type QueriesHierarchyComponent = BUI.StatefullComponent<QueriesHierarchyState>;
482
+
483
+ export declare const queriesHierarchyTemplate: QueriesHierarchyComponent;
484
+ export declare const onQueriesHierarchyCreated: ([table, _, { getCurrentState }]: [BUI.Table<QueriesHierarchyData>, BUI.UpdateFunction<QueriesHierarchyState>, BUI.ComponentUtils<QueriesHierarchyState>]) => void;
485
+
486
+ export interface ViewerToolbarState {
487
+ components: OBC.Components;
488
+ world: OBC.World;
489
+ }
490
+ export type ViewerToolbarComponent = BUI.StatefullComponent<ViewerToolbarState>;
491
+
492
+ export declare const viewerToolbarTemplate: ViewerToolbarComponent;
493
+
494
+ export interface ModelsDropdownState {
495
+ components: OBC.Components;
496
+ filterFn?: (modelId: string) => boolean;
497
+ }
498
+ export type ModelsDropdownComponent = BUI.StatefullComponent<ModelsDropdownState>;
499
+
500
+ export declare const modelsDropdownTemplate: ModelsDropdownComponent;
501
+ export declare const onModelsDropdownCreated: ([dropdown]: [BUI.Dropdown, BUI.UpdateFunction<ModelsDropdownState>, BUI.ComponentUtils<ModelsDropdownState>]) => void;
502
+
503
+ export interface ModelsSectionState {
504
+ components: OBC.Components;
505
+ /** Whether to show the load-model button. Defaults to `true`. */
506
+ showLoadButton?: boolean;
507
+ /** Custom element to use as load button instead of the default. */
508
+ loadButton?: HTMLElement;
509
+ }
510
+ export type ModelsSectionComponent = BUI.StatefullComponent<ModelsSectionState>;
511
+ export type ModelsSectionGridElement = {
512
+ name: "collider";
513
+ state: ModelsSectionState;
514
+ };
515
+
516
+ export declare const modelsSectionTemplate: ModelsSectionComponent;
517
+ export declare const onModelsSectionCreated: ([panelSection, _, { getCurrentState }]: [BUI.PanelSection, BUI.UpdateFunction<ModelsSectionState>, BUI.ComponentUtils<ModelsSectionState>]) => void;
518
+
519
+ export type UICustomShape = Record<string, {
520
+ type: HTMLElement;
521
+ state: Record<string, any>;
522
+ }>;
523
+ export type BuiltinShape = {
524
+ colorsPalette: {
525
+ type: HTMLDivElement;
526
+ state: ColorsPaletteState;
527
+ };
528
+ loadModelButton: {
529
+ type: BUI.Button;
530
+ state: LoadModelButtonState;
531
+ };
532
+ highlightersList: {
533
+ type: BUI.Table<HighlightersListData>;
534
+ state: HighlightersListState;
535
+ };
536
+ clippingsList: {
537
+ type: BUI.Table<ClippingsListData>;
538
+ state: ClippingsListState;
539
+ };
540
+ screenshotAnnotator: {
541
+ type: HTMLDialogElement;
542
+ state: ScreenshotAnnotatorState;
543
+ };
544
+ areaMeasuringsList: {
545
+ type: BUI.Table<AreaMeasuringsListData>;
546
+ state: AreaMeasuringsListState;
547
+ };
548
+ classificationsList: {
549
+ type: BUI.Table<ClassificationsListData>;
550
+ state: ClassificationsListState;
551
+ };
552
+ lengthMeasuringsList: {
553
+ type: BUI.Table<LengthMeasuringsListData>;
554
+ state: LengthMeasuringsListState;
555
+ };
556
+ queriesHierarchy: {
557
+ type: BUI.Table<QueriesHierarchyData>;
558
+ state: QueriesHierarchyState;
559
+ };
560
+ viewerToolbar: {
561
+ type: HTMLElement;
562
+ state: ViewerToolbarState;
563
+ };
564
+ modelsDropdown: {
565
+ type: BUI.Dropdown;
566
+ state: ModelsDropdownState;
567
+ };
568
+ modelsSection: {
569
+ type: BUI.PanelSection;
570
+ state: ModelsSectionState;
571
+ };
572
+ };
573
+
574
+ export type UIFactoryMap<T extends UICustomShape> = {
575
+ [K in keyof T]: UIFactory<T[K]['type'], T[K]['state']>;
576
+ };
577
+ export declare class UIDataMap<T extends UICustomShape> {
578
+ get<K extends keyof T & string>(key: K): UIFactoryMap<T>[K];
579
+ get(key: keyof T & string): UIFactoryMap<T>[keyof T];
580
+ }
581
+ export type UIFactoryInstance<TElement extends HTMLElement, TState extends Record<string, any>> = [TElement, BUI.UpdateFunction<TState>, BUI.ComponentUtils<TState>];
582
+ export declare abstract class UIFactory<TElement extends HTMLElement, TState extends Record<string, any>> {
583
+ readonly instances: DataMap<string, UIFactoryInstance<TElement, TState>>;
584
+ abstract readonly template: BUI.StatefullComponent<TState>;
585
+ create(state: TState, options?: {
586
+ id?: string;
587
+ }): UIFactoryInstance<TElement, TState>;
588
+ updateInstances(state?: Partial<TState>): void;
589
+ }
590
+ export declare function createFactory<TEl extends HTMLElement, TState extends Record<string, any>>(template: BUI.StatefullComponent<TState>, onInstanceCreated?: (item: UIFactoryInstance<TEl, TState>) => void): UIFactory<TEl, TState>;
591
+
592
+ declare class _UIManager<TCustom extends UICustomShape = UICustomShape> extends OBC.Component {
593
+ static readonly uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb";
594
+ enabled: boolean;
595
+ readonly name = "UIManager";
596
+ readonly builtIn: UIDataMap<BuiltinShape>;
597
+ readonly custom: UIDataMap<TCustom>;
598
+ constructor(components: OBC.Components);
599
+ private registerBuiltInTemplate;
600
+ registerTemplate<K extends keyof TCustom & string>(name: K, config: {
601
+ template: BUI.StatefullComponent<TCustom[K]['state']>;
602
+ onInstanceCreated?: (item: [TCustom[K]['type'], BUI.UpdateFunction<TCustom[K]['state']>, BUI.ComponentUtils<TCustom[K]['state']>]) => void;
603
+ }): void;
604
+ }
605
+
606
+ export type UIManager = InstanceType<typeof _UIManager>;
607
+ export const UIManager = { uuid: '234f1416-528d-452a-9cc9-a16c5239b2eb' } as typeof _UIManager & { uuid: '234f1416-528d-452a-9cc9-a16c5239b2eb' };
608
+
609
+ export type ViewportFloatingGridLayouts = ['default'];
610
+ export interface ViewportFloatingGridToolbarState {
611
+ components: OBC.Components;
612
+ world: OBC.World;
613
+ }
614
+ export type ViewportFloatingGridElements = [
615
+ {
616
+ name: 'top';
617
+ state: ViewportFloatingGridToolbarState;
618
+ },
619
+ {
620
+ name: 'left';
621
+ state: ViewportFloatingGridToolbarState;
622
+ },
623
+ {
624
+ name: 'right';
625
+ state: ViewportFloatingGridToolbarState;
626
+ },
627
+ {
628
+ name: 'bottom';
629
+ state: ViewportFloatingGridToolbarState;
630
+ }
631
+ ];
632
+ export type ViewportFloatingGrid = BUI.Grid<ViewportFloatingGridLayouts, ViewportFloatingGridElements>;
633
+ /**
634
+ * The result of creating a viewport instance via {@link ViewportsManager.create}.
635
+ */
636
+ export interface ViewportInstance {
637
+ /** The `<bim-viewport>` HTML element to mount in a layout slot. */
638
+ element: BUI.Viewport;
639
+ /** The Three.js world bound to this viewport. */
640
+ world: OBC.SimpleWorld<OBC.SimpleScene, OBC.OrthoPerspectiveCamera, OBC.SimpleRenderer>;
641
+ floatingGrid?: ViewportFloatingGrid;
642
+ }
643
+ export type FloatingGridToolbars = {
644
+ top?: ViewportFloatingGrid['elements']['top'];
645
+ bottom?: ViewportFloatingGrid['elements']['bottom'];
646
+ left?: ViewportFloatingGrid['elements']['left'];
647
+ right?: ViewportFloatingGrid['elements']['right'];
648
+ };
649
+ /**
650
+ * Optional configuration when creating a viewport instance.
651
+ */
652
+ export interface ViewportConfig {
653
+ /** Background color for the scene. Set to `null` for transparent. Defaults to `null`. */
654
+ backgroundColor?: THREE.ColorRepresentation | null;
655
+ /** Grid color. Defaults to `"lightgray"`. */
656
+ gridColor?: THREE.ColorRepresentation;
657
+ /** Setup for the floating grid in the viewport. Useful for toolbars. */
658
+ floatingToolbarsSetup?: (state: ViewportFloatingGridToolbarState) => FloatingGridToolbars;
659
+ }
660
+
661
+ /**
662
+ * Built-in component that creates 3D viewports with a pre-configured
663
+ * world (scene, camera, renderer) and fragments manager.
664
+ *
665
+ * ViewportManager is a factory: each call to {@link create} returns a
666
+ * new independent viewport with its own world. The component tracks all
667
+ * created instances and cleans them up on {@link dispose}.
668
+ *
669
+ * @example
670
+ * ```ts
671
+ * const viewports = components.get(ViewportManager);
672
+ * const { element, world } = await viewports.create();
673
+ *
674
+ * // Use `element` as a slot in AppManager
675
+ * app.setup = {
676
+ * elements: { viewer: element },
677
+ * layouts: { Main: { template: `"viewer" 1fr / 1fr` } },
678
+ * };
679
+ * ```
680
+ */
681
+ declare class _ViewportsManager extends OBC.Component {
682
+ static readonly uuid: "def81d43-6b44-4f4a-9c08-7649486112a4";
683
+ enabled: boolean;
684
+ readonly name = "ViewportManager";
685
+ private _instances;
686
+ private _fragmentsInitialized;
687
+ /**
688
+ * Creates a new viewport instance with its own world, scene, camera,
689
+ * and renderer. Fragments manager is initialised automatically on
690
+ * the first call.
691
+ *
692
+ * @param config - Optional visual configuration for the viewport.
693
+ * @returns A {@link ViewportInstance} containing the DOM element and world.
694
+ */
695
+ create(config?: ViewportConfig): Promise<ViewportInstance>;
696
+ private setupFloatingGrid;
697
+ /**
698
+ * Disposes all created viewport instances and their worlds.
699
+ */
700
+ dispose(): void;
701
+ /**
702
+ * Initialises the fragments manager if not yet done, and wires up
703
+ * model loading for the given world.
704
+ */
705
+ private _initFragments;
706
+ /**
707
+ * Grows the camera's far plane so it always encompasses every loaded
708
+ * model. Without this, large models clip against the default far plane
709
+ * and disappear from view.
710
+ */
711
+ private _expandCameraFar;
712
+ }
713
+
714
+ /**
715
+ * Built-in component that creates 3D viewports with a pre-configured
716
+ * world (scene, camera, renderer) and fragments manager.
717
+ *
718
+ * ViewportManager is a factory: each call to {@link create} returns a
719
+ * new independent viewport with its own world. The component tracks all
720
+ * created instances and cleans them up on {@link dispose}.
721
+ *
722
+ * @example
723
+ * ```ts
724
+ * const viewports = components.get(ViewportManager);
725
+ * const { element, world } = await viewports.create();
726
+ *
727
+ * // Use `element` as a slot in AppManager
728
+ * app.setup = {
729
+ * elements: { viewer: element },
730
+ * layouts: { Main: { template: `"viewer" 1fr / 1fr` } },
731
+ * };
732
+ * ```
733
+ */
734
+ export type ViewportsManager = InstanceType<typeof _ViewportsManager>;
735
+ /**
736
+ * Built-in component that creates 3D viewports with a pre-configured
737
+ * world (scene, camera, renderer) and fragments manager.
738
+ *
739
+ * ViewportManager is a factory: each call to {@link create} returns a
740
+ * new independent viewport with its own world. The component tracks all
741
+ * created instances and cleans them up on {@link dispose}.
742
+ *
743
+ * @example
744
+ * ```ts
745
+ * const viewports = components.get(ViewportManager);
746
+ * const { element, world } = await viewports.create();
747
+ *
748
+ * // Use `element` as a slot in AppManager
749
+ * app.setup = {
750
+ * elements: { viewer: element },
751
+ * layouts: { Main: { template: `"viewer" 1fr / 1fr` } },
752
+ * };
753
+ * ```
754
+ */
755
+ export const ViewportsManager = { uuid: 'def81d43-6b44-4f4a-9c08-7649486112a4' } as typeof _ViewportsManager & { uuid: 'def81d43-6b44-4f4a-9c08-7649486112a4' };