@combos-fun/plugin-development-tool 0.0.36 → 0.0.38

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/agent-skill.md CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  COMBOS_DEVELOPMENT_TOOL_CLEAR_SELECTION,
17
17
  COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_DESELECTED,
18
18
  COMBOS_DEVELOPMENT_TOOL_REFRESH,
19
- COMBOS_DEVELOPMENT_TOOL_SET,
19
+ COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE,
20
20
  type CombosDevelopmentToolTargetParams,
21
21
  type CombosDevelopmentToolSystemParams,
22
22
  type CombosDevelopmentToolSelectScope,
@@ -33,9 +33,9 @@ import {
33
33
 
34
34
  | Field | Type | Notes |
35
35
  |---|---|---|
36
- | `payload` | `Record<string, unknown>?` | Extra JSON-serializable data included in the selected-object snapshot. |
36
+ | `payload` | `Record<string, unknown>?` | Extra JSON-serializable data included in the selected-object snapshot. Creator persist **requires** `payload.source`. |
37
37
 
38
- Creator source persistence uses the optional `payload.source` convention:
38
+ Creator source persistence **requires** `payload.source.file` and `payload.source.anchor` on every Target. A Target without this pair can be picked in-canvas but cannot be resolved after reload. `new CombosDevelopmentToolTarget()` with an empty payload is invalid in Creator-managed games.
39
39
 
40
40
  ```ts
41
41
  go.addComponent(new CombosDevelopmentToolTarget({
@@ -48,7 +48,7 @@ go.addComponent(new CombosDevelopmentToolTarget({
48
48
  }));
49
49
  ```
50
50
 
51
- Use a stable `file` + `anchor` pair when property edits must resolve the same GameObject after reload. The Target accepts arbitrary JSON-safe payload fields, but only `payload.source.file` and `payload.source.anchor` participate in source lookup.
51
+ Use a stable `file` + `anchor` pair so property edits resolve the same GameObject after reload. The Target accepts arbitrary JSON-safe payload fields, but only `payload.source.file` and `payload.source.anchor` participate in source lookup.
52
52
 
53
53
  ## Required setup
54
54
 
@@ -93,6 +93,7 @@ Set `transform.size` for `Img`, `Text`, `Sprite`, and `SpriteAnimation` GameObje
93
93
  | Parent frame never receives messages | The page must be in an iframe / embedded context; `window.parent !== window` |
94
94
  | Parent postMessage ignored | Check `allowedMessageOrigins` — defaults allow `knoffice.tech` and `converge.ai` (+ subdomains). Pass `['localhost']` to merge local dev hosts |
95
95
  | Selection stuck after a parent-driven structural replacement | Have the parent/tooling send `COMBOS_DEVELOPMENT_TOOL_REFRESH`; ordinary Target add/remove is automatic |
96
+ | Scene Edit cannot persist / object not found after reload | Target is missing `payload.source.file` + `payload.source.anchor` |
96
97
 
97
98
  ## Inbound postMessage security
98
99
 
@@ -116,7 +117,8 @@ Outbound `postMessageOrigin` is separate — it limits which parent origin recei
116
117
 
117
118
  | Direction | type | Payload | Behavior |
118
119
  |-----------|------|---------|----------|
119
- | parent → iframe | `combos-development-tool:set` | `{ enabled: boolean }` | Enable/disable pick mode |
120
+ | parent → iframe | `combos-development-tool:set-pick-mode` | `{ enabled: boolean }` | Enable/disable pick mode |
121
+ | iframe → parent | `combos-development-tool:pick-mode-success` | `{ enabled: boolean }` | Pick mode finished attaching or restoring |
120
122
  | parent → iframe | `combos-development-tool:clear-selection` | `{}` | Clear in-canvas outline |
121
123
  | parent → iframe | `combos-development-tool:apply-property` | component field mutation | Live preview |
122
124
  | parent → iframe | `combos-development-tool:set-marker-overlay` | `{ enabled: boolean }` | Toggle the marker overlay (independent of pick mode) |
@@ -141,7 +143,8 @@ triggers / spawn points later) but nothing else is registered yet.
141
143
  editing (e.g. `Sound.volume`) go through the normal
