@taole/giftstage 0.3.2 → 0.3.4

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.
@@ -144,6 +144,7 @@ export declare class WebGL2Backend implements GPUBackend {
144
144
  private recordSubmittedDraw;
145
145
  private rejectSVGAFastPathDraw;
146
146
  private initPrograms;
147
+ prepareParticleSpritePipelines(): void;
147
148
  private ensureParticleSpriteProgram;
148
149
  private makeProgramEntry;
149
150
  /**
@@ -57,6 +57,8 @@ export declare class WebGPUBackend implements GPUBackend {
57
57
  private buffers;
58
58
  private textures;
59
59
  private pipelines;
60
+ private particleSpritePreparations;
61
+ private particleSpritePreparationEpoch;
60
62
  private sampler;
61
63
  private uniformBuffer;
62
64
  private texturedBindGroupLayout;
@@ -214,7 +216,9 @@ export declare class WebGPUBackend implements GPUBackend {
214
216
  private ensureSVGAFrameTableMeshPipeline;
215
217
  private ensureMotionSvgaPipeline;
216
218
  private ensureParticlePipeline;
219
+ prepareParticleSpritePipelines(): Promise<void>;
217
220
  private ensureParticleSpritePipeline;
221
+ private particleSpritePipelineDescriptor;
218
222
  private createInstancedSvgaPipeline;
219
223
  private createInstancedClipMaskPipeline;
220
224
  private createVapInstancedPipeline;
@@ -314,6 +314,8 @@ export interface GPUBackend {
314
314
  createSVGAFrameTable?(packedData: Float32Array, options: SVGAFrameTableCreateOptions): SVGAFrameTableBinding;
315
315
  /** Releases a frame table returned by `createSVGAFrameTable`. */
316
316
  deleteSVGAFrameTable?(binding: SVGAFrameTableBinding): void;
317
+ /** Prepares sprite-v2 shaders before playback, without drawing or advancing a clock. */
318
+ prepareParticleSpritePipelines?(): void | Promise<void>;
317
319
  createTexture(source: TexImageSource | ArrayBuffer, opts: TextureOpts): GPUTextureHandle;
318
320
  /** Uninitialized RGBA texture (e.g. WebCodecs atlas backing store). */
319
321
  createEmptyTexture(width: number, height: number, opts?: TextureOpts): GPUTextureHandle;
@@ -1,3 +1,4 @@
1
+ import { parseSvgPath } from './svg-path-parser.js';
1
2
  export interface ClipMeshData {
2
3
  vertices: Float32Array;
3
4
  indices: Uint32Array;
@@ -16,4 +17,8 @@ export type ClipPathGeometryKind = 'empty' | 'fillable' | 'invalid';
16
17
  * validation remains authoritative for those genuinely malformed contours.
17
18
  */
18
19
  export declare function classifyClipPathGeometry(clipPath: string): ClipPathGeometryKind;
20
+ /** Reuses flattened geometry when callers also inspect the path's bounds. */
21
+ export declare function classifyParsedClipPathGeometry(subPaths: ReturnType<typeof parseSvgPath>): ClipPathGeometryKind;
22
+ /** Checkpoints also bound work for a single large, collinear contour. */
23
+ export declare function classifyParsedClipPathGeometrySteps(subPaths: ReturnType<typeof parseSvgPath>): Generator<void, ClipPathGeometryKind>;
19
24
  export declare function buildClipMeshFromPath(clipPath: string, triangulator?: ClipMeshTriangulator): ClipMeshData | null;
@@ -8,4 +8,6 @@ interface Point {
8
8
  y: number;
9
9
  }
10
10
  export declare function parseSvgPath(d: string): Point[][];
11
+ /** Incremental curve flattening for frame-budgeted clip analysis. */
12
+ export declare function parseSvgPathSteps(d: string): Generator<void, Point[][]>;
11
13
  export {};
@@ -4,9 +4,13 @@ export declare const SVGA_HYBRID_OP_SHAPE = 1;
4
4
  export declare const SVGA_HYBRID_OP_CLIP_WRITE = 2;
5
5
  export declare const SVGA_HYBRID_OP_CLIP_TEST = 3;
6
6
  export declare const SVGA_HYBRID_OP_CLIP_CLEAR = 4;
7
- /**
8
- * Compiles the SVGA paint graph once per resource. Runtime Hybrid rendering
9
- * indexes one immutable frame slice and never scans all sprite rows or resolves
10
- * image/shape/clip keys on the hot path.
11
- */
7
+ export interface SVGAHybridCommandTableBuildOptions {
8
+ /** Shares the same main-thread budget as SVGA parsing, atlas and slot work. */
9
+ frameBudgetMs?: number;
10
+ /** Throw when the owning resource has been released or its backend is lost. */
11
+ checkActive?: () => void;
12
+ }
13
+ /** Compatibility entry point for offline/synchronous callers. Playback uses the cooperative builder. */
12
14
  export declare function buildSVGAHybridCommandTable(entity: VideoEntity): SVGAHybridCommandTable;
15
+ /** Only returns a complete immutable table; partially built state never reaches the renderer. */
16
+ export declare function buildSVGAHybridCommandTableCooperative(entity: VideoEntity, options?: SVGAHybridCommandTableBuildOptions): Promise<SVGAHybridCommandTable>;
package/package.json CHANGED
@@ -1,82 +1,82 @@
1
- {
2
- "name": "@taole/giftstage",
3
- "version": "0.3.2",
4
- "description": "High-performance WebGPU/WebGL gift animation player unifying SVGA, VAP, AlphaVideo, and images",
5
- "type": "module",
6
- "main": "dist/gift-stage.cjs",
7
- "module": "dist/gift-stage.es.js",
8
- "types": "dist/public.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/public.d.ts",
12
- "import": "./dist/gift-stage.es.js",
13
- "require": "./dist/gift-stage.cjs"
14
- }
15
- },
16
- "publishConfig": {
17
- "access": "public",
18
- "registry": "https://registry.npmjs.org/"
19
- },
20
- "files": [
21
- "dist",
22
- "!dist/**/*.map",
23
- "!dist/bundle-report.*.html",
24
- "!dist/fixtures/**"
25
- ],
26
- "scripts": {
27
- "dev": "vite",
28
- "build": "tsc --noEmit && vite build && tsc -p tsconfig.build.json && node scripts/write-public-types.mjs",
29
- "build:analyze": "tsc --noEmit && vite build --mode analyze-es && vite build --mode analyze-cjs && tsc -p tsconfig.build.json && node scripts/write-public-types.mjs",
30
- "build:demo": "tsc --noEmit && vite build --config vite.demo.config.ts && node -e \"const fs=require('fs'); fs.mkdirSync('dist-demo/static',{recursive:true}); fs.copyFileSync('static/vap.min.js','dist-demo/static/vap.min.js');\"",
31
- "build:wasm": "echo \"Requires: cargo install wasm-pack\" && cd wasm && wasm-pack build --target web --out-dir pkg",
32
- "test": "vitest run",
33
- "test:watch": "vitest",
34
- "test:browser": "vitest run --browser.enabled --browser.name=chromium",
35
- "test:e2e": "playwright test",
1
+ {
2
+ "name": "@taole/giftstage",
3
+ "version": "0.3.4",
4
+ "description": "High-performance WebGPU/WebGL gift animation player unifying SVGA, VAP, AlphaVideo, and images",
5
+ "type": "module",
6
+ "main": "dist/gift-stage.cjs",
7
+ "module": "dist/gift-stage.es.js",
8
+ "types": "dist/public.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/public.d.ts",
12
+ "import": "./dist/gift-stage.es.js",
13
+ "require": "./dist/gift-stage.cjs"
14
+ }
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "!dist/**/*.map",
23
+ "!dist/bundle-report.*.html",
24
+ "!dist/fixtures/**"
25
+ ],
26
+ "scripts": {
27
+ "dev": "vite",
28
+ "build": "tsc --noEmit && vite build && tsc -p tsconfig.build.json && node scripts/write-public-types.mjs",
29
+ "build:analyze": "tsc --noEmit && vite build --mode analyze-es && vite build --mode analyze-cjs && tsc -p tsconfig.build.json && node scripts/write-public-types.mjs",
30
+ "build:demo": "tsc --noEmit && vite build --config vite.demo.config.ts && node -e \"const fs=require('fs'); fs.mkdirSync('dist-demo/static',{recursive:true}); fs.copyFileSync('static/vap.min.js','dist-demo/static/vap.min.js');\"",
31
+ "build:wasm": "echo \"Requires: cargo install wasm-pack\" && cd wasm && wasm-pack build --target web --out-dir pkg",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "test:browser": "vitest run --browser.enabled --browser.name=chromium",
35
+ "test:e2e": "playwright test",
36
36
  "test:perf": "node scripts/run-performance.mjs",
37
37
  "test:real-assets": "node scripts/verify-real-svga-manifest.mjs",
38
- "test:package": "npm run build && node scripts/check-package-contract.mjs",
39
- "perf:record": "node scripts/run-performance.mjs --record",
40
- "lint": "eslint src/ tests/",
41
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
42
- "typecheck": "tsc --noEmit",
43
- "dp": "node publish/deploy.mjs"
44
- },
45
- "devDependencies": {
46
- "@playwright/test": "^1.50.0",
47
- "@types/dom-webcodecs": "^0.1.11",
48
- "@types/earcut": "^3.0.0",
49
- "@types/node": "^25.6.0",
50
- "@types/pngjs": "^6.0.5",
51
- "@vitest/browser": "^3.0.0",
52
- "eslint": "^9.0.0",
53
- "fake-indexeddb": "^6.2.5",
54
- "jsdom": "^24.1.3",
55
- "playwright": "^1.50.0",
56
- "pngjs": "^7.0.0",
57
- "prettier": "^3.4.0",
58
- "rollup-plugin-visualizer": "^7.0.1",
59
- "typescript": "^5.7.0",
60
- "typescript-eslint": "^8.68.0",
61
- "vite": "^6.0.0",
62
- "vite-plugin-wasm": "^3.4.0",
63
- "vitest": "^3.0.0"
64
- },
65
- "keywords": [
66
- "svga",
67
- "vap",
68
- "alpha-video",
69
- "image",
70
- "webgl",
71
- "webgpu",
72
- "animation",
73
- "gift",
74
- "transparent-video"
75
- ],
76
- "license": "MIT",
77
- "dependencies": {
78
- "@webgpu/types": "^0.1.69",
79
- "earcut": "^3.0.2",
80
- "mp4box": "^2.3.0"
81
- }
82
- }
38
+ "test:package": "npm run build && node scripts/check-package-contract.mjs",
39
+ "perf:record": "node scripts/run-performance.mjs --record",
40
+ "lint": "eslint src/ tests/",
41
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
42
+ "typecheck": "tsc --noEmit",
43
+ "dp": "node publish/deploy.mjs"
44
+ },
45
+ "devDependencies": {
46
+ "@playwright/test": "^1.50.0",
47
+ "@types/dom-webcodecs": "^0.1.11",
48
+ "@types/earcut": "^3.0.0",
49
+ "@types/node": "^25.6.0",
50
+ "@types/pngjs": "^6.0.5",
51
+ "@vitest/browser": "^3.0.0",
52
+ "eslint": "^9.0.0",
53
+ "fake-indexeddb": "^6.2.5",
54
+ "jsdom": "^24.1.3",
55
+ "playwright": "^1.50.0",
56
+ "pngjs": "^7.0.0",
57
+ "prettier": "^3.4.0",
58
+ "rollup-plugin-visualizer": "^7.0.1",
59
+ "typescript": "^5.7.0",
60
+ "typescript-eslint": "^8.68.0",
61
+ "vite": "^6.0.0",
62
+ "vite-plugin-wasm": "^3.4.0",
63
+ "vitest": "^3.0.0"
64
+ },
65
+ "keywords": [
66
+ "svga",
67
+ "vap",
68
+ "alpha-video",
69
+ "image",
70
+ "webgl",
71
+ "webgpu",
72
+ "animation",
73
+ "gift",
74
+ "transparent-video"
75
+ ],
76
+ "license": "MIT",
77
+ "dependencies": {
78
+ "@webgpu/types": "^0.1.69",
79
+ "earcut": "^3.0.2",
80
+ "mp4box": "^2.3.0"
81
+ }
82
+ }