@thatopen/services 0.3.15 → 0.4.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 (68) hide show
  1. package/README.md +62 -62
  2. package/dist/built-in/index.d.ts +165 -2
  3. package/dist/cli.js +27 -13
  4. package/dist/core/client.d.ts +1 -0
  5. package/dist/core/platform-client.d.ts +7 -0
  6. package/dist/index.cjs.js +2 -2
  7. package/dist/index.es.js +396 -374
  8. package/dist/vite-env.d.ts +1 -1
  9. package/docs/builtin/paths.json +94 -86
  10. package/docs/cli/create.md +29 -29
  11. package/docs/cli/local-server.md +38 -38
  12. package/docs/cli/login.md +32 -32
  13. package/docs/cli/publish.md +31 -31
  14. package/docs/cli/run.md +26 -26
  15. package/docs/cli/serve.md +43 -43
  16. package/docs/cli/swap.md +30 -30
  17. package/package.json +4 -4
  18. package/resources/AGENTS.md +40 -40
  19. package/src/built-in/CDEManager/example.ts +214 -214
  20. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  21. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  22. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  23. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  24. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  25. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  26. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  27. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  28. package/src/built-in/ClashesManager/example.ts +283 -283
  29. package/src/built-in/UIManager/src/app/example.ts +97 -97
  30. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
  31. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
  32. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
  33. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
  34. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
  35. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
  36. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
  37. package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -0
  38. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
  39. package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -160
  40. package/src/built-in/UIManager/src/models-list/example.ts +122 -122
  41. package/src/built-in/UIManager/src/topics-panel/example.ts +170 -0
  42. package/src/built-in/index.ts +1048 -881
  43. package/src/cli/templates/app/index.html +35 -35
  44. package/src/cli/templates/app/package.json +32 -32
  45. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
  46. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  47. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  48. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  49. package/src/cli/templates/app/src/globals.ts +1 -1
  50. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
  51. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
  52. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
  53. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
  54. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
  55. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
  56. package/src/cli/templates/app/src/ui-components/index.ts +2 -2
  57. package/src/cli/templates/app/tsconfig.json +16 -16
  58. package/src/cli/templates/app/vite.config.js +57 -57
  59. package/src/cli/templates/cloud-component/README.md +205 -205
  60. package/src/cli/templates/cloud-component/_thatopen +5 -5
  61. package/src/cli/templates/cloud-component/declarations.json +4 -4
  62. package/src/cli/templates/cloud-component/package.json +21 -21
  63. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  64. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  65. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  66. package/src/cli/templates/shared/AGENTS.md +8 -8
  67. package/src/cli/templates/shared/CLAUDE.md +1 -1
  68. package/src/cli/templates/shared/_gitignore +5 -5
