@toonstrip/pack-example 0.1.0
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/NOTICE +9 -0
- package/backdrops/meadow.png +0 -0
- package/characters/pip/pip.json +108 -0
- package/characters/pip/sheet.png +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +30 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.js +9 -0
- package/pack.json +21 -0
- package/package.json +30 -0
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@toonstrip/pack-example
|
|
2
|
+
|
|
3
|
+
All art in this package (characters/pip, backdrops/meadow) is original,
|
|
4
|
+
procedurally generated for this project by scripts/generate.mjs — plain
|
|
5
|
+
canvas-drawing code, not AI image generation and not derived from Microsoft
|
|
6
|
+
Comic Chat or any other third-party asset. No third-party attribution is
|
|
7
|
+
required for this pack.
|
|
8
|
+
|
|
9
|
+
Licensed under the MIT License (see the repository root LICENSE).
|
|
Binary file
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Pip",
|
|
3
|
+
"type": "COMPLEX",
|
|
4
|
+
"torsoFirst": false,
|
|
5
|
+
"sheet": "sheet.png",
|
|
6
|
+
"sheetWidth": 240,
|
|
7
|
+
"sheetHeight": 160,
|
|
8
|
+
"torsos": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "torso",
|
|
11
|
+
"index": 0,
|
|
12
|
+
"emotion": "NEUTRAL",
|
|
13
|
+
"angle": 0,
|
|
14
|
+
"intensity": 0,
|
|
15
|
+
"cx": 40,
|
|
16
|
+
"cy": 8,
|
|
17
|
+
"cxDelta": 0,
|
|
18
|
+
"cyDelta": 0,
|
|
19
|
+
"x": 40,
|
|
20
|
+
"figure": {
|
|
21
|
+
"x": 0,
|
|
22
|
+
"y": 0,
|
|
23
|
+
"width": 80,
|
|
24
|
+
"height": 90
|
|
25
|
+
},
|
|
26
|
+
"aura": null
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "torso",
|
|
30
|
+
"index": 1,
|
|
31
|
+
"emotion": "WAVE",
|
|
32
|
+
"angle": 1001,
|
|
33
|
+
"intensity": 1,
|
|
34
|
+
"cx": 40,
|
|
35
|
+
"cy": 8,
|
|
36
|
+
"cxDelta": 0,
|
|
37
|
+
"cyDelta": 0,
|
|
38
|
+
"x": 40,
|
|
39
|
+
"figure": {
|
|
40
|
+
"x": 80,
|
|
41
|
+
"y": 0,
|
|
42
|
+
"width": 80,
|
|
43
|
+
"height": 90
|
|
44
|
+
},
|
|
45
|
+
"aura": null
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "torso",
|
|
49
|
+
"index": 2,
|
|
50
|
+
"emotion": "SHRUG",
|
|
51
|
+
"angle": 1005,
|
|
52
|
+
"intensity": 1,
|
|
53
|
+
"cx": 40,
|
|
54
|
+
"cy": 8,
|
|
55
|
+
"cxDelta": 0,
|
|
56
|
+
"cyDelta": 0,
|
|
57
|
+
"x": 40,
|
|
58
|
+
"figure": {
|
|
59
|
+
"x": 160,
|
|
60
|
+
"y": 0,
|
|
61
|
+
"width": 80,
|
|
62
|
+
"height": 90
|
|
63
|
+
},
|
|
64
|
+
"aura": null
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"faces": [
|
|
68
|
+
{
|
|
69
|
+
"kind": "face",
|
|
70
|
+
"index": 0,
|
|
71
|
+
"emotion": "NEUTRAL",
|
|
72
|
+
"angle": 0,
|
|
73
|
+
"intensity": 0,
|
|
74
|
+
"cx": 35,
|
|
75
|
+
"cy": 40,
|
|
76
|
+
"cxDelta": 0,
|
|
77
|
+
"cyDelta": 0,
|
|
78
|
+
"x": 35,
|
|
79
|
+
"figure": {
|
|
80
|
+
"x": 0,
|
|
81
|
+
"y": 90,
|
|
82
|
+
"width": 70,
|
|
83
|
+
"height": 70
|
|
84
|
+
},
|
|
85
|
+
"aura": null
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"kind": "face",
|
|
89
|
+
"index": 1,
|
|
90
|
+
"emotion": "HAPPY",
|
|
91
|
+
"angle": 0,
|
|
92
|
+
"intensity": 1,
|
|
93
|
+
"cx": 35,
|
|
94
|
+
"cy": 40,
|
|
95
|
+
"cxDelta": 0,
|
|
96
|
+
"cyDelta": -2,
|
|
97
|
+
"x": 35,
|
|
98
|
+
"figure": {
|
|
99
|
+
"x": 70,
|
|
100
|
+
"y": 90,
|
|
101
|
+
"width": 70,
|
|
102
|
+
"height": 70
|
|
103
|
+
},
|
|
104
|
+
"aura": null
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"bodies": []
|
|
108
|
+
}
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CastManifest, PackJson } from "./types.js";
|
|
2
|
+
export type { CastManifest, PackedAvatar, PackedBackdrop, PackedPart, SheetRect, PackJson } from "./types.js";
|
|
3
|
+
/** Absolute path to this pack's root directory (where `pack.json` lives). */
|
|
4
|
+
export declare function packRoot(): string;
|
|
5
|
+
/** This pack's `pack.json`, unmodified. */
|
|
6
|
+
export declare function loadPackJson(): PackJson;
|
|
7
|
+
/**
|
|
8
|
+
* Assembles a `CastManifest` (the shape `packages/core` consumes) from
|
|
9
|
+
* `pack.json` plus each character's per-character manifest. `sheet` paths are
|
|
10
|
+
* rewritten to absolute paths so a caller can load them from any cwd.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadCastManifest(): CastManifest;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
const PACK_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
5
|
+
/** Absolute path to this pack's root directory (where `pack.json` lives). */
|
|
6
|
+
export function packRoot() {
|
|
7
|
+
return PACK_ROOT;
|
|
8
|
+
}
|
|
9
|
+
function readJson(path) {
|
|
10
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
11
|
+
}
|
|
12
|
+
/** This pack's `pack.json`, unmodified. */
|
|
13
|
+
export function loadPackJson() {
|
|
14
|
+
return readJson(join(PACK_ROOT, "pack.json"));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Assembles a `CastManifest` (the shape `packages/core` consumes) from
|
|
18
|
+
* `pack.json` plus each character's per-character manifest. `sheet` paths are
|
|
19
|
+
* rewritten to absolute paths so a caller can load them from any cwd.
|
|
20
|
+
*/
|
|
21
|
+
export function loadCastManifest() {
|
|
22
|
+
const pack = loadPackJson();
|
|
23
|
+
const cast = {};
|
|
24
|
+
for (const entry of pack.characters) {
|
|
25
|
+
const avatar = readJson(join(PACK_ROOT, entry.manifest));
|
|
26
|
+
cast[entry.id] = { ...avatar, sheet: join(PACK_ROOT, entry.sheet) };
|
|
27
|
+
}
|
|
28
|
+
const backdrops = pack.backdrops.map((b) => ({ ...b, file: join(PACK_ROOT, b.file) }));
|
|
29
|
+
return { version: 1, cast, backdrops };
|
|
30
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local copies of the pack contract shapes, kept independent of
|
|
3
|
+
* `@toonstrip/core` (see dev plan §2: "asset packs depend on schema only").
|
|
4
|
+
* Identical in shape to `@toonstrip/pack-comic-chat`'s own `src/types.ts` —
|
|
5
|
+
* every pack carries its own copy rather than importing a shared one, which
|
|
6
|
+
* is itself part of what this pack exists to prove (see docs/packs.md and
|
|
7
|
+
* NOTES.md "M5").
|
|
8
|
+
*/
|
|
9
|
+
export interface SheetRect {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PackedPart {
|
|
16
|
+
kind: "face" | "torso" | "body";
|
|
17
|
+
index: number;
|
|
18
|
+
emotion: string;
|
|
19
|
+
angle: number;
|
|
20
|
+
intensity: number;
|
|
21
|
+
cx: number;
|
|
22
|
+
cy: number;
|
|
23
|
+
cxDelta: number;
|
|
24
|
+
cyDelta: number;
|
|
25
|
+
x: number;
|
|
26
|
+
figure: SheetRect;
|
|
27
|
+
aura: SheetRect | null;
|
|
28
|
+
}
|
|
29
|
+
export interface PackedAvatar {
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
torsoFirst: boolean;
|
|
33
|
+
sheet: string;
|
|
34
|
+
sheetWidth: number;
|
|
35
|
+
sheetHeight: number;
|
|
36
|
+
faces: PackedPart[];
|
|
37
|
+
torsos: PackedPart[];
|
|
38
|
+
bodies: PackedPart[];
|
|
39
|
+
}
|
|
40
|
+
export interface PackedBackdrop {
|
|
41
|
+
id: string;
|
|
42
|
+
file: string;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}
|
|
46
|
+
export interface CastManifest {
|
|
47
|
+
version: 1;
|
|
48
|
+
cast: Record<string, PackedAvatar>;
|
|
49
|
+
backdrops: PackedBackdrop[];
|
|
50
|
+
}
|
|
51
|
+
export interface PackJson {
|
|
52
|
+
name: string;
|
|
53
|
+
version: string;
|
|
54
|
+
license: string;
|
|
55
|
+
characters: {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
manifest: string;
|
|
59
|
+
sheet: string;
|
|
60
|
+
}[];
|
|
61
|
+
backdrops: PackedBackdrop[];
|
|
62
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local copies of the pack contract shapes, kept independent of
|
|
3
|
+
* `@toonstrip/core` (see dev plan §2: "asset packs depend on schema only").
|
|
4
|
+
* Identical in shape to `@toonstrip/pack-comic-chat`'s own `src/types.ts` —
|
|
5
|
+
* every pack carries its own copy rather than importing a shared one, which
|
|
6
|
+
* is itself part of what this pack exists to prove (see docs/packs.md and
|
|
7
|
+
* NOTES.md "M5").
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
package/pack.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"characters": [
|
|
6
|
+
{
|
|
7
|
+
"id": "pip",
|
|
8
|
+
"name": "Pip",
|
|
9
|
+
"manifest": "characters/pip/pip.json",
|
|
10
|
+
"sheet": "characters/pip/sheet.png"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"backdrops": [
|
|
14
|
+
{
|
|
15
|
+
"id": "meadow",
|
|
16
|
+
"file": "backdrops/meadow.png",
|
|
17
|
+
"width": 240,
|
|
18
|
+
"height": 240
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@toonstrip/pack-example",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"pack.json",
|
|
11
|
+
"characters",
|
|
12
|
+
"backdrops",
|
|
13
|
+
"NOTICE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.json",
|
|
17
|
+
"generate": "node scripts/generate.mjs",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@napi-rs/canvas": "^0.1.65",
|
|
23
|
+
"@types/node": "^22.9.0",
|
|
24
|
+
"typescript": "^5.6.3",
|
|
25
|
+
"vitest": "^2.1.4"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|