@kurot/atlas 0.0.0-stage → 0.1.1

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/LICENSE +21 -0
  3. package/README.md +146 -2
  4. package/dist/AtlasError.d.ts +9 -0
  5. package/dist/AtlasError.d.ts.map +1 -0
  6. package/dist/AtlasError.js +12 -0
  7. package/dist/AtlasError.js.map +1 -0
  8. package/dist/AtlasTypes.d.ts +76 -0
  9. package/dist/AtlasTypes.d.ts.map +1 -0
  10. package/dist/AtlasTypes.js +2 -0
  11. package/dist/AtlasTypes.js.map +1 -0
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +3 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/layout.d.ts +10 -0
  17. package/dist/layout.d.ts.map +1 -0
  18. package/dist/layout.js +39 -0
  19. package/dist/layout.js.map +1 -0
  20. package/dist/max-rects.d.ts +17 -0
  21. package/dist/max-rects.d.ts.map +1 -0
  22. package/dist/max-rects.js +67 -0
  23. package/dist/max-rects.js.map +1 -0
  24. package/dist/options.d.ts +5 -0
  25. package/dist/options.d.ts.map +1 -0
  26. package/dist/options.js +64 -0
  27. package/dist/options.js.map +1 -0
  28. package/dist/pack-atlas.d.ts +7 -0
  29. package/dist/pack-atlas.d.ts.map +1 -0
  30. package/dist/pack-atlas.js +16 -0
  31. package/dist/pack-atlas.js.map +1 -0
  32. package/dist/png/index.d.ts +26 -0
  33. package/dist/png/index.d.ts.map +1 -0
  34. package/dist/png/index.js +114 -0
  35. package/dist/png/index.js.map +1 -0
  36. package/dist/render.d.ts +6 -0
  37. package/dist/render.d.ts.map +1 -0
  38. package/dist/render.js +40 -0
  39. package/dist/render.js.map +1 -0
  40. package/dist/trim.d.ts +12 -0
  41. package/dist/trim.d.ts.map +1 -0
  42. package/dist/trim.js +29 -0
  43. package/dist/trim.js.map +1 -0
  44. package/docs/ai-context.md +78 -0
  45. package/docs/cli-integration.md +130 -0
  46. package/docs/reference-validation.md +62 -0
  47. package/package.json +40 -5
