@snaptrude/plugin-client 0.3.0 → 0.5.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.
- package/AGENTS.md +39 -45
- package/CHANGELOG.md +99 -0
- package/CLAUDE.md +1 -1
- package/dist/api/index.d.ts +12 -13
- package/dist/api/index.d.ts.map +1 -1
- package/dist/index.cjs +23 -467
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -460
- package/dist/index.js.map +1 -1
- package/dist/rpc-proxy.d.ts +28 -0
- package/dist/rpc-proxy.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/api/index.ts +26 -18
- package/src/rpc-proxy.ts +56 -0
- package/dist/api/core/geom/arc.d.ts +0 -5
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -5
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/index.d.ts +0 -17
- package/dist/api/core/geom/index.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -5
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -7
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/core/index.d.ts +0 -11
- package/dist/api/core/index.d.ts.map +0 -1
- package/dist/api/core/math/index.d.ts +0 -11
- package/dist/api/core/math/index.d.ts.map +0 -1
- package/dist/api/core/math/quat.d.ts +0 -5
- package/dist/api/core/math/quat.d.ts.map +0 -1
- package/dist/api/core/math/vec3.d.ts +0 -5
- package/dist/api/core/math/vec3.d.ts.map +0 -1
- package/dist/api/entity/department.d.ts +0 -7
- package/dist/api/entity/department.d.ts.map +0 -1
- package/dist/api/entity/index.d.ts +0 -17
- package/dist/api/entity/index.d.ts.map +0 -1
- package/dist/api/entity/referenceLine.d.ts +0 -9
- package/dist/api/entity/referenceLine.d.ts.map +0 -1
- package/dist/api/entity/space.d.ts +0 -11
- package/dist/api/entity/space.d.ts.map +0 -1
- package/dist/api/entity/story.d.ts +0 -9
- package/dist/api/entity/story.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -3
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -17
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -6
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -3
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -6
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -7
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -7
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -7
- package/src/api/core/geom/curve.ts +0 -7
- package/src/api/core/geom/index.ts +0 -25
- package/src/api/core/geom/line.ts +0 -7
- package/src/api/core/geom/profile.ts +0 -17
- package/src/api/core/index.ts +0 -17
- package/src/api/core/math/index.ts +0 -17
- package/src/api/core/math/quat.ts +0 -7
- package/src/api/core/math/vec3.ts +0 -7
- package/src/api/entity/department.ts +0 -30
- package/src/api/entity/index.ts +0 -25
- package/src/api/entity/referenceLine.ts +0 -54
- package/src/api/entity/space.ts +0 -98
- package/src/api/entity/story.ts +0 -66
- package/src/api/tools/copy.ts +0 -10
- package/src/api/tools/index.ts +0 -36
- package/src/api/tools/material.ts +0 -22
- package/src/api/tools/offset.ts +0 -15
- package/src/api/tools/selection.ts +0 -15
- package/src/api/tools/transform.ts +0 -44
- package/src/api/units/index.ts +0 -34
package/AGENTS.md
CHANGED
|
@@ -7,13 +7,16 @@ Plugins import `snaptrude` from this package to interact with the Snaptrude host
|
|
|
7
7
|
|
|
8
8
|
> Source of truth: [`packages/plugin-core/AGENTS.md`](../plugin-core/AGENTS.md)
|
|
9
9
|
|
|
10
|
-
This package
|
|
11
|
-
|
|
10
|
+
This package implements the API surface defined in `@snaptrude/plugin-core`. Only the
|
|
11
|
+
root `PluginApi` class is extended; every namespace under it is satisfied structurally
|
|
12
|
+
by a generic RPC proxy (see below). When plugin-core changes its top-level shape,
|
|
13
|
+
this package must be updated to match.
|
|
12
14
|
|
|
13
15
|
## What this package contains
|
|
14
16
|
|
|
15
|
-
- `src/api
|
|
16
|
-
- `src/
|
|
17
|
+
- `src/api/index.ts` — `ClientPluginApi`: wires one generic RPC proxy per top-level namespace
|
|
18
|
+
- `src/rpc-proxy.ts` — `createRpcNamespace()`: Proxy mapping dotted property paths to host RPC calls
|
|
19
|
+
- `src/host-api.ts` — Comlink RPC wrapper (`HostApi.call()`); unwraps success/error results
|
|
17
20
|
- `src/plugin-worker.ts` — `PluginWorker` base class (lifecycle, UI messaging, Comlink exposure)
|
|
18
21
|
- `src/index.ts` — Exports the `snaptrude` singleton (`ClientPluginApi` instance)
|
|
19
22
|
|
|
@@ -27,65 +30,56 @@ pnpm dev # tsup watch mode
|
|
|
27
30
|
|
|
28
31
|
## Implementation patterns
|
|
29
32
|
|
|
30
|
-
###
|
|
33
|
+
### Everything is a generic RPC proxy (async, remote)
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
Under the all-handle model there is no in-worker compute: `core.math.*` and
|
|
36
|
+
`core.geom.*` values are opaque handles, so **every** namespace — `core.*`
|
|
37
|
+
(including `core.units`), `design.*`, `entity.*`, `tools.*` — is a
|
|
38
|
+
`createRpcNamespace<PluginXApi>("x")` Proxy. There are no hand-written
|
|
39
|
+
per-method wrappers. Nested property access builds the dot-separated method
|
|
40
|
+
path; the call marshals `{ method, args }` to the host via Comlink
|
|
41
|
+
(`getHostApi().call()`):
|
|
34
42
|
|
|
35
43
|
```typescript
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Host API calls (async, RPC)
|
|
41
|
-
|
|
42
|
-
Methods on `entity.*`, `tools.*`, and `units.*` marshal calls to the host via Comlink:
|
|
44
|
+
// src/api/index.ts — one proxy per top-level namespace
|
|
45
|
+
this.core = createRpcNamespace<PluginCoreApi>("core")
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
method: "entity.space.createRectangular",
|
|
49
|
-
args,
|
|
50
|
-
})
|
|
51
|
-
}
|
|
47
|
+
// Plugin code — positional args (whole tuple crosses the wire), values are handles:
|
|
48
|
+
const v = await snaptrude.core.math.vec3.new(1, 2, 3)
|
|
49
|
+
await snaptrude.entity.space.createRectangular(position, dimensions)
|
|
50
|
+
// → getHostApi().call({ method: "entity.space.createRectangular", args: [position, dimensions] })
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
The
|
|
55
|
-
|
|
53
|
+
The proxy is structurally cast to the abstract API type, so argument and return
|
|
54
|
+
types are enforced by plugin-core while dispatch stays dynamic. The `method`
|
|
55
|
+
string is exactly the property path and must match `PluginApiMethod`
|
|
56
|
+
(auto-inferred from the class hierarchy in `plugin-core/src/host-utils.ts`).
|
|
56
57
|
|
|
57
58
|
## When to update this package
|
|
58
59
|
|
|
59
|
-
- **plugin-core adds a
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- **plugin-core adds a new
|
|
63
|
-
|
|
60
|
+
- **plugin-core adds/removes/changes a method**: Usually nothing to do here — the
|
|
61
|
+
proxy dispatches dynamically and types flow from plugin-core. Rebuild plugin-core,
|
|
62
|
+
then run `pnpm check-types` here.
|
|
63
|
+
- **plugin-core adds a new top-level namespace on `PluginApi`**: Add a matching
|
|
64
|
+
`createRpcNamespace<PluginNewApi>("new")` property in `ClientPluginApi`
|
|
65
|
+
(`src/api/index.ts`). Nested modules under an existing namespace need no wiring.
|
|
64
66
|
|
|
65
67
|
After making changes, always run `pnpm check-types` to verify everything compiles.
|
|
66
68
|
|
|
67
69
|
## File mapping (plugin-core -> plugin-client)
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| `src/api
|
|
75
|
-
| `src/
|
|
76
|
-
| `src/api/core/geom/profile.ts` | `src/api/core/geom/profile.ts` |
|
|
77
|
-
| `src/api/entity/space.ts` | `src/api/entity/space.ts` |
|
|
78
|
-
| `src/api/entity/story.ts` | `src/api/entity/story.ts` |
|
|
79
|
-
| `src/api/entity/referenceLine.ts` | `src/api/entity/referenceLine.ts` |
|
|
80
|
-
| `src/api/entity/department.ts` | `src/api/entity/department.ts` |
|
|
81
|
-
| `src/api/tools/selection.ts` | `src/api/tools/selection.ts` |
|
|
82
|
-
| `src/api/tools/transform.ts` | `src/api/tools/transform.ts` |
|
|
83
|
-
| `src/api/units/index.ts` | `src/api/units/index.ts` |
|
|
84
|
-
| `src/api/index.ts` (`PluginApi`) | `src/api/index.ts` (`ClientPluginApi`) |
|
|
71
|
+
There are no per-namespace files here anymore — the whole plugin-core API tree is
|
|
72
|
+
served by two files:
|
|
73
|
+
|
|
74
|
+
| plugin-core | plugin-client |
|
|
75
|
+
| --------------------------------------------- | -------------------------------------------------------------------- |
|
|
76
|
+
| `src/api/**` (all namespaces, e.g. `core.math.vec3`) | `src/api/index.ts` (`ClientPluginApi`, one `createRpcNamespace` each) |
|
|
77
|
+
| `src/host-utils.ts` (`PluginApiMethod` types) | `src/rpc-proxy.ts` + `src/host-api.ts` (dispatch + Comlink transport) |
|
|
85
78
|
|
|
86
79
|
## Downstream consumers
|
|
87
80
|
|
|
88
81
|
Changes to this package's **public exports** affect:
|
|
82
|
+
|
|
89
83
|
- Internal plugins under `plugins/`
|
|
90
84
|
- Example plugins under `examples/`
|
|
91
85
|
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @snaptrude/plugin-client
|
|
2
|
+
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7750aa3: Exposed more snaptrude APIs
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7750aa3]
|
|
12
|
+
- @snaptrude/plugin-core@0.5.0
|
|
13
|
+
|
|
14
|
+
## 0.2.9
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 94842d0: added new space areaClass and innerProfiles APIs
|
|
19
|
+
- Updated dependencies [94842d0]
|
|
20
|
+
- Updated dependencies [ddf05fa]
|
|
21
|
+
- @snaptrude/plugin-core@0.2.9
|
|
22
|
+
|
|
23
|
+
## 0.2.8
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 445e0b8: Add Present-mode AI Inspiration plugin APIs under `snaptrude.documentation.aiInspiration`.
|
|
28
|
+
- Updated dependencies [445e0b8]
|
|
29
|
+
- @snaptrude/plugin-core@0.2.8
|
|
30
|
+
|
|
31
|
+
## 0.2.7
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- c5afd9a: added adjacecny
|
|
36
|
+
- Updated dependencies [c5afd9a]
|
|
37
|
+
- @snaptrude/plugin-core@0.2.7
|
|
38
|
+
|
|
39
|
+
## 0.2.6
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- c17d287: Add bulk space APIs: `space.bulkCreate`, `space.bulkUpdate`, and `space.bulkDelete`. Each batches its work into a single undo/redo step. All items are validated up front and the call throws if any item is invalid (nothing is applied), consistent with the single-item space methods. `bulkCreate` supports `spaceType`/`massType`/`departmentId` per item and returns `{ spaceIds }`; `bulkUpdate` takes geometry (`profile`+`extrudeHeight`) and/or nested `properties` per item and returns `{ spaces }` (one echoed result per item, like `update`); `bulkDelete` returns `{ deletedSpaceIds }`.
|
|
44
|
+
- 0683194: bulk apis
|
|
45
|
+
- Updated dependencies [c17d287]
|
|
46
|
+
- Updated dependencies [0683194]
|
|
47
|
+
- @snaptrude/plugin-core@0.2.6
|
|
48
|
+
|
|
49
|
+
## 0.2.5
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Restore declaration files in published plugin packages.
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
- @snaptrude/plugin-core@0.2.5
|
|
56
|
+
|
|
57
|
+
## 0.2.4
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Add inner profile hole support to space creation from profiles.
|
|
62
|
+
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @snaptrude/plugin-core@0.2.4
|
|
65
|
+
|
|
66
|
+
## 0.2.3
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- 647466b: fixed merge issues
|
|
71
|
+
- Updated dependencies [647466b]
|
|
72
|
+
- @snaptrude/plugin-core@0.2.3
|
|
73
|
+
|
|
74
|
+
## 0.2.2
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 064777a: buildable envelope apis
|
|
79
|
+
- Updated dependencies [064777a]
|
|
80
|
+
- @snaptrude/plugin-core@0.2.2
|
|
81
|
+
|
|
82
|
+
## 0.2.1
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- 3b37f4a: added buildable envelop api
|
|
87
|
+
- Updated dependencies [3b37f4a]
|
|
88
|
+
- @snaptrude/plugin-core@0.2.1
|
|
89
|
+
|
|
90
|
+
## 0.2.0
|
|
91
|
+
|
|
92
|
+
### Minor Changes
|
|
93
|
+
|
|
94
|
+
- 4d959a4: Exposed new offset and copy APIs for tools
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [4d959a4]
|
|
99
|
+
- @snaptrude/plugin-core@0.2.0
|
package/CLAUDE.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
See [AGENTS.md](AGENTS.md) for:
|
|
7
7
|
|
|
8
|
-
- Implementation
|
|
8
|
+
- Implementation pattern (generic RPC proxy — every namespace is async host RPC)
|
|
9
9
|
- File mapping from plugin-core to plugin-client
|
|
10
10
|
- When and how to update this package in response to plugin-core changes
|
|
11
11
|
- Downstream consumer notes
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClientEntityApi } from "./entity";
|
|
3
|
-
import { ClientToolsApi } from "./tools";
|
|
4
|
-
import { ClientUnitsApi } from "./units";
|
|
5
|
-
import { PluginApi } from "@snaptrude/plugin-core";
|
|
1
|
+
import { PluginApi, PluginCoreApi, PluginDesignApi, PluginEntityApi, PluginProgramApi, PluginPresentationApi } from "@snaptrude/plugin-core";
|
|
6
2
|
export declare class ClientPluginApi extends PluginApi {
|
|
7
3
|
private static instance;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Every namespace is fully remote under the all-handle model: math/geom now
|
|
6
|
+
* cross to the host (values are opaque handles), so there is no in-worker
|
|
7
|
+
* compute left. All dispatch through a single generic RPC Proxy. Units live
|
|
8
|
+
* under `core.units`, so they ride the `core` proxy.
|
|
9
|
+
*/
|
|
10
|
+
core: PluginCoreApi;
|
|
11
|
+
design: PluginDesignApi;
|
|
12
|
+
entity: PluginEntityApi;
|
|
13
|
+
program: PluginProgramApi;
|
|
14
|
+
presentation: PluginPresentationApi;
|
|
12
15
|
private constructor();
|
|
13
16
|
static getInstance(): ClientPluginApi;
|
|
14
17
|
}
|
|
15
|
-
export * from "./core";
|
|
16
|
-
export * from "./entity";
|
|
17
|
-
export * from "./tools";
|
|
18
|
-
export * from "./units";
|
|
19
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAG/B,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IAExC;;;;;OAKG;IACI,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,gBAAgB,CAAA;IACzB,YAAY,EAAE,qBAAqB,CAAA;IAE1C,OAAO;IAUP,MAAM,CAAC,WAAW,IAAI,eAAe;CAMtC"}
|