@combos-fun/plugin-a11y 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-a11y
2
2
 
3
- Internal workspace package (Combos Fun monorepo).
3
+ @combos-fun/plugin-a11y part of the Combos Fun engine monorepo.
4
+
5
+ Keywords: `a11y`, `accessibility`, `aria`, `screen-reader`, `overlay`.
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-a11y/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/plugin-a11y/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,84 @@
1
+ # `@combos-fun/plugin-a11y` — Agent notes
2
+
3
+ Accessibility plugin. Creates a positioned `<div>` overlay over the canvas;
4
+ for each `GameObject` carrying an `A11y` component, creates a child `<div>`
5
+ with `aria-label` / `role`. Click on the overlay forwards to the
6
+ GameObject's `Event` component as `touchstart` / `touchend` / `tap`.
7
+
8
+ ## When to read
9
+
10
+ Read for any accessibility task: screen-reader hints, keyboard-friendly
11
+ DOM interaction, A11y debugging.
12
+
13
+ ## Public API
14
+
15
+ ```ts
16
+ import { A11ySystem, A11y, A11yActivate } from '@combos-fun/plugin-a11y';
17
+ ```
18
+
19
+ ### `A11yParams`
20
+
21
+ | Field | Notes |
22
+ |-------|-------|
23
+ | `hint` | Required. Used as `aria-label` |
24
+ | `role` | ARIA role |
25
+ | `delay` | Per-element activation delay |
26
+ | `interactive` | Whether the overlay div is clickable |
27
+ | `a11yId` | Optional stable id |
28
+ | `event` | Forward target (defaults to the GameObject's `Event`) |
29
+ | `props` / `state` / `attr` | Free-form ARIA `aria-*` props |
30
+
31
+ ### `A11yActivate`
32
+
33
+ | Value | Numeric | Meaning |
34
+ |-------|---------|---------|
35
+ | `ENABLE` | `0` | Always on |
36
+ | `DISABLE` | `1` | Always off |
37
+ | `CHECK` | `2` | Use the system's `checkA11yOpen()` callback |
38
+
39
+ ### `A11ySystemParams`
40
+
41
+ | Field | Type | Notes |
42
+ |-------|------|-------|
43
+ | `debug` | `boolean?` | Red overlay on a11y elements |
44
+ | `activate` | `A11yActivate?` | Default `ENABLE` |
45
+ | `checkA11yOpen` | `() => Promise<boolean>?` | Async check used when `activate === CHECK` |
46
+ | `delay` / `zIndex` | optional | |
47
+
48
+ ## Required setup
49
+
50
+ `A11ySystem` should be added after `RendererSystem` and `EventSystem`. The
51
+ overlay is appended to the canvas's parent element.
52
+
53
+ ## Runtime behaviour
54
+
55
+ - The overlay div is a sibling of the canvas, not a child. It tracks the
56
+ canvas position and scales accordingly.
57
+ - Click on an overlay child forwards to the matching GameObject's `Event`
58
+ component as `touchstart` → `touchend` → `tap` in sequence.
59
+ - Use Event + A11y on the **same** GameObject. Subscribe to events on
60
+ `Event`, not on `A11y`.
61
+
62
+ ## Common pitfalls
63
+
64
+ | Symptom | Fix |
65
+ |---------|-----|
66
+ | No screen reader output | Verify `hint` is non-empty and `activate` is `ENABLE` |
67
+ | Click only fires once | Don't add multiple `Event` subscriptions; reuse a single Component handler |
68
+ | Visual misalignment | Ensure canvas's CSS `transform` doesn't differ from the overlay parent |
69
+
70
+ ## Minimal example
71
+
72
+ ```ts
73
+ import { Event, HIT_AREA_TYPE } from '@combos-fun/plugin-renderer-event';
74
+ import { A11y } from '@combos-fun/plugin-a11y';
75
+
76
+ const button = new GameObject('start-button');
77
+ button.addComponent(new Transform({ position: { x: 100, y: 100 }, size: { x: 200, y: 80 } }));
78
+ button.addComponent(new Event({ hitArea: { type: HIT_AREA_TYPE.Rect, style: { width: 200, height: 80 } } }));
79
+ button.addComponent(new A11y({ hint: 'Start game', role: 'button', interactive: true }));
80
+ ```
81
+
82
+ ## Verification
83
+
84
+ `pnpm --filter @combos-fun/plugin-a11y run build`.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@combos-fun/plugin-a11y",
3
+ "pluginId": "a11y",
4
+ "category": "a11y",
5
+ "dimension": "shared",
6
+ "isCore": false,
7
+ "keywords": ["a11y", "accessibility", "aria", "screen-reader", "overlay"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": [
10
+ "@combos-fun/engine",
11
+ "@combos-fun/plugin-renderer",
12
+ "@combos-fun/plugin-renderer-event"
13
+ ],
14
+ "exports": ["A11ySystem", "A11y", "A11yActivate"]
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-a11y",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "@combos-fun/plugin-a11y",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-a11y.esm.js",
@@ -8,8 +8,22 @@
8
8
  "unpkg": "dist/CombosFun.plugin.a11y.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-a11y.esm.js",
18
+ "require": "./index.js",
19
+ "types": "./dist/plugin-a11y.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-a11y.d.ts",
14
28
  "keywords": [
15
29
  "combos-fun",
@@ -18,9 +32,9 @@
18
32
  "author": "sun668 <q947692259@gmail.com>",
19
33
  "dependencies": {
20
34
  "eventemitter3": "^5.0.4",
21
- "@combos-fun/engine": "0.0.6",
22
- "@combos-fun/inspector-decorator": "0.0.6",
23
- "@combos-fun/plugin-renderer": "0.0.6"
35
+ "@combos-fun/inspector-decorator": "0.0.7",
36
+ "@combos-fun/plugin-renderer": "0.0.7",
37
+ "@combos-fun/engine": "0.0.7"
24
38
  },
25
39
  "scripts": {
26
40
  "build": "node ../../scripts/build-package.mjs"