@thatopen/services 0.2.0 → 0.3.0

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 (115) hide show
  1. package/README.md +59 -59
  2. package/dist/built-in/index.d.ts +486 -563
  3. package/dist/cli.js +10 -0
  4. package/dist/index.cjs.js +2 -2
  5. package/dist/index.es.js +3 -5
  6. package/dist/vite-env.d.ts +1 -1
  7. package/docs/builtin/paths.json +74 -70
  8. package/docs/cli/create.md +28 -28
  9. package/docs/cli/local-server.md +38 -38
  10. package/docs/cli/login.md +32 -32
  11. package/docs/cli/publish.md +31 -31
  12. package/docs/cli/run.md +26 -26
  13. package/docs/cli/serve.md +43 -43
  14. package/docs/cli/swap.md +30 -30
  15. package/package.json +100 -100
  16. package/resources/AGENTS.md +40 -40
  17. package/src/built-in/CDEManager/example.ts +214 -214
  18. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  19. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  20. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  21. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  22. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  23. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  24. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  25. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  26. package/src/built-in/UIManager/src/app/example.ts +99 -99
  27. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +142 -142
  28. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +161 -0
  29. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +125 -125
  30. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +126 -0
  31. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +92 -92
  32. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +165 -0
  33. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +135 -161
  34. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +104 -104
  35. package/src/built-in/index.ts +649 -755
  36. package/src/cli/templates/app/README.md +241 -241
  37. package/src/cli/templates/app/index.html +35 -27
  38. package/src/cli/templates/app/package.json +31 -27
  39. package/src/cli/templates/app/src/app.ts +37 -0
  40. package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -0
  41. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -87
  42. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  43. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  44. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  45. package/src/cli/templates/app/src/globals.ts +1 -0
  46. package/src/cli/templates/app/src/main.ts +340 -56
  47. package/src/cli/templates/app/src/setups/active-tool-hud.ts +69 -0
  48. package/src/cli/templates/app/src/setups/camera-tools.ts +63 -0
  49. package/src/cli/templates/app/src/setups/camera-views.ts +201 -0
  50. package/src/cli/templates/app/src/setups/card-header.ts +35 -0
  51. package/src/cli/templates/app/src/setups/clipper-panel.ts +167 -0
  52. package/src/cli/templates/app/src/setups/clipper-tool.ts +754 -0
  53. package/src/cli/templates/app/src/setups/clipper.ts +75 -0
  54. package/src/cli/templates/app/src/setups/cloud-runner.ts +13 -9
  55. package/src/cli/templates/app/src/setups/commands-panel.ts +239 -0
  56. package/src/cli/templates/app/src/setups/data-table-panel.ts +2224 -0
  57. package/src/cli/templates/app/src/setups/exploded-view.ts +246 -0
  58. package/src/cli/templates/app/src/setups/file-format-icons.ts +95 -0
  59. package/src/cli/templates/app/src/setups/files-panel.ts +1503 -0
  60. package/src/cli/templates/app/src/setups/fps-indicator.ts +63 -0
  61. package/src/cli/templates/app/src/setups/graphics-panel.ts +490 -0
  62. package/src/cli/templates/app/src/setups/helper-panel.ts +88 -0
  63. package/src/cli/templates/app/src/setups/hider.ts +98 -0
  64. package/src/cli/templates/app/src/setups/index.ts +33 -3
  65. package/src/cli/templates/app/src/setups/inspection.ts +136 -0
  66. package/src/cli/templates/app/src/setups/measurement-panel.ts +188 -0
  67. package/src/cli/templates/app/src/setups/measurement-settings-panel.ts +161 -0
  68. package/src/cli/templates/app/src/setups/measurement-tool.ts +570 -0
  69. package/src/cli/templates/app/src/setups/measurements.ts +133 -0
  70. package/src/cli/templates/app/src/setups/model-tree.ts +797 -0
  71. package/src/cli/templates/app/src/setups/navigation-gizmo.ts +316 -0
  72. package/src/cli/templates/app/src/setups/objects-panel.ts +127 -0
  73. package/src/cli/templates/app/src/setups/plans-panel.ts +619 -0
  74. package/src/cli/templates/app/src/setups/properties-panel.ts +1048 -0
  75. package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -0
  76. package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -0
  77. package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -0
  78. package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -0
  79. package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -0
  80. package/src/cli/templates/app/src/setups/right-sidebar.ts +178 -0
  81. package/src/cli/templates/app/src/setups/settings-panel.ts +94 -0
  82. package/src/cli/templates/app/src/setups/styles-panel.ts +110 -0
  83. package/src/cli/templates/app/src/setups/styles.ts +375 -0
  84. package/src/cli/templates/app/src/setups/tool-mode-manager.ts +150 -0
  85. package/src/cli/templates/app/src/setups/tool-mode.ts +23 -0
  86. package/src/cli/templates/app/src/setups/toolbar.ts +229 -0
  87. package/src/cli/templates/app/src/setups/ui-manager.ts +27 -0
  88. package/src/cli/templates/app/src/setups/visibility-toolbar.ts +498 -0
  89. package/src/cli/templates/app/src/setups/walkthrough.ts +528 -0
  90. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -0
  91. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -0
  92. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -0
  93. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -0
  94. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -0
  95. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -0
  96. package/src/cli/templates/app/src/ui-components/index.ts +2 -1
  97. package/src/cli/templates/app/tsconfig.json +16 -17
  98. package/src/cli/templates/app/vite.config.js +45 -42
  99. package/src/cli/templates/cloud-component/README.md +205 -205
  100. package/src/cli/templates/cloud-component/_thatopen +5 -5
  101. package/src/cli/templates/cloud-component/declarations.json +4 -4
  102. package/src/cli/templates/cloud-component/package.json +21 -21
  103. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  104. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  105. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  106. package/src/cli/templates/shared/AGENTS.md +8 -8
  107. package/src/cli/templates/shared/CLAUDE.md +1 -1
  108. package/src/cli/templates/shared/_gitignore +5 -5
  109. package/src/built-in/AppManager/example.ts +0 -86
  110. package/src/built-in/FileList/example.ts +0 -107
  111. package/src/built-in/TabbedNavigation/example.ts +0 -115
  112. package/src/built-in/ViewportsManager/example.ts +0 -106
  113. package/src/cli/templates/app/src/setups/fragments.ts +0 -18
  114. package/src/cli/templates/app/src/setups/ifc-loader.ts +0 -12
  115. package/src/cli/templates/app/src/ui-components/AppPanel/index.ts +0 -160
