@combos-fun/plugin-development-tool 0.0.47 → 0.0.49
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 +11 -1
- package/agent-skill.md +41 -27
- package/combos-plugin.json +3 -4
- package/dist/plugin-development-tool.cjs.js +673 -432
- package/dist/plugin-development-tool.cjs.js.map +1 -1
- package/dist/plugin-development-tool.cjs.prod.js +1 -1
- package/dist/plugin-development-tool.d.ts +53 -69
- package/dist/plugin-development-tool.esm.js +674 -434
- package/dist/plugin-development-tool.esm.js.map +1 -1
- package/dist/vite.cjs +540 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.ts +43 -0
- package/dist/vite.mjs +527 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +11 -8
package/README.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# @combos-fun/plugin-development-tool
|
|
2
2
|
|
|
3
|
-
Scene / tagged object tap development tool:
|
|
3
|
+
Scene / tagged object tap development tool: canvas overlay (2D + 3D) and parent postMessage
|
|
4
4
|
|
|
5
5
|
Keywords: `devtool`, `inspector`, `selection`, `outline`, `editor`, `debug`.
|
|
6
6
|
|
|
7
|
+
Game `GameObject` nodes are tagged at build time. Add the Vite plugin to the **game** config:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { combosDevelopmentTargetPlugin } from '@combos-fun/plugin-development-tool/vite';
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
plugins: [combosDevelopmentTargetPlugin()],
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
7
17
|
## Documentation
|
|
8
18
|
|
|
9
19
|
- Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
|
package/agent-skill.md
CHANGED
|
@@ -1,46 +1,70 @@
|
|
|
1
1
|
# `@combos-fun/plugin-development-tool` — Agent notes
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Shared editor iframe picker** (2D and 3D). Outline, markers, and pick hit-testing are drawn on a transparent HTML canvas overlay with the Canvas 2D API. It does **not** depend on `plugin-renderer`, `plugin-renderer-event`, `plugin-renderer-graphics`, or any `plugin-renderer-3d*` package.
|
|
4
|
+
|
|
5
|
+
Game authors do **not** mount Targets or write `payload.source`. The host Vite plugin rewrites `new GameObject(...)`.
|
|
4
6
|
|
|
5
7
|
## When to read
|
|
6
8
|
|
|
7
|
-
Read when integrating the Combos editor iframe, pick mode, Scene Edit messages, or
|
|
9
|
+
Read when integrating the Combos editor iframe, pick mode, Scene Edit messages, marker overlays, or the host Vite plugin.
|
|
8
10
|
|
|
9
11
|
## Public API
|
|
10
12
|
|
|
11
|
-
`
|
|
13
|
+
`attachDevelopmentTarget(go, { file, anchor })` is the runtime helper the Vite plugin inserts. It is idempotent.
|
|
12
14
|
|
|
13
15
|
`CombosDevelopmentToolSystem` accepts:
|
|
14
16
|
|
|
15
17
|
- `postMessageOrigin`: outbound parent `targetOrigin`, default `'*'`.
|
|
16
18
|
- `allowedMessageOrigins`: inbound origins merged with the default `knoffice.tech` and `converge.ai` host suffixes.
|
|
17
19
|
|
|
18
|
-
It exposes `setEnabled`, `requestSceneRescan`,
|
|
20
|
+
It exposes `setEnabled`, `requestSceneRescan`, and `setMarkerOverlay`, plus matching `COMBOS_DEVELOPMENT_TOOL_*` constants and protocol helpers. `setMuted` still forwards to `SoundSystem` but host mute messages are owned by `@combos-fun/plugin-sound`. There is no `CombosDevelopmentToolSelectScope`. `COMBOS_DEVELOPMENT_TOOL_READY` is exported but never posted; wait for engine `combos-game:ready`.
|
|
19
21
|
|
|
20
22
|
## Required setup
|
|
21
23
|
|
|
22
|
-
Register the
|
|
24
|
+
Register the dimension renderer first, then the development tool. Event / Graphics systems are **not** required for picking.
|
|
25
|
+
|
|
26
|
+
2D:
|
|
23
27
|
|
|
24
28
|
```ts
|
|
25
29
|
new Game({
|
|
26
30
|
systems: [
|
|
27
31
|
new RendererSystem({ canvas, width, height }),
|
|
28
|
-
new EventSystem(),
|
|
29
|
-
new GraphicsSystem(),
|
|
30
32
|
new CombosDevelopmentToolSystem(),
|
|
31
33
|
],
|
|
32
34
|
});
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
3D:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
new Game({
|
|
41
|
+
systems: [
|
|
42
|
+
new Renderer3DSystem({ canvas, width, height }),
|
|
43
|
+
new CombosDevelopmentToolSystem(),
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
In the **game** Vite config (host / Creator), not in game source:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { defineConfig } from 'vite';
|
|
52
|
+
import { combosDevelopmentTargetPlugin } from '@combos-fun/plugin-development-tool/vite';
|
|
53
|
+
|
|
54
|
+
export default defineConfig({
|
|
55
|
+
plugins: [combosDevelopmentTargetPlugin()],
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Do not add `CombosDevelopmentToolTarget` from game code. Opt out of a construct with `// combos-no-target` or `{ editor: { pickable: false } }` on the `GameObject` params object (the extra key is ignored by `Transform`).
|
|
36
60
|
|
|
37
61
|
## Runtime behaviour
|
|
38
62
|
|
|
39
|
-
The System starts disabled. In pick mode it
|
|
63
|
+
The System starts disabled. In pick mode it shows a full-canvas overlay (`pointer-events: auto`) so game `Event` / `Event3D` do not receive the tap. Targets are hit-tested from engine transforms projected to overlay CSS pixels. Target additions/removals are observed automatically; `requestSceneRescan()` is for parent-driven structural refreshes.
|
|
40
64
|
|
|
41
|
-
|
|
65
|
+
2D bounds come from `Transform` size / hierarchy (position, origin, anchor, scale, rotation). Set `transform.size` when the visual does not match a zero size. 3D bounds project `Transform3D` world position through the active `Renderer3DSystem` camera; a mesh bounding box is used when the Three object is available, otherwise a screen-space pad around the projected point.
|
|
42
66
|
|
|
43
|
-
The marker overlay is independent of pick mode and mute. It currently draws a 28×28
|
|
67
|
+
The marker overlay is independent of pick mode and mute. It currently draws a 28×28 canvas badge only for `Sound`; the owner still needs a Target for selection and persistence (the Vite plugin attaches that Target).
|
|
44
68
|
|
|
45
69
|
## postMessage protocol
|
|
46
70
|
|
|
@@ -49,7 +73,6 @@ Parent → iframe:
|
|
|
49
73
|
- `set-pick-mode { enabled }`
|
|
50
74
|
- `refresh`, `clear-selection`
|
|
51
75
|
- `apply-property`
|
|
52
|
-
- `set-muted { muted }`
|
|
53
76
|
- `set-marker-overlay { enabled }`
|
|
54
77
|
|
|
55
78
|
Iframe → parent:
|
|
@@ -57,33 +80,24 @@ Iframe → parent:
|
|
|
57
80
|
- `pick-mode-success { enabled }`
|
|
58
81
|
- `gameobject-selected { snapshot, pointer }`
|
|
59
82
|
- `gameobject-deselected { reason }`
|
|
60
|
-
- `state-changed { muted }`
|
|
61
83
|
- `marker-overlay-success { enabled, total, markers }`
|
|
62
84
|
|
|
63
85
|
Inbound messages are origin-checked. `allowedMessageOrigins: ['localhost']` adds local development; `['*']` alone disables the check. `postMessageOrigin` controls outbound delivery separately.
|
|
64
86
|
|
|
65
87
|
## Scene Edit fields
|
|
66
88
|
|
|
67
|
-
Snapshots expose described schema-backed `fieldDescriptors`, not raw fields. For authoritative `@Field` metadata rules, read `@combos-fun/inspector-decorator`.
|
|
89
|
+
Snapshots expose described schema-backed `fieldDescriptors`, not raw fields. For authoritative `@Field` metadata rules, read `@combos-fun/inspector-decorator`. Persist lookup uses `payload.source.file` + `payload.source.anchor` injected by the Vite plugin.
|
|
68
90
|
|
|
69
91
|
## Common pitfalls
|
|
70
92
|
|
|
71
|
-
-
|
|
93
|
+
- 2D picking needs a positive `transform.size` to get a usable hit rect.
|
|
94
|
+
- 3D picking needs `Renderer3DSystem` (for the camera) at runtime; there is no package dependency.
|
|
72
95
|
- Parent messages require an iframe (`window.parent !== window`) and an allowed origin.
|
|
73
96
|
- Structural replacement needs `refresh`; ordinary Target add/remove does not.
|
|
74
|
-
- Persistence fails
|
|
97
|
+
- Persistence fails if the game build did not run `combosDevelopmentTargetPlugin`.
|
|
75
98
|
- Markers are visual only and do not create a Target.
|
|
76
|
-
|
|
77
|
-
## Minimal example
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
editableGo.addComponent(new CombosDevelopmentToolTarget({
|
|
81
|
-
payload: {
|
|
82
|
-
source: { file: 'src/scene.ts', anchor: 'start-button' },
|
|
83
|
-
},
|
|
84
|
-
}));
|
|
85
|
-
```
|
|
99
|
+
- Creator-managed game code must not call `setEnabled` / `requestSceneRescan` or emit `combos-development-tool:*` control messages.
|
|
86
100
|
|
|
87
101
|
## Verification
|
|
88
102
|
|
|
89
|
-
Run `pnpm --filter @combos-fun/plugin-development-tool run build`.
|
|
103
|
+
Run `pnpm --filter @combos-fun/plugin-development-tool run test` and `pnpm --filter @combos-fun/plugin-development-tool run build`.
|
package/combos-plugin.json
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
"name": "@combos-fun/plugin-development-tool",
|
|
3
3
|
"pluginId": "development-tool",
|
|
4
4
|
"category": "devtool",
|
|
5
|
-
"dimension": "
|
|
5
|
+
"dimension": "shared",
|
|
6
6
|
"isCore": false,
|
|
7
7
|
"keywords": ["devtool", "inspector", "selection", "outline", "editor", "debug"],
|
|
8
8
|
"agentSkill": "./agent-skill.md",
|
|
9
9
|
"requires": [
|
|
10
|
-
"@combos-fun/engine"
|
|
11
|
-
"@combos-fun/plugin-renderer-event",
|
|
12
|
-
"@combos-fun/plugin-renderer-graphics"
|
|
10
|
+
"@combos-fun/engine"
|
|
13
11
|
],
|
|
14
12
|
"exports": [
|
|
15
13
|
"CombosDevelopmentToolSystem",
|
|
16
14
|
"CombosDevelopmentToolTarget",
|
|
15
|
+
"attachDevelopmentTarget",
|
|
17
16
|
"COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_SELECTED",
|
|
18
17
|
"COMBOS_DEVELOPMENT_TOOL_REFRESH",
|
|
19
18
|
"COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE",
|