@thatopen/services 0.0.6 → 0.1.3

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 (64) hide show
  1. package/README.md +46 -46
  2. package/dist/built-in/index.d.ts +723 -0
  3. package/dist/cli.js +22 -0
  4. package/dist/core/client.d.ts +10 -1
  5. package/dist/index.cjs.js +2 -2
  6. package/dist/index.es.js +87 -71
  7. package/dist/types/files.d.ts +6 -0
  8. package/dist/vite-env.d.ts +1 -1
  9. package/docs/builtin/paths.json +22 -6
  10. package/package.json +99 -99
  11. package/resources/AGENTS.md +5 -3
  12. package/src/built-in/AppManager/example.ts +86 -86
  13. package/src/built-in/CDEManager/example.ts +214 -214
  14. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  15. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  16. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  17. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  18. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  19. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  20. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  21. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  22. package/src/built-in/FileList/example.ts +107 -107
  23. package/src/built-in/TabbedNavigation/example.ts +115 -115
  24. package/src/built-in/UIManager/src/app/example.ts +99 -0
  25. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +142 -0
  26. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +125 -0
  27. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +92 -0
  28. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +161 -0
  29. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +104 -0
  30. package/src/built-in/ViewportsManager/example.ts +106 -106
  31. package/src/built-in/index.ts +755 -755
  32. package/src/cli/templates/app/README.md +241 -241
  33. package/src/cli/templates/app/index.html +27 -27
  34. package/src/cli/templates/app/package.json +27 -25
  35. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +87 -91
  36. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  37. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  38. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  39. package/src/cli/templates/app/src/main.ts +56 -89
  40. package/src/cli/templates/app/src/setups/cloud-runner.ts +9 -13
  41. package/src/cli/templates/app/src/setups/fragments.ts +18 -0
  42. package/src/cli/templates/app/src/setups/ifc-loader.ts +12 -0
  43. package/src/cli/templates/app/src/setups/index.ts +3 -3
  44. package/src/cli/templates/app/src/ui-components/AppPanel/index.ts +160 -0
  45. package/src/cli/templates/app/src/ui-components/index.ts +1 -2
  46. package/src/cli/templates/app/tsconfig.json +17 -16
  47. package/src/cli/templates/cloud-component/README.md +205 -205
  48. package/src/cli/templates/cloud-component/_thatopen +5 -5
  49. package/src/cli/templates/cloud-component/declarations.json +4 -4
  50. package/src/cli/templates/cloud-component/package.json +21 -21
  51. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  52. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  53. package/src/cli/templates/shared/CLAUDE.md +1 -1
  54. package/src/cli/templates/shared/_gitignore +4 -4
  55. package/src/cli/templates/app/src/app.ts +0 -16
  56. package/src/cli/templates/app/src/globals.ts +0 -1
  57. package/src/cli/templates/app/src/setups/ui-manager.ts +0 -27
  58. package/src/cli/templates/app/src/setups/viewports-manager.ts +0 -22
  59. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +0 -26
  60. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +0 -1
  61. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +0 -15
  62. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +0 -37
  63. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +0 -1
  64. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +0 -14
