@haiyue/animation-spec 0.2.0 → 0.2.2

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/package.json CHANGED
@@ -1,89 +1,93 @@
1
- {
2
- "name": "@haiyue/animation-spec",
3
- "version": "0.2.0",
4
- "private": false,
5
- "description": "Source-neutral HYA animation schemas, validation, binary codecs, and conversion adapters.",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/HaiyueStudio/Engine.git",
10
- "directory": "animation-spec"
11
- },
12
- "type": "module",
13
- "main": "dist/index.js",
14
- "module": "dist/index.js",
15
- "types": "dist/index.d.ts",
16
- "sideEffects": false,
17
- "engines": {
18
- "node": ">=22"
19
- },
20
- "publishConfig": {
21
- "access": "public",
22
- "tag": "latest"
23
- },
24
- "files": [
25
- "dist",
26
- "bin",
27
- "schema",
28
- "LICENSE",
29
- "README.md",
30
- "SPECIFICATION.md"
31
- ],
32
- "bin": {
33
- "hya-convert": "./bin/hya-lottie-convert.mjs",
34
- "hya-lottie-convert": "./bin/hya-lottie-convert.mjs",
35
- "hya-live2d-convert": "./bin/hya-live2d-convert.mjs",
36
- "hya-cubism-convert": "./bin/hya-live2d-convert.mjs"
37
- },
38
- "exports": {
39
- ".": {
40
- "types": "./dist/index.d.ts",
41
- "import": "./dist/index.js"
42
- },
43
- "./lottie": {
44
- "types": "./dist/lottie.d.ts",
45
- "import": "./dist/lottie.js"
46
- },
47
- "./native3d": {
48
- "types": "./dist/native3d.d.ts",
49
- "import": "./dist/native3d.js"
50
- },
51
- "./deformable2d": {
52
- "types": "./dist/deformable2d.d.ts",
53
- "import": "./dist/deformable2d.js"
54
- },
55
- "./cubism": {
56
- "types": "./dist/cubism.d.ts",
57
- "import": "./dist/cubism.js"
58
- },
59
- "./live2d": {
60
- "types": "./dist/live2d.d.ts",
61
- "import": "./dist/live2d.js"
62
- },
63
- "./conversion": {
64
- "types": "./dist/conversion.d.ts",
65
- "import": "./dist/conversion.js"
66
- },
67
- "./live2d/clip-baked": {
68
- "types": "./dist/live2d/clip-baked.d.ts",
69
- "import": "./dist/live2d/clip-baked.js"
70
- }
71
- },
72
- "scripts": {
73
- "build": "node ../scripts/build-rollup-once.mjs && rollup -c rollup.dts.config.js && node ../scripts/install-bundled-declarations.mjs animation-spec dist-declarations",
74
- "test": "npm run build && npm run build:conversion-tests && node --test --test-concurrency=1 \"test/**/*.test.mjs\"",
75
- "build:conversion-tests": "node -e \"require('node:fs').rmSync('dist-test', { recursive: true, force: true })\" && tsc -p tsconfig.conversion-tests.json",
76
- "typecheck": "tsc -p tsconfig.json --noEmit",
77
- "samples:generate": "node ../scripts/build-rollup-once.mjs && node scripts/generate-samples.mjs",
78
- "corpus:sync": "node ../scripts/hya-corpus/sync.mjs"
79
- },
80
- "devDependencies": {
81
- "@rollup/plugin-node-resolve": "^15.3.1",
82
- "rollup": "^4.0.0",
83
- "tslib": "^2.6.0",
84
- "typescript": "^5.2.0"
85
- },
86
- "dependencies": {
87
- "polygon-clipping": "^0.15.7"
88
- }
89
- }
1
+ {
2
+ "name": "@haiyue/animation-spec",
3
+ "version": "0.2.2",
4
+ "private": false,
5
+ "description": "Source-neutral HYA animation schemas, validation, binary codecs, and conversion adapters.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/HaiyueStudio/Engine.git",
10
+ "directory": "animation-spec"
11
+ },
12
+ "type": "module",
13
+ "main": "dist/index.js",
14
+ "module": "dist/index.js",
15
+ "types": "dist/index.d.ts",
16
+ "sideEffects": false,
17
+ "engines": {
18
+ "node": ">=22"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "tag": "latest"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "bin",
27
+ "schema",
28
+ "LICENSE",
29
+ "README.md",
30
+ "SPECIFICATION.md"
31
+ ],
32
+ "bin": {
33
+ "hya-convert": "./bin/hya-lottie-convert.mjs",
34
+ "hya-lottie-convert": "./bin/hya-lottie-convert.mjs",
35
+ "hya-live2d-convert": "./bin/hya-live2d-convert.mjs",
36
+ "hya-cubism-convert": "./bin/hya-live2d-convert.mjs"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.js"
42
+ },
43
+ "./lottie": {
44
+ "types": "./dist/lottie.d.ts",
45
+ "import": "./dist/lottie.js"
46
+ },
47
+ "./native3d": {
48
+ "types": "./dist/native3d.d.ts",
49
+ "import": "./dist/native3d.js"
50
+ },
51
+ "./deformable2d": {
52
+ "types": "./dist/deformable2d.d.ts",
53
+ "import": "./dist/deformable2d.js"
54
+ },
55
+ "./cubism": {
56
+ "types": "./dist/cubism.d.ts",
57
+ "import": "./dist/cubism.js"
58
+ },
59
+ "./live2d": {
60
+ "types": "./dist/live2d.d.ts",
61
+ "import": "./dist/live2d.js"
62
+ },
63
+ "./conversion": {
64
+ "types": "./dist/conversion.d.ts",
65
+ "import": "./dist/conversion.js"
66
+ },
67
+ "./live2d/clip-baked": {
68
+ "types": "./dist/live2d/clip-baked.d.ts",
69
+ "import": "./dist/live2d/clip-baked.js"
70
+ },
71
+ "./hya-production": {
72
+ "types": "./dist/hya-production.d.ts",
73
+ "import": "./dist/hya-production.js"
74
+ }
75
+ },
76
+ "scripts": {
77
+ "build": "node ../scripts/build-rollup-once.mjs && rollup -c rollup.dts.config.js && node ../scripts/install-bundled-declarations.mjs animation-spec dist-declarations",
78
+ "test": "npm run build && npm run build:conversion-tests && node --test --test-concurrency=1 \"test/**/*.test.mjs\"",
79
+ "build:conversion-tests": "node -e \"require('node:fs').rmSync('dist-test', { recursive: true, force: true })\" && tsc -p tsconfig.conversion-tests.json",
80
+ "typecheck": "tsc -p tsconfig.json --noEmit",
81
+ "samples:generate": "node ../scripts/build-rollup-once.mjs && node scripts/generate-samples.mjs",
82
+ "corpus:sync": "node ../scripts/hya-corpus/sync.mjs"
83
+ },
84
+ "devDependencies": {
85
+ "@rollup/plugin-node-resolve": "^15.3.1",
86
+ "rollup": "^4.0.0",
87
+ "tslib": "^2.6.0",
88
+ "typescript": "^5.2.0"
89
+ },
90
+ "dependencies": {
91
+ "polygon-clipping": "^0.15.7"
92
+ }
93
+ }
@@ -222,8 +222,8 @@
222
222
  "easing": { "type": "array", "items": { "type": "number", "minimum": 0, "maximum": 1 }, "minItems": 4, "maxItems": 4 },
