@thatopen/services 0.0.1 → 0.0.2
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/AGENTS.md +76 -0
- package/CONTEXT.md +4 -4
- package/README.md +4 -4
- package/dist/cli.js +7 -5
- package/dist/core/client.d.ts +1 -1
- package/docs/access-backend-data.md +19 -0
- package/docs/app-architecture.md +94 -0
- package/docs/app-layout.md +139 -0
- package/docs/app-wiring.md +123 -0
- package/docs/bim-components/coding-conventions.md +128 -0
- package/docs/bim-components/element-collections.md +69 -0
- package/docs/bim-components/expose-events.md +84 -0
- package/docs/bim-components/library-examples.md +28 -0
- package/docs/bim-components/observable-collections.md +83 -0
- package/docs/bim-components/overview.md +160 -0
- package/docs/bim-components/per-frame-updates.md +20 -0
- package/docs/bim-components/save-and-restore-state.md +21 -0
- package/docs/bim-components/setup-and-cleanup.md +64 -0
- package/docs/bim-components/type-conventions.md +49 -0
- package/docs/bim-components/user-driven-object-creation.md +56 -0
- package/docs/cli-setup.md +54 -0
- package/docs/cloud-components.md +74 -0
- package/docs/connect-logic-to-ui.md +113 -0
- package/docs/previewing.md +45 -0
- package/docs/publishing.md +35 -0
- package/docs/scaffolding.md +54 -0
- package/docs/ui-components/async-actions.md +18 -0
- package/docs/ui-components/confirmation-dialog.md +39 -0
- package/docs/ui-components/data-table.md +185 -0
- package/docs/ui-components/display-text.md +39 -0
- package/docs/ui-components/inline-form.md +44 -0
- package/docs/ui-components/library-examples.md +24 -0
- package/docs/ui-components/overview.md +194 -0
- package/docs/ui-components/rendering-patterns.md +129 -0
- package/docs/ui-components/sections-layout.md +123 -0
- package/docs/update-grid-elements.md +46 -0
- package/docs/using-colors.md +32 -0
- package/docs/using-icons.md +37 -0
- package/package.json +3 -1
- package/src/cli/templates/bim/CONTEXT.md +3 -3
- package/src/cli/templates/bim/package.json +1 -1
- package/src/cli/templates/bim/src/app.ts +1 -1
- package/src/cli/templates/bim/src/bim-components/CloudRunner/index.ts +1 -1
- package/src/cli/templates/bim/src/main.ts +1 -1
- package/src/cli/templates/bim/src/setups/ui-manager.ts +1 -1
- package/src/cli/templates/bim/src/setups/viewports-manager.ts +1 -1
- package/src/cli/templates/cloud/CONTEXT.md +4 -4
- package/src/cli/templates/cloud/package.json +1 -1
- package/src/cli/templates/cloud/src/main.ts +1 -1
- package/src/cli/templates/cloud-test/package.json +1 -1
- package/src/cli/templates/cloud-test/src/main.ts +1 -1
- package/src/cli/templates/default/CONTEXT.md +4 -4
- package/src/cli/templates/default/package.json +3 -0
- package/src/cli/templates/default/src/main.ts +3 -3
- package/src/cli/templates/shared/AGENTS.md +23 -0
- package/src/cli/templates/shared/CLAUDE.md +1 -0
- package/src/cli/templates/shared/cloud/vite.config.js +3 -3
- package/src/cli/templates/test/package.json +1 -1
- package/src/cli/templates/test/src/main.ts +2 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Panel Section Layout
|
|
2
|
+
|
|
3
|
+
## Composition mental model
|
|
4
|
+
|
|
5
|
+
A panel section has zones that follow a natural sequence reflecting how the user processes the panel: first they act on the context (controls), then understand the current state (messages), then operate on the selected item (toolbar), then see the data (main content), and finally execute high-impact actions (bottom).
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<bim-panel-section label="..." icon="..." fixed?>
|
|
9
|
+
[controls bar] ← search or selector + action buttons
|
|
10
|
+
[status messages] ← conditional bim-labels (warn, success, info)
|
|
11
|
+
[actions toolbar] ← bim-toolbar when there are many actions on the active item
|
|
12
|
+
[main content] ← table, list, or sub-component
|
|
13
|
+
[primary actions] ← 1-2 high-impact buttons at the bottom
|
|
14
|
+
</bim-panel-section>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Not all zones are always present. This sequence is a guide, not a mandatory template — if the panel's content breaks that flow in a way that improves the experience, propose the layout that makes the most sense and explain the reasoning.
|
|
18
|
+
|
|
19
|
+
### Forbidden nesting
|
|
20
|
+
|
|
21
|
+
Inside a `<bim-panel-section>` it is **never** valid to place:
|
|
22
|
+
|
|
23
|
+
- Another `<bim-panel-section>`
|
|
24
|
+
- A `<bim-panel>`
|
|
25
|
+
|
|
26
|
+
This mistake is most tempting when the user asks to "group" sections. The correct answer is **not** nesting — it is creating independent templates. A template does not decide how it is grouped with others; that is the consumer's responsibility. If the content truly belongs in one section, use the existing internal zones (`controls bar`, `toolbar`, `main content`). If it needs to be split into multiple sections, each section is its own independent template.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Controls bar
|
|
31
|
+
|
|
32
|
+
Always a `<div style="display: flex; gap: 0.5rem;">`. There are two main variants:
|
|
33
|
+
|
|
34
|
+
**Search** — when the user filters over a list or table:
|
|
35
|
+
```ts
|
|
36
|
+
return BUI.html`
|
|
37
|
+
<bim-panel-section label="Elements">
|
|
38
|
+
<div style="display: flex; gap: 0.5rem;">
|
|
39
|
+
<bim-text-input @input=${onSearch} vertical placeholder="Search..."></bim-text-input>
|
|
40
|
+
<bim-button icon=${icons.ADD} @click=${onCreate}></bim-button>
|
|
41
|
+
</div>
|
|
42
|
+
${table}
|
|
43
|
+
</bim-panel-section>
|
|
44
|
+
`
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Selector** — when the user picks the active item from a dropdown. The gap is tighter (`0.25rem`) because the dropdown already takes most of the width:
|
|
48
|
+
```ts
|
|
49
|
+
return BUI.html`
|
|
50
|
+
<bim-panel-section label="Proposals">
|
|
51
|
+
<div style="display: flex; gap: 0.25rem;">
|
|
52
|
+
${proposalsDropdown}
|
|
53
|
+
<bim-button icon=${icons.ADD} @click=${onCreate}></bim-button>
|
|
54
|
+
</div>
|
|
55
|
+
${content}
|
|
56
|
+
</bim-panel-section>
|
|
57
|
+
`
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Action buttons in the controls bar are always icon-only (`icon=` without `label=`). The search `<bim-text-input>` always has `vertical` and `debounce="200"`.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Status messages
|
|
65
|
+
|
|
66
|
+
Conditional `<bim-label>` elements that appear between the controls and the content to communicate the state of the active item — warnings, confirmations, relevant info. Built as optional variables:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
let statusMessage: BUI.TemplateResult | undefined
|
|
70
|
+
if (item?.status === "sent") {
|
|
71
|
+
statusMessage = BUI.html`<bim-label>This item has been sent and can't be modified.</bim-label>`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return BUI.html`
|
|
75
|
+
<bim-panel-section label="...">
|
|
76
|
+
${controls}
|
|
77
|
+
${statusMessage}
|
|
78
|
+
${content}
|
|
79
|
+
</bim-panel-section>
|
|
80
|
+
`
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Actions toolbar
|
|
86
|
+
|
|
87
|
+
When there are many actions on the active item (more than 3-4 buttons), use `<bim-toolbar>` with `<bim-toolbar-section>` instead of a plain flex div. The toolbar goes after the status messages and before the main content:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const toolbar = BUI.html`
|
|
91
|
+
<bim-toolbar style="border: 1px solid var(--bim-ui_bg-contrast-20);">
|
|
92
|
+
<bim-toolbar-section>
|
|
93
|
+
${addItemBtn}
|
|
94
|
+
<bim-button style="flex: 0" icon=${icons.SELECT} @click=${onSelect}></bim-button>
|
|
95
|
+
<bim-button style="flex: 0" icon=${icons.DELETE} @click=${onDelete}></bim-button>
|
|
96
|
+
</bim-toolbar-section>
|
|
97
|
+
</bim-toolbar>
|
|
98
|
+
`
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Buttons inside the toolbar always have `style="flex: 0"` to prevent them from stretching.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Conditional content
|
|
106
|
+
|
|
107
|
+
When the panel content changes completely based on state (e.g. "select something first" vs. showing data), assign to a variable before the `return`:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
let content: BUI.TemplateResult
|
|
111
|
+
if (hasSelection) {
|
|
112
|
+
content = BUI.html`<bim-table ...></bim-table>`
|
|
113
|
+
} else {
|
|
114
|
+
content = BUI.html`<bim-label>Select an element to see its data.</bim-label>`
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return BUI.html`
|
|
118
|
+
<bim-panel-section label="...">
|
|
119
|
+
${controls}
|
|
120
|
+
${content}
|
|
121
|
+
</bim-panel-section>
|
|
122
|
+
`
|
|
123
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Update Grid Elements
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
`app.grid.updateComponent` pushes a state update to a specific named grid element. Use it when a BIM component event needs to refresh the state of a template-based section mounted in the grid.
|
|
6
|
+
|
|
7
|
+
This is different from `uis.custom.get(...).updateInstances()` — that re-renders all instances of a UIManager template regardless of where they're mounted. `updateComponent` targets a **specific grid slot by name**, which makes it the right choice when the element lives in the grid and you want precise, typed control over what state it receives.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
app.grid.updateComponent[componentName](updatedState)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **`componentName`** — the element name as declared in the `App` type (e.g. `"qtosSection"`)
|
|
18
|
+
- **`updatedState`** — partial state; only the provided fields are merged
|
|
19
|
+
|
|
20
|
+
The call is fully typed: the accepted state shape is inferred from the `{ComponentName}GridElement` type in `app.ts`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Where to call it
|
|
25
|
+
|
|
26
|
+
In a setup file (`setups/{custom}.ts`), in response to a BIM component event:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// setups/qto-manager.ts
|
|
30
|
+
export const qtoManager = (components: OBC.Components) => {
|
|
31
|
+
const app = getAppManager(components)
|
|
32
|
+
const qtoManager = components.get(QtoManager)
|
|
33
|
+
|
|
34
|
+
qtoManager.onResultsChanged.add((results) => {
|
|
35
|
+
app.grid.updateComponent["qtosSection"]({ results })
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Never call `updateComponent` from inside a template function — templates receive state passively and should not trigger updates themselves.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Type safety
|
|
45
|
+
|
|
46
|
+
Because `app.grid` is typed via the `App` type in `app.ts`, TypeScript knows which names are valid and what state shape each one accepts. Passing an unknown name or a mismatched state shape produces a type error at the call site.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Using Colors
|
|
2
|
+
|
|
3
|
+
## `globals.ts` shape
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
export const colors = {
|
|
7
|
+
GREEN: "#00FF00",
|
|
8
|
+
SOFT_BLUE: "#5B8CFF",
|
|
9
|
+
}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Colors are always stored as full hex codes, including the `#`.** This is required because some systems (like the highlighter) use the string itself as a style identifier in addition to a color value.
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
|
|
16
|
+
- No hardcoded inline colors — not in the highlighter, not in palettes, not in any component. Always imported from `globals.ts`.
|
|
17
|
+
- Before adding a new color, check whether an existing one already works.
|
|
18
|
+
|
|
19
|
+
## Example: highlighter
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const highlighter = components.get(OBF.Highlighter)
|
|
23
|
+
if (!highlighter.styles.has(colors.GREEN)) {
|
|
24
|
+
highlighter.styles.set(colors.GREEN, {
|
|
25
|
+
color: new THREE.Color(colors.GREEN),
|
|
26
|
+
renderedFaces: 1,
|
|
27
|
+
opacity: 1,
|
|
28
|
+
transparent: false,
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
highlighter.highlightByID(colors.GREEN, modelIdMap)
|
|
32
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Using Icons
|
|
2
|
+
|
|
3
|
+
## Icon registry rules
|
|
4
|
+
|
|
5
|
+
**All icons in a platform app must be declared in `globals.ts` and accessed through `AppManager`.** This is not optional.
|
|
6
|
+
|
|
7
|
+
The flow is always:
|
|
8
|
+
1. Declare the icon in `globals.ts` with a `UPPER_SNAKE_CASE` key
|
|
9
|
+
2. `app.ts` — the `App` type's `icons` field is typed as `(keyof typeof icons)[]`, which means any new key added to the registry is automatically reflected in the type — no manual update needed per icon, but this field must be present in the `App` type
|
|
10
|
+
3. Pass the registry to `app.init()` as `icons: appIcons`
|
|
11
|
+
4. Access icons elsewhere via `app.icons.KEY_NAME` (always through `getAppManager(components)`)
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// ✗ Forbidden — inline icon string anywhere in the app
|
|
15
|
+
<bim-button icon="ic:round-warning"></bim-button>
|
|
16
|
+
grid.layouts = { Viewer: { icon: "ic:round-warning", template: `...` } }
|
|
17
|
+
|
|
18
|
+
// ✓ Correct — always via the registry
|
|
19
|
+
const app = getAppManager(components)
|
|
20
|
+
<bim-button icon=${app.icons.WARNING}></bim-button>
|
|
21
|
+
grid.layouts = { Viewer: { icon: app.icons.WARNING, template: `...` } }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Before adding a new icon
|
|
25
|
+
|
|
26
|
+
Before declaring a new icon in `globals.ts`, check if an existing one in the registry already serves the purpose. Reuse an existing icon when it communicates the same intent — avoid registry bloat.
|
|
27
|
+
|
|
28
|
+
If no existing icon fits, add it to `globals.ts` first — then use it through `app.icons`.
|
|
29
|
+
|
|
30
|
+
## `globals.ts` shape
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export const icons = {
|
|
34
|
+
WARNING: "ic:round-warning",
|
|
35
|
+
COLLISION: "fa7-solid:explosion",
|
|
36
|
+
}
|
|
37
|
+
```
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"private": false,
|
|
18
|
-
"version": "0.0.
|
|
18
|
+
"version": "0.0.2",
|
|
19
19
|
"main": "dist/index.cjs.js",
|
|
20
20
|
"module": "dist/index.es.js",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"dist",
|
|
27
27
|
"src/cli/templates",
|
|
28
28
|
"src/built-in",
|
|
29
|
+
"docs",
|
|
30
|
+
"AGENTS.md",
|
|
29
31
|
"CONTEXT.md"
|
|
30
32
|
],
|
|
31
33
|
"scripts": {
|
|
@@ -46,7 +46,7 @@ Always use `npm run dev` which runs `thatopen serve` under the hood.
|
|
|
46
46
|
| `@thatopen/ui` | `BUI` | UI web components (`<bim-panel>`, `<bim-grid>`, etc.) |
|
|
47
47
|
| `@thatopen/ui-obc` | `CUI` | Pre-built OBC UI tables (used by ModelsPanel) |
|
|
48
48
|
| `three` | `THREE` | 3D rendering engine |
|
|
49
|
-
|
|
|
49
|
+
| `@thatopen/services` | `EngineServicesClient` | Platform API client + built-in components |
|
|
50
50
|
|
|
51
51
|
## Architecture pattern
|
|
52
52
|
|
|
@@ -85,7 +85,7 @@ They are fetched, evaluated, and registered with the OBC component system.
|
|
|
85
85
|
| **ScreenshotAnnotator** | Modal for annotating screenshots (arrows, text, freehand) via MarkerJS |
|
|
86
86
|
|
|
87
87
|
**Full API reference**: Each component has detailed JSDoc with `@example` blocks in the
|
|
88
|
-
|
|
88
|
+
`@thatopen/services` package source (`src/built-in/index.ts`). Read that file for config
|
|
89
89
|
interfaces, method signatures, and code examples.
|
|
90
90
|
|
|
91
91
|
### Loading pattern
|
|
@@ -93,7 +93,7 @@ interfaces, method signatures, and code examples.
|
|
|
93
93
|
Use `setup` to create the component system and load built-in components in one call:
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
|
-
import { PlatformClient, AppManager, ViewportsManager } from "thatopen
|
|
96
|
+
import { PlatformClient, AppManager, ViewportsManager } from "@thatopen/services";
|
|
97
97
|
|
|
98
98
|
const client = PlatformClient.fromPlatformContext();
|
|
99
99
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as OBC from "@thatopen/components";
|
|
2
2
|
import * as BUI from "@thatopen/ui";
|
|
3
|
-
import { AppManager } from "thatopen
|
|
3
|
+
import { AppManager } from "@thatopen/services";
|
|
4
4
|
import { icons } from "./globals";
|
|
5
5
|
import { AppInfoSectionGridElement, CloudRunnerSectionGridElement } from "./ui-components";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as OBC from "@thatopen/components";
|
|
2
|
-
import { ViewportsManager } from "thatopen
|
|
2
|
+
import { ViewportsManager } from "@thatopen/services";
|
|
3
3
|
|
|
4
4
|
export const viewportsManager = async (components: OBC.Components) => {
|
|
5
5
|
const viewports = components.get(ViewportsManager);
|
|
@@ -7,7 +7,7 @@ It runs on the server as a Node.js process, triggered via the platform API.
|
|
|
7
7
|
|
|
8
8
|
- **Entry point**: `src/main.ts` — must export an `async function main()`.
|
|
9
9
|
- **Parameter schema**: `declarations.json` — the list of parameters this component accepts. Bundled next to the code so the platform, the UI, and `thatopen run` know what to pass in.
|
|
10
|
-
- **Build output**: `dist/bundle.js` — an IIFE built by Vite with
|
|
10
|
+
- **Build output**: `dist/bundle.js` — an IIFE built by Vite with `@thatopen/services` externalized.
|
|
11
11
|
- **Execution**: The platform (or `thatopen run` locally) wraps the bundle in an execution engine that provides globals and calls `main()`.
|
|
12
12
|
|
|
13
13
|
## Parameters (`declarations.json`)
|
|
@@ -57,7 +57,7 @@ npx thatopen local-server --port 5000 # Custom port
|
|
|
57
57
|
Then in your app or test script:
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
import { EngineServicesClient } from "thatopen
|
|
60
|
+
import { EngineServicesClient } from "@thatopen/services";
|
|
61
61
|
|
|
62
62
|
const client = new EngineServicesClient(token, apiUrl, {
|
|
63
63
|
localServerUrl: "http://localhost:4001",
|
|
@@ -89,7 +89,7 @@ Libraries like `@thatopen/components`, `three`, `web-ifc`, or Node's `fs` are **
|
|
|
89
89
|
Already declared in `src/main.ts`. Keep them there for type checking:
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
|
-
declare const thatOpenServices: import("thatopen
|
|
92
|
+
declare const thatOpenServices: import("@thatopen/services").EngineServicesClient;
|
|
93
93
|
declare const executionParams: Record<string, unknown>;
|
|
94
94
|
declare const executionContext: {
|
|
95
95
|
projectId?: string;
|
|
@@ -197,7 +197,7 @@ if (!hasPermission) {
|
|
|
197
197
|
## Build configuration
|
|
198
198
|
|
|
199
199
|
- `vite.config.js` builds to IIFE format.
|
|
200
|
-
- Only
|
|
200
|
+
- Only `@thatopen/services` is externalized — the wrapper provides it at runtime via `require()`. Everything else (including any third-party npm dependency you install) is bundled into `dist/bundle.js`.
|
|
201
201
|
- The build output has a footer `var main = ThatOpenComponent.main;` so the engine can find the entry point as a top-level `main` variable.
|
|
202
202
|
|
|
203
203
|
## Configuration
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
// Globals injected by the execution engine at runtime — keep these for type checking
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
declare const thatOpenServices: import("thatopen
|
|
25
|
+
declare const thatOpenServices: import("@thatopen/services").EngineServicesClient;
|
|
26
26
|
declare const executionParams: Record<string, unknown>;
|
|
27
27
|
declare const executionContext: {
|
|
28
28
|
projectId?: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Generated by: thatopen create --template cloud-test
|
|
4
4
|
|
|
5
5
|
// Globals injected by the execution engine at runtime
|
|
6
|
-
declare const thatOpenServices: import("thatopen
|
|
6
|
+
declare const thatOpenServices: import("@thatopen/services").EngineServicesClient;
|
|
7
7
|
declare const executionParams: Record<string, unknown>;
|
|
8
8
|
declare const executionReporter: {
|
|
9
9
|
message(msg: string): void;
|
|
@@ -41,7 +41,7 @@ Always use `npm run dev` which runs `thatopen serve` under the hood.
|
|
|
41
41
|
To add 3D BIM viewing, install the BIM dependencies:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
npm install @thatopen/components @thatopen/ui three thatopen
|
|
44
|
+
npm install @thatopen/components @thatopen/ui three @thatopen/services
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Then follow the BIM app pattern:
|
|
@@ -53,7 +53,7 @@ import * as OBF from "@thatopen/components-front";
|
|
|
53
53
|
import * as FRAGS from "@thatopen/fragments";
|
|
54
54
|
import * as BUI from "@thatopen/ui";
|
|
55
55
|
import * as CUI from "@thatopen/ui-obc";
|
|
56
|
-
import { PlatformClient, AppManager, ViewportManager } from "thatopen
|
|
56
|
+
import { PlatformClient, AppManager, ViewportManager } from "@thatopen/services";
|
|
57
57
|
|
|
58
58
|
const client = PlatformClient.fromPlatformContext();
|
|
59
59
|
const { components } = await client.setup(
|
|
@@ -67,10 +67,10 @@ const { element, world } = await viewports.create();
|
|
|
67
67
|
|
|
68
68
|
## EngineServicesClient API
|
|
69
69
|
|
|
70
|
-
If you install
|
|
70
|
+
If you install `@thatopen/services`, you can make API calls:
|
|
71
71
|
|
|
72
72
|
```ts
|
|
73
|
-
import { PlatformClient } from "thatopen
|
|
73
|
+
import { PlatformClient } from "@thatopen/services";
|
|
74
74
|
|
|
75
75
|
const client = PlatformClient.fromPlatformContext();
|
|
76
76
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
// apiUrl — base URL for the That Open API
|
|
11
11
|
//
|
|
12
12
|
// To add BIM capabilities (3D viewer, model loading), install:
|
|
13
|
-
// npm install @thatopen/components @thatopen/ui three thatopen
|
|
13
|
+
// npm install @thatopen/components @thatopen/ui three @thatopen/services
|
|
14
14
|
// Then see the "bim" template for the full pattern.
|
|
15
15
|
|
|
16
|
-
import { PlatformClient } from "thatopen
|
|
17
|
-
import type { ThatOpenContext, ProjectData } from "thatopen
|
|
16
|
+
import { PlatformClient } from "@thatopen/services";
|
|
17
|
+
import type { ThatOpenContext, ProjectData } from "@thatopen/services";
|
|
18
18
|
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Working on this That Open Platform project — Agent Guide
|
|
2
|
+
|
|
3
|
+
You're an AI assistant helping build/extend this project (a BIM app or cloud component) on the
|
|
4
|
+
That Open Platform. Read this first.
|
|
5
|
+
|
|
6
|
+
## Rules (always apply)
|
|
7
|
+
1. **All business logic lives in a BIM component** (`src/bim-components/`). `setups/` only wire;
|
|
8
|
+
`ui-components/` only render; `main.ts` only boots. New logic → a new (or existing) component.
|
|
9
|
+
2. **Check engine components first** — `@thatopen/components` (`OBC`) / `@thatopen/components-front`
|
|
10
|
+
(`OBF`) — before building anything custom.
|
|
11
|
+
3. **Propose a short plan and get the user's OK** before changing files.
|
|
12
|
+
|
|
13
|
+
## Where the full build guides live
|
|
14
|
+
The complete, up-to-date guides ship with the library. Read them from the installed package:
|
|
15
|
+
- `node_modules/@thatopen/services/AGENTS.md` — the router; **start here**
|
|
16
|
+
- `node_modules/@thatopen/services/docs/` — detailed guides (app wiring, layout, connecting logic
|
|
17
|
+
to UI, building BIM/UI components, cloud components, publishing, icons, colors, …)
|
|
18
|
+
- `node_modules/@thatopen/services/CONTEXT.md` — library API reference (`PlatformClient` vs
|
|
19
|
+
`EngineServicesClient`, permissions)
|
|
20
|
+
|
|
21
|
+
## This project
|
|
22
|
+
- `CONTEXT.md` (this folder) — the context for *this specific* project.
|
|
23
|
+
- `package.json` scripts — `npm run dev` (preview), `npm run login`, `npm run publish`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
See [AGENTS.md](./AGENTS.md) for how to work on this project, the rules to follow, and where the full That Open Platform build guides live.
|
|
@@ -14,11 +14,11 @@ export default defineConfig({
|
|
|
14
14
|
},
|
|
15
15
|
outDir: 'dist',
|
|
16
16
|
rollupOptions: {
|
|
17
|
-
// Only thatopen
|
|
18
|
-
// provides it at runtime via require('thatopen
|
|
17
|
+
// Only @thatopen/services is externalized — the execution wrapper
|
|
18
|
+
// provides it at runtime via require('@thatopen/services'). Every
|
|
19
19
|
// other dependency (including @thatopen/components, three, web-ifc,
|
|
20
20
|
// or any npm package you install) must be bundled into bundle.js.
|
|
21
|
-
external: ['thatopen
|
|
21
|
+
external: ['@thatopen/services'],
|
|
22
22
|
output: {
|
|
23
23
|
footer: 'var main = ThatOpenComponent.main;',
|
|
24
24
|
},
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
PlatformClient,
|
|
13
13
|
AppManager,
|
|
14
14
|
ViewportManager,
|
|
15
|
-
} from "thatopen
|
|
16
|
-
import type { ThatOpenContext } from "thatopen
|
|
15
|
+
} from "@thatopen/services";
|
|
16
|
+
import type { ThatOpenContext } from "@thatopen/services";
|
|
17
17
|
|
|
18
18
|
declare global {
|
|
19
19
|
interface Window {
|