@@ -0,0 +1,170 @@
1
+ /* MD
2
+ ## topics-panel
3
+ ---
4
+ Every coordination workflow needs a place to track issues, clashes, and
5
+ action items against a 3D model — who's responsible, what still needs
6
+ review, and where in the model it actually is. Building that from scratch
7
+ means a BCF-compatible data model, a form, comment threads, viewpoint
8
+ capture/navigation, document links, and a persistence layer — all before a
9
+ single issue gets tracked.
10
+
11
+ `topics-panel` is a ready-made web component that delivers exactly that. It
12
+ connects to `@thatopen/components`' `BCFTopics` (and `Viewpoints`)
13
+ automatically and manages the entire workflow: the topic list with search,
14
+ full CRUD on topics/comments/viewpoints/documents, camera navigation,
15
+ BCF export/import, and auto-save — without you writing any UI code.
16
+
17
+ This tutorial covers the prerequisites before mounting the panel; dropping
18
+ it into a `top-app` layout alongside a 3D viewer; and a breakdown of
19
+ everything the panel handles automatically so you know what you do not need
20
+ to implement yourself.
21
+
22
+ By the end, you'll have a fully working topics/issues environment running
23
+ in your application with a single line of markup.
24
+ */
25
+
26
+ import { html } from "lit";
27
+ import * as THREE from "three";
28
+ import * as OBC from "@thatopen/components";
29
+ import * as OBF from "@thatopen/components-front";
30
+ import * as FRAGS from "@thatopen/fragments";
31
+ import * as BUI from "@thatopen/ui";
32
+ import { PlatformClient, UIManager, TopicsManager } from "@thatopen/services";
33
+ import type { App } from "../app/index";
34
+
35
+
36
+ /* MD
37
+ ### ✅ Prerequisites
38
+
39
+ Two conditions must be met before the panel mounts:
40
+
41
+ 1. **`UIManager` must be in the setup call.** It registers all platform web
42
+ components, including `<top-topics-panel>` itself. Without it the
43
+ element is unknown to the browser and renders as an empty box.
44
+
45
+ 2. **`TopicsManager.init(client)` must have resolved.** It configures
46
+ `BCFTopics` (version, author, assignable users — all from real project
47
+ data) and loads whatever BCF was previously saved for this project. The
48
+ panel mounts into an empty state and never catches up on its own if you
49
+ load a BCF after the fact; it only subscribes to change events, it does
50
+ not poll.
51
+
52
+ Both conditions are naturally satisfied when you call `init` before
53
+ appending `top-app` to the document, which is the pattern shown below.
54
+ */
55
+
56
+ const client = PlatformClient.fromPlatformContext();
57
+
58
+ // The `{ uuid }` entries tell the platform which built-ins to register for
59
+ // this app — one per built-in beyond the "stable" `@thatopen/components`
60
+ // globals passed as the first argument.
61
+ const { components } = (await client.setup(
62
+ { OBC, OBF, BUI, THREE, FRAGS },
63
+ { uuid: UIManager.uuid },
64
+ { uuid: TopicsManager.uuid },
65
+ )) as { components: OBC.Components };
66
+
67
+ components.get(UIManager).init();
68
+
69
+ // init must resolve before top-app (and therefore topics-panel) mounts.
70
+ await components.get(TopicsManager).init(client);
71
+
72
+ /* MD
73
+ ### 🖥️ Wiring the panel
74
+
75
+ Add `topics-panel` as a named area in `app.elements` and reference it in
76
+ your layout template, next to the 3D viewer — the panel controls the
77
+ camera and element selection directly in the scene when you click a
78
+ viewpoint.
79
+ */
80
+
81
+ const app = document.createElement("top-app") as unknown as App;
82
+
83
+ app.setup = (waitUntil) => {
84
+ waitUntil(
85
+ (async () => {
86
+ const fragments = components.get(OBC.FragmentsManager);
87
+ const workerUrl = await FRAGS.FragmentsModels.getWorker();
88
+ fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
89
+ })(),
90
+ "Fragments Core",
91
+ );
92
+ return { components, client };
93
+ };
94
+
95
+ app.elements = {
96
+ viewer: () => html`<top-viewer><top-viewer-tools></top-viewer-tools></top-viewer>`,
97
+ topics: () => html`<top-topics-panel></top-topics-panel>`,
98
+ };
99
+
100
+ app.layouts = {
101
+ main: {
102
+ label: "Main",
103
+ icon: "solar:3d-square-bold",
104
+ template: `"viewer topics" 1fr / 1fr 30rem`,
105
+ },
106
+ };
107
+
108
+ app.layout = "main";
109
+
110
+ const container = document.getElementById("that-open-app") ?? document.body;
111
+ container.appendChild(app);
112
+ document.body.style.margin = "0";
113
+
114
+ /* MD
115
+ ### 🤖 What's handled automatically
116
+
117
+ **`TopicsManager`** resolves `Viewpoints.world` in the background once
118
+ `top-viewer` creates it (which only happens after `top-app` finishes
119
+ mounting), including backfilling it onto viewpoints that were restored
120
+ from the saved BCF before the world existed — `Viewpoint.go()` would
121
+ otherwise silently no-op for every one of them. Nothing to wire yourself.
122
+
123
+ **`topics-panel`**, once mounted, takes ownership of the following without
124
+ any further code from you:
125
+
126
+ **Full topic CRUD** — create, edit, and delete (behind a confirmation
127
+ modal) topics with title, type, status, priority, assigned-to, due date,
128
+ and stage. The list shows a search bar, a type badge next to each title,
129
+ and switches to an empty state with a "New topic" call-to-action when
130
+ there's nothing yet.
131
+
132
+ **Comments** — add, edit, and delete (with confirmation) threaded comments
133
+ on a topic, each optionally linked to a specific viewpoint via a clickable
134
+ tag that jumps the camera there.
135
+
136
+ **Viewpoints** — capture the current camera + selection as a new
137
+ viewpoint, browse them in a snapshot carousel, and click one to fly the
138
+ camera and re-apply its selection highlight. Navigation is a no-op (not an
139
+ error) if no models are loaded yet, so a stray click can't fly the camera
140
+ toward nothing.
141
+
142
+ **Documents** — link files from the project's CDE storage (searchable tree
143
+ picker), unlink from just this topic or hard-delete everywhere it's
144
+ referenced, and download. Linking is genuinely shared: the same file
145
+ referenced by two topics reuses one document entry instead of duplicating
146
+ it.
147
+
148
+ **BCF export/import** — export the selected topics (or, with nothing
149
+ selected, the whole project) to a single `.bcf` file named after the
150
+ project or the lone topic's title. Import merges a `.bcf` into the current
151
+ project instead of replacing it; a topic sharing a GUID with an existing
152
+ one is overwritten (treated as an update from elsewhere, not a conflict).
153
+
154
+ **Persistence** — every mutation is auto-saved through `top-app`'s
155
+ `projectStorageContext`, debounced per file so rapid edits collapse into
156
+ one upload. A small "Saving..." indicator (shared with any other built-in
157
+ using the same context, e.g. `clashes-panel`) reflects the real
158
+ debounce-then-upload cycle: just the icon while pending, the full pill
159
+ while actually uploading.
160
+
161
+ **Author/assignee names** — emails resolve to real names (with an
162
+ initials avatar) via `top-app`'s `projectDataContext`, which already
163
+ covers the project owner as well as regular collaborators — no separate
164
+ lookup needed.
165
+
166
+ **Cross-panel awareness** — the list updates live even when a topic is
167
+ created somewhere else entirely (e.g. `clashes-panel`'s "Create topic from
168
+ clash"), including the empty-state → list transition if this was the
169
+ project's first topic.
170
+ */