@thatopen/services 0.35.0 → 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 (110) hide show
  1. package/README.md +66 -66
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/vite-env.d.ts +1 -1
  6. package/docs/ai-quickstart.md +548 -548
  7. package/docs/builtin/paths.json +130 -130
  8. package/docs/cli/create.md +29 -29
  9. package/docs/cli/local-server.md +38 -38
  10. package/docs/cli/login.md +32 -32
  11. package/docs/cli/mcp.md +46 -46
  12. package/docs/cli/publish.md +31 -31
  13. package/docs/cli/run.md +26 -26
  14. package/docs/cli/serve.md +43 -43
  15. package/docs/cli/swap.md +30 -30
  16. package/docs/cloud/GaussianSplatConverter.md +43 -43
  17. package/docs/cloud/PointCloudConverter.md +53 -53
  18. package/docs/flow-architecture.md +393 -393
  19. package/docs/flow-plugin-guide.md +354 -354
  20. package/docs/platform-token.md +81 -81
  21. package/docs/rate-limits.md +133 -133
  22. package/docs/recipes-guide.md +243 -243
  23. package/docs/revit-collab-quickstart.md +445 -445
  24. package/docs/rhino-interop-quickstart.md +387 -387
  25. package/docs/sheet-sets-guide.md +69 -69
  26. package/package.json +1 -1
  27. package/resources/AGENTS.md +57 -57
  28. package/src/built-in/CDEManager/example.ts +214 -214
  29. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  30. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  31. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  32. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  33. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  34. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  35. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  36. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  37. package/src/built-in/ClashesManager/example.ts +283 -283
  38. package/src/built-in/GISManager/example.ts +355 -355
  39. package/src/built-in/ProjectManager/example.ts +124 -124
  40. package/src/built-in/UIManager/src/app/example.ts +97 -97
  41. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
  42. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
  43. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
  44. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
  45. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
  46. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
  47. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
  48. package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -150
  49. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +105 -105
  50. package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -183
  51. package/src/built-in/UIManager/src/gis-panel/example.ts +163 -163
  52. package/src/built-in/UIManager/src/gis-properties-panel/example.ts +168 -168
  53. package/src/built-in/UIManager/src/git-history-panel/example.ts +70 -70
  54. package/src/built-in/UIManager/src/map-panel/example.ts +189 -189
  55. package/src/built-in/UIManager/src/models-list/example.ts +181 -181
  56. package/src/built-in/UIManager/src/settings-panel/example.ts +303 -303
  57. package/src/built-in/UIManager/src/topics-panel/example.ts +170 -170
  58. package/src/built-in/UIManager/src/viewer/example.ts +182 -182
  59. package/src/built-in/UIManager/src/viewer-toolbar/example.ts +376 -376
  60. package/src/built-in/index.ts +2995 -2995
  61. package/src/cli/templates/app/README.md +250 -250
  62. package/src/cli/templates/app/index.html +35 -35
  63. package/src/cli/templates/app/package.json +32 -32
  64. package/src/cli/templates/app/src/app.ts +37 -37
  65. package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -50
  66. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
  67. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  68. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  69. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  70. package/src/cli/templates/app/src/globals.ts +1 -1
  71. package/src/cli/templates/app/src/main.history.ts +191 -191
  72. package/src/cli/templates/app/src/main.ts +226 -226
  73. package/src/cli/templates/app/src/setups/channel.ts +76 -76
  74. package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -88
  75. package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -166
  76. package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -31
  77. package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -51
  78. package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -1383
  79. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
  80. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
  81. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
  82. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
  83. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
  84. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
  85. package/src/cli/templates/app/src/ui-components/index.ts +2 -2
  86. package/src/cli/templates/app/tsconfig.json +16 -16
  87. package/src/cli/templates/app/vite.config.js +57 -57
  88. package/src/cli/templates/cloud-component/README.md +205 -205
  89. package/src/cli/templates/cloud-component/_thatopen +5 -5
  90. package/src/cli/templates/cloud-component/declarations.json +4 -4
  91. package/src/cli/templates/cloud-component/package.json +21 -21
  92. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  93. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  94. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  95. package/src/cli/templates/shared/AGENTS.md +8 -8
  96. package/src/cli/templates/shared/CLAUDE.md +1 -1
  97. package/src/cli/templates/shared/_gitignore +5 -5
  98. package/src/core/examples/.env.example +7 -7
  99. package/src/core/examples/apps.ts +67 -67
  100. package/src/core/examples/batch-reads.ts +99 -99
  101. package/src/core/examples/channel.ts +65 -65
  102. package/src/core/examples/components.ts +91 -91
  103. package/src/core/examples/execution.ts +75 -75
  104. package/src/core/examples/file-metadata.ts +94 -94
  105. package/src/core/examples/files.ts +81 -81
  106. package/src/core/examples/folders.ts +82 -82
  107. package/src/core/examples/hidden-files.ts +88 -88
  108. package/src/core/examples/history.ts +103 -103
  109. package/src/core/examples/icons.ts +68 -68
  110. package/src/core/examples/permissions.ts +87 -87
