@thatopen/services 0.3.8 → 0.3.10

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.
@@ -27,8 +27,7 @@ import * as OBC from "@thatopen/components";
27
27
  import * as OBF from "@thatopen/components-front";
28
28
  import * as FRAGS from "@thatopen/fragments";
29
29
  import * as BUI from "@thatopen/ui";
30
- import { PlatformClient, ProjectData } from "thatopen-services";
31
- import uiManagerDef from "../../../../index";
30
+ import { PlatformClient, ProjectData, UIManager } from "@thatopen/services";
32
31
  import {
33
32
  componentsContext,
34
33
  clientContext,
@@ -78,7 +77,6 @@ class ProjectInfoPanel extends LitElement {
78
77
 
79
78
  // ---- app wiring ----
80
79
 
81
- const UIManager = uiManagerDef.componentDefinition;
82
80
  const client = PlatformClient.fromPlatformContext();
83
81
  const { components } = (await client.setup(
84
82
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -30,11 +30,9 @@ import * as OBC from "@thatopen/components";
30
30
  import * as OBF from "@thatopen/components-front";
31
31
  import * as FRAGS from "@thatopen/fragments";
32
32
  import * as BUI from "@thatopen/ui";
33
- import { PlatformClient } from "thatopen-services";
34
- import uiManagerDef from "../../../../index";
33
+ import { PlatformClient, UIManager } from "@thatopen/services";
35
34
  import type { App, AppReadyEvent } from "../../index";
36
35
 
37
- const UIManager = uiManagerDef.componentDefinition;
38
36
  const client = PlatformClient.fromPlatformContext();
39
37
  const { components } = (await client.setup(
40
38
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -26,11 +26,9 @@ import * as OBC from "@thatopen/components";
26
26
  import * as OBF from "@thatopen/components-front";
27
27
  import * as FRAGS from "@thatopen/fragments";
28
28
  import * as BUI from "@thatopen/ui";
29
- import { PlatformClient } from "thatopen-services";
30
- import uiManagerDef from "../../../../index";
29
+ import { PlatformClient, UIManager } from "@thatopen/services";
31
30
  import type { App } from "../../index";
32
31
 
33
- const UIManager = uiManagerDef.componentDefinition;
34
32
  const client = PlatformClient.fromPlatformContext();
35
33
  const { components } = (await client.setup(
36
34
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -27,8 +27,7 @@ import * as OBC from "@thatopen/components";
27
27
  import * as OBF from "@thatopen/components-front";
28
28
  import * as FRAGS from "@thatopen/fragments";
29
29
  import * as BUI from "@thatopen/ui";
30
- import { PlatformClient } from "thatopen-services";
31
- import uiManagerDef from "../../../../index";
30
+ import { PlatformClient, UIManager } from "@thatopen/services";
32
31
  import type { App } from "../../index";
33
32
 
34
33
  // A child component that triggers modals without holding a reference to top-app.
@@ -120,7 +119,6 @@ class ModalActions extends LitElement {
120
119
 
121
120
  // ---- app wiring ----
122
121
 
123
- const UIManager = uiManagerDef.componentDefinition;
124
122
  const client = PlatformClient.fromPlatformContext();
125
123
  const { components } = (await client.setup(
126
124
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -26,8 +26,7 @@ import * as OBC from "@thatopen/components";
26
26
  import * as OBF from "@thatopen/components-front";
27
27
  import * as FRAGS from "@thatopen/fragments";
28
28
  import * as BUI from "@thatopen/ui";
29
- import { PlatformClient } from "thatopen-services";
30
- import uiManagerDef from "../../../../index";
29
+ import { PlatformClient, UIManager } from "@thatopen/services";
31
30
  import type { App, AppReadyEvent } from "../../index";
32
31
 
33
32
  // A child component that dispatches top:notification to surface messages
@@ -83,7 +82,6 @@ class StatusReporter extends LitElement {
83
82
 
84
83
  // ---- app wiring ----
85
84
 
86
- const UIManager = uiManagerDef.componentDefinition;
87
85
  const client = PlatformClient.fromPlatformContext();
88
86
  const { components } = (await client.setup(
89
87
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -24,11 +24,9 @@ import * as OBC from "@thatopen/components";
24
24
  import * as OBF from "@thatopen/components-front";
25
25
  import * as FRAGS from "@thatopen/fragments";
26
26
  import * as BUI from "@thatopen/ui";
27
- import { PlatformClient } from "thatopen-services";
28
- import uiManagerDef from "../../../../index";
27
+ import { PlatformClient, UIManager } from "@thatopen/services";
29
28
  import type { App } from "../../index";
30
29
 
31
- const UIManager = uiManagerDef.componentDefinition;
32
30
  const client = PlatformClient.fromPlatformContext();
33
31
  const { components } = (await client.setup(
34
32
  { OBC, OBF, BUI, THREE, FRAGS },
@@ -1,164 +1,160 @@
1
- /* MD
2
- ## clashes-panel
3
- ---
4
- BIM coordinators need a dedicated review environment where they can see all
5
- detected clashes, filter by status, navigate to each issue in the 3D viewer,
6
- and mark items as resolved — without writing any UI code themselves.
7
-
8
- `clashes-panel` is a ready-made web component that delivers exactly that. It
9
- connects to `ClashesManager` automatically and manages the entire review
10
- workflow: the detection matrix, the clash table with status filters, sphere
11
- markers and element highlights in the viewer, run controls with live progress,
12
- and a loading skeleton while fresh data reloads after a run completes.
13
-
14
- This tutorial covers the prerequisites before mounting the panel; dropping it
15
- into a `top-app` layout alongside a 3D viewer; and a detailed breakdown of
16
- everything the panel handles automatically so you know what you do not need to
17
- implement yourself.
18
-
19
- By the end, you'll have a fully working clash-review environment running in
20
- your application with a single line of markup.
21
- */
22
-
23
- import { html } from "lit";
24
- import * as THREE from "three";
25
- import * as OBC from "@thatopen/components";
26
- import * as OBF from "@thatopen/components-front";
27
- import * as FRAGS from "@thatopen/fragments";
28
- import * as BUI from "@thatopen/ui";
29
- import { PlatformClient } from "thatopen-services";
30
- import uiManagerDef from "../../../index";
31
- import clashesManagerDef from "../../../ClashesManager/index";
32
- import type { App } from "../app/index";
33
-
34
- const UIManager = uiManagerDef.componentDefinition;
35
- const ClashesManager = clashesManagerDef.componentDefinition;
36
-
37
- /* MD
38
- ### ✅ Prerequisites
39
-
40
- Two conditions must be met before the panel mounts:
41
-
42
- 1. **`UIManager` must be in the setup call.** It registers all platform web
43
- components, including `<clashes-panel>` itself. Without it the element is
44
- unknown to the browser and renders as an empty box.
45
-
46
- 2. **`ClashesManager.init(client)` must have resolved.** The panel reads all
47
- its initial data from the manager in `connectedCallback`. If `init` has not
48
- finished, the panel mounts into an empty state and never catches up because
49
- it only subscribes to change events — it does not poll.
50
-
51
- Both conditions are naturally satisfied when you call `init` before appending
52
- `top-app` to the document, which is the pattern shown below.
53
- */
54
-
55
- const client = PlatformClient.fromPlatformContext();
56
-
57
- const { components } = (await client.setup(
58
- { OBC, OBF, BUI, THREE, FRAGS },
59
- { uuid: UIManager.uuid },
60
- { uuid: ClashesManager.uuid },
61
- )) as { components: OBC.Components };
62
-
63
- components.get(UIManager).init();
64
-
65
- // init must resolve before top-app (and therefore clashes-panel) mounts.
66
- await components.get(ClashesManager).init(client);
67
-
68
- /* MD
69
- ### 🖥️ Wiring the panel
70
-
71
- Add `clashes-panel` as a named area in `app.elements` and reference it in your
72
- layout template. A side-by-side layout with the 3D viewer is the most natural
73
- arrangement — the panel controls markers and highlights directly in the scene.
74
- */
75
-
76
- const app = document.createElement("top-app") as unknown as App;
77
-
78
- app.setup = (waitUntil) => {
79
- waitUntil(
80
- (async () => {
81
- const fragments = components.get(OBC.FragmentsManager);
82
- const workerUrl = await FRAGS.FragmentsModels.getWorker();
83
- fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
84
- })(),
85
- "Fragments Core",
86
- );
87
-
88
- waitUntil(
89
- (async () => {
90
- const loader = components.get(OBC.IfcLoader);
91
- await loader.setup();
92
- })(),
93
- "IFC Loader",
94
- );
95
-
96
- return { components, client };
97
- };
98
-
99
- app.elements = {
100
- viewer: () => html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
101
- clashes: () => html`<clashes-panel></clashes-panel>`,
102
- };
103
-
104
- app.layouts = {
105
- main: {
106
- label: "Main",
107
- icon: "solar:3d-square-bold",
108
- template: `"viewer clashes" 1fr / 1fr 22rem`,
109
- },
110
- };
111
-
112
- app.layout = "main";
113
-
114
- const container = document.getElementById("that-open-app") ?? document.body;
115
- container.appendChild(app);
116
- document.body.style.margin = "0";
117
-
118
- /* MD
119
- ### 🤖 What the panel manages automatically
120
-
121
- Once mounted, `clashes-panel` takes ownership of the following without any
122
- further code from you:
123
-
124
- **Data synchronization** — the panel subscribes to every `ClashesManager`
125
- event (`onJobsChanged`, `onRunsChanged`, `onClashesChanged`,
126
- `onClashStatusChanged`, `onQueriesChanged`, `onRunningJobsChanged`) and keeps
127
- its tables in sync. Changes made programmatically through the manager API are
128
- reflected in the panel immediately.
129
-
130
- **Run lifecycle** — a progress callout appears as soon as a run starts
131
- (`onRunProgress`), updates its percentage and message in real time, and
132
- disappears when the run completes or errors. If a run was already in progress
133
- when the page loaded, the panel calls `reconnectIfRunning` automatically when
134
- the user opens that job.
135
-
136
- **Post-run reload skeleton** — after a successful run the manager reloads clash
137
- data from storage. During that window (`onReloadingChanged = true`) the panel
138
- replaces its entire content with an animated skeleton so the user is never left
139
- looking at stale results that appear final.
140
-
141
- **Sphere markers** — entering a job view places colored spheres in the 3D scene
142
- at each clash location, transformed from IFC world space to viewer space.
143
- Selecting a clash in the table zooms the camera, ghosts unrelated elements, and
144
- re-focuses the markers on the selection. Leaving the job view removes all
145
- markers and restores the full scene.
146
-
147
- **Element highlights** — element A is highlighted green and element B red for
148
- every new or active clash in the current job. Selecting a single clash refines
149
- the highlight to that pair only. Clearing the selection or changing status
150
- restores the full job highlight.
151
-
152
- **Model awareness** — the panel tracks which fragment models are currently
153
- loaded in the scene. Markers and highlights are activated only when the relevant
154
- models are present, and are cleaned up automatically if a model is disposed
155
- while the panel is open.
156
-
157
- **Save indicator** — a subtle indicator appears while auto-save is in progress
158
- (`onSaveStart`) and disappears once the write confirms (`onSaveComplete`), so
159
- users know their status changes and query edits are persisted.
160
-
161
- **Disconnection cleanup** — when the panel is removed from the DOM it calls
162
- `hideMarkers` and `clearClashHighlight` on the manager, leaving the 3D scene
163
- clean regardless of what was selected at the time.
164
- */
1
+ /* MD
2
+ ## clashes-panel
3
+ ---
4
+ BIM coordinators need a dedicated review environment where they can see all
5
+ detected clashes, filter by status, navigate to each issue in the 3D viewer,
6
+ and mark items as resolved — without writing any UI code themselves.
7
+
8
+ `clashes-panel` is a ready-made web component that delivers exactly that. It
9
+ connects to `ClashesManager` automatically and manages the entire review
10
+ workflow: the detection matrix, the clash table with status filters, sphere
11
+ markers and element highlights in the viewer, run controls with live progress,
12
+ and a loading skeleton while fresh data reloads after a run completes.
13
+
14
+ This tutorial covers the prerequisites before mounting the panel; dropping it
15
+ into a `top-app` layout alongside a 3D viewer; and a detailed breakdown of
16
+ everything the panel handles automatically so you know what you do not need to
17
+ implement yourself.
18
+
19
+ By the end, you'll have a fully working clash-review environment running in
20
+ your application with a single line of markup.
21
+ */
22
+
23
+ import { html } from "lit";
24
+ import * as THREE from "three";
25
+ import * as OBC from "@thatopen/components";
26
+ import * as OBF from "@thatopen/components-front";
27
+ import * as FRAGS from "@thatopen/fragments";
28
+ import * as BUI from "@thatopen/ui";
29
+ import { PlatformClient, UIManager, ClashesManager } from "@thatopen/services";
30
+ import type { App } from "../app/index";
31
+
32
+
33
+ /* MD
34
+ ### ✅ Prerequisites
35
+
36
+ Two conditions must be met before the panel mounts:
37
+
38
+ 1. **`UIManager` must be in the setup call.** It registers all platform web
39
+ components, including `<top-clashes-panel>` itself. Without it the element is
40
+ unknown to the browser and renders as an empty box.
41
+
42
+ 2. **`ClashesManager.init(client)` must have resolved.** The panel reads all
43
+ its initial data from the manager in `connectedCallback`. If `init` has not
44
+ finished, the panel mounts into an empty state and never catches up because
45
+ it only subscribes to change events — it does not poll.
46
+
47
+ Both conditions are naturally satisfied when you call `init` before appending
48
+ `top-app` to the document, which is the pattern shown below.
49
+ */
50
+
51
+ const client = PlatformClient.fromPlatformContext();
52
+
53
+ const { components } = (await client.setup(
54
+ { OBC, OBF, BUI, THREE, FRAGS },
55
+ { uuid: UIManager.uuid },
56
+ { uuid: ClashesManager.uuid },
57
+ )) as { components: OBC.Components };
58
+
59
+ components.get(UIManager).init();
60
+
61
+ // init must resolve before top-app (and therefore clashes-panel) mounts.
62
+ await components.get(ClashesManager).init(client);
63
+
64
+ /* MD
65
+ ### 🖥️ Wiring the panel
66
+
67
+ Add `clashes-panel` as a named area in `app.elements` and reference it in your
68
+ layout template. A side-by-side layout with the 3D viewer is the most natural
69
+ arrangement — the panel controls markers and highlights directly in the scene.
70
+ */
71
+
72
+ const app = document.createElement("top-app") as unknown as App;
73
+
74
+ app.setup = (waitUntil) => {
75
+ waitUntil(
76
+ (async () => {
77
+ const fragments = components.get(OBC.FragmentsManager);
78
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
79
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
80
+ })(),
81
+ "Fragments Core",
82
+ );
83
+
84
+ waitUntil(
85
+ (async () => {
86
+ const loader = components.get(OBC.IfcLoader);
87
+ await loader.setup();
88
+ })(),
89
+ "IFC Loader",
90
+ );
91
+
92
+ return { components, client };
93
+ };
94
+
95
+ app.elements = {
96
+ viewer: () => html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
97
+ clashes: () => html`<top-clashes-panel></top-clashes-panel>`,
98
+ };
99
+
100
+ app.layouts = {
101
+ main: {
102
+ label: "Main",
103
+ icon: "solar:3d-square-bold",
104
+ template: `"viewer clashes" 1fr / 1fr 22rem`,
105
+ },
106
+ };
107
+
108
+ app.layout = "main";
109
+
110
+ const container = document.getElementById("that-open-app") ?? document.body;
111
+ container.appendChild(app);
112
+ document.body.style.margin = "0";
113
+
114
+ /* MD
115
+ ### 🤖 What the panel manages automatically
116
+
117
+ Once mounted, `clashes-panel` takes ownership of the following without any
118
+ further code from you:
119
+
120
+ **Data synchronization** — the panel subscribes to every `ClashesManager`
121
+ event (`onJobsChanged`, `onRunsChanged`, `onClashesChanged`,
122
+ `onClashStatusChanged`, `onQueriesChanged`, `onRunningJobsChanged`) and keeps
123
+ its tables in sync. Changes made programmatically through the manager API are
124
+ reflected in the panel immediately.
125
+
126
+ **Run lifecycle** — a progress callout appears as soon as a run starts
127
+ (`onRunProgress`), updates its percentage and message in real time, and
128
+ disappears when the run completes or errors. If a run was already in progress
129
+ when the page loaded, the panel calls `reconnectIfRunning` automatically when
130
+ the user opens that job.
131
+
132
+ **Post-run reload skeleton** — after a successful run the manager reloads clash
133
+ data from storage. During that window (`onReloadingChanged = true`) the panel
134
+ replaces its entire content with an animated skeleton so the user is never left
135
+ looking at stale results that appear final.
136
+
137
+ **Sphere markers** — entering a job view places colored spheres in the 3D scene
138
+ at each clash location, transformed from IFC world space to viewer space.
139
+ Selecting a clash in the table zooms the camera, ghosts unrelated elements, and
140
+ re-focuses the markers on the selection. Leaving the job view removes all
141
+ markers and restores the full scene.
142
+
143
+ **Element highlights** — element A is highlighted green and element B red for
144
+ every new or active clash in the current job. Selecting a single clash refines
145
+ the highlight to that pair only. Clearing the selection or changing status
146
+ restores the full job highlight.
147
+
148
+ **Model awareness** — the panel tracks which fragment models are currently
149
+ loaded in the scene. Markers and highlights are activated only when the relevant
150
+ models are present, and are cleaned up automatically if a model is disposed
151
+ while the panel is open.
152
+
153
+ **Save indicator** — a subtle indicator appears while auto-save is in progress
154
+ (`onSaveStart`) and disappears once the write confirms (`onSaveComplete`), so
155
+ users know their status changes and query edits are persisted.
156
+
157
+ **Disconnection cleanup** — when the panel is removed from the DOM it calls
158
+ `hideMarkers` and `clearClashHighlight` on the manager, leaving the 3D scene
159
+ clean regardless of what was selected at the time.
160
+ */
@@ -14,12 +14,10 @@ import * as OBC from "@thatopen/components";
14
14
  import * as OBF from "@thatopen/components-front";
15
15
  import * as FRAGS from "@thatopen/fragments";
16
16
  import * as BUI from "@thatopen/ui";
17
- import { PlatformClient } from "thatopen-services";
18
- import uiManagerDef from "../../index";
17
+ import { PlatformClient, UIManager } from "@thatopen/services";
19
18
  import type { App } from "../app/index";
20
19
  import type { ModelsList } from "./index";
21
20
 
22
- const UIManager = uiManagerDef.componentDefinition;
23
21
 
24
22
  const client = PlatformClient.fromPlatformContext();
25
23