@combos-fun/plugin-renderer-nine-patch 0.0.5 → 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 +25 -1
- package/agent-skill.md +61 -0
- package/combos-plugin.json +11 -0
- package/package.json +20 -6
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
# @combos-fun/plugin-renderer-nine-patch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
@combos-fun/plugin-renderer-nine-patch — part of the Combos Fun engine monorepo.
|
|
4
|
+
|
|
5
|
+
Keywords: `nine-patch`, `nine-slice`, `panel`, `ui`, `stretch`, `2d`.
|
|
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-nine-patch/plugin-manifest';
|
|
21
|
+
// or fetch the markdown directly:
|
|
22
|
+
// require.resolve('@combos-fun/plugin-renderer-nine-patch/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,61 @@
|
|
|
1
|
+
# `@combos-fun/plugin-renderer-nine-patch` — Agent notes
|
|
2
|
+
|
|
3
|
+
9-patch (nine-slice) panels for the 2D pipeline. Stretches the centre of a
|
|
4
|
+
texture while keeping corner sizes fixed — used for resizable buttons,
|
|
5
|
+
panels, dialog frames.
|
|
6
|
+
|
|
7
|
+
## When to read
|
|
8
|
+
|
|
9
|
+
Read for any stretchable UI panel: buttons, dialog backgrounds, tooltip
|
|
10
|
+
frames, list backgrounds.
|
|
11
|
+
|
|
12
|
+
## Public API
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { NinePatch, NinePatchSystem, type NinePatchParams } from '@combos-fun/plugin-renderer-nine-patch';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`componentName = 'NinePatch'`, `systemName = 'NinePatchSystem'`.
|
|
19
|
+
|
|
20
|
+
### `NinePatchParams`
|
|
21
|
+
|
|
22
|
+
| Field | Type | Notes |
|
|
23
|
+
|-------|------|-------|
|
|
24
|
+
| `resource` | `string` | Engine resource name. Supports `RESOURCE_TYPE.IMAGE` and `RESOURCE_TYPE.SPRITE` |
|
|
25
|
+
| `spriteName` | `string?` | Required when `resource` is a SPRITE atlas |
|
|
26
|
+
| `leftWidth` | `number` | Left fixed border (px) |
|
|
27
|
+
| `topHeight` | `number` | Top fixed border (px) |
|
|
28
|
+
| `rightWidth` | `number` | Right fixed border (px) |
|
|
29
|
+
| `bottomHeight` | `number` | Bottom fixed border (px) |
|
|
30
|
+
|
|
31
|
+
The actual stretched size comes from `Transform.size`. Set
|
|
32
|
+
`transform.size = { x: 300, y: 100 }` to stretch the centre to those
|
|
33
|
+
dimensions.
|
|
34
|
+
|
|
35
|
+
## Required setup
|
|
36
|
+
|
|
37
|
+
`RendererSystem` then `NinePatchSystem`. Resource must be loaded before
|
|
38
|
+
the component is added (use `preload: true`).
|
|
39
|
+
|
|
40
|
+
## Common pitfalls
|
|
41
|
+
|
|
42
|
+
| Symptom | Fix |
|
|
43
|
+
|---------|-----|
|
|
44
|
+
| Border distorted | Border widths must add up to ≤ texture size; otherwise corners overlap |
|
|
45
|
+
| Panel collapses to corners | Set `Transform.size` to the desired stretched dimensions |
|
|
46
|
+
| Wrong slice | Atlas (`SPRITE`) types need `spriteName` matching the atlas frame |
|
|
47
|
+
|
|
48
|
+
## Minimal example
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const panel = new GameObject('panel');
|
|
52
|
+
panel.addComponent(new Transform({ position: { x: 100, y: 100 }, size: { x: 300, y: 120 } }));
|
|
53
|
+
panel.addComponent(new NinePatch({
|
|
54
|
+
resource: 'panel-bg',
|
|
55
|
+
leftWidth: 16, topHeight: 16, rightWidth: 16, bottomHeight: 16,
|
|
56
|
+
}));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Verification
|
|
60
|
+
|
|
61
|
+
`pnpm --filter @combos-fun/plugin-renderer-nine-patch run build`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@combos-fun/plugin-renderer-nine-patch",
|
|
3
|
+
"pluginId": "renderer-nine-patch",
|
|
4
|
+
"category": "rendering",
|
|
5
|
+
"dimension": "2d",
|
|
6
|
+
"isCore": false,
|
|
7
|
+
"keywords": ["nine-patch", "nine-slice", "panel", "ui", "stretch", "2d"],
|
|
8
|
+
"agentSkill": "./agent-skill.md",
|
|
9
|
+
"requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer"],
|
|
10
|
+
"exports": ["NinePatch", "NinePatchSystem"]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-nine-patch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "@combos-fun/plugin-renderer-nine-patch",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-nine-patch.esm.js",
|
|
@@ -8,8 +8,22 @@
|
|
|
8
8
|
"unpkg": "dist/CombosFun.plugin.renderer.ninePatch.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-nine-patch.esm.js",
|
|
18
|
+
"require": "./index.js",
|
|
19
|
+
"types": "./dist/plugin-renderer-nine-patch.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-nine-patch.d.ts",
|
|
14
28
|
"keywords": [
|
|
15
29
|
"combos-fun",
|
|
@@ -18,10 +32,10 @@
|
|
|
18
32
|
"author": "sun668 <q947692259@gmail.com>",
|
|
19
33
|
"dependencies": {
|
|
20
34
|
"pixi.js": "^8.18.1",
|
|
21
|
-
"@combos-fun/plugin-renderer": "0.0.
|
|
22
|
-
"@combos-fun/
|
|
23
|
-
"@combos-fun/inspector-decorator": "0.0.
|
|
24
|
-
"@combos-fun/
|
|
35
|
+
"@combos-fun/plugin-renderer": "0.0.7",
|
|
36
|
+
"@combos-fun/renderer-adapter": "0.0.7",
|
|
37
|
+
"@combos-fun/inspector-decorator": "0.0.7",
|
|
38
|
+
"@combos-fun/engine": "0.0.7"
|
|
25
39
|
},
|
|
26
40
|
"scripts": {
|
|
27
41
|
"build": "node ../../scripts/build-package.mjs"
|