@thatopen/services 0.34.5 → 0.35.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 (118) hide show
  1. package/README.md +66 -66
  2. package/dist/cli.js +54 -12
  3. package/dist/cli.js.map +1 -1
  4. package/dist/core/app-cache.d.ts +32 -0
  5. package/dist/core/app-cache.test.d.ts +1 -0
  6. package/dist/core/client.d.ts +9 -1
  7. package/dist/index.cjs.js +5 -5
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.js +974 -917
  11. package/dist/index.es.js.map +1 -1
  12. package/dist/types/context.d.ts +6 -0
  13. package/dist/vite-env.d.ts +1 -1
  14. package/docs/ai-quickstart.md +548 -548
  15. package/docs/builtin/paths.json +130 -130
  16. package/docs/cli/create.md +29 -29
  17. package/docs/cli/local-server.md +38 -38
  18. package/docs/cli/login.md +32 -32
  19. package/docs/cli/mcp.md +46 -46
  20. package/docs/cli/publish.md +31 -31
  21. package/docs/cli/run.md +26 -26
  22. package/docs/cli/serve.md +43 -43
  23. package/docs/cli/swap.md +30 -30
  24. package/docs/cloud/GaussianSplatConverter.md +43 -43
  25. package/docs/cloud/PointCloudConverter.md +53 -53
  26. package/docs/flow-architecture.md +393 -393
  27. package/docs/flow-plugin-guide.md +354 -354
  28. package/docs/platform-token.md +81 -81
  29. package/docs/rate-limits.md +133 -133
  30. package/docs/recipes-guide.md +243 -243
  31. package/docs/revit-collab-quickstart.md +445 -445
  32. package/docs/rhino-interop-quickstart.md +387 -387
  33. package/docs/sheet-sets-guide.md +69 -69
  34. package/package.json +4 -4
  35. package/resources/AGENTS.md +57 -57
  36. package/src/built-in/CDEManager/example.ts +214 -214
  37. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  38. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  39. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  40. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  41. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  42. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  43. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  44. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  45. package/src/built-in/ClashesManager/example.ts +283 -283
  46. package/src/built-in/GISManager/example.ts +355 -355
  47. package/src/built-in/ProjectManager/example.ts +124 -124
  48. package/src/built-in/UIManager/src/app/example.ts +97 -97
  49. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
  50. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
  51. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
  52. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
  53. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
  54. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
  55. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
  56. package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -150
  57. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +105 -105
  58. package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -183
  59. package/src/built-in/UIManager/src/gis-panel/example.ts +163 -163
  60. package/src/built-in/UIManager/src/gis-properties-panel/example.ts +168 -168
  61. package/src/built-in/UIManager/src/git-history-panel/example.ts +70 -70
  62. package/src/built-in/UIManager/src/map-panel/example.ts +189 -189
  63. package/src/built-in/UIManager/src/models-list/example.ts +181 -181
  64. package/src/built-in/UIManager/src/settings-panel/example.ts +303 -303
  65. package/src/built-in/UIManager/src/topics-panel/example.ts +170 -170
  66. package/src/built-in/UIManager/src/viewer/example.ts +182 -182
  67. package/src/built-in/UIManager/src/viewer-toolbar/example.ts +376 -376
  68. package/src/built-in/index.ts +2995 -2995
  69. package/src/cli/templates/app/README.md +250 -250
  70. package/src/cli/templates/app/index.html +35 -35
  71. package/src/cli/templates/app/package.json +32 -32
  72. package/src/cli/templates/app/src/app.ts +37 -37
  73. package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -50
  74. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
  75. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  76. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  77. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  78. package/src/cli/templates/app/src/globals.ts +1 -1
  79. package/src/cli/templates/app/src/main.history.ts +191 -191
  80. package/src/cli/templates/app/src/main.ts +226 -226
  81. package/src/cli/templates/app/src/setups/channel.ts +76 -76
  82. package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -88
  83. package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -166
  84. package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -31
  85. package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -51
  86. package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -1383
  87. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
  88. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
  89. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
  90. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
  91. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
  92. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
  93. package/src/cli/templates/app/src/ui-components/index.ts +2 -2
  94. package/src/cli/templates/app/tsconfig.json +16 -16
  95. package/src/cli/templates/app/vite.config.js +57 -57
  96. package/src/cli/templates/cloud-component/README.md +205 -205
  97. package/src/cli/templates/cloud-component/_thatopen +5 -5
  98. package/src/cli/templates/cloud-component/declarations.json +4 -4
  99. package/src/cli/templates/cloud-component/package.json +21 -21
  100. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  101. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  102. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  103. package/src/cli/templates/shared/AGENTS.md +8 -8
  104. package/src/cli/templates/shared/CLAUDE.md +1 -1
  105. package/src/cli/templates/shared/_gitignore +5 -5
  106. package/src/core/examples/.env.example +7 -7
  107. package/src/core/examples/apps.ts +67 -67
  108. package/src/core/examples/batch-reads.ts +99 -99
  109. package/src/core/examples/channel.ts +65 -65
  110. package/src/core/examples/components.ts +91 -91
  111. package/src/core/examples/execution.ts +75 -75
  112. package/src/core/examples/file-metadata.ts +94 -94
  113. package/src/core/examples/files.ts +81 -81
  114. package/src/core/examples/folders.ts +82 -82
  115. package/src/core/examples/hidden-files.ts +88 -88
  116. package/src/core/examples/history.ts +103 -103
  117. package/src/core/examples/icons.ts +68 -68
  118. package/src/core/examples/permissions.ts +87 -87