142
144
  selection → snapshot (`fieldDescriptors`) → `apply-property` flow and **persist to source** like any
143
145
  other scene edit. **The marked object must therefore carry a
144
- `CombosDevelopmentToolTarget`** added by game code. Objects with a `Sound`
146
+ `CombosDevelopmentToolTarget`** added by game code, including
147
+ `payload.source.file` and `payload.source.anchor`. Objects with a `Sound`
145
148
  component must be given a Target when they should be editable even when they
146
149
  render nothing. Space independently editable Sound GameObjects apart so their
147
150
  marker badges do not overlap.
@@ -16,7 +16,7 @@
16
16
  "CombosDevelopmentToolTarget",
17
17
  "COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_SELECTED",
18
18
  "COMBOS_DEVELOPMENT_TOOL_REFRESH",
19
- "COMBOS_DEVELOPMENT_TOOL_SET",
20
- "COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS"
19
+ "COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE",
20
+ "COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS"
21
21
  ]
22
22
  }
@@ -7,10 +7,10 @@ var pluginRendererGraphics = require('@combos-fun/plugin-renderer-graphics');
7
7
  var pluginRendererEvent = require('@combos-fun/plugin-renderer-event');
8
8
  var inspectorDecorator = require('@combos-fun/inspector-decorator');
9
9
 
10
- /** Toggle development-tool selection / parent postMessage. Payload: `{ enabled: boolean }`. */
11
- const COMBOS_DEVELOPMENT_TOOL_SET = 'combos-development-tool:set';
12
- /** iframe → parent: `setEnabled` finished (pick attach after enable, or restore after disable). Payload: `{ enabled: boolean }`. */
13
- const COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS = 'combos-development-tool:set-success';
10
+ /** Parent iframe (also `window` CustomEvent / `game.emit`): toggle pick mode. Payload: `{ enabled: boolean }`. */
11
+ const COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE = 'combos-development-tool:set-pick-mode';
12
+ /** iframe → parent (and `game.emit`): pick mode finished attaching (enable) or restoring (disable). Payload: `{ enabled: boolean }`. */
13
+ const COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS = 'combos-development-tool:pick-mode-success';
14
14
  /** Re-scan the scene tree while the development tool is enabled. */
15
15
  const COMBOS_DEVELOPMENT_TOOL_REFRESH = 'combos-development-tool:refresh';
16
16
  /** Emitted to `window.parent` when an object is selected while the tool is on. */
@@ -597,9 +597,9 @@ const MARKER_GO_NAME_PREFIX = '__combosDevelopmentToolMarker:';
597
597
  * - attaches pick `Event` + outline only on nodes with {@link CombosDevelopmentToolTarget}.
598
598
  *
599
599
  * Turn on/off via:
600
- * - `window.dispatchEvent(new CustomEvent(COMBOS_DEVELOPMENT_TOOL_SET, { detail: { enabled: true } }))`
601
- * - `window.postMessage({ type: COMBOS_DEVELOPMENT_TOOL_SET, enabled: true }, targetOrigin)` (e.g. from parent iframe)
602
- * - `game.emit(COMBOS_DEVELOPMENT_TOOL_SET, { enabled: true })` or `getSystem(CombosDevelopmentToolSystem).setEnabled(true)`
600
+ * - `window.dispatchEvent(new CustomEvent(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, { detail: { enabled: true } }))`
601
+ * - `window.postMessage({ type: COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, enabled: true }, targetOrigin)` (e.g. from parent iframe)
602
+ * - `game.emit(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, { enabled: true })` or `getSystem(CombosDevelopmentToolSystem).setEnabled(true)`
603
603
  *
