@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,303 +1,303 @@
1
- /* MD
2
- ## top-settings-panel
3
- ---
4
- Every viewer app ends up needing the same settings screen: rendering
5
- options, clip/measurement styling, a "which cloud component converts this
6
- format" picker, a keyboard-shortcut reference — plus a search box that
7
- filters all of it and a "restore defaults" button that resets whatever has
8
- persisted state. Building that, and keeping it in sync with the tools it
9
- configures, is real work before you've added a single setting of your own.
10
-
11
- `top-settings-panel` is a ready-made web component that delivers exactly
12
- that. Mounted as-is, it's a complete, self-wiring Settings panel. But like
13
- `top-viewer-toolbar` (see that tutorial), it's built out of standalone,
14
- individually-importable `<top-*-settings>` elements — so you can drop the
15
- panel it builds for you and compose your own layout out of the same
16
- pieces, mixed freely with sections of your own.
17
-
18
- This tutorial covers the prerequisites; the default, batteries-included
19
- panel; what it manages automatically; building your own section with
20
- `bim-panel-section`; and composing a custom layout with `headless`.
21
-
22
- By the end, you'll have a working default panel plus your own custom
23
- section, both wired into the same shared search box and reset button as
24
- the stock ones.
25
- */
26
-
27
- import { html, LitElement } from "lit";
28
- import { customElement, state } from "lit/decorators.js";
29
- import { consume } from "@lit/context";
30
- import * as THREE from "three";
31
- import * as OBC from "@thatopen/components";
32
- import * as OBF from "@thatopen/components-front";
33
- import * as FRAGS from "@thatopen/fragments";
34
- import * as BUI from "@thatopen/ui";
35
- import { PlatformClient, UIManager } from "@thatopen/services";
36
- // TODO(#34 follow-up): `settingsSearchContext` is not part of the published
37
- // `@thatopen/services` surface yet — see the TODO in settings-panel/index.ts.
38
- // Imported by local relative path until the distribute pipeline exports
39
- // context objects too; same workaround `app/examples/Contexts/example.ts`
40
- // uses for `componentsContext`/`clientContext`.
41
- import { settingsSearchContext } from "./src/context";
42
- import type { App } from "../app/index";
43
-
44
- /* MD
45
- ### ✅ Prerequisites
46
-
47
- `UIManager` must be in the setup call so `<top-settings-panel>` and every
48
- `<top-*-settings>` element are registered. `<top-settings-panel>` must be
49
- mounted as a descendant of `<top-app>` — it and its sections consume
50
- `componentsContext`/`clientContext`, which `top-app` provides. It does
51
- **not** need to be a descendant of `<top-viewer>` specifically — but the
52
- sections that talk to the 3D engine (Graphics, Clip styling, Measurement,
53
- Commands) render an empty placeholder until a `<top-viewer>` exists
54
- somewhere in the same app, since that's what actually builds the tools they
55
- configure.
56
- */
57
-
58
- const client = PlatformClient.fromPlatformContext();
59
-
60
- const { components } = (await client.setup(
61
- { OBC, OBF, BUI, THREE, FRAGS },
62
- { uuid: UIManager.uuid },
63
- )) as { components: OBC.Components };
64
-
65
- components.get(UIManager).init();
66
-
67
- /* MD
68
- ### 🖥️ Default panel (batteries included)
69
-
70
- Add it as a plain element anywhere under `top-app` — a side-by-side layout
71
- with the 3D viewer is the most natural arrangement, since most of its
72
- sections act on what's in the scene:
73
-
74
- ```html
75
- <top-viewer>...</top-viewer>
76
- <top-settings-panel></top-settings-panel>
77
- ```
78
-
79
- ### 🤖 What the default panel manages automatically
80
-
81
- **Graphics** — point/line/edge styling, background, shadows, ambient
82
- occlusion — whatever `top-viewer` supports, persisted across reloads. When the
83
- app uses `GISManager`, a "GIS Map" group also appears, with the sky on/off, the
84
- horizon fade (how far before the camera's far plane the map dissolves, 0 = hard
85
- cut) and the sky's horizon and zenith colours.
86
-
87
- **Clip styling** — fill/edge color, opacity, width for the clip tool,
88
- shared live with `top-viewer-toolbar`'s clip button.
89
-
90
- **Measurement** — units (length/area/angle), color, decimals, per-snap-kind
91
- toggles, shared live with the toolbar's measurement buttons.
92
-
93
- **File conversion** — which provisioned cloud component converts each
94
- format when a file is opened, per project.
95
-
96
- **Commands** — a click-to-run shortcut reference (focus, hide, isolate,
97
- ghost, show all, clear selection) that also registers the actual keyboard
98
- shortcuts while mounted.
99
-
100
- **Search box** — sits at the top of the panel, above the sections, and
101
- filters every section's own rows by label, stock or custom, as long as a
102
- section opts in (see below).
103
-
104
- **Restore defaults** — a two-click-confirm button in the panel header that
105
- resets every
106
- section with persisted state (currently: Graphics) back to its defaults.
107
-
108
- ### 🧩 Building your own section
109
-
110
- A custom section is a `LitElement` that renders its own `<bim-panel-section>`
111
- — nothing about it is specific to `top-settings-panel` beyond that. Consume
112
- `settingsSearchContext` if you want the shared search box to filter your
113
- rows too; skip it and your section simply never filters.
114
- */
115
-
116
- @customElement("my-lidar-settings")
117
- class MyLidarSettings extends LitElement {
118
- @consume({ context: settingsSearchContext, subscribe: true })
119
- searchQuery = "";
120
-
121
- @state() private _pointBudget = 2_000_000;
122
- @state() private _showIntensity = false;
123
-
124
- render() {
125
- const rows = [
126
- {
127
- label: "Point budget",
128
- control: html`<bim-number-input
129
- label="Point budget"
130
- slider
131
- value=${this._pointBudget}
132
- min="100000"
133
- max="10000000"
134
- step="100000"
135
- @change=${(e: Event) => {
136
- this._pointBudget = Number((e.target as HTMLInputElement).value);
137
- }}
138
- ></bim-number-input>`,
139
- },
140
- {
141
- label: "Show intensity",
142
- control: html`<bim-checkbox
143
- label="Show intensity"
144
- toggle
145
- ?checked=${this._showIntensity}
146
- @change=${(e: Event) => {
147
- this._showIntensity = (e.target as HTMLInputElement).checked;
148
- }}
149
- ></bim-checkbox>`,
150
- },
151
- ];
152
-
153
- const q = this.searchQuery.trim().toLowerCase();
154
- const visible = q
155
- ? rows.filter((r) => r.label.toLowerCase().includes(q))
156
- : rows;
157
-
158
- return html`<bim-panel-section label="LIDAR" icon="mdi:radar">
159
- ${visible.length
160
- ? visible.map((r) => r.control)
161
- : html`<bim-label style="opacity: 0.6; font-size: 0.78rem;"
162
- >No settings match "${this.searchQuery}".</bim-label
163
- >`}
164
- </bim-panel-section>`;
165
- }
166
- }
167
-
168
- /* MD
169
- ### 🧱 Composing a custom layout with `headless`
170
-
171
- Set the `headless` attribute to skip the panel's own 5 stock sections —
172
- everything else (the search box, the reset button, both contexts) keeps
173
- running. Slot whatever `top-*-settings` elements and/or your own sections
174
- as light-DOM children, in whatever order you want; that's exactly what
175
- renders.
176
-
177
- The most common case: keep every stock section and just add your own —
178
- this is the live demo below.
179
-
180
- ```html
181
- <top-settings-panel headless>
182
- <top-graphic-settings></top-graphic-settings>
183
- <top-clipstyling-settings></top-clipstyling-settings>
184
- <top-measurement-settings></top-measurement-settings>
185
- <top-fileconversion-settings></top-fileconversion-settings>
186
- <top-commands-settings></top-commands-settings>
187
- <my-lidar-settings></my-lidar-settings>
188
- </top-settings-panel>
189
- ```
190
- */
191
-
192
- const app = document.createElement("top-app") as unknown as App;
193
-
194
- app.setup = (waitUntil) => {
195
- waitUntil(
196
- (async () => {
197
- const fragments = components.get(OBC.FragmentsManager);
198
- const workerUrl = await FRAGS.FragmentsModels.getWorker();
199
- fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
200
- })(),
201
- "Fragments Core",
202
- );
203
- return { components, client };
204
- };
205
-
206
- app.elements = {
207
- viewer: () =>
208
- html`<top-viewer><top-viewer-toolbar></top-viewer-toolbar></top-viewer>`,
209
- settings: () => html`
210
- <top-settings-panel headless>
211
- <top-graphic-settings></top-graphic-settings>
212
- <top-clipstyling-settings></top-clipstyling-settings>
213
- <top-measurement-settings></top-measurement-settings>
214
- <top-fileconversion-settings></top-fileconversion-settings>
215
- <top-commands-settings></top-commands-settings>
216
- <my-lidar-settings></my-lidar-settings>
217
- </top-settings-panel>
218
- `,
219
- };
220
-
221
- app.layouts = {
222
- main: {
223
- label: "Main",
224
- icon: "solar:3d-square-bold",
225
- template: `"viewer settings" 1fr / 1fr 22rem`,
226
- },
227
- };
228
-
229
- app.layout = "main";
230
-
231
- const container = document.getElementById("that-open-app") ?? document.body;
232
- container.appendChild(app);
233
- document.body.style.margin = "0";
234
-
235
- /* MD
236
- ### 🔀 A few other ways to compose it
237
-
238
- A lighter viewer that only needs Graphics plus its own section — drop
239
- everything else:
240
-
241
- ```html
242
- <top-settings-panel headless>
243
- <top-graphic-settings></top-graphic-settings>
244
- <my-lidar-settings></my-lidar-settings>
245
- </top-settings-panel>
246
- ```
247
-
248
- Reordering — `headless` respects DOM order, so Commands first is just:
249
-
250
- ```html
251
- <top-settings-panel headless>
252
- <top-commands-settings></top-commands-settings>
253
- <top-graphic-settings></top-graphic-settings>
254
- <top-clipstyling-settings></top-clipstyling-settings>
255
- <top-measurement-settings></top-measurement-settings>
256
- <top-fileconversion-settings></top-fileconversion-settings>
257
- </top-settings-panel>
258
- ```
259
-
260
- Swapping a single stock section for your own (e.g. Measurement with
261
- different units) — the same `headless` list, just with that one tag
262
- replaced:
263
-
264
- ```html
265
- <top-settings-panel headless>
266
- <top-graphic-settings></top-graphic-settings>
267
- <top-clipstyling-settings></top-clipstyling-settings>
268
- <my-measurement-settings></my-measurement-settings>
269
- <top-fileconversion-settings></top-fileconversion-settings>
270
- <top-commands-settings></top-commands-settings>
271
- </top-settings-panel>
272
- ```
273
-
274
- Keeping the full stock default and only ADDING a section, without going
275
- `headless` at all — the non-headless layout also projects a trailing
276
- `<slot>`, so any light-DOM children you give it render after the 5 stock
277
- sections:
278
-
279
- ```html
280
- <top-settings-panel>
281
- <my-lidar-settings></my-lidar-settings>
282
- </top-settings-panel>
283
- ```
284
-
285
- ### ⚠️ Gotchas
286
-
287
- - **Never `document.createElement` a `bim-*` element** — same rule as
288
- `top-viewer-toolbar`. Render them with lit's `html`/`render` (or, as
289
- here, from inside your own `LitElement`'s `render()`); never build them
290
- imperatively.
291
- - **A custom section renders its OWN `<bim-panel-section>`**, in its own
292
- shadow root — there's no API to inject rows into a stock section, only
293
- to sit alongside it.
294
- - **`fixed` layout quirk**: `<bim-panel-section>`'s default logic checks
295
- `this.closest("bim-panel")`, which can't see past your own section's
296
- shadow boundary — so, like the stock sections, a custom one may render
297
- with `fixed` behavior until the upstream `@thatopen/ui` fix ships. Not
298
- something to work around here; tracked separately.
299
- - **Search filtering is opt-in per section** — consuming
300
- `settingsSearchContext` is what makes a section respond to the shared
301
- search box; forgetting it just means that section never filters, not an
302
- error.
303
- */
1
+ /* MD
2
+ ## top-settings-panel
3
+ ---
4
+ Every viewer app ends up needing the same settings screen: rendering
5
+ options, clip/measurement styling, a "which cloud component converts this
6
+ format" picker, a keyboard-shortcut reference — plus a search box that
7
+ filters all of it and a "restore defaults" button that resets whatever has
8
+ persisted state. Building that, and keeping it in sync with the tools it
9
+ configures, is real work before you've added a single setting of your own.
10
+
11
+ `top-settings-panel` is a ready-made web component that delivers exactly
12
+ that. Mounted as-is, it's a complete, self-wiring Settings panel. But like
13
+ `top-viewer-toolbar` (see that tutorial), it's built out of standalone,
14
+ individually-importable `<top-*-settings>` elements — so you can drop the
15
+ panel it builds for you and compose your own layout out of the same
16
+ pieces, mixed freely with sections of your own.
17
+
18
+ This tutorial covers the prerequisites; the default, batteries-included
19
+ panel; what it manages automatically; building your own section with
20
+ `bim-panel-section`; and composing a custom layout with `headless`.
21
+
22
+ By the end, you'll have a working default panel plus your own custom
23
+ section, both wired into the same shared search box and reset button as
24
+ the stock ones.
25
+ */
26
+
27
+ import { html, LitElement } from "lit";
28
+ import { customElement, state } from "lit/decorators.js";
29
+ import { consume } from "@lit/context";
30
+ import * as THREE from "three";
31
+ import * as OBC from "@thatopen/components";
32
+ import * as OBF from "@thatopen/components-front";
33
+ import * as FRAGS from "@thatopen/fragments";
34
+ import * as BUI from "@thatopen/ui";
35
+ import { PlatformClient, UIManager } from "@thatopen/services";
36
+ // TODO(#34 follow-up): `settingsSearchContext` is not part of the published
37
+ // `@thatopen/services` surface yet — see the TODO in settings-panel/index.ts.
38
+ // Imported by local relative path until the distribute pipeline exports
39
+ // context objects too; same workaround `app/examples/Contexts/example.ts`
40
+ // uses for `componentsContext`/`clientContext`.
41
+ import { settingsSearchContext } from "./src/context";
42
+ import type { App } from "../app/index";
43
+
44
+ /* MD
45
+ ### ✅ Prerequisites
46
+
47
+ `UIManager` must be in the setup call so `<top-settings-panel>` and every
48
+ `<top-*-settings>` element are registered. `<top-settings-panel>` must be
49
+ mounted as a descendant of `<top-app>` — it and its sections consume
50
+ `componentsContext`/`clientContext`, which `top-app` provides. It does
51
+ **not** need to be a descendant of `<top-viewer>` specifically — but the
52
+ sections that talk to the 3D engine (Graphics, Clip styling, Measurement,
53
+ Commands) render an empty placeholder until a `<top-viewer>` exists
54
+ somewhere in the same app, since that's what actually builds the tools they
55
+ configure.
56
+ */
57
+
58
+ const client = PlatformClient.fromPlatformContext();
59
+
60
+ const { components } = (await client.setup(
61
+ { OBC, OBF, BUI, THREE, FRAGS },
62
+ { uuid: UIManager.uuid },
63
+ )) as { components: OBC.Components };
64
+
65
+ components.get(UIManager).init();
66
+
67
+ /* MD
68
+ ### 🖥️ Default panel (batteries included)
69
+
70
+ Add it as a plain element anywhere under `top-app` — a side-by-side layout
71
+ with the 3D viewer is the most natural arrangement, since most of its
72
+ sections act on what's in the scene:
73
+
74
+ ```html
75
+ <top-viewer>...</top-viewer>
76
+ <top-settings-panel></top-settings-panel>
77
+ ```
78
+
79
+ ### 🤖 What the default panel manages automatically
80
+
81
+ **Graphics** — point/line/edge styling, background, shadows, ambient
82
+ occlusion — whatever `top-viewer` supports, persisted across reloads. When the
83
+ app uses `GISManager`, a "GIS Map" group also appears, with the sky on/off, the
84
+ horizon fade (how far before the camera's far plane the map dissolves, 0 = hard
85
+ cut) and the sky's horizon and zenith colours.
86
+
87
+ **Clip styling** — fill/edge color, opacity, width for the clip tool,
88
+ shared live with `top-viewer-toolbar`'s clip button.
89
+
90
+ **Measurement** — units (length/area/angle), color, decimals, per-snap-kind
91
+ toggles, shared live with the toolbar's measurement buttons.
92
+
93
+ **File conversion** — which provisioned cloud component converts each
94
+ format when a file is opened, per project.
95
+
96
+ **Commands** — a click-to-run shortcut reference (focus, hide, isolate,
97
+ ghost, show all, clear selection) that also registers the actual keyboard
98
+ shortcuts while mounted.
99
+
100
+ **Search box** — sits at the top of the panel, above the sections, and
101
+ filters every section's own rows by label, stock or custom, as long as a
102
+ section opts in (see below).
103
+
104
+ **Restore defaults** — a two-click-confirm button in the panel header that
105
+ resets every
106
+ section with persisted state (currently: Graphics) back to its defaults.
107
+
108
+ ### 🧩 Building your own section
109
+
110
+ A custom section is a `LitElement` that renders its own `<bim-panel-section>`
111
+ — nothing about it is specific to `top-settings-panel` beyond that. Consume
112
+ `settingsSearchContext` if you want the shared search box to filter your
113
+ rows too; skip it and your section simply never filters.
114
+ */
115
+
116
+ @customElement("my-lidar-settings")
117
+ class MyLidarSettings extends LitElement {
118
+ @consume({ context: settingsSearchContext, subscribe: true })
119
+ searchQuery = "";
120
+
121
+ @state() private _pointBudget = 2_000_000;
122
+ @state() private _showIntensity = false;
123
+
124
+ render() {
125
+ const rows = [
126
+ {
127
+ label: "Point budget",
128
+ control: html`<bim-number-input
129
+ label="Point budget"
130
+ slider
131
+ value=${this._pointBudget}
132
+ min="100000"
133
+ max="10000000"
134
+ step="100000"
135
+ @change=${(e: Event) => {
136
+ this._pointBudget = Number((e.target as HTMLInputElement).value);
137
+ }}
138
+ ></bim-number-input>`,
139
+ },
140
+ {
141
+ label: "Show intensity",
142
+ control: html`<bim-checkbox
143
+ label="Show intensity"
144
+ toggle
145
+ ?checked=${this._showIntensity}
146
+ @change=${(e: Event) => {
147
+ this._showIntensity = (e.target as HTMLInputElement).checked;
148
+ }}
149
+ ></bim-checkbox>`,
150
+ },
151
+ ];
152
+
153
+ const q = this.searchQuery.trim().toLowerCase();
154
+ const visible = q
155
+ ? rows.filter((r) => r.label.toLowerCase().includes(q))
156
+ : rows;
157
+
158
+ return html`<bim-panel-section label="LIDAR" icon="mdi:radar">
159
+ ${visible.length
160
+ ? visible.map((r) => r.control)
161
+ : html`<bim-label style="opacity: 0.6; font-size: 0.78rem;"
162
+ >No settings match "${this.searchQuery}".</bim-label
163
+ >`}
164
+ </bim-panel-section>`;
165
+ }
166
+ }
167
+
168
+ /* MD
169
+ ### 🧱 Composing a custom layout with `headless`
170
+
171
+ Set the `headless` attribute to skip the panel's own 5 stock sections —
172
+ everything else (the search box, the reset button, both contexts) keeps
173
+ running. Slot whatever `top-*-settings` elements and/or your own sections
174
+ as light-DOM children, in whatever order you want; that's exactly what
175
+ renders.
176
+
177
+ The most common case: keep every stock section and just add your own —
178
+ this is the live demo below.
179
+
180
+ ```html
181
+ <top-settings-panel headless>
182
+ <top-graphic-settings></top-graphic-settings>
183
+ <top-clipstyling-settings></top-clipstyling-settings>
184
+ <top-measurement-settings></top-measurement-settings>
185
+ <top-fileconversion-settings></top-fileconversion-settings>
186
+ <top-commands-settings></top-commands-settings>
187
+ <my-lidar-settings></my-lidar-settings>
188
+ </top-settings-panel>
189
+ ```
190
+ */
191
+
192
+ const app = document.createElement("top-app") as unknown as App;
193
+
194
+ app.setup = (waitUntil) => {
195
+ waitUntil(
196
+ (async () => {
197
+ const fragments = components.get(OBC.FragmentsManager);
198
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
199
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
200
+ })(),
201
+ "Fragments Core",
202
+ );
203
+ return { components, client };
204
+ };
205
+
206
+ app.elements = {
207
+ viewer: () =>
208
+ html`<top-viewer><top-viewer-toolbar></top-viewer-toolbar></top-viewer>`,
209
+ settings: () => html`
210
+ <top-settings-panel headless>
211
+ <top-graphic-settings></top-graphic-settings>
212
+ <top-clipstyling-settings></top-clipstyling-settings>
213
+ <top-measurement-settings></top-measurement-settings>
214
+ <top-fileconversion-settings></top-fileconversion-settings>
215
+ <top-commands-settings></top-commands-settings>
216
+ <my-lidar-settings></my-lidar-settings>
217
+ </top-settings-panel>
218
+ `,
219
+ };
220
+
221
+ app.layouts = {
222
+ main: {
223
+ label: "Main",
224
+ icon: "solar:3d-square-bold",
225
+ template: `"viewer settings" 1fr / 1fr 22rem`,
226
+ },
227
+ };
228
+
229
+ app.layout = "main";
230
+
231
+ const container = document.getElementById("that-open-app") ?? document.body;
232
+ container.appendChild(app);
233
+ document.body.style.margin = "0";
234
+
235
+ /* MD
236
+ ### 🔀 A few other ways to compose it
237
+
238
+ A lighter viewer that only needs Graphics plus its own section — drop
239
+ everything else:
240
+
241
+ ```html
242
+ <top-settings-panel headless>
243
+ <top-graphic-settings></top-graphic-settings>
244
+ <my-lidar-settings></my-lidar-settings>
245
+ </top-settings-panel>
246
+ ```
247
+
248
+ Reordering — `headless` respects DOM order, so Commands first is just:
249
+
250
+ ```html
251
+ <top-settings-panel headless>
252
+ <top-commands-settings></top-commands-settings>
253
+ <top-graphic-settings></top-graphic-settings>
254
+ <top-clipstyling-settings></top-clipstyling-settings>
255
+ <top-measurement-settings></top-measurement-settings>
256
+ <top-fileconversion-settings></top-fileconversion-settings>
257
+ </top-settings-panel>
258
+ ```
259
+
260
+ Swapping a single stock section for your own (e.g. Measurement with
261
+ different units) — the same `headless` list, just with that one tag
262
+ replaced:
263
+
264
+ ```html
265
+ <top-settings-panel headless>
266
+ <top-graphic-settings></top-graphic-settings>
267
+ <top-clipstyling-settings></top-clipstyling-settings>
268
+ <my-measurement-settings></my-measurement-settings>
269
+ <top-fileconversion-settings></top-fileconversion-settings>
270
+ <top-commands-settings></top-commands-settings>
271
+ </top-settings-panel>
272
+ ```
273
+
274
+ Keeping the full stock default and only ADDING a section, without going
275
+ `headless` at all — the non-headless layout also projects a trailing
276
+ `<slot>`, so any light-DOM children you give it render after the 5 stock
277
+ sections:
278
+
279
+ ```html
280
+ <top-settings-panel>
281
+ <my-lidar-settings></my-lidar-settings>
282
+ </top-settings-panel>
283
+ ```
284
+
285
+ ### ⚠️ Gotchas
286
+
287
+ - **Never `document.createElement` a `bim-*` element** — same rule as
288
+ `top-viewer-toolbar`. Render them with lit's `html`/`render` (or, as
289
+ here, from inside your own `LitElement`'s `render()`); never build them
290
+ imperatively.
291
+ - **A custom section renders its OWN `<bim-panel-section>`**, in its own
292
+ shadow root — there's no API to inject rows into a stock section, only
293
+ to sit alongside it.
294
+ - **`fixed` layout quirk**: `<bim-panel-section>`'s default logic checks
295
+ `this.closest("bim-panel")`, which can't see past your own section's
296
+ shadow boundary — so, like the stock sections, a custom one may render
297
+ with `fixed` behavior until the upstream `@thatopen/ui` fix ships. Not
298
+ something to work around here; tracked separately.
299
+ - **Search filtering is opt-in per section** — consuming
300
+ `settingsSearchContext` is what makes a section respond to the shared
301
+ search box; forgetting it just means that section never filters, not an
302
+ error.
303
+ */