@@ -1,90 +1,90 @@
1
- /* MD
2
- ## Floating layout
3
- ---
4
- Developers building BIM coordination tools often want the 3D model to fill the
5
- entire window while control panels float above it — but standard grid layouts
6
- give every area equal standing, shrinking the viewer into one cell and leaving
7
- visible seams between it and the panels.
8
-
9
- top-app supports a floating mode where one element is mounted as an absolute
10
- background that fills the container edge-to-edge, and all other layout areas
11
- render as a transparent overlay on top of it with independent pointer events.
12
-
13
- This tutorial covers assigning the viewer as the absolute background of the app;
14
- defining an overlay layout where a side panel floats above the viewer without
15
- sharing grid space; and annotating why the base element is excluded from the
16
- layout template.
17
-
18
- By the end, you'll have a full-screen 3D viewer with a floating side panel
19
- hovering above it, with the model filling the entire window and the panel
20
- receiving its own pointer events.
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 } from "@thatopen/services";
30
- import type { App } from "../../index";
31
-
32
- const client = PlatformClient.fromPlatformContext();
33
- const { components } = (await client.setup(
34
- { OBC, OBF, BUI, THREE, FRAGS },
35
- { uuid: UIManager.uuid },
36
- )) as { components: OBC.Components };
37
- components.get(UIManager).init();
38
-
39
- const app = document.createElement("top-app") as unknown as App;
40
-
41
- app.setup = (waitUntil) => {
42
- waitUntil(
43
- (async () => {
44
- const fragments = components.get(OBC.FragmentsManager);
45
- const workerUrl = await FRAGS.FragmentsModels.getWorker();
46
- fragments.init(await FRAGS.toClassicWorker(workerUrl), {
47
- classicWorker: true,
48
- });
49
- })(),
50
- "Fragments Core",
51
- );
52
- return { components, client };
53
- };
54
-
55
- app.elements = {
56
- // "viewer" is referenced by app.base — rendered as a position:absolute layer
57
- // behind all layout content so it fills the container edge-to-edge.
58
- viewer: () =>
59
- html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
60
-
61
- // Panels declared here appear in the floating content grid on top of the viewer.
62
- // Their container has pointer-events: none; each child re-enables them individually.
63
- panel: () => html`
64
- <bim-panel>
65
- <bim-panel-section label="Models" icon="solar:layers-bold">
66
- <bim-label>Load models here</bim-label>
67
- </bim-panel-section>
68
- </bim-panel>
69
- `,
70
- };
71
-
72
- // Setting app.base to an element key mounts that element as the absolute background.
73
- // Layout templates then only list the floating overlay areas — not the base element.
74
- // Without app.base, every area in the template is a peer grid cell (inline mode).
75
- app.base = "viewer";
76
-
77
- app.layouts = {
78
- main: {
79
- label: "Main",
80
- icon: "solar:home-bold",
81
- // Only overlay areas appear here. "viewer" is not listed because it is the base.
82
- template: `"panel" 1fr / 22rem`,
83
- },
84
- };
85
-
86
- app.layout = "main";
87
-
88
- const container = document.getElementById("that-open-app") ?? document.body;
89
- container.appendChild(app);
90
- document.body.style.margin = "0";
1
+ /* MD
2
+ ## Floating layout
3
+ ---
4
+ Developers building BIM coordination tools often want the 3D model to fill the
5
+ entire window while control panels float above it — but standard grid layouts
6
+ give every area equal standing, shrinking the viewer into one cell and leaving
7
+ visible seams between it and the panels.
8
+
9
+ top-app supports a floating mode where one element is mounted as an absolute
10
+ background that fills the container edge-to-edge, and all other layout areas
11
+ render as a transparent overlay on top of it with independent pointer events.
12
+
13
+ This tutorial covers assigning the viewer as the absolute background of the app;
14
+ defining an overlay layout where a side panel floats above the viewer without
15
+ sharing grid space; and annotating why the base element is excluded from the
16
+ layout template.
17
+
18
+ By the end, you'll have a full-screen 3D viewer with a floating side panel
19
+ hovering above it, with the model filling the entire window and the panel
20
+ receiving its own pointer events.
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 } from "@thatopen/services";
30
+ import type { App } from "../../index";
31
+
32
+ const client = PlatformClient.fromPlatformContext();
33
+ const { components } = (await client.setup(
34
+ { OBC, OBF, BUI, THREE, FRAGS },
35
+ { uuid: UIManager.uuid },
36
+ )) as { components: OBC.Components };
37
+ components.get(UIManager).init();
38
+
39
+ const app = document.createElement("top-app") as unknown as App;
40
+
41
+ app.setup = (waitUntil) => {
42
+ waitUntil(
43
+ (async () => {
44
+ const fragments = components.get(OBC.FragmentsManager);
45
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
46
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), {
47
+ classicWorker: true,
48
+ });
49
+ })(),
50
+ "Fragments Core",
51
+ );
52
+ return { components, client };
53
+ };
54
+
55
+ app.elements = {
56
+ // "viewer" is referenced by app.base — rendered as a position:absolute layer
57
+ // behind all layout content so it fills the container edge-to-edge.
58
+ viewer: () =>
59
+ html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
60
+
61
+ // Panels declared here appear in the floating content grid on top of the viewer.
62
+ // Their container has pointer-events: none; each child re-enables them individually.
63
+ panel: () => html`
64
+ <bim-panel>
65
+ <bim-panel-section label="Models" icon="solar:layers-bold">
66
+ <bim-label>Load models here</bim-label>
67
+ </bim-panel-section>
68
+ </bim-panel>
69
+ `,
70
+ };
71
+
72
+ // Setting app.base to an element key mounts that element as the absolute background.
73
+ // Layout templates then only list the floating overlay areas — not the base element.
74
+ // Without app.base, every area in the template is a peer grid cell (inline mode).
75
+ app.base = "viewer";
76
+
77
+ app.layouts = {
78
+ main: {
79
+ label: "Main",
80
+ icon: "solar:home-bold",
81
+ // Only overlay areas appear here. "viewer" is not listed because it is the base.
82
+ template: `"panel" 1fr / 22rem`,
83
+ },
84
+ };
85
+
86
+ app.layout = "main";
87
+
88
+ const container = document.getElementById("that-open-app") ?? document.body;
89
+ container.appendChild(app);
90
+ document.body.style.margin = "0";
@@ -1,163 +1,163 @@
1
- /* MD
2
- ## Confirmation modals with top:modal
3
- ---
4
- Destructive or irreversible actions — deleting records, overwriting files,
5
- leaving unsaved changes — should ask the user to confirm before proceeding.
6
- Opening a custom dialog element from a deeply nested component means threading
7
- a reference to a controller up through every layer of the tree.
8
-
9
- top-app provides a modal slot that any descendant can trigger by dispatching
10
- a single DOM event. The modal blocks the UI, shows a configurable message and
11
- action labels, and calls back into the originating component when the user
12
- confirms or cancels — no reference to the root element required.
13
-
14
- This tutorial covers showing a modal from a child component by dispatching
15
- top:modal; setting the label, icon, and button labels; running an async
16
- confirm handler while the modal shows a loading spinner; and handling the
17
- cancel path without side effects.
18
-
19
- By the end, you'll have an app where a panel can trigger confirmation dialogs
20
- for actions of varying severity, each with its own copy and async behaviour.
21
- */
22
-
23
- import { html, LitElement } from "lit";
24
- import { customElement, state } from "lit/decorators.js";
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
- // A child component that triggers modals without holding a reference to top-app.
34
- // It dispatches top:modal and receives the result via onConfirm / onCancel callbacks.
35
- @customElement("modal-actions")
36
- class ModalActions extends LitElement {
37
- @state() private _lastAction = "—";
38
-
39
- private _confirmDelete() {
40
- // top:modal opens a blocking dialog on the nearest top-app ancestor.
41
- // The modal stays open (with a loading spinner) while onConfirm is awaited.
42
- this.dispatchEvent(
43
- new CustomEvent("top:modal", {
44
- bubbles: true,
45
- composed: true,
46
- detail: {
47
- label: "Delete model",
48
- icon: "tabler:trash",
49
- confirmLabel: "Delete",
50
- cancelLabel: "Keep",
51
- content: html`
52
- <bim-label style="white-space:normal;">
53
- This will permanently remove the model and all its versions.
54
- This action cannot be undone.
55
- </bim-label>
56
- `,
57
- onConfirm: async () => {
58
- // Simulate an async delete operation.
59
- // The modal shows a loading spinner until this promise resolves.
60
- await new Promise<void>((resolve) => setTimeout(resolve, 1500));
61
- this._lastAction = "Model deleted";
62
- },
63
- onCancel: () => {
64
- this._lastAction = "Delete cancelled";
65
- },
66
- },
67
- }),
68
- );
69
- }
70
-
71
- private _confirmOverwrite() {
72
- this.dispatchEvent(
73
- new CustomEvent("top:modal", {
74
- bubbles: true,
75
- composed: true,
76
- detail: {
77
- label: "File already exists",
78
- icon: "tabler:alert-triangle",
79
- confirmLabel: "Overwrite",
80
- cancelLabel: "Cancel",
81
- content: html`
82
- <bim-label style="white-space:normal;">
83
- A file named <strong>structure.ifc</strong> already exists in this
84
- folder. Uploading will create a new version alongside it.
85
- </bim-label>
86
- `,
87
- // onConfirm can be synchronous too — the modal closes immediately.
88
- onConfirm: () => {
89
- this._lastAction = "Overwrite confirmed";
90
- },
91
- onCancel: () => {
92
- this._lastAction = "Overwrite cancelled";
93
- },
94
- },
95
- }),
96
- );
97
- }
98
-
99
- render() {
100
- return html`
101
- <bim-panel label="Modal Actions">
102
- <bim-panel-section label="Actions" icon="tabler:click">
103
- <bim-button
104
- label="Delete model (async confirm)"
105
- icon="tabler:trash"
106
- @click=${this._confirmDelete}
107
- ></bim-button>
108
- <bim-button
109
- label="Overwrite file (sync confirm)"
110
- icon="tabler:file-upload"
111
- @click=${this._confirmOverwrite}
112
- ></bim-button>
113
- <bim-label>Last action: ${this._lastAction}</bim-label>
114
- </bim-panel-section>
115
- </bim-panel>
116
- `;
117
- }
118
- }
119
-
120
- // ---- app wiring ----
121
-
122
- const client = PlatformClient.fromPlatformContext();
123
- const { components } = (await client.setup(
124
- { OBC, OBF, BUI, THREE, FRAGS },
125
- { uuid: UIManager.uuid },
126
- )) as { components: OBC.Components };
127
- components.get(UIManager).init();
128
-
129
- const app = document.createElement("top-app") as unknown as App;
130
-
131
- app.setup = (waitUntil) => {
132
- waitUntil(
133
- (async () => {
134
- const fragments = components.get(OBC.FragmentsManager);
135
- const workerUrl = await FRAGS.FragmentsModels.getWorker();
136
- fragments.init(await FRAGS.toClassicWorker(workerUrl), {
137
- classicWorker: true,
138
- });
139
- })(),
140
- "Fragments Core",
141
- );
142
- return { components, client };
143
- };
144
-
145
- app.elements = {
146
- viewer: () =>
147
- html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
148
- panel: () => html`<modal-actions></modal-actions>`,
149
- };
150
-
151
- app.base = "viewer";
152
- app.layouts = {
153
- main: {
154
- label: "Main",
155
- icon: "solar:home-bold",
156
- template: `"panel" 1fr / 22rem`,
157
- },
158
- };
159
- app.layout = "main";
160
-
161
- const container = document.getElementById("that-open-app") ?? document.body;
162
- container.appendChild(app);
163
- document.body.style.margin = "0";
1
+ /* MD
2
+ ## Confirmation modals with top:modal
3
+ ---
4
+ Destructive or irreversible actions — deleting records, overwriting files,
5
+ leaving unsaved changes — should ask the user to confirm before proceeding.
6
+ Opening a custom dialog element from a deeply nested component means threading
7
+ a reference to a controller up through every layer of the tree.
8
+
9
+ top-app provides a modal slot that any descendant can trigger by dispatching
10
+ a single DOM event. The modal blocks the UI, shows a configurable message and
11
+ action labels, and calls back into the originating component when the user
12
+ confirms or cancels — no reference to the root element required.
13
+
14
+ This tutorial covers showing a modal from a child component by dispatching
15
+ top:modal; setting the label, icon, and button labels; running an async
16
+ confirm handler while the modal shows a loading spinner; and handling the
17
+ cancel path without side effects.
18
+
19
+ By the end, you'll have an app where a panel can trigger confirmation dialogs
20
+ for actions of varying severity, each with its own copy and async behaviour.
21
+ */
22
+
23
+ import { html, LitElement } from "lit";
24
+ import { customElement, state } from "lit/decorators.js";
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
+ // A child component that triggers modals without holding a reference to top-app.
34
+ // It dispatches top:modal and receives the result via onConfirm / onCancel callbacks.
35
+ @customElement("modal-actions")
36
+ class ModalActions extends LitElement {
37
+ @state() private _lastAction = "—";
38
+
39
+ private _confirmDelete() {
40
+ // top:modal opens a blocking dialog on the nearest top-app ancestor.
41
+ // The modal stays open (with a loading spinner) while onConfirm is awaited.
42
+ this.dispatchEvent(
43
+ new CustomEvent("top:modal", {
44
+ bubbles: true,
45
+ composed: true,
46
+ detail: {
47
+ label: "Delete model",
48
+ icon: "tabler:trash",
49
+ confirmLabel: "Delete",
50
+ cancelLabel: "Keep",
51
+ content: html`
52
+ <bim-label style="white-space:normal;">
53
+ This will permanently remove the model and all its versions.
54
+ This action cannot be undone.
55
+ </bim-label>
56
+ `,
57
+ onConfirm: async () => {
58
+ // Simulate an async delete operation.
59
+ // The modal shows a loading spinner until this promise resolves.
60
+ await new Promise<void>((resolve) => setTimeout(resolve, 1500));
61
+ this._lastAction = "Model deleted";
62
+ },
63
+ onCancel: () => {
64
+ this._lastAction = "Delete cancelled";
65
+ },
66
+ },
67
+ }),
68
+ );
69
+ }
70
+
71
+ private _confirmOverwrite() {
72
+ this.dispatchEvent(
73
+ new CustomEvent("top:modal", {
74
+ bubbles: true,
75
+ composed: true,
76
+ detail: {
77
+ label: "File already exists",
78
+ icon: "tabler:alert-triangle",
79
+ confirmLabel: "Overwrite",
80
+ cancelLabel: "Cancel",
81
+ content: html`
82
+ <bim-label style="white-space:normal;">
83
+ A file named <strong>structure.ifc</strong> already exists in this
84
+ folder. Uploading will create a new version alongside it.
85
+ </bim-label>
86
+ `,
87
+ // onConfirm can be synchronous too — the modal closes immediately.
88
+ onConfirm: () => {
89
+ this._lastAction = "Overwrite confirmed";
90
+ },
91
+ onCancel: () => {
92
+ this._lastAction = "Overwrite cancelled";
93
+ },
94
+ },
95
+ }),
96
+ );
97
+ }
98
+
99
+ render() {
100
+ return html`
101
+ <bim-panel label="Modal Actions">
102
+ <bim-panel-section label="Actions" icon="tabler:click">
103
+ <bim-button
104
+ label="Delete model (async confirm)"
105
+ icon="tabler:trash"
106
+ @click=${this._confirmDelete}
107
+ ></bim-button>
108
+ <bim-button
109
+ label="Overwrite file (sync confirm)"
110
+ icon="tabler:file-upload"
111
+ @click=${this._confirmOverwrite}
112
+ ></bim-button>
113
+ <bim-label>Last action: ${this._lastAction}</bim-label>
114
+ </bim-panel-section>
115
+ </bim-panel>
116
+ `;
117
+ }
118
+ }
119
+
120
+ // ---- app wiring ----
121
+
122
+ const client = PlatformClient.fromPlatformContext();
123
+ const { components } = (await client.setup(
124
+ { OBC, OBF, BUI, THREE, FRAGS },
125
+ { uuid: UIManager.uuid },
126
+ )) as { components: OBC.Components };
127
+ components.get(UIManager).init();
128
+
129
+ const app = document.createElement("top-app") as unknown as App;
130
+
131
+ app.setup = (waitUntil) => {
132
+ waitUntil(
133
+ (async () => {
134
+ const fragments = components.get(OBC.FragmentsManager);
135
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
136
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), {
137
+ classicWorker: true,
138
+ });
139
+ })(),
140
+ "Fragments Core",
141
+ );
142
+ return { components, client };
143
+ };
144
+
145
+ app.elements = {
146
+ viewer: () =>
147
+ html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
148
+ panel: () => html`<modal-actions></modal-actions>`,
149
+ };
150
+
151
+ app.base = "viewer";
152
+ app.layouts = {
153
+ main: {
154
+ label: "Main",
155
+ icon: "solar:home-bold",
156
+ template: `"panel" 1fr / 22rem`,
157
+ },
158
+ };
159
+ app.layout = "main";
160
+
161
+ const container = document.getElementById("that-open-app") ?? document.body;
162
+ container.appendChild(app);
163
+ document.body.style.margin = "0";