@combos-fun/plugin-renderer-event 0.0.6 → 0.0.8

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 CHANGED
@@ -1,3 +1,27 @@
1
1
  # @combos-fun/plugin-renderer-event
2
2
 
3
- Internal workspace package (Combos Fun monorepo).
3
+ @combos-fun/plugin-renderer-event part of the Combos Fun engine monorepo.
4
+
5
+ Keywords: `pointer`, `touch`, `tap`, `hit-area`, `input`, `event`.
6
+
7
+ ## Documentation
8
+
9
+ - Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
10
+ - Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
11
+ (validated against `schemas/combos-plugin.schema.json` in the repo
12
+ root)
13
+ - Entry skill (single source of truth for AI agents working with this
14
+ monorepo): `skills/combos-engine-development/SKILL.md`
15
+
16
+ When consumed from npm, the manifest and agent notes are exposed as
17
+ stable subpaths:
18
+
19
+ ```ts
20
+ import manifest from '@combos-fun/plugin-renderer-event/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/plugin-renderer-event/agent-skill')
23
+ ```
24
+
25
+ ## License
26
+
27
+ Internal workspace package, part of the Combos Fun engine monorepo.
package/agent-skill.md ADDED
@@ -0,0 +1,95 @@
1
+ # `@combos-fun/plugin-renderer-event` — Agent notes
2
+
3
+ Pointer / touch event input for the 2D pipeline via Pixi v8 interaction. Provides hit-area shapes and a unified `tap` / `touchstart` / `touchmove` / `touchend` event surface on the `Event` Component.
4
+
5
+ ## When to read
6
+
7
+ Read for any input task: tap detection, drag, swipe, hit-area shapes, or when integrating with `plugin-a11y` (which forwards DOM clicks as Event events).
8
+
9
+ ## Public API
10
+
11
+ ```ts
12
+ import {
13
+ EventSystem,
14
+ Event,
15
+ HIT_AREA_TYPE,
16
+ type EventParams,
17
+ type EventSystemParams,
18
+ } from '@combos-fun/plugin-renderer-event';
19
+ ```
20
+
21
+ ### `HIT_AREA_TYPE`
22
+
23
+ `Circle`, `Ellipse`, `Polygon`, `Rect`, `RoundedRect`.
24
+
25
+ ### `EventParams`
26
+
27
+ ```ts
28
+ {
29
+ hitArea: {
30
+ type: HIT_AREA_TYPE;
31
+ style?: { x?, y?, radius?, width?, height?, paths? };
32
+ };
33
+ }
34
+ ```
35
+
36
+ ### `EventSystemParams`
37
+
38
+ | Field | Type | Notes |
39
+ |-------|------|-------|
40
+ | `moveWhenInside` | `boolean?` | Drives Pixi `events.features.globalMove` |
41
+
42
+ ### Events emitted by the `Event` component
43
+
44
+ `touchstart`, `touchmove`, `touchend`, `tap`, `touchendoutside`, `touchcancel`.
45
+
46
+ Callback payload:
47
+
48
+ ```ts
49
+ (payload) => {
50
+ payload.stopPropagation();
51
+ payload.data.pointerId;
52
+ payload.data.position; // global / canvas-space
53
+ payload.data.localPosition; // local to the GameObject
54
+ payload.gameObject;
55
+ };
56
+ ```
57
+
58
+ ## Required setup
59
+
60
+ - Add `RendererSystem` (from `plugin-renderer`) before `EventSystem`.
61
+ - Provide `hitArea.style` in the same coordinate space as the visual:
62
+ `style` is interpreted in **local space** of the GameObject.
63
+
64
+ ## Runtime behaviour
65
+
66
+ - Each `Event` component installs a Pixi hit-area on its container; the
67
+ system routes Pixi pointer events into Combos events.
68
+ - `plugin-a11y` forwards DOM clicks on the a11y overlay as
69
+ `touchstart` / `touchend` / `tap` on the matching `Event` component.
70
+
71
+ ## Common pitfalls
72
+
73
+ | Symptom | Fix |
74
+ |---------|-----|
75
+ | `tap` never fires | Add `EventSystem`, attach an `Event` component with a `hitArea` |
76
+ | Hit area off-target | `style` coords are in local space — origin is the GameObject's `Transform.origin` |
77
+ | Double-fire from a11y + canvas | Only attach handler once; A11y forwards through Event so a single subscription is enough |
78
+
79
+ ## Minimal example
80
+
81
+ ```ts
82
+ import { Event, HIT_AREA_TYPE } from '@combos-fun/plugin-renderer-event';
83
+
84
+ go.addComponent(new Event({
85
+ hitArea: { type: HIT_AREA_TYPE.Rect, style: { width: 200, height: 80 } },
86
+ }));
87
+
88
+ go.getComponent(Event)!.on('tap', (e) => {
89
+ /* handle */
90
+ });
91
+ ```
92
+
93
+ ## Verification
94
+
95
+ `pnpm --filter @combos-fun/plugin-renderer-event run build`.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@combos-fun/plugin-renderer-event",
3
+ "pluginId": "renderer-event",
4
+ "category": "input",
5
+ "dimension": "2d",
6
+ "isCore": false,
7
+ "keywords": ["pointer", "touch", "tap", "hit-area", "input", "event"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer"],
10
+ "exports": ["EventSystem", "Event", "HIT_AREA_TYPE"]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-event",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "@combos-fun/plugin-renderer-event",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-event.esm.js",
@@ -8,8 +8,22 @@
8
8
  "unpkg": "dist/CombosFun.plugin.renderer.event.min.js",
9
9
  "files": [
10
10
  "index.js",
11
- "dist"
11
+ "dist",
12
+ "agent-skill.md",
13
+ "combos-plugin.json"
12
14
  ],
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/plugin-renderer-event.esm.js",
18
+ "require": "./index.js",
19
+ "types": "./dist/plugin-renderer-event.d.ts"
20
+ },
21
+ "./plugin-manifest": "./combos-plugin.json",
22
+ "./agent-skill": "./agent-skill.md"
23
+ },
24
+ "combos": {
25
+ "pluginManifest": "./combos-plugin.json"
26
+ },
13
27
  "types": "dist/plugin-renderer-event.d.ts",
14
28
  "keywords": [
15
29
  "combos-fun",
@@ -18,8 +32,8 @@
18
32
  "author": "sun668 <q947692259@gmail.com>",
19
33
  "dependencies": {
20
34
  "pixi.js": "^8.18.1",
21
- "@combos-fun/engine": "0.0.6",
22
- "@combos-fun/plugin-renderer": "0.0.6"
35
+ "@combos-fun/plugin-renderer": "0.0.8",
36
+ "@combos-fun/engine": "0.0.8"
23
37
  },
24
38
  "scripts": {
25
39
  "build": "node ../../scripts/build-package.mjs"