223
223
  "smoothness": { "type": "number", "minimum": 0, "maximum": 1 },
224
224
  "randomSeed": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
225
- "startTrack": { "$ref": "#/$defs/vectorTrack" }, "endTrack": { "$ref": "#/$defs/vectorTrack" },
226
- "offsetTrack": { "$ref": "#/$defs/vectorTrack" }, "amountTrack": { "$ref": "#/$defs/vectorTrack" }
225
+ "startTrack": { "$ref": "#/$defs/vectorValueTrack" }, "endTrack": { "$ref": "#/$defs/vectorValueTrack" },
226
+ "offsetTrack": { "$ref": "#/$defs/vectorValueTrack" }, "amountTrack": { "$ref": "#/$defs/vectorValueTrack" }
227
227
  }, "additionalProperties": false
228
228
  },
229
229
  "textAnimator": {
@@ -232,9 +232,9 @@
232
232
  "selector": { "$ref": "#/$defs/textSelector" }, "position": { "$ref": "#/$defs/vec2" }, "scale": { "$ref": "#/$defs/vec2" },
233
233
  "rotation": { "type": "number" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
234
234
  "fillColor": { "$ref": "#/$defs/color" }, "tracking": { "type": "number" },
235
- "positionTrack": { "$ref": "#/$defs/vectorTrack" }, "scaleTrack": { "$ref": "#/$defs/vectorTrack" },
236
- "rotationTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" },
237
- "fillColorTrack": { "$ref": "#/$defs/vectorTrack" }, "trackingTrack": { "$ref": "#/$defs/vectorTrack" }
235
+ "positionTrack": { "$ref": "#/$defs/vectorValueTrack" }, "scaleTrack": { "$ref": "#/$defs/vectorValueTrack" },
236
+ "rotationTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" },
237
+ "fillColorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "trackingTrack": { "$ref": "#/$defs/vectorValueTrack" }
238
238
  }, "additionalProperties": false