@@ -1,104 +1,104 @@
1
- /* MD
2
- ## Sidebar navigation
3
- ---
4
- Product teams building BIM apps often need multiple distinct views — a 3D model
5
- viewer, a data browser, a settings screen — but wiring a custom nav bar and
6
- managing view transitions from scratch adds complexity before any real feature
7
- work begins.
8
-
9
- top-app supports named layouts with a built-in sidebar navigation bar that
10
- switches the active grid template on click, so teams get multi-view navigation
11
- without building the scaffolding themselves.
12
-
13
- This tutorial covers defining three named layouts with their own grid templates
14
- and icons; providing a dedicated element for each view; enabling the sidebar nav
15
- bar; and setting the initial active layout.
16
-
17
- By the end, you'll have a multi-view BIM app with a persistent sidebar that lets
18
- users switch between a 3D viewer, a data panel, and a settings screen.
19
- */
20
-
21
- import { html } from "lit";
22
- import * as THREE from "three";
23
- import * as OBC from "@thatopen/components";
24
- import * as OBF from "@thatopen/components-front";
25
- import * as FRAGS from "@thatopen/fragments";
26
- import * as BUI from "@thatopen/ui";
27
- import { PlatformClient } from "thatopen-services";
28
- import uiManagerDef from "../../../../index";
29
- import type { App } from "../../index";
30
-
31
- const UIManager = uiManagerDef.componentDefinition;
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: () =>
57
- html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
58
-
59
- data: () => html`
60
- <bim-panel label="Data">
61
- <bim-panel-section label="Properties" icon="solar:document-bold">
62
- <bim-label>Select an element in the viewer to inspect its properties.</bim-label>
63
- </bim-panel-section>
64
- </bim-panel>
65
- `,
66
-
67
- settings: () => html`
68
- <bim-panel label="Settings">
69
- <bim-panel-section label="Appearance" icon="solar:settings-bold">
70
- <bim-checkbox label="Show grid" checked></bim-checkbox>
71
- <bim-checkbox label="Show axes"></bim-checkbox>
72
- </bim-panel-section>
73
- </bim-panel>
74
- `,
75
- };
76
-
77
- app.layouts = {
78
- // Each layout defines its own CSS grid template. Only areas used in a template
79
- // are rendered for that layout — unused elements are not created.
80
- viewer: {
81
- label: "Viewer",
82
- icon: "solar:3d-square-bold",
83
- template: `"viewer" 1fr / 1fr`,
84
- },
85
- data: {
86
- label: "Data",
87
- icon: "solar:document-bold",
88
- template: `"data" 1fr / 1fr`,
89
- },
90
- settings: {
91
- label: "Settings",
92
- icon: "solar:settings-bold",
93
- template: `"settings" 1fr / 1fr`,
94
- },
95
- };
96
-
97
- // sidebar=true adds a vertical nav column on the left with one button per layout.
98
- // Each button shows the layout's label and icon and activates that layout on click.
99
- app.sidebar = true;
100
- app.layout = "viewer";
101
-
102
- const container = document.getElementById("that-open-app") ?? document.body;
103
- container.appendChild(app);
104
- document.body.style.margin = "0";
1
+ /* MD
2
+ ## Sidebar navigation
3
+ ---
4
+ Product teams building BIM apps often need multiple distinct views — a 3D model
5
+ viewer, a data browser, a settings screen — but wiring a custom nav bar and
6
+ managing view transitions from scratch adds complexity before any real feature
7
+ work begins.
8
+
9
+ top-app supports named layouts with a built-in sidebar navigation bar that
10
+ switches the active grid template on click, so teams get multi-view navigation
11
+ without building the scaffolding themselves.
12
+
13
+ This tutorial covers defining three named layouts with their own grid templates
14
+ and icons; providing a dedicated element for each view; enabling the sidebar nav
15
+ bar; and setting the initial active layout.
16
+
17
+ By the end, you'll have a multi-view BIM app with a persistent sidebar that lets
18
+ users switch between a 3D viewer, a data panel, and a settings screen.
19
+ */
20
+
21
+ import { html } from "lit";
22
+ import * as THREE from "three";
23
+ import * as OBC from "@thatopen/components";
24
+ import * as OBF from "@thatopen/components-front";
25
+ import * as FRAGS from "@thatopen/fragments";
26
+ import * as BUI from "@thatopen/ui";
27
+ import { PlatformClient } from "thatopen-services";
28
+ import uiManagerDef from "../../../../index";
29
+ import type { App } from "../../index";
30
+
31
+ const UIManager = uiManagerDef.componentDefinition;
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: () =>
57
+ html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
58
+
59
+ data: () => html`
60
+ <bim-panel label="Data">
61
+ <bim-panel-section label="Properties" icon="solar:document-bold">
62
+ <bim-label>Select an element in the viewer to inspect its properties.</bim-label>
63
+ </bim-panel-section>
64
+ </bim-panel>
65
+ `,
66
+
67
+ settings: () => html`
68
+ <bim-panel label="Settings">
69
+ <bim-panel-section label="Appearance" icon="solar:settings-bold">
70
+ <bim-checkbox label="Show grid" checked></bim-checkbox>
71
+ <bim-checkbox label="Show axes"></bim-checkbox>
72
+ </bim-panel-section>
73
+ </bim-panel>
74
+ `,
75
+ };
76
+
77
+ app.layouts = {
78
+ // Each layout defines its own CSS grid template. Only areas used in a template
79
+ // are rendered for that layout — unused elements are not created.
80
+ viewer: {
81
+ label: "Viewer",
82
+ icon: "solar:3d-square-bold",
83
+ template: `"viewer" 1fr / 1fr`,
84
+ },
85
+ data: {
86
+ label: "Data",
87
+ icon: "solar:document-bold",
88
+ template: `"data" 1fr / 1fr`,
89
+ },
90
+ settings: {
91
+ label: "Settings",
92
+ icon: "solar:settings-bold",
93
+ template: `"settings" 1fr / 1fr`,
94
+ },
95
+ };
96
+
97
+ // sidebar=true adds a vertical nav column on the left with one button per layout.
98
+ // Each button shows the layout's label and icon and activates that layout on click.
99
+ app.sidebar = true;
100
+ app.layout = "viewer";
101
+
102
+ const container = document.getElementById("that-open-app") ?? document.body;
103
+ container.appendChild(app);
104
+ document.body.style.margin = "0";