@@ -0,0 +1,62 @@
1
+ # Atlas reference validation
2
+
3
+ Use the local read-only reference validator to check frame geometry and pixels
4
+ against supplied basis/basis_icon source and atlas files. Reference data is not
5
+ part of the npm package.
6
+
7
+ ## Reference inputs and configuration
8
+
9
+ - Source images: `ui-tps/src/basis/*.png`, `ui-tps/src/basis_icon/*.png`.
10
+ - Reference outputs: `ui-tps/export/r_basis.{json,png,tps}`, `r_basis_icon.{json,png,tps}`.
11
+ - Project resources: `resource/assets/ui/app/r_basis.{json,png}`, `r_basis_icon.{json,png}`.
12
+ Compare the selected baseline explicitly rather than assuming it matches runtime copies.
13
+ - TexturePacker 8.3 Egret export: single sheet, no rotation, POT, rectangular sheets
14
+ allowed, maximum 2048², scale 1, RGBA8888 PNG, alpha threshold 1, trim margin 1,
15
+ extrude 1, shape/border padding 0, and cleared RGB for fully transparent pixels.
16
+ Auto-alias is enabled; alias behavior requires a separate fixture when relevant.
17
+
18
+ Use default packing options, with only the corresponding PNG filename
19
+ specified explicitly. The library does not read `.tps`; scope compatibility to the selected settings
20
+ and source sets.
21
+
22
+ ## Validation coverage
23
+
24
+ `scripts/verify-reference.ts` and `scripts/reference-checks.ts` check:
25
+
26
+ 1. Source image names exactly match the reference JSON frame set.
27
+ 2. JSON uses `file` + `frames`. Each frame has integer `x/y/w/h` and optional
28
+ `offX/offY/sourceW/sourceH`, with no rotation or nested format.
29
+ 3. Reference and new PNGs are 8-bit RGBA. Frames and their 1 px extrusion fit
30
+ within atlas bounds; extruded rectangles do not overlap.
31
+ 4. Independently computed bounds contain source alpha ≥ 1, expanded by a 1 px
32
+ margin and clamped to source bounds. Both reference and new crops match;
33
+ discarded regions contain no nonzero alpha.
34
+ 5. Each frame is restored to its source canvas using offX/offY. All retained
35
+ pixels match channel by channel: fully transparent pixels have RGB checked
36
+ against 0, and nonzero-alpha pixels have exactly matching RGBA.
37
+ 6. Every pixel in the 1 px edge and corner extrusion matches.
38
+ 7. Apart from x/y, old and new frames have identical field values and field presence.
39
+ 8. Reversing input order produces identical new PNG bytes and JSON objects.
40
+ 9. Reports retain source/reference SHA-256 hashes to identify the baseline after
41
+ future source-image updates.
42
+
43
+ The library does not emit TexturePacker's top-level `meta`; Core's
44
+ SheetAnalyzer does not read it. `meta.smartupdate` is TexturePacker update
45
+ metadata and must not retain an old value as if it described a new output.
46
+
47
+ ## Repeating the validation
48
+
49
+ Run from the engine repository root. The second argument must be a directory
50
+ that does not yet exist and is outside the sample project:
51
+
52
+ ```sh
53
+ pnpm --dir packages/atlas verify:reference \
54
+ /path/to/CrashMaster/kurot-project-kui \
55
+ /tmp/kurot-atlas-reference-new
56
+ ```
57
+
58
+ The script reads the sample project without modifying it and writes two PNG/JSON
59
+ pairs plus `report.json` to the new directory. Failures exit with a nonzero code.
60
+ It is a local reference-validation tool with no fixed developer path; it is not
61
+ part of default CI tests, and its scripts are not published. Rerun it after
62
+ baseline files change. An old report does not verify new files.
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
- "name": "@kurot/atlas",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@kurot/atlas",
3
+ "version": "0.1.1",
4
+ "description": "Independent RGBA atlas packing and PNG tooling with Kurot-compatible sheet output",
5
+ "author": "Kelvin <kyia.x52@gmail.com>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
13
+ "./png": { "types": "./dist/png/index.d.ts", "import": "./dist/png/index.js" }
14
+ },
15
+ "files": ["dist/**/*", "docs/**/*", "CHANGELOG.md", "LICENSE"],
16
+ "scripts": {
17
+ "build": "tsc --build",
18
+ "dev": "tsc --watch",
19
+ "clean": "rm -rf dist",
20
+ "test": "tsc --project tsconfig.test.json && vitest run",
21
+ "test:watch": "vitest",
22
+ "verify:reference": "tsc --project tsconfig.verify.json && node .verify/scripts/verify-reference.js",
23
+ "prepublishOnly": "pnpm run clean && pnpm run build"
24
+ },
25
+ "dependencies": { "pngjs": "^7.0.0" },
26
+ "devDependencies": {
27
+ "@types/node": "^22.0.0",
28
+ "@types/pngjs": "^6.0.5",
29
+ "typescript": "^5.6.0",
30
+ "vitest": "^4.1.4"
31
+ },
32
+ "engines": { "node": ">=20" },
33
+ "keywords": ["kurot", "atlas", "sprite-sheet", "maxrects", "typescript"],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/kurot-engine/kurot.git",
37
+ "directory": "packages/atlas"
38
+ },
39
+ "packageManager": "pnpm@10.33.0",
40
+ "publishConfig": { "access": "public" }
41
+ }