@@ -1,124 +1,124 @@
1
- /* MD
2
- ## ProjectManager
3
- ---
4
- Project-level configuration and data — GIS origin, georeferencing, app
5
- settings, and other project-scoped concerns — need a single canonical place
6
- to live. Without it, every builtin that needs to persist something at the
7
- project level (not per-file, not per-user) ends up inventing its own file,
8
- its own save/load pattern, and its own place to put it.
9
-
10
- ProjectManager is that canonical store. It persists one JSON file
11
- (`${ProjectManager.uuid}.json`) loose directly inside `__project_data` — the
12
- same folder convention `GISManager` already used — rather than in a
13
- per-app subfolder like `collider`/`cde`, which are reserved for secondary,
14
- per-builtin data.
15
-
16
- This tutorial covers initializing the manager from the platform client; the
17
- `origin` and `graphicsSettings` singletons; the `assetCoordinates`
18
- collection used for splats and point clouds; auto-save and its events; and
19
- the read-only namespace introspection API.
20
-
21
- ProjectManager has no built-in UI panel — it's a pure data layer. Apps that
22
- need georeferencing or project-settings UI (like Aqualia's viewer) build it
23
- on top of this.
24
-
25
- ### 🖖 Importing our libraries
26
- */
27
-
28
- import * as OBC from "@thatopen/components";
29
- import { PlatformClient, ProjectManager } from "@thatopen/services";
30
-
31
-
32
- /* MD
33
- ### 🚀 Initializing ProjectManager
34
- Like any other built-in, ProjectManager is set up through the platform
35
- client. `client.setup(...)` resolves the shared `OBC.Components` instance
36
- and gives us back everything we need.
37
- */
38
-
39
- const client = PlatformClient.fromPlatformContext();
40
-
41
- const { components } = (await client.setup(
42
- { OBC },
43
- { uuid: ProjectManager.uuid },
44
- )) as { components: OBC.Components };
45
-
46
- const manager = components.get(ProjectManager);
47
-
48
- /* MD
49
- `init(client)` loads the persisted JSON for the current project — or
50
- creates it with the default schema if it doesn't exist yet. `manager.ready`
51
- flips to `true` once that's done, and the entity accessors below are only
52
- safe to use after that.
53
- */
54
-
55
- await manager.init(client);
56
- console.log("ready:", manager.ready);
57
- console.log("namespaces:", manager.getNamespaces());
58
-
59
- manager.onSaveStart.add(() => console.log("[event] onSaveStart"));
60
- manager.onSaveComplete.add((success) => console.log("[event] onSaveComplete:", success));
61
-
62
- /* MD
63
- ### 📍 origin — a singleton entity
64
- `origin` holds the project's GIS origin: latitude, longitude, height, and
65
- rotation. Singletons expose `get`/`set`/`update`; `set` replaces the whole
66
- value, `update` merges a partial one. Both schedule a debounced auto-save —
67
- call `flush()` to force it immediately and await completion.
68
- */
69
-
70
- console.log("origin before:", manager.origin.get());
71
-
72
- await manager.origin.set({ lat: 40.4164, lon: -3.7038, height: 700, rotation: 0 });
73
- await manager.origin.update({ height: 710 });
74
- await manager.flush();
75
-
76
- console.log("origin after update+flush:", manager.origin.get());
77
-
78
- /* MD
79
- ### 🖼️ assetCoordinates — the files collection
80
- `assetCoordinates` georeferences individual files — splats, point clouds —
81
- that live outside the BIM model tree. Unlike sites, entries are keyed by
82
- the caller-supplied `fileId`, since that id already comes from the platform
83
- and is stable by construction.
84
- */
85
-
86
- await manager.assetCoordinates.set("splat_1", {
87
- type: "splat",
88
- lat: 40.416600807789145,
89
- lon: -3.703739209785748,
90
- height: 727.2700125737748,
91
- rotation: 0,
92
- });
93
- await manager.flush();
94
-
95
- console.log("splats:", manager.assetCoordinates.getByType("splat"));
96
- console.log("splat_1:", manager.assetCoordinates.get("splat_1"));
97
-
98
- /* MD
99
- ### ⚙️ graphicsSettings — another singleton
100
- Same shape as `origin` — `get`/`set`/`update`, debounced auto-save.
101
- */
102
-
103
- await manager.graphicsSettings.update({ /* project-wide graphics defaults */ } as any);
104
- await manager.flush();
105
-
106
- console.log("graphicsSettings:", manager.graphicsSettings.get());
107
-
108
- /* MD
109
- ### 🔍 Namespaces — read-only introspection
110
- `getNamespaces()` lists the closed set of namespaces the schema defines;
111
- `getNamespace(key)` returns every entity registered under one. Useful for
112
- debugging or building a generic project-data inspector — not for reading
113
- values you already know the shape of, which is what the entity accessors
114
- above are for.
115
- */
116
-
117
- console.log("georeferencing namespace:", manager.getNamespace("georeferencing"));
118
-
119
- /* MD
120
- ### 🤖 What's not covered here
121
- ProjectManager ships without a UI panel — everything above is the data
122
- layer only. Building georeferencing or project-settings UI on top of
123
- `origin`/`crs`/`assetCoordinates` is up to the consuming app.
124
- */
1
+ /* MD
2
+ ## ProjectManager
3
+ ---
4
+ Project-level configuration and data — GIS origin, georeferencing, app
5
+ settings, and other project-scoped concerns — need a single canonical place
6
+ to live. Without it, every builtin that needs to persist something at the
7
+ project level (not per-file, not per-user) ends up inventing its own file,
8
+ its own save/load pattern, and its own place to put it.
9
+
10
+ ProjectManager is that canonical store. It persists one JSON file
11
+ (`${ProjectManager.uuid}.json`) loose directly inside `__project_data` — the
12
+ same folder convention `GISManager` already used — rather than in a
13
+ per-app subfolder like `collider`/`cde`, which are reserved for secondary,
14
+ per-builtin data.
15
+
16
+ This tutorial covers initializing the manager from the platform client; the
17
+ `origin` and `graphicsSettings` singletons; the `assetCoordinates`
18
+ collection used for splats and point clouds; auto-save and its events; and
19
+ the read-only namespace introspection API.
20
+
21
+ ProjectManager has no built-in UI panel — it's a pure data layer. Apps that
22
+ need georeferencing or project-settings UI (like Aqualia's viewer) build it
23
+ on top of this.
24
+
25
+ ### 🖖 Importing our libraries
26
+ */
27
+
28
+ import * as OBC from "@thatopen/components";
29
+ import { PlatformClient, ProjectManager } from "@thatopen/services";
30
+
31
+
32
+ /* MD
33
+ ### 🚀 Initializing ProjectManager
34
+ Like any other built-in, ProjectManager is set up through the platform
35
+ client. `client.setup(...)` resolves the shared `OBC.Components` instance
36
+ and gives us back everything we need.
37
+ */
38
+
39
+ const client = PlatformClient.fromPlatformContext();
40
+
41
+ const { components } = (await client.setup(
42
+ { OBC },
43
+ { uuid: ProjectManager.uuid },
44
+ )) as { components: OBC.Components };
45
+
46
+ const manager = components.get(ProjectManager);
47
+
48
+ /* MD
49
+ `init(client)` loads the persisted JSON for the current project — or
50
+ creates it with the default schema if it doesn't exist yet. `manager.ready`
51
+ flips to `true` once that's done, and the entity accessors below are only
52
+ safe to use after that.
53
+ */
54
+
55
+ await manager.init(client);
56
+ console.log("ready:", manager.ready);
57
+ console.log("namespaces:", manager.getNamespaces());
58
+
59
+ manager.onSaveStart.add(() => console.log("[event] onSaveStart"));
60
+ manager.onSaveComplete.add((success) => console.log("[event] onSaveComplete:", success));
61
+
62
+ /* MD
63
+ ### 📍 origin — a singleton entity
64
+ `origin` holds the project's GIS origin: latitude, longitude, height, and
65
+ rotation. Singletons expose `get`/`set`/`update`; `set` replaces the whole
66
+ value, `update` merges a partial one. Both schedule a debounced auto-save —
67
+ call `flush()` to force it immediately and await completion.
68
+ */
69
+
70
+ console.log("origin before:", manager.origin.get());
71
+
72
+ await manager.origin.set({ lat: 40.4164, lon: -3.7038, height: 700, rotation: 0 });
73
+ await manager.origin.update({ height: 710 });
74
+ await manager.flush();
75
+
76
+ console.log("origin after update+flush:", manager.origin.get());
77
+
78
+ /* MD
79
+ ### 🖼️ assetCoordinates — the files collection
80
+ `assetCoordinates` georeferences individual files — splats, point clouds —
81
+ that live outside the BIM model tree. Unlike sites, entries are keyed by
82
+ the caller-supplied `fileId`, since that id already comes from the platform
83
+ and is stable by construction.
84
+ */
85
+
86
+ await manager.assetCoordinates.set("splat_1", {
87
+ type: "splat",
88
+ lat: 40.416600807789145,
89
+ lon: -3.703739209785748,
90
+ height: 727.2700125737748,
91
+ rotation: 0,
92
+ });
93
+ await manager.flush();
94
+
95
+ console.log("splats:", manager.assetCoordinates.getByType("splat"));
96
+ console.log("splat_1:", manager.assetCoordinates.get("splat_1"));
97
+
98
+ /* MD
99
+ ### ⚙️ graphicsSettings — another singleton
100
+ Same shape as `origin` — `get`/`set`/`update`, debounced auto-save.
101
+ */
102
+
103
+ await manager.graphicsSettings.update({ /* project-wide graphics defaults */ } as any);
104
+ await manager.flush();
105
+
106
+ console.log("graphicsSettings:", manager.graphicsSettings.get());
107
+
108
+ /* MD
109
+ ### 🔍 Namespaces — read-only introspection
110
+ `getNamespaces()` lists the closed set of namespaces the schema defines;
111
+ `getNamespace(key)` returns every entity registered under one. Useful for
112
+ debugging or building a generic project-data inspector — not for reading
113
+ values you already know the shape of, which is what the entity accessors
114
+ above are for.
115
+ */
116
+
117
+ console.log("georeferencing namespace:", manager.getNamespace("georeferencing"));
118
+
119
+ /* MD
120
+ ### 🤖 What's not covered here
121
+ ProjectManager ships without a UI panel — everything above is the data
122
+ layer only. Building georeferencing or project-settings UI on top of
123
+ `origin`/`crs`/`assetCoordinates` is up to the consuming app.
124
+ */
@@ -1,97 +1,97 @@
1
- /* MD
2
- ## top-app
3
- ---
4
- Front-end developers building BIM web apps need to coordinate several async
5
- initialization steps before the UI can be shown — loading the engine, preparing
6
- fragment workers, registering loaders — and users need visible feedback on what
7
- is happening during that wait, rather than a blank screen.
8
-
9
- top-app is the platform's root shell element. It manages the full boot sequence,
10
- tracks each async setup task individually, shows a labelled loading screen until
11
- every task completes, and then mounts the app's visual layout.
12
-
13
- This tutorial covers initializing the platform client and registering all
14
- platform web components; registering two async setup tasks — the fragment worker
15
- and the IFC loader — each with its own loading-screen label; declaring a named
16
- layout area as a CSS grid template; wiring a 3D viewer into that layout; and
17
- using a flag to keep the loading screen visible during development.
18
-
19
- By the end, you'll have a working app shell that boots the engine, shows a
20
- step-by-step loading screen, and mounts a 3D viewer once every setup task
21
- resolves.
22
- */
23
-
24
- import { html } from "lit";
25
- import * as THREE from "three";
26
- import * as OBC from "@thatopen/components";
27
- import * as OBF from "@thatopen/components-front";
28
- import * as FRAGS from "@thatopen/fragments";
29
- import * as BUI from "@thatopen/ui";
30
- import { PlatformClient, UIManager } from "@thatopen/services";
31
- import type { App } from "./index";
32
-
33
-
34
- const client = PlatformClient.fromPlatformContext();
35
-
36
- // UIManager must be in the setup call: it registers all platform web components
37
- // (top-app, top-viewer, top-viewer-tools, etc.) before the DOM renders.
38
- const { components } = (await client.setup(
39
- { OBC, OBF, BUI, THREE, FRAGS },
40
- { uuid: UIManager.uuid },
41
- )) as { components: OBC.Components };
42
-
43
- components.get(UIManager).init();
44
-
45
- const app = document.createElement("top-app") as unknown as App;
46
-
47
- // setup runs synchronously and returns { components, client }.
48
- // waitUntil registers async tasks that appear as labelled steps in the loading screen.
49
- // All tasks run in parallel; top-app mounts only after every promise resolves.
50
- app.setup = (waitUntil) => {
51
- waitUntil(
52
- (async () => {
53
- const fragments = components.get(OBC.FragmentsManager);
54
- const workerUrl = await FRAGS.FragmentsModels.getWorker();
55
- fragments.init(await FRAGS.toClassicWorker(workerUrl), {
56
- classicWorker: true,
57
- });
58
- })(),
59
- "Fragments Core",
60
- );
61
-
62
- waitUntil(
63
- (async () => {
64
- const loader = components.get(OBC.IfcLoader);
65
- await loader.setup();
66
- })(),
67
- "IFC Loader",
68
- );
69
-
70
- return { components, client };
71
- };
72
-
73
- // Each key must match an area name used in at least one layout template.
74
- app.elements = {
75
- viewer: () =>
76
- html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
77
- };
78
-
79
- // CSS grid-template shorthand. Area names are the keys for app.elements.
80
- // "." creates an empty unnamed cell and is never rendered.
81
- app.layouts = {
82
- main: {
83
- label: "Main",
84
- icon: "solar:3d-square-bold",
85
- template: `"viewer" 1fr / 1fr`,
86
- },
87
- };
88
-
89
- app.layout = "main";
90
-
91
- // forceLoading keeps the boot screen visible even after setup completes.
92
- // Useful during development to inspect the loading UI without real async tasks.
93
- // app.forceLoading = true;
94
-
95
- const container = document.getElementById("that-open-app") ?? document.body;
96
- container.appendChild(app);
97
- document.body.style.margin = "0";
1
+ /* MD
2
+ ## top-app
3
+ ---
4
+ Front-end developers building BIM web apps need to coordinate several async
5
+ initialization steps before the UI can be shown — loading the engine, preparing
6
+ fragment workers, registering loaders — and users need visible feedback on what
7
+ is happening during that wait, rather than a blank screen.
8
+
9
+ top-app is the platform's root shell element. It manages the full boot sequence,
10
+ tracks each async setup task individually, shows a labelled loading screen until
11
+ every task completes, and then mounts the app's visual layout.
12
+
13
+ This tutorial covers initializing the platform client and registering all
14
+ platform web components; registering two async setup tasks — the fragment worker
15
+ and the IFC loader — each with its own loading-screen label; declaring a named
16
+ layout area as a CSS grid template; wiring a 3D viewer into that layout; and
17
+ using a flag to keep the loading screen visible during development.
18
+
19
+ By the end, you'll have a working app shell that boots the engine, shows a
20
+ step-by-step loading screen, and mounts a 3D viewer once every setup task
21
+ resolves.
22
+ */
23
+
24
+ import { html } from "lit";
25
+ import * as THREE from "three";
26
+ import * as OBC from "@thatopen/components";
27
+ import * as OBF from "@thatopen/components-front";
28
+ import * as FRAGS from "@thatopen/fragments";
29
+ import * as BUI from "@thatopen/ui";
30
+ import { PlatformClient, UIManager } from "@thatopen/services";
31
+ import type { App } from "./index";
32
+
33
+
34
+ const client = PlatformClient.fromPlatformContext();
35
+
36
+ // UIManager must be in the setup call: it registers all platform web components
37
+ // (top-app, top-viewer, top-viewer-tools, etc.) before the DOM renders.
38
+ const { components } = (await client.setup(
39
+ { OBC, OBF, BUI, THREE, FRAGS },
40
+ { uuid: UIManager.uuid },
41
+ )) as { components: OBC.Components };
42
+
43
+ components.get(UIManager).init();
44
+
45
+ const app = document.createElement("top-app") as unknown as App;
46
+
47
+ // setup runs synchronously and returns { components, client }.
48
+ // waitUntil registers async tasks that appear as labelled steps in the loading screen.
49
+ // All tasks run in parallel; top-app mounts only after every promise resolves.
50
+ app.setup = (waitUntil) => {
51
+ waitUntil(
52
+ (async () => {
53
+ const fragments = components.get(OBC.FragmentsManager);
54
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
55
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), {
56
+ classicWorker: true,
57
+ });
58
+ })(),
59
+ "Fragments Core",
60
+ );
61
+
62
+ waitUntil(
63
+ (async () => {
64
+ const loader = components.get(OBC.IfcLoader);
65
+ await loader.setup();
66
+ })(),
67
+ "IFC Loader",
68
+ );
69
+
70
+ return { components, client };
71
+ };
72
+
73
+ // Each key must match an area name used in at least one layout template.
74
+ app.elements = {
75
+ viewer: () =>
76
+ html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
77
+ };
78
+
79
+ // CSS grid-template shorthand. Area names are the keys for app.elements.
80
+ // "." creates an empty unnamed cell and is never rendered.
81
+ app.layouts = {
82
+ main: {
83
+ label: "Main",
84
+ icon: "solar:3d-square-bold",
85
+ template: `"viewer" 1fr / 1fr`,
86
+ },
87
+ };
88
+
89
+ app.layout = "main";
90
+
91
+ // forceLoading keeps the boot screen visible even after setup completes.
92
+ // Useful during development to inspect the loading UI without real async tasks.
93
+ // app.forceLoading = true;
94
+
95
+ const container = document.getElementById("that-open-app") ?? document.body;
96
+ container.appendChild(app);
97
+ document.body.style.margin = "0";