604
604
  * Mute (independent of pick mode; parent toolbar or in-game debug UI):
605
605
  * - `postMessage({ type: COMBOS_DEVELOPMENT_TOOL_SET_MUTED, muted: true })`
@@ -643,7 +643,7 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
643
643
  this.needsMarkerRescan = false;
644
644
  /** ownerGoId → its marker GO (icon child, Graphics only). */
645
645
  this.markerGoByOwner = new Map();
646
- this.onWindowSet = (e) => {
646
+ this.onWindowSetPickMode = (e) => {
647
647
  const d = e.detail;
648
648
  if (d && typeof d.enabled === 'boolean') {
649
649
  this.setEnabled(d.enabled);
@@ -673,7 +673,7 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
673
673
  const d = e.data;
674
674
  if (!d || typeof d !== 'object')
675
675
  return;
676
- if (d.type === COMBOS_DEVELOPMENT_TOOL_SET && typeof d.enabled === 'boolean') {
676
+ if (d.type === COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE && typeof d.enabled === 'boolean') {
677
677
  this.setEnabled(d.enabled);
678
678
  }
679
679
  else if (d.type === COMBOS_DEVELOPMENT_TOOL_SET_MUTED && typeof d.muted === 'boolean') {
@@ -693,7 +693,7 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
693
693
  this.handleApplyProperty(d);
694
694
  }
695
695
  };
696
- this.onGameSet = (payload) => {
696
+ this.onGameSetPickMode = (payload) => {
697
697
  if (payload && typeof payload.enabled === 'boolean') {
698
698
  this.setEnabled(payload.enabled);
699
699
  }
@@ -715,13 +715,13 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
715
715
  this.postMessageOrigin = params?.postMessageOrigin ?? '*';
716
716
  this.allowedMessageOrigins = mergeAllowedMessageOrigins(params?.allowedMessageOrigins);
717
717
  if (typeof window !== 'undefined') {
718
- window.addEventListener(COMBOS_DEVELOPMENT_TOOL_SET, this.onWindowSet);
718
+ window.addEventListener(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, this.onWindowSetPickMode);
719
719
  window.addEventListener(COMBOS_DEVELOPMENT_TOOL_SET_MUTED, this.onWindowSetMuted);
720
720
  window.addEventListener(COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY, this.onWindowSetMarkerOverlay);
721
721
  window.addEventListener(COMBOS_DEVELOPMENT_TOOL_REFRESH, this.onWindowRefresh);
722
722
  window.addEventListener('message', this.onWindowMessage);
723
723
  }
724
- this.game.on(COMBOS_DEVELOPMENT_TOOL_SET, this.onGameSet);
724
+ this.game.on(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, this.onGameSetPickMode);
725
725
  this.game.on(COMBOS_DEVELOPMENT_TOOL_SET_MUTED, this.onGameSetMuted);
726
726
  this.game.on(COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY, this.onGameSetMarkerOverlay);
727
727
  this.game.on(COMBOS_DEVELOPMENT_TOOL_REFRESH, this.onGameRefresh);
@@ -731,13 +731,13 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
731
731
  }
732
732
  onDestroy() {
733
733
  if (typeof window !== 'undefined') {
734
- window.removeEventListener(COMBOS_DEVELOPMENT_TOOL_SET, this.onWindowSet);
734
+ window.removeEventListener(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, this.onWindowSetPickMode);
735
735
  window.removeEventListener(COMBOS_DEVELOPMENT_TOOL_SET_MUTED, this.onWindowSetMuted);
736
736
  window.removeEventListener(COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY, this.onWindowSetMarkerOverlay);
737
737
  window.removeEventListener(COMBOS_DEVELOPMENT_TOOL_REFRESH, this.onWindowRefresh);
738
738
  window.removeEventListener('message', this.onWindowMessage);
739
739
  }
740
- this.game.off(COMBOS_DEVELOPMENT_TOOL_SET, this.onGameSet);
740
+ this.game.off(COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE, this.onGameSetPickMode);
741
741
  this.game.off(COMBOS_DEVELOPMENT_TOOL_SET_MUTED, this.onGameSetMuted);
742
742
  this.game.off(COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY, this.onGameSetMarkerOverlay);
743
743
  this.game.off(COMBOS_DEVELOPMENT_TOOL_REFRESH, this.onGameRefresh);
@@ -1096,13 +1096,13 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
1096
1096
  }
1097
1097
  postSetSuccess(enabled) {
1098
1098
  const payload = {
1099
- type: COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS,
1099
+ type: COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS,
1100
1100
  enabled,
1101
1101
  };
1102
1102
  if (typeof window !== 'undefined' && window.parent && window.parent !== window) {
1103
1103
  window.parent.postMessage(payload, this.postMessageOrigin);
1104
1104
  }
1105
- this.game.emit(COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS, { enabled });
1105
+ this.game.emit(COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS, { enabled });
1106
1106
  }
1107
1107
  postStateChanged() {
1108
1108
  const state = {
@@ -1375,7 +1375,7 @@ var CombosDevelopmentToolSystem = CombosDevelopmentToolSystem$1;
1375
1375
  /** Auto-generated by scripts/build-package.mjs — do not edit. */
1376
1376
  Object.assign(CombosDevelopmentToolSystem, {
1377
1377
  packageName: "@combos-fun/plugin-development-tool",
1378
- packageVersion: "0.0.36",
1378
+ packageVersion: "0.0.38",
1379
1379
  });
1380
1380
 
1381
1381
  exports.COMBOS_DEVELOPMENT_TOOL_APPLY_PROPERTY = COMBOS_DEVELOPMENT_TOOL_APPLY_PROPERTY;
@@ -1383,12 +1383,12 @@ exports.COMBOS_DEVELOPMENT_TOOL_CLEAR_SELECTION = COMBOS_DEVELOPMENT_TOOL_CLEAR_
1383
1383
  exports.COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_DESELECTED = COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_DESELECTED;
1384
1384
  exports.COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_SELECTED = COMBOS_DEVELOPMENT_TOOL_GAMEOBJECT_SELECTED;
1385
1385
  exports.COMBOS_DEVELOPMENT_TOOL_MARKER_OVERLAY_SUCCESS = COMBOS_DEVELOPMENT_TOOL_MARKER_OVERLAY_SUCCESS;
1386
+ exports.COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS = COMBOS_DEVELOPMENT_TOOL_PICK_MODE_SUCCESS;
1386
1387
  exports.COMBOS_DEVELOPMENT_TOOL_READY = COMBOS_DEVELOPMENT_TOOL_READY;
1387
1388
  exports.COMBOS_DEVELOPMENT_TOOL_REFRESH = COMBOS_DEVELOPMENT_TOOL_REFRESH;
1388
- exports.COMBOS_DEVELOPMENT_TOOL_SET = COMBOS_DEVELOPMENT_TOOL_SET;
1389
1389
  exports.COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY = COMBOS_DEVELOPMENT_TOOL_SET_MARKER_OVERLAY;
1390
1390
  exports.COMBOS_DEVELOPMENT_TOOL_SET_MUTED = COMBOS_DEVELOPMENT_TOOL_SET_MUTED;
1391
- exports.COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS = COMBOS_DEVELOPMENT_TOOL_SET_SUCCESS;
1391
+ exports.COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE = COMBOS_DEVELOPMENT_TOOL_SET_PICK_MODE;
1392
1392
  exports.COMBOS_DEVELOPMENT_TOOL_STATE_CHANGED = COMBOS_DEVELOPMENT_TOOL_STATE_CHANGED;
1393
1393
  exports.CombosDevelopmentToolSystem = CombosDevelopmentToolSystem;
1394
1394
  exports.CombosDevelopmentToolTarget = CombosDevelopmentToolTarget;