@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.
- package/README.md +46 -46
- package/dist/built-in/index.d.ts +723 -0
- package/dist/cli.js +22 -0
- package/dist/core/client.d.ts +10 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +87 -71
- package/dist/types/files.d.ts +6 -0
- package/dist/vite-env.d.ts +1 -1
- package/docs/builtin/paths.json +22 -6
- package/package.json +99 -99
- package/resources/AGENTS.md +5 -3
- package/src/built-in/AppManager/example.ts +86 -86
- package/src/built-in/CDEManager/example.ts +214 -214
- package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
- package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
- package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
- package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
- package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
- package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
- package/src/built-in/FileList/example.ts +107 -107
- package/src/built-in/TabbedNavigation/example.ts +115 -115
- package/src/built-in/UIManager/src/app/example.ts +99 -0
- package/src/built-in/UIManager/src/app/examples/AppState/example.ts +142 -0
- package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +125 -0
- package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +92 -0
- package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +161 -0
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +104 -0
- package/src/built-in/ViewportsManager/example.ts +106 -106
- package/src/built-in/index.ts +755 -755
- package/src/cli/templates/app/README.md +241 -241
- package/src/cli/templates/app/index.html +27 -27
- package/src/cli/templates/app/package.json +27 -25
- package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +87 -91
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
- package/src/cli/templates/app/src/bim-components/index.ts +1 -1
- package/src/cli/templates/app/src/main.ts +56 -89
- package/src/cli/templates/app/src/setups/cloud-runner.ts +9 -13
- package/src/cli/templates/app/src/setups/fragments.ts +18 -0
- package/src/cli/templates/app/src/setups/ifc-loader.ts +12 -0
- package/src/cli/templates/app/src/setups/index.ts +3 -3
- package/src/cli/templates/app/src/ui-components/AppPanel/index.ts +160 -0
- package/src/cli/templates/app/src/ui-components/index.ts +1 -2
- package/src/cli/templates/app/tsconfig.json +17 -16
- package/src/cli/templates/cloud-component/README.md +205 -205
- package/src/cli/templates/cloud-component/_thatopen +5 -5
- package/src/cli/templates/cloud-component/declarations.json +4 -4
- package/src/cli/templates/cloud-component/package.json +21 -21
- package/src/cli/templates/cloud-component/src/main.ts +70 -70
- package/src/cli/templates/cloud-component/tsconfig.json +16 -16
- package/src/cli/templates/shared/CLAUDE.md +1 -1
- package/src/cli/templates/shared/_gitignore +4 -4
- package/src/cli/templates/app/src/app.ts +0 -16
- package/src/cli/templates/app/src/globals.ts +0 -1
- package/src/cli/templates/app/src/setups/ui-manager.ts +0 -27
- package/src/cli/templates/app/src/setups/viewports-manager.ts +0 -22
- package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +0 -26
- package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +0 -1
- package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +0 -15
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +0 -37
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +0 -1
- 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
|
-
};
|