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

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,100 @@
1
+ # `@combos-fun/plugin-renderer-event` — Agent notes
2
+
3
+ Pointer / touch event input for the 2D pipeline via Pixi v8 interaction.
4
+ Provides hit-area shapes and a unified `tap` / `touchstart` / `touchmove` /
5
+ `touchend` event surface on the `Event` Component.
6
+
7
+ ## When to read
8
+
9
+ Read for any input task: tap detection, drag, swipe, hit-area shapes, or
10
+ when integrating with `plugin-a11y` (which forwards DOM clicks as Event
11
+ events).
12
+
13
+ ## Public API
14
+
15
+ ```ts
16
+ import {
17
+ EventSystem,
18
+ Event,
19
+ HIT_AREA_TYPE,
20
+ type EventParams,
21
+ type EventSystemParams,
22
+ } from '@combos-fun/plugin-renderer-event';
23
+ ```
24
+
25
+ ### `HIT_AREA_TYPE`
26
+
27
+ `Circle`, `Ellipse`, `Polygon`, `Rect`, `RoundedRect`.
28
+
29
+ ### `EventParams`
30
+
31
+ ```ts
32
+ {
33
+ hitArea: {
34
+ type: HIT_AREA_TYPE;
35
+ style?: { x?, y?, radius?, width?, height?, paths? };
36
+ };
37
+ }
38
+ ```
39
+
40
+ ### `EventSystemParams`
41
+
42
+ | Field | Type | Notes |
43
+ |-------|------|-------|
44
+ | `moveWhenInside` | `boolean?` | Drives Pixi `events.features.globalMove` |
45
+
46
+ ### Events emitted by the `Event` component
47
+
48
+ `touchstart`, `touchmove`, `touchend`, `tap`, `touchendoutside`,
49
+ `touchcancel`.
50
+
51
+ Callback payload:
52
+
53
+ ```ts
54
+ (payload) => {
55
+ payload.stopPropagation();
56
+ payload.data.pointerId;
57
+ payload.data.position; // global / canvas-space
58
+ payload.data.localPosition; // local to the GameObject
59
+ payload.gameObject;
60
+ };
61
+ ```
62
+
63
+ ## Required setup
64
+
65
+ - Add `RendererSystem` (from `plugin-renderer`) before `EventSystem`.
66
+ - Provide `hitArea.style` in the same coordinate space as the visual:
67
+ `style` is interpreted in **local space** of the GameObject.
68
+
69
+ ## Runtime behaviour
70
+
71
+ - Each `Event` component installs a Pixi hit-area on its container; the
72
+ system routes Pixi pointer events into Combos events.
73
+ - `plugin-a11y` forwards DOM clicks on the a11y overlay as
74
+ `touchstart` / `touchend` / `tap` on the matching `Event` component.
75
+
76
+ ## Common pitfalls
77
+
78
+ | Symptom | Fix |
79
+ |---------|-----|
80
+ | `tap` never fires | Add `EventSystem`, attach an `Event` component with a `hitArea` |
81
+ | Hit area off-target | `style` coords are in local space — origin is the GameObject's `Transform.origin` |
82
+ | Double-fire from a11y + canvas | Only attach handler once; A11y forwards through Event so a single subscription is enough |
83
+
84
+ ## Minimal example
85
+
86
+ ```ts
87
+ import { Event, HIT_AREA_TYPE } from '@combos-fun/plugin-renderer-event';
88
+
89
+ go.addComponent(new Event({
90
+ hitArea: { type: HIT_AREA_TYPE.Rect, style: { width: 200, height: 80 } },
91
+ }));
92
+
93
+ go.getComponent(Event)!.on('tap', (e) => {
94
+ /* handle */
95
+ });
96
+ ```
97
+
98
+ ## Verification
99
+
100
+ `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.7",
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.7",
36
+ "@combos-fun/engine": "0.0.7"
23
37
  },
24
38
  "scripts": {
25
39
  "build": "node ../../scripts/build-package.mjs"