@@ -1,4 +1,4 @@
1
- node_modules
2
- dist
3
- *.zip
4
- .thatopen
1
+ node_modules
2
+ dist
3
+ *.zip
4
+ .thatopen
@@ -1,16 +0,0 @@
1
- import * as OBC from "@thatopen/components";
2
- import * as BUI from "@thatopen/ui";
3
- import { AppManager } from "@thatopen/services";
4
- import { icons } from "./globals";
5
- import { AppInfoSectionGridElement, CloudRunnerSectionGridElement } from "./ui-components";
6
-
7
- export type App = {
8
- icons: (keyof typeof icons)[];
9
- grid: BUI.Grid<
10
- ["Viewer", "Split"],
11
- ["viewer", AppInfoSectionGridElement, CloudRunnerSectionGridElement]
12
- >;
13
- };
14
-
15
- export const getAppManager = (components: OBC.Components) =>
16
- components.get(AppManager<App>);
@@ -1 +0,0 @@
1
- export const icons = {};
@@ -1,27 +0,0 @@
1
- import * as OBC from "@thatopen/components";
2
- import * as BUI from "@thatopen/ui";
3
- import { UIManager } from "@thatopen/services";
4
- import {
5
- appInfoSectionTemplate,
6
- AppInfoSectionState,
7
- cloudRunnerSectionTemplate,
8
- CloudRunnerSectionState,
9
- } from "../ui-components";
10
-
11
- export type CustomUIs = {
12
- appInfoSection: { type: BUI.PanelSection; state: AppInfoSectionState };
13
- cloudRunnerSection: { type: BUI.PanelSection; state: CloudRunnerSectionState };
14
- };
15
-
16
- export const getUIManager = (components: OBC.Components) =>
17
- components.get(UIManager<CustomUIs>);
18
-
19
- export const uiManager = (components: OBC.Components) => {
20
- const uis = getUIManager(components);
21
- uis.registerTemplate("appInfoSection", {
22
- template: appInfoSectionTemplate,
23
- });
24
- uis.registerTemplate("cloudRunnerSection", {
25
- template: cloudRunnerSectionTemplate,
26
- });
27
- };
@@ -1,22 +0,0 @@
1
- import * as OBC from "@thatopen/components";
2
- import { ViewportsManager } from "@thatopen/services";
3
-
4
- export const viewportsManager = async (components: OBC.Components) => {
5
- const viewports = components.get(ViewportsManager);
6
- const { element, world } = await viewports.create();
7
-
8
- // Load a sample model. Replace with client.downloadFile(fileId) to load
9
- // a model from the platform:
10
- // const response = await client.downloadFile(fileId);
11
- // const buffer = await response.arrayBuffer();
12
- const fragments = components.get(OBC.FragmentsManager);
13
- const file = await fetch(
14
- "https://thatopen.github.io/engine_components/resources/frags/school_arq.frag",
15
- );
16
- const buffer = await file.arrayBuffer();
17
- await fragments.core.load(buffer, { modelId: "school_arq" });
18
- await world.camera.controls.setLookAt(68, 23, -8.5, 21.5, -5.5, 23);
19
- await fragments.core.update(true);
20
-
21
- return element;
22
- };
@@ -1,26 +0,0 @@
1
- import * as BUI from "@thatopen/ui";
2
- import { AppInfoSectionComponent } from "./src";
3
- import { getAppManager } from "../../app";
4
-
5
- export const appInfoSectionTemplate: AppInfoSectionComponent = ({
6
- components,
7
- }) => {
8
- const app = getAppManager(components);
9
-
10
- const fileItems =
11
- app.projectData?.files.map(
12
- (f: { name: string }) => BUI.html`<bim-label>${f.name}</bim-label>`,
13
- ) ?? [];
14
-
15
- return BUI.html`
16
- <bim-panel-section label="App Info" icon="solar:info-circle-bold">
17
- <bim-label>App ID: ${app.client?.context.appId}</bim-label>
18
- <bim-label>Project ID: ${app.client?.context.projectId}</bim-label>
19
- <bim-label>API URL: ${app.client?.context.apiUrl}</bim-label>
20
- <bim-label>Files: ${fileItems.length}</bim-label>
21
- ${fileItems}
22
- </bim-panel-section>
23
- `;
24
- };
25
-
26
- export * from "./src";
@@ -1 +0,0 @@
1
- export * from "./types";
@@ -1,15 +0,0 @@
1
- import * as BUI from "@thatopen/ui";
2
- import * as OBC from "@thatopen/components";
3
-
4
- export interface AppInfoSectionState {
5
- components: OBC.Components;
6
- }
7
-
8
- export type AppInfoSectionComponent =
9
- BUI.StatefullComponent<AppInfoSectionState>;
10
-
11
- // Used in App type (app.ts) to type this element slot in the grid.
12
- export type AppInfoSectionGridElement = {
13
- name: "appInfoSection";
14
- state: AppInfoSectionState;
15
- };
@@ -1,37 +0,0 @@
1
- import * as BUI from "@thatopen/ui";
2
- import { CloudRunner } from "../../bim-components";
3
- import { CloudRunnerSectionComponent } from "./src";
4
-
5
- export const cloudRunnerSectionTemplate: CloudRunnerSectionComponent = ({
6
- components,
7
- }) => {
8
- const runner = components.get(CloudRunner);
9
-
10
- const messageItems = runner.messages.map(
11
- (m) => BUI.html`<bim-label>${m}</bim-label>`,
12
- );
13
-
14
- return BUI.html`
15
- <bim-panel-section label="Cloud Component" icon="solar:code-bold">
16
- <bim-label>Component ID: ${runner.componentId}</bim-label>
17
- <bim-label>Local server: ${runner.localServerUrl}</bim-label>
18
- <div style="display:flex;gap:0.5rem;">
19
- <bim-button
20
- label="Run Local"
21
- icon="solar:play-bold"
22
- @click=${() => runner.run(true)}
23
- ></bim-button>
24
- <bim-button
25
- label="Run Deployed"
26
- icon="solar:cloud-bold-duotone"
27
- @click=${() => runner.run(false)}
28
- ></bim-button>
29
- </div>
30
- <bim-label>${runner.status}</bim-label>
31
- <bim-label>Progress: ${runner.progress}%</bim-label>
32
- ${messageItems}
33
- </bim-panel-section>
34
- `;
35
- };
36
-
37
- export * from "./src";
@@ -1 +0,0 @@
1
- export * from "./types";
@@ -1,14 +0,0 @@
1
- import * as OBC from "@thatopen/components";
2
- import * as BUI from "@thatopen/ui";
3
-
4
- export interface CloudRunnerSectionState {
5
- components: OBC.Components;
6
- }
7
-
8
- export type CloudRunnerSectionComponent =
9
- BUI.StatefullComponent<CloudRunnerSectionState>;
10
-
11
- export type CloudRunnerSectionGridElement = {
12
- name: "cloudRunnerSection";
13
- state: CloudRunnerSectionState;
14
- };