239
239
  },
240
240
  "particle2d": {
@@ -488,31 +488,31 @@
488
488
  "black": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
489
489
  "white": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
490
490
  "amount": { "type": "number", "minimum": 0, "maximum": 1 },
491
- "blackTrack": { "$ref": "#/$defs/vectorTrack" }, "whiteTrack": { "$ref": "#/$defs/vectorTrack" }, "amountTrack": { "$ref": "#/$defs/vectorTrack" }
491
+ "blackTrack": { "$ref": "#/$defs/vectorValueTrack" }, "whiteTrack": { "$ref": "#/$defs/vectorValueTrack" }, "amountTrack": { "$ref": "#/$defs/vectorValueTrack" }
492
492
  }, "additionalProperties": false
493
493
  },
494
494
  {
495
495
  "type": "object", "required": ["kind", "color"],
496
496
  "properties": {
497
497
  "kind": { "const": "fill" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
498
- "colorTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" }
498
+ "colorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" }
499
499
  }, "additionalProperties": false
500
500
  },
501
501
  {
502
502
  "type": "object", "required": ["kind", "opacity"],
503
- "properties": { "kind": { "const": "opacity" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" } },
503
+ "properties": { "kind": { "const": "opacity" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" } },
504
504
  "additionalProperties": false
505
505
  },
506
506
  {
507
507
  "type": "object", "required": ["kind", "matrix"],
508
508
  "properties": {
509
509
  "kind": { "const": "color-matrix" }, "matrix": { "type": "array", "minItems": 20, "maxItems": 20, "items": { "type": "number" } },
510
- "matrixTrack": { "$ref": "#/$defs/vectorTrack" }
510
+ "matrixTrack": { "$ref": "#/$defs/vectorValueTrack" }
511
511
  }, "additionalProperties": false
512
512
  },
513
513
  {
514
514
  "type": "object", "required": ["kind", "radius"],
515
- "properties": { "kind": { "const": "blur" }, "radius": { "$ref": "#/$defs/nonNegativeVec2" }, "radiusTrack": { "$ref": "#/$defs/vectorTrack" } },
515
+ "properties": { "kind": { "const": "blur" }, "radius": { "$ref": "#/$defs/nonNegativeVec2" }, "radiusTrack": { "$ref": "#/$defs/vectorValueTrack" } },
516
516
  "additionalProperties": false
517
517
  },
518
518
  {
@@ -520,8 +520,8 @@
520
520
  "properties": {
521
521
  "kind": { "const": "drop-shadow" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
522
522
  "offset": { "$ref": "#/$defs/vec2" }, "blur": { "type": "number", "minimum": 0 },
523
- "colorTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" },
524
- "offsetTrack": { "$ref": "#/$defs/vectorTrack" }, "blurTrack": { "$ref": "#/$defs/vectorTrack" }
523
+ "colorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" },
524
+ "offsetTrack": { "$ref": "#/$defs/vectorValueTrack" }, "blurTrack": { "$ref": "#/$defs/vectorValueTrack" }
525
525
  }, "additionalProperties": false
526
526
  }
527
527
  ]
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://haiyue.dev/schema/hya-composition-v1.json",
4
+ "title": "HYA composition envelope v1",
5
+ "description": "Editor shape aid. The source-neutral parser is normative for JSON safety, aggregate budgets, existing part formats, typed target addresses, dependencies and capability negotiation.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["format", "version", "parts", "targets"],
9
+ "properties": {
10
+ "format": {"const": "haiyue-composition"},
11
+ "version": {"const": 1},
12
+ "parts": {"type": "array", "maxItems": 16, "items": {"$ref": "#/$defs/part"}},
13
+ "targets": {"type": "array", "maxItems": 100000, "items": {"$ref": "#/$defs/target"}}
14
+ },
15
+ "$defs": {
16
+ "id": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\u0000-\\u001f]+$"},
17
+ "extension": {"type": "string", "maxLength": 256, "pattern": "^[a-zA-Z0-9]+(?:[.-][a-zA-Z0-9]+)+@[1-9][0-9]*$"},
18
+ "part": {
19
+ "type": "object", "additionalProperties": false,
20
+ "required": ["id", "extension", "required", "requires", "dependencies", "document"],
21
+ "properties": {
22
+ "id": {"$ref": "#/$defs/id"},
23
+ "extension": {"$ref": "#/$defs/extension"},
24
+ "required": {"type": "boolean"},
25
+ "requires": {"type": "array", "maxItems": 64, "uniqueItems": true, "items": {"$ref": "#/$defs/extension"}},
26
+ "dependencies": {"type": "array", "maxItems": 16, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
27
+ "document": {}
28
+ }
29
+ },
30
+ "target": {
31
+ "type": "object", "additionalProperties": false,
32
+ "required": ["id", "part", "kind", "address"],
33
+ "properties": {
34
+ "id": {"$ref": "#/$defs/id"},
35
+ "part": {"$ref": "#/$defs/id"},
36
+ "kind": {"enum": ["animation-node", "layout-node", "text-block", "asset", "state-input", "interaction-target", "semantic-node", "audio-cue"]},
37
+ "address": {"type": "array", "minItems": 1, "maxItems": 2, "items": {"$ref": "#/$defs/id"}}
38
+ }
39
+ }
40
+ }
41
+ }
@@ -11,7 +11,7 @@
11
11
  "extension": { "const": "org.haiyue.layout-2d@1" },
12
12
  "shaping": { "$ref": "#/$defs/shaping" },
13
13
  "assets": { "type": "array", "maxItems": 4096, "items": { "$ref": "#/$defs/asset" } },
14
- "textStyles": { "type": "array", "maxItems": 250000, "items": { "type": "object", "required": ["id", "fontAssets", "fontFamily", "fontWeight", "fontStyle", "fontSize", "lineHeight", "tracking", "alignment", "fills"] },
14
+ "textStyles": { "type": "array", "maxItems": 250000, "items": { "type": "object", "required": ["id", "fontAssets", "fontFamily", "fontWeight", "fontStyle", "fontSize", "lineHeight", "tracking", "alignment", "fills"] } },
15
15
  "textBlocks": { "type": "array", "maxItems": 250000, "items": { "type": "object", "required": ["id", "runs", "width", "height"] } },
16
16
  "artboards": { "type": "array", "maxItems": 8192, "items": { "$ref": "#/$defs/artboard" } },
17
17
  "instances": { "type": "array", "maxItems": 8192, "items": { "$ref": "#/$defs/instance" } }