@agrhub/engine-pixi 0.0.0-stage → 1.4.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/LICENSE +47 -0
- package/NOTICE.md +20 -0
- package/README.md +6 -2
- package/dist/animation/block-reveal-animation.d.ts +33 -0
- package/dist/animation/easings.d.ts +4 -0
- package/dist/animation/gsap-animation.d.ts +32 -0
- package/dist/animation/index.d.ts +9 -0
- package/dist/animation/keyframe-animation.d.ts +11 -0
- package/dist/animation/mask-animation.d.ts +170 -0
- package/dist/animation/pixi-animation-utils.d.ts +10 -0
- package/dist/animation/registry.d.ts +11 -0
- package/dist/animation/types.d.ts +211 -0
- package/dist/animation/wipe-animation.d.ts +53 -0
- package/dist/clips/audio-clip.d.ts +122 -0
- package/dist/clips/backdrop-clip.d.ts +56 -0
- package/dist/clips/base-clip.d.ts +150 -0
- package/dist/clips/base-text-clip.d.ts +228 -0
- package/dist/clips/caption-clip.d.ts +129 -0
- package/dist/clips/clip-registry.d.ts +56 -0
- package/dist/clips/effect-clip.d.ts +37 -0
- package/dist/clips/iclip.d.ts +235 -0
- package/dist/clips/image-clip.d.ts +116 -0
- package/dist/clips/index.d.ts +20 -0
- package/dist/clips/placeholder-clip.d.ts +22 -0
- package/dist/clips/shape-clip.d.ts +59 -0
- package/dist/clips/text-clip.d.ts +148 -0
- package/dist/clips/transition-clip.d.ts +45 -0
- package/dist/clips/video-clip.d.ts +216 -0
- package/dist/compositor/audio-mixer.d.ts +8 -0
- package/dist/compositor/av-encoder.d.ts +17 -0
- package/dist/compositor/clip-style-renderer.d.ts +23 -0
- package/dist/compositor/compositor-renderer.d.ts +29 -0
- package/dist/compositor/effect-manager.d.ts +30 -0
- package/dist/compositor/scheduler.d.ts +8 -0
- package/dist/compositor/transition-manager.d.ts +45 -0
- package/dist/compositor.d.ts +157 -0
- package/dist/effect/constant/index.d.ts +566 -0
- package/dist/effect/effect.d.ts +9 -0
- package/dist/effect/glsl/custom-glsl.d.ts +1043 -0
- package/dist/effect/glsl/gl-effect.d.ts +38 -0
- package/dist/effect/interface/index.d.ts +25 -0
- package/dist/effect/types.d.ts +26 -0
- package/dist/effect/vertex.d.ts +1 -0
- package/dist/event-emitter.d.ts +55 -0
- package/dist/filters/outline-filter.d.ts +28 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.es.js +16144 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.cjs +3335 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/json-serialization.d.ts +312 -0
- package/dist/mp4-utils/index.d.ts +31 -0
- package/dist/mp4-utils/mp4box-utils.d.ts +44 -0
- package/dist/mp4-utils/sample-transform.d.ts +26 -0
- package/dist/sprite/base-sprite.d.ts +273 -0
- package/dist/sprite/pixi-sprite-renderer.d.ts +69 -0
- package/dist/standalone/index.es.js +94191 -0
- package/dist/standalone/index.es.js.map +1 -0
- package/dist/studio/history-manager.d.ts +46 -0
- package/dist/studio/resource-manager.d.ts +53 -0
- package/dist/studio/selection-manager.d.ts +66 -0
- package/dist/studio/timeline-model.d.ts +117 -0
- package/dist/studio/transport.d.ts +44 -0
- package/dist/studio-bridge.d.ts +50 -0
- package/dist/studio.d.ts +529 -0
- package/dist/transformer/handle.d.ts +17 -0
- package/dist/transformer/snapping.d.ts +45 -0
- package/dist/transformer/transformer.d.ts +38 -0
- package/dist/transformer/wireframe.d.ts +5 -0
- package/dist/transition/fragment.d.ts +1 -0
- package/dist/transition/glsl/custom-glsl.d.ts +231 -0
- package/dist/transition/glsl/gl-transition.d.ts +42 -0
- package/dist/transition/transition.d.ts +6 -0
- package/dist/transition/types.d.ts +31 -0
- package/dist/transition/uniforms.d.ts +35 -0
- package/dist/transition/vertex.d.ts +1 -0
- package/dist/utils/asset-manager.d.ts +15 -0
- package/dist/utils/audio-codec-detector.d.ts +39 -0
- package/dist/utils/audio.d.ts +81 -0
- package/dist/utils/chromakey.d.ts +24 -0
- package/dist/utils/color-adjustment.d.ts +53 -0
- package/dist/utils/color.d.ts +17 -0
- package/dist/utils/common.d.ts +7 -0
- package/dist/utils/dom.d.ts +48 -0
- package/dist/utils/effect.d.ts +1 -0
- package/dist/utils/fonts.d.ts +21 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/log.d.ts +27 -0
- package/dist/utils/media-cache.d.ts +45 -0
- package/dist/utils/stream-utils.d.ts +4 -0
- package/dist/utils/video.d.ts +16 -0
- package/dist/utils/worker-timer.d.ts +1 -0
- package/package.json +63 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new HTML element
|
|
3
|
+
* @param tagName - Tag name of the element to create
|
|
4
|
+
* @returns Newly created HTML element
|
|
5
|
+
*/
|
|
6
|
+
export declare function createEl(tagName: string): HTMLElement;
|
|
7
|
+
/**
|
|
8
|
+
* Render text as an image
|
|
9
|
+
* @param text - Text to render
|
|
10
|
+
* @param cssText - CSS styles to apply to the text
|
|
11
|
+
* @returns Rendered image element
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderTxt2Img(text: string, cssText: string, opts?: {
|
|
14
|
+
font?: {
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
18
|
+
onCreated?: (el: HTMLElement) => void;
|
|
19
|
+
}): Promise<HTMLImageElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Render text as {@link ImageBitmap} for creating {@link Image}
|
|
22
|
+
* @param text - Text to render
|
|
23
|
+
* @param cssText - CSS styles to apply to the text
|
|
24
|
+
* @param opts - Options
|
|
25
|
+
* @param opts.font - Custom font
|
|
26
|
+
* @param opts.onCreated - Callback after creation
|
|
27
|
+
*
|
|
28
|
+
* // Example:
|
|
29
|
+
* new Image(
|
|
30
|
+
* await renderTxt2ImgBitmap(
|
|
31
|
+
* 'Watermark',
|
|
32
|
+
* `font-size:40px; color: white; text-shadow: 2px 2px 6px red; font-family: CustomFont;`,
|
|
33
|
+
* {
|
|
34
|
+
* font: {
|
|
35
|
+
* name: 'CustomFont',
|
|
36
|
+
* url: '/CustomFont.ttf',
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* )
|
|
40
|
+
* )
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderTxt2ImgBitmap(text: string, cssText: string, opts?: {
|
|
43
|
+
font?: {
|
|
44
|
+
name: string;
|
|
45
|
+
url: string;
|
|
46
|
+
};
|
|
47
|
+
onCreated?: (el: HTMLElement) => void;
|
|
48
|
+
}): Promise<ImageBitmap>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function camelToWords(text: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IFont {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class FontManager {
|
|
6
|
+
private static instance;
|
|
7
|
+
private fonts;
|
|
8
|
+
/** In-flight loads, so concurrent addFont calls for one font share a single FontFace load */
|
|
9
|
+
private loading;
|
|
10
|
+
private warnedConflicts;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getInstance(): FontManager;
|
|
13
|
+
addFont(font: IFont): Promise<void>;
|
|
14
|
+
/** The first registration of a name wins; a different URL for it is almost always a data bug */
|
|
15
|
+
private warnOnConflict;
|
|
16
|
+
loadFonts(fonts: IFont[]): Promise<void>;
|
|
17
|
+
removeFont(fontName: string): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
getLoadedFonts(): string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const fontManager: FontManager;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global logging utility.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Log: {
|
|
5
|
+
debug: (...args: any[]) => void;
|
|
6
|
+
info: (...args: any[]) => void;
|
|
7
|
+
warn: (...args: any[]) => void;
|
|
8
|
+
error: (...args: any[]) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the logging threshold. Only logs at this level or higher will be recorded.
|
|
11
|
+
* @example Log.setLogLevel(Log.warn) // Only warn and error will be logged
|
|
12
|
+
*/
|
|
13
|
+
setLogLevel: <T extends Function>(logfn: T) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a logger instance that prefixes all messages with a tag.
|
|
16
|
+
*/
|
|
17
|
+
create: (tag: string) => {
|
|
18
|
+
debug: (...args: any[]) => void;
|
|
19
|
+
info: (...args: any[]) => void;
|
|
20
|
+
warn: (...args: any[]) => void;
|
|
21
|
+
error: (...args: any[]) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Dumps the log history as a string.
|
|
25
|
+
*/
|
|
26
|
+
dump: () => Promise<string>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared media cache for video/audio/image/font bytes.
|
|
3
|
+
*
|
|
4
|
+
* Every consumer (clip creation, preload, split/duplicate, export Compositor, app timeline
|
|
5
|
+
* thumbnails/waveforms) gets the same bytes for a URL:
|
|
6
|
+
* 1. in-flight requests are shared (one network fetch per URL at a time),
|
|
7
|
+
* 2. completed downloads stay in an in-memory LRU of Blobs (byte budget; browsers keep large
|
|
8
|
+
* Blobs in their blob store, not the JS heap),
|
|
9
|
+
* 3. remote URLs are persisted to OPFS (AssetManager) for later sessions.
|
|
10
|
+
*
|
|
11
|
+
* It is a globalThis singleton so duplicated bundle copies share one cache.
|
|
12
|
+
*/
|
|
13
|
+
export interface MediaCacheOptions {
|
|
14
|
+
/** Total bytes kept in memory (default 768 MB) */
|
|
15
|
+
maxMemoryBytes?: number;
|
|
16
|
+
/** Larger entries are not kept in memory, only in OPFS (default 400 MB) */
|
|
17
|
+
maxEntryBytes?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class MediaCache {
|
|
20
|
+
private memory;
|
|
21
|
+
private memoryBytes;
|
|
22
|
+
private inflight;
|
|
23
|
+
private maxMemoryBytes;
|
|
24
|
+
private maxEntryBytes;
|
|
25
|
+
constructor(opts?: MediaCacheOptions);
|
|
26
|
+
configure(opts: MediaCacheOptions): void;
|
|
27
|
+
/** Cache key: absolute URL (relative paths resolve against the page) */
|
|
28
|
+
key(url: string): string;
|
|
29
|
+
/** Bytes for a URL, from memory, an in-flight request, OPFS, or the network (in that order) */
|
|
30
|
+
getBlob(url: string): Promise<Blob>;
|
|
31
|
+
getStream(url: string): Promise<ReadableStream<Uint8Array>>;
|
|
32
|
+
/** A fresh ImageBitmap per call (callers own and may close it); the bytes are shared */
|
|
33
|
+
getImageBitmap(url: string): Promise<ImageBitmap>;
|
|
34
|
+
getArrayBuffer(url: string): Promise<ArrayBuffer>;
|
|
35
|
+
/** Warm the cache; resolves once every URL is loaded (failures are ignored) */
|
|
36
|
+
preload(urls: string[]): Promise<void>;
|
|
37
|
+
has(url: string): boolean;
|
|
38
|
+
/** Forget a URL in memory (OPFS copy stays) */
|
|
39
|
+
release(url: string): void;
|
|
40
|
+
clearMemory(): void;
|
|
41
|
+
private load;
|
|
42
|
+
private remember;
|
|
43
|
+
private evict;
|
|
44
|
+
}
|
|
45
|
+
export declare const mediaCache: MediaCache;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode image stream, return an array of video frames.
|
|
3
|
+
*
|
|
4
|
+
* @param stream - Readable stream containing image data.
|
|
5
|
+
* @param type - MIME type of the image, e.g. 'image/jpeg'.
|
|
6
|
+
*
|
|
7
|
+
* @returns Returns a Promise that resolves to an array of {@link VideoFrame} after decoding completes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const frames = await decodeImg(
|
|
12
|
+
* (await fetch('<gif url>')).body!,
|
|
13
|
+
* `image/gif`,
|
|
14
|
+
* );
|
|
15
|
+
*/
|
|
16
|
+
export declare function decodeImg(stream: ReadableStream<Uint8Array>, type: string): Promise<VideoFrame[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const workerTimer: (handler: () => void, time: number) => (() => void);
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agrhub/engine-pixi",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "PixiJS/WebCodecs rendering engine for the AgrHub video editor (fork of @openvideo/engine-pixi)",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mp4",
|
|
7
|
+
"rendering",
|
|
8
|
+
"video",
|
|
9
|
+
"webcodecs"
|
|
10
|
+
],
|
|
11
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
12
|
+
"author": "AgrHub (fork of OpenVideo by OpenVideoDev)",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md",
|
|
17
|
+
"NOTICE.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "dist/index.umd.cjs",
|
|
21
|
+
"module": "dist/index.es.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.es.js",
|
|
27
|
+
"require": "./dist/index.umd.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./standalone": "./dist/standalone/index.es.js",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": true,
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"tag": "latest"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@pixi/layout": "^3.2.0",
|
|
39
|
+
"@types/dom-webcodecs": "^0.1.17",
|
|
40
|
+
"gl-transitions": "^1.43.0",
|
|
41
|
+
"gsap": "^3.12.7",
|
|
42
|
+
"mediabunny": "^1.26.0",
|
|
43
|
+
"microdiff": "^1.4.0",
|
|
44
|
+
"nanoid": "^5.0.7",
|
|
45
|
+
"opfs-tools": "^0.7.2",
|
|
46
|
+
"pixi-filters": "^6.1.5",
|
|
47
|
+
"pixi.js": "^8.14.3",
|
|
48
|
+
"wave-resampler": "^1.0.0",
|
|
49
|
+
"wrapbox": "^0.1.0",
|
|
50
|
+
"@agrhub/core": "^1.4.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@vitest/browser": "^4.0.18",
|
|
54
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
55
|
+
"@vitest/ui": "^4.0.18",
|
|
56
|
+
"jsdom": "^27.4.0",
|
|
57
|
+
"typescript": "~5.9.2",
|
|
58
|
+
"vite": "^7.1.5",
|
|
59
|
+
"vite-plugin-dts": "^4.5.4",
|
|
60
|
+
"vitest": "^4.0.18"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc --noEmit && vite build && vite build --config vite.standalone.config.ts",
|
|
64
|
+
"test": "vitest run"
|
|
65
|
+
}
|
|
6
66
|
}
|