@clypra-studio/engine 1.2.0 → 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.
Files changed (47) hide show
  1. package/README.md +13 -39
  2. package/dist/{chunk-LT3HTJ3X.js → chunk-3UEOLDJJ.js} +5 -829
  3. package/dist/chunk-3UEOLDJJ.js.map +1 -0
  4. package/dist/{chunk-Y4FMAOTW.js → chunk-E6O6LZME.js} +266 -1004
  5. package/dist/chunk-E6O6LZME.js.map +1 -0
  6. package/dist/chunk-PU3Q4QI7.js +833 -0
  7. package/dist/chunk-PU3Q4QI7.js.map +1 -0
  8. package/dist/{index-D6GAXDBy.d.cts → index-C18SQ-y6.d.cts} +171 -37
  9. package/dist/{index-D6GAXDBy.d.ts → index-C18SQ-y6.d.ts} +171 -37
  10. package/dist/index.cjs +12064 -19908
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +3302 -7641
  13. package/dist/index.d.ts +3302 -7641
  14. package/dist/index.js +11201 -14606
  15. package/dist/index.js.map +1 -1
  16. package/dist/textEffects/index.cjs +259 -971
  17. package/dist/textEffects/index.cjs.map +1 -1
  18. package/dist/textEffects/index.d.cts +1 -1
  19. package/dist/textEffects/index.d.ts +1 -1
  20. package/dist/textEffects/index.js +1 -1
  21. package/dist/transitions/index.cjs +18 -2199
  22. package/dist/transitions/index.cjs.map +1 -1
  23. package/dist/transitions/index.d.cts +37 -53
  24. package/dist/transitions/index.d.ts +37 -53
  25. package/dist/transitions/index.js +3 -51
  26. package/dist/videoEffects/index.cjs +4 -835
  27. package/dist/videoEffects/index.cjs.map +1 -1
  28. package/dist/videoEffects/index.d.cts +9 -138
  29. package/dist/videoEffects/index.d.ts +9 -138
  30. package/dist/videoEffects/index.js +1 -15
  31. package/package.json +14 -17
  32. package/dist/TransitionDefinition-CQoSb4ZB.d.cts +0 -158
  33. package/dist/TransitionDefinition-CQoSb4ZB.d.ts +0 -158
  34. package/dist/chunk-FIJBB3MH.js +0 -2990
  35. package/dist/chunk-FIJBB3MH.js.map +0 -1
  36. package/dist/chunk-LT3HTJ3X.js.map +0 -1
  37. package/dist/chunk-RYA4KGDB.js +0 -690
  38. package/dist/chunk-RYA4KGDB.js.map +0 -1
  39. package/dist/chunk-Y4FMAOTW.js.map +0 -1
  40. package/dist/index-Da47I6aX.d.cts +0 -139
  41. package/dist/index-Da47I6aX.d.ts +0 -139
  42. package/dist/v2/backends/index.cjs +0 -693
  43. package/dist/v2/backends/index.cjs.map +0 -1
  44. package/dist/v2/backends/index.d.cts +0 -3
  45. package/dist/v2/backends/index.d.ts +0 -3
  46. package/dist/v2/backends/index.js +0 -8
  47. package/dist/v2/backends/index.js.map +0 -1
@@ -1,7 +1,3 @@
1
- import { E as EffectDefinition, e as ParamValues, i as TransitionDefinition, P as PixiEffectDefinition } from '../TransitionDefinition-CQoSb4ZB.cjs';
2
- export { C as Canvas2DEffectDefinition, a as Canvas2DEngine, b as Canvas2DEngineConstructor, c as ParamSchema, d as ParamType, f as PixiEffectContext, g as PixiEffectSubtype, h as PixiFilterSpec, j as isCanvas2DEffect, k as isCompositeEffect, l as isFilterEffect, m as isMotionEffect, n as isPixiEffect } from '../TransitionDefinition-CQoSb4ZB.cjs';
3
- import { Application, Sprite, Container, Texture } from 'pixi.js';
4
-
5
1
  /**
6
2
  * Video Effects Type System
7
3
  *
@@ -183,9 +179,7 @@ declare class EffectRenderer {
183
179
  *
184
180
  * Directed Acyclic Graph evaluator for effect chains.
185
181
  * Uses Kahn's algorithm for topological ordering.
186
- * Supports both Canvas2D and PixiJS effect nodes transparently.
187
- *
188
- * Unchanged public API from v1 — new PixiJS nodes slot in automatically.
182
+ * Supports native effect metadata and explicit Canvas2D source-preview nodes.
189
183
  */
190
184
 
191
185
  interface KeyframePoint {
@@ -195,7 +189,12 @@ interface KeyframePoint {
195
189
  }
196
190
  interface GraphNode {
197
191
  id: string;
198
- effect?: EffectDefinition;
192
+ /** Native effect metadata attached by the Studio graph editor. */
193
+ effect?: {
194
+ backend?: "native" | "canvas2d";
195
+ id?: string;
196
+ [key: string]: unknown;
197
+ };
199
198
  type?: string;
200
199
  params?: Record<string, any>;
201
200
  keyframes?: Record<string, KeyframePoint[]>;
@@ -237,15 +236,7 @@ declare class EffectGraph {
237
236
  resolve(): GraphNode[];
238
237
  getExecutionOrder(): string[];
239
238
  getUpstreamNodes(nodeId: string): string[];
240
- /**
241
- * Returns only the PixiJS nodes in resolved order.
242
- * Used by EffectRenderer to build the PixiJS filter + motion pipeline.
243
- */
244
- resolvePixi(): GraphNode[];
245
- /**
246
- * Returns only the Canvas2D nodes in resolved order.
247
- * Used by EffectRenderer for text effect overlays.
248
- */
239
+ /** Returns nodes that can execute in the browser-side authoring raster path. */
249
240
  resolveCanvas2D(): GraphNode[];
250
241
  get size(): number;
251
242
  clear(): this;
@@ -461,126 +452,6 @@ declare function generateEffectsManifest(): {
461
452
  effects: VideoEffectApiDefinition[];
462
453
  };
463
454
 
464
- /**
465
- * @clypra-studio/engine — PixiRenderer
466
- *
467
- * Manages a single shared PixiJS Application instance.
468
- * Handles three effect subtypes:
469
- * - filter → builds filter chain on videoSprite, updates uniforms per frame
470
- * - motion → calls mount/unmount lifecycle, hooks into Ticker
471
- * - composite → does both
472
- *
473
- * Used by:
474
- * - Clypra Studio (VideoEffectWorkspace preview canvas)
475
- * - Clypra Desktop (rasterizer.ts frame compositor)
476
- *
477
- * Both environments receive the same canvas output — PixiJS renders into it,
478
- * then the Desktop rasterizer reads the pixels for FFmpeg.
479
- */
480
-
481
- declare class PixiRenderer {
482
- private app;
483
- private videoSprite;
484
- private transitionSprite;
485
- private _activeTransition;
486
- private fromRenderTexture;
487
- private toRenderTexture;
488
- private blitSprite;
489
- private _transitionFromTex;
490
- private _transitionToTex;
491
- private overlayContainer;
492
- private baseMediaContainer;
493
- private mounted;
494
- private initialized;
495
- private initializing;
496
- private _activeSource;
497
- private _fitMode;
498
- /**
499
- * Initialize the PixiJS Application.
500
- * Call once, reuse across effect changes.
501
- *
502
- * @param canvas The target HTMLCanvasElement (Studio preview or rasterizer offscreen canvas)
503
- * @param width Canvas width in pixels
504
- * @param height Canvas height in pixels
505
- */
506
- init(canvas: HTMLCanvasElement, width: number, height: number): Promise<void>;
507
- setVideoSource(video: HTMLVideoElement): void;
508
- setImageSource(image: HTMLImageElement | HTMLCanvasElement): void;
509
- /**
510
- * Mount a resolved set of PixiJS graph nodes.
511
- * Builds filter chains and initialises motion effects.
512
- * Previously mounted effects NOT in the new list are unmounted.
513
- */
514
- applyNodes(nodes: GraphNode[], globalParams?: Map<string, ParamValues>): void;
515
- /**
516
- * Update multiple params on a mounted effect in one pass.
517
- */
518
- updateParams(nodeId: string, params: ParamValues): void;
519
- /**
520
- * Force a render pass (required for static image previews after uniform changes).
521
- */
522
- render(): void;
523
- /**
524
- * Update a single param on a mounted effect.
525
- * Triggers uniform refresh and calls onParamChange lifecycle hook.
526
- */
527
- updateParam(nodeId: string, key: string, value: number | string | boolean): void;
528
- /**
529
- * Capture the current rendered frame as an ImageData.
530
- * Used by the Desktop rasterizer to extract pixels for FFmpeg.
531
- */
532
- captureFrame(): ImageData | null;
533
- /**
534
- * Resize the renderer (e.g. when project resolution changes).
535
- */
536
- resize(width: number, height: number): void;
537
- setFitMode(mode: "stretch" | "fit" | "crop"): void;
538
- resizeSprites(): void;
539
- private _getElementDimensions;
540
- private _resizeSprite;
541
- /**
542
- * Full teardown — unmounts all effects, destroys the PixiJS Application.
543
- * Call when the editor session ends or the Studio workspace unmounts.
544
- */
545
- destroy(): void;
546
- private _unmount;
547
- private _defaultParams;
548
- getApp(): Application | null;
549
- getVideoSprite(): Sprite | null;
550
- getTransitionSprite(): Sprite | null;
551
- getBaseMediaContainer(): Container | null;
552
- getOverlayContainer(): Container | null;
553
- get isReady(): boolean;
554
- private _ensureRenderTextures;
555
- private _blitTransitionFrames;
556
- mountTransition(definition: TransitionDefinition, fromTexture: Texture, toTexture: Texture, params: ParamValues): void;
557
- getActiveTransitionId(): string | null;
558
- updateTransitionProgress(id: string, progress: number, params?: ParamValues): void;
559
- unmountTransition(): void;
560
- }
561
-
562
- /**
563
- * @clypra-studio/engine — example effects
564
- *
565
- * Three fully-worked examples covering every PixiJS subtype.
566
- * Copy these as templates when authoring new effects.
567
- *
568
- * 1. NeonGlowEffect — 'filter' — GPU shader, no ticker needed
569
- * 2. ParticleBurstEffect — 'motion' — ticker-driven animation, no shader
570
- * 3. VHSCompositeEffect — 'composite' — shader + animated overlay together
571
- */
572
-
573
- declare const NeonGlowEffect: PixiEffectDefinition;
574
- declare const ParticleBurstEffect: PixiEffectDefinition;
575
- declare const VHSCompositeEffect: PixiEffectDefinition;
576
-
577
- declare const example_NeonGlowEffect: typeof NeonGlowEffect;
578
- declare const example_ParticleBurstEffect: typeof ParticleBurstEffect;
579
- declare const example_VHSCompositeEffect: typeof VHSCompositeEffect;
580
- declare namespace example {
581
- export { example_NeonGlowEffect as NeonGlowEffect, example_ParticleBurstEffect as ParticleBurstEffect, example_VHSCompositeEffect as VHSCompositeEffect };
582
- }
583
-
584
455
  /**
585
456
  * Shake Effect
586
457
  */
@@ -694,4 +565,4 @@ declare namespace index {
694
565
  export { index_renderDustParticles as renderDustParticles, index_renderFire as renderFire, index_renderFlash as renderFlash, index_renderFlicker as renderFlicker, index_renderGlow as renderGlow, index_renderLightLeak as renderLightLeak, index_renderLightLeak2 as renderLightLeak2, index_renderParticles as renderParticles, index_renderVignette as renderVignette };
695
566
  }
696
567
 
697
- export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectDefinition, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, example as ExamplePixiEffects, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, ParamValues, PixiEffectDefinition, PixiRenderer, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
568
+ export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
@@ -1,7 +1,3 @@
1
- import { E as EffectDefinition, e as ParamValues, i as TransitionDefinition, P as PixiEffectDefinition } from '../TransitionDefinition-CQoSb4ZB.js';
2
- export { C as Canvas2DEffectDefinition, a as Canvas2DEngine, b as Canvas2DEngineConstructor, c as ParamSchema, d as ParamType, f as PixiEffectContext, g as PixiEffectSubtype, h as PixiFilterSpec, j as isCanvas2DEffect, k as isCompositeEffect, l as isFilterEffect, m as isMotionEffect, n as isPixiEffect } from '../TransitionDefinition-CQoSb4ZB.js';
3
- import { Application, Sprite, Container, Texture } from 'pixi.js';
4
-
5
1
  /**
6
2
  * Video Effects Type System
7
3
  *
@@ -183,9 +179,7 @@ declare class EffectRenderer {
183
179
  *
184
180
  * Directed Acyclic Graph evaluator for effect chains.
185
181
  * Uses Kahn's algorithm for topological ordering.
186
- * Supports both Canvas2D and PixiJS effect nodes transparently.
187
- *
188
- * Unchanged public API from v1 — new PixiJS nodes slot in automatically.
182
+ * Supports native effect metadata and explicit Canvas2D source-preview nodes.
189
183
  */
190
184
 
191
185
  interface KeyframePoint {
@@ -195,7 +189,12 @@ interface KeyframePoint {
195
189
  }
196
190
  interface GraphNode {
197
191
  id: string;
198
- effect?: EffectDefinition;
192
+ /** Native effect metadata attached by the Studio graph editor. */
193
+ effect?: {
194
+ backend?: "native" | "canvas2d";
195
+ id?: string;
196
+ [key: string]: unknown;
197
+ };
199
198
  type?: string;
200
199
  params?: Record<string, any>;
201
200
  keyframes?: Record<string, KeyframePoint[]>;
@@ -237,15 +236,7 @@ declare class EffectGraph {
237
236
  resolve(): GraphNode[];
238
237
  getExecutionOrder(): string[];
239
238
  getUpstreamNodes(nodeId: string): string[];
240
- /**
241
- * Returns only the PixiJS nodes in resolved order.
242
- * Used by EffectRenderer to build the PixiJS filter + motion pipeline.
243
- */
244
- resolvePixi(): GraphNode[];
245
- /**
246
- * Returns only the Canvas2D nodes in resolved order.
247
- * Used by EffectRenderer for text effect overlays.
248
- */
239
+ /** Returns nodes that can execute in the browser-side authoring raster path. */
249
240
  resolveCanvas2D(): GraphNode[];
250
241
  get size(): number;
251
242
  clear(): this;
@@ -461,126 +452,6 @@ declare function generateEffectsManifest(): {
461
452
  effects: VideoEffectApiDefinition[];
462
453
  };
463
454
 
464
- /**
465
- * @clypra-studio/engine — PixiRenderer
466
- *
467
- * Manages a single shared PixiJS Application instance.
468
- * Handles three effect subtypes:
469
- * - filter → builds filter chain on videoSprite, updates uniforms per frame
470
- * - motion → calls mount/unmount lifecycle, hooks into Ticker
471
- * - composite → does both
472
- *
473
- * Used by:
474
- * - Clypra Studio (VideoEffectWorkspace preview canvas)
475
- * - Clypra Desktop (rasterizer.ts frame compositor)
476
- *
477
- * Both environments receive the same canvas output — PixiJS renders into it,
478
- * then the Desktop rasterizer reads the pixels for FFmpeg.
479
- */
480
-
481
- declare class PixiRenderer {
482
- private app;
483
- private videoSprite;
484
- private transitionSprite;
485
- private _activeTransition;
486
- private fromRenderTexture;
487
- private toRenderTexture;
488
- private blitSprite;
489
- private _transitionFromTex;
490
- private _transitionToTex;
491
- private overlayContainer;
492
- private baseMediaContainer;
493
- private mounted;
494
- private initialized;
495
- private initializing;
496
- private _activeSource;
497
- private _fitMode;
498
- /**
499
- * Initialize the PixiJS Application.
500
- * Call once, reuse across effect changes.
501
- *
502
- * @param canvas The target HTMLCanvasElement (Studio preview or rasterizer offscreen canvas)
503
- * @param width Canvas width in pixels
504
- * @param height Canvas height in pixels
505
- */
506
- init(canvas: HTMLCanvasElement, width: number, height: number): Promise<void>;
507
- setVideoSource(video: HTMLVideoElement): void;
508
- setImageSource(image: HTMLImageElement | HTMLCanvasElement): void;
509
- /**
510
- * Mount a resolved set of PixiJS graph nodes.
511
- * Builds filter chains and initialises motion effects.
512
- * Previously mounted effects NOT in the new list are unmounted.
513
- */
514
- applyNodes(nodes: GraphNode[], globalParams?: Map<string, ParamValues>): void;
515
- /**
516
- * Update multiple params on a mounted effect in one pass.
517
- */
518
- updateParams(nodeId: string, params: ParamValues): void;
519
- /**
520
- * Force a render pass (required for static image previews after uniform changes).
521
- */
522
- render(): void;
523
- /**
524
- * Update a single param on a mounted effect.
525
- * Triggers uniform refresh and calls onParamChange lifecycle hook.
526
- */
527
- updateParam(nodeId: string, key: string, value: number | string | boolean): void;
528
- /**
529
- * Capture the current rendered frame as an ImageData.
530
- * Used by the Desktop rasterizer to extract pixels for FFmpeg.
531
- */
532
- captureFrame(): ImageData | null;
533
- /**
534
- * Resize the renderer (e.g. when project resolution changes).
535
- */
536
- resize(width: number, height: number): void;
537
- setFitMode(mode: "stretch" | "fit" | "crop"): void;
538
- resizeSprites(): void;
539
- private _getElementDimensions;
540
- private _resizeSprite;
541
- /**
542
- * Full teardown — unmounts all effects, destroys the PixiJS Application.
543
- * Call when the editor session ends or the Studio workspace unmounts.
544
- */
545
- destroy(): void;
546
- private _unmount;
547
- private _defaultParams;
548
- getApp(): Application | null;
549
- getVideoSprite(): Sprite | null;
550
- getTransitionSprite(): Sprite | null;
551
- getBaseMediaContainer(): Container | null;
552
- getOverlayContainer(): Container | null;
553
- get isReady(): boolean;
554
- private _ensureRenderTextures;
555
- private _blitTransitionFrames;
556
- mountTransition(definition: TransitionDefinition, fromTexture: Texture, toTexture: Texture, params: ParamValues): void;
557
- getActiveTransitionId(): string | null;
558
- updateTransitionProgress(id: string, progress: number, params?: ParamValues): void;
559
- unmountTransition(): void;
560
- }
561
-
562
- /**
563
- * @clypra-studio/engine — example effects
564
- *
565
- * Three fully-worked examples covering every PixiJS subtype.
566
- * Copy these as templates when authoring new effects.
567
- *
568
- * 1. NeonGlowEffect — 'filter' — GPU shader, no ticker needed
569
- * 2. ParticleBurstEffect — 'motion' — ticker-driven animation, no shader
570
- * 3. VHSCompositeEffect — 'composite' — shader + animated overlay together
571
- */
572
-
573
- declare const NeonGlowEffect: PixiEffectDefinition;
574
- declare const ParticleBurstEffect: PixiEffectDefinition;
575
- declare const VHSCompositeEffect: PixiEffectDefinition;
576
-
577
- declare const example_NeonGlowEffect: typeof NeonGlowEffect;
578
- declare const example_ParticleBurstEffect: typeof ParticleBurstEffect;
579
- declare const example_VHSCompositeEffect: typeof VHSCompositeEffect;
580
- declare namespace example {
581
- export { example_NeonGlowEffect as NeonGlowEffect, example_ParticleBurstEffect as ParticleBurstEffect, example_VHSCompositeEffect as VHSCompositeEffect };
582
- }
583
-
584
455
  /**
585
456
  * Shake Effect
586
457
  */
@@ -694,4 +565,4 @@ declare namespace index {
694
565
  export { index_renderDustParticles as renderDustParticles, index_renderFire as renderFire, index_renderFlash as renderFlash, index_renderFlicker as renderFlicker, index_renderGlow as renderGlow, index_renderLightLeak as renderLightLeak, index_renderLightLeak2 as renderLightLeak2, index_renderParticles as renderParticles, index_renderVignette as renderVignette };
695
566
  }
696
567
 
697
- export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectDefinition, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, example as ExamplePixiEffects, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, ParamValues, PixiEffectDefinition, PixiRenderer, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
568
+ export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
@@ -3,13 +3,11 @@ import {
3
3
  EffectEngine,
4
4
  EffectGraph,
5
5
  EffectRenderer,
6
- PixiRenderer,
7
6
  addNoise,
8
7
  blendColors,
9
8
  camera_exports,
10
9
  clearCanvas,
11
10
  effectMetadataToApi,
12
- example_exports,
13
11
  generateEffectsManifest,
14
12
  getAllEffectsForApi,
15
13
  getEffectByIdForApi,
@@ -20,17 +18,12 @@ import {
20
18
  getEffectsByCategory,
21
19
  getEffectsByCategoryForApi,
22
20
  hexToRgba,
23
- isCanvas2DEffect,
24
- isCompositeEffect,
25
- isFilterEffect,
26
- isMotionEffect,
27
- isPixiEffect,
28
21
  light_exports,
29
22
  rgbaToComponents,
30
23
  searchEffects,
31
24
  searchEffectsForApi,
32
25
  withContext
33
- } from "../chunk-LT3HTJ3X.js";
26
+ } from "../chunk-3UEOLDJJ.js";
34
27
  import "../chunk-PZ5AY32C.js";
35
28
  export {
36
29
  camera_exports as CameraEffects,
@@ -38,9 +31,7 @@ export {
38
31
  EffectEngine,
39
32
  EffectGraph,
40
33
  EffectRenderer,
41
- example_exports as ExamplePixiEffects,
42
34
  light_exports as LightEffects,
43
- PixiRenderer,
44
35
  addNoise,
45
36
  blendColors,
46
37
  clearCanvas,
@@ -55,11 +46,6 @@ export {
55
46
  getEffectsByCategory,
56
47
  getEffectsByCategoryForApi,
57
48
  hexToRgba,
58
- isCanvas2DEffect,
59
- isCompositeEffect,
60
- isFilterEffect,
61
- isMotionEffect,
62
- isPixiEffect,
63
49
  rgbaToComponents,
64
50
  searchEffects,
65
51
  searchEffectsForApi,
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@clypra-studio/engine",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "clypra",
7
7
  "clypra-studio",
8
8
  "video-effects",
9
9
  "gpu-accelerated",
10
- "pixijs",
11
10
  "webgl",
12
11
  "webgpu",
13
12
  "open-source"
@@ -64,20 +63,26 @@
64
63
  ],
65
64
  "repository": {
66
65
  "type": "git",
67
- "url": "https://github.com/AIEraDev/clypra-studio.git",
66
+ "url": "https://github.com/AIEraDev/clypra-packages.git",
68
67
  "directory": "packages/clypra-engine"
69
68
  },
70
- "homepage": "https://github.com/AIEraDev/clypra-studio/tree/main/packages/clypra-engine#readme",
69
+ "homepage": "https://github.com/AIEraDev/clypra-packages/tree/main/packages/clypra-engine#readme",
71
70
  "bugs": {
72
- "url": "https://github.com/AIEraDev/clypra-studio/issues"
71
+ "url": "https://github.com/AIEraDev/clypra-packages/issues"
72
+ },
73
+ "scripts": {
74
+ "build": "tsup",
75
+ "dev": "tsup --watch",
76
+ "clean": "rm -rf dist",
77
+ "lint": "tsc --noEmit",
78
+ "typecheck": "tsc --noEmit",
79
+ "test": "vitest run"
73
80
  },
74
81
  "dependencies": {
75
82
  "@clypra-studio/shaders": "^0.1.5",
76
- "@clypra-studio/types": "^0.4.0",
83
+ "@clypra-studio/types": "^0.5.0",
77
84
  "jszip": "^3.10.1",
78
85
  "lottie-web": "^5.13.0",
79
- "pixi-filters": "^6.0.0",
80
- "pixi.js": "^8.0.0",
81
86
  "zod": "^4.4.3"
82
87
  },
83
88
  "devDependencies": {
@@ -118,13 +123,5 @@
118
123
  ],
119
124
  "@semantic-release/github"
120
125
  ]
121
- },
122
- "scripts": {
123
- "build": "tsup",
124
- "dev": "tsup --watch",
125
- "clean": "rm -rf dist",
126
- "lint": "tsc --noEmit",
127
- "typecheck": "tsc --noEmit",
128
- "test": "vitest run"
129
126
  }
130
- }
127
+ }
@@ -1,158 +0,0 @@
1
- import { Filter, Application, Container, Ticker, Texture } from 'pixi.js';
2
-
3
- /**
4
- * @clypra-studio/engine — EffectDefinition
5
- *
6
- * Unified type system for all Clypra video effects.
7
- * Supports two rendering backends:
8
- * - 'canvas2d' → existing text/overlay effects (EffectEngine class pattern)
9
- * - 'pixi' → new GPU-accelerated video/motion/filter effects (PixiJS)
10
- *
11
- * Both backends are consumed identically by EffectGraph and EffectRenderer.
12
- * The Studio and Desktop Editor import from this single package — same code, same output.
13
- */
14
-
15
- type ParamType = "range" | "color" | "toggle" | "select" | "text";
16
- interface ParamSchema {
17
- key: string;
18
- label: string;
19
- type: ParamType;
20
- value: number | string | boolean;
21
- min?: number;
22
- max?: number;
23
- step?: number;
24
- options?: string[];
25
- }
26
- type ParamValues = Record<string, number | string | boolean>;
27
- type EffectCategory = "light" | "glitch" | "cinematic" | "neon" | "retro" | "motion" | "color" | "blur" | "distortion" | "particle" | "custom";
28
- interface Canvas2DEngine {
29
- /** Advance internal animation state by N steps */
30
- advanceSteps(steps: number): void;
31
- /** Draw one frame onto the provided context */
32
- drawFrame(ctx: CanvasRenderingContext2D, ghostFrames?: ImageData[]): void;
33
- }
34
- type Canvas2DEngineConstructor = new (config: ParamValues) => Canvas2DEngine;
35
- interface Canvas2DEffectDefinition {
36
- backend: "canvas2d";
37
- id: string;
38
- name: string;
39
- category: EffectCategory;
40
- description: string;
41
- tags: string[];
42
- thumbnail?: string;
43
- /** Static param schema — parsed by Studio to build sliders */
44
- params: ParamSchema[];
45
- /** The engine class that renders this effect */
46
- engineClass: Canvas2DEngineConstructor;
47
- }
48
- /**
49
- * PixiJS effect subtypes:
50
- *
51
- * 'filter' — one or more GLSL shaders applied as a filter chain on a sprite/container.
52
- * Pure GPU, no per-frame JS. Uniform values are updated from param changes.
53
- *
54
- * 'motion' — animated overlay managed via PixiJS Ticker. Particles, sweeps, pulses.
55
- * Has full scene-graph access (can add/remove children).
56
- *
57
- * 'composite' — combines filter + motion in one effect (e.g. neon glow + particle burst).
58
- */
59
- type PixiEffectSubtype = "filter" | "motion" | "composite";
60
- /** Context passed to every PixiJS effect lifecycle method */
61
- interface PixiEffectContext {
62
- /** The PixiJS Application instance (shared, do not destroy) */
63
- app: Application;
64
- /** The container to attach overlays or receive filters */
65
- container: Container;
66
- /** PixiJS ticker — subscribe for per-frame updates */
67
- ticker: Ticker;
68
- /** Current param values (updated when user moves a slider) */
69
- params: ParamValues;
70
- /** Canvas dimensions */
71
- width: number;
72
- height: number;
73
- }
74
- /** A single PixiJS Filter definition (for 'filter' and 'composite' subtypes) */
75
- interface PixiFilterSpec {
76
- /**
77
- * Factory that returns a configured PixiJS Filter.
78
- * Called once on mount, and again when params change significantly.
79
- * Import Filter types lazily inside the factory to keep the engine tree-shakeable.
80
- */
81
- create: (params: ParamValues) => Filter | Filter[];
82
- /**
83
- * Called every frame (if the filter has animated uniforms).
84
- * Mutate filter.resources / uniforms here instead of re-creating the filter.
85
- * Return false to skip uniform update this frame (for static filters).
86
- */
87
- updateUniforms?: (filter: Filter | Filter[], params: ParamValues, elapsed: number) => void;
88
- }
89
- interface PixiEffectDefinition {
90
- backend: "pixi";
91
- subtype: PixiEffectSubtype;
92
- id: string;
93
- name: string;
94
- category: EffectCategory;
95
- description: string;
96
- tags: string[];
97
- thumbnail?: string;
98
- /** Static param schema — same shape as Canvas2D, drives Studio sliders */
99
- params: ParamSchema[];
100
- /**
101
- * Filter spec — required for 'filter' and 'composite' subtypes.
102
- * For 'motion' only, omit this.
103
- */
104
- filterSpec?: PixiFilterSpec;
105
- /**
106
- * Lifecycle hooks for motion and composite subtypes.
107
- * mount → called once when effect is activated (add sprites, subscribe ticker)
108
- * unmount → called when effect is removed (clean up ALL resources — critical)
109
- * update → called when param values change (slider moved)
110
- */
111
- mount?: (ctx: PixiEffectContext) => void;
112
- unmount?: (ctx: PixiEffectContext) => void;
113
- onParamChange?: (ctx: PixiEffectContext, key: string, value: ParamValues[string]) => void;
114
- }
115
- type EffectDefinition = Canvas2DEffectDefinition | PixiEffectDefinition;
116
- declare function isCanvas2DEffect(e: EffectDefinition): e is Canvas2DEffectDefinition;
117
- declare function isPixiEffect(e: EffectDefinition): e is PixiEffectDefinition;
118
- declare function isFilterEffect(e: EffectDefinition): e is PixiEffectDefinition & {
119
- subtype: "filter";
120
- };
121
- declare function isMotionEffect(e: EffectDefinition): e is PixiEffectDefinition & {
122
- subtype: "motion";
123
- };
124
- declare function isCompositeEffect(e: EffectDefinition): e is PixiEffectDefinition & {
125
- subtype: "composite";
126
- };
127
-
128
- type GPUEffectTransitionCategory = 'geometric' | 'optical-distortion' | 'temporal' | 'particle-dissolve' | 'light-based' | 'depth-based' | 'physics-simulated';
129
- interface TransitionContext {
130
- /** Outgoing clip texture — sampled as uFrom in the shader */
131
- fromTexture: Texture;
132
- /** Incoming clip texture — sampled as uTo in the shader */
133
- toTexture: Texture;
134
- /** 0 at transition start, 1 at transition end — driven by the Studio timeline scrubber */
135
- progress: number;
136
- width: number;
137
- height: number;
138
- }
139
- interface TransitionDefinition {
140
- id: string;
141
- name: string;
142
- category: GPUEffectTransitionCategory;
143
- description: string;
144
- tags: string[];
145
- thumbnail?: string;
146
- /** Default duration in ms — used as the starting value in Studio, editable per-cut in Desktop */
147
- defaultDurationMs: number;
148
- params: ParamSchema[];
149
- /** Called once — builds the dual-texture filter */
150
- create(params: ParamValues): Filter;
151
- /**
152
- * Called every frame during the transition window.
153
- * progress goes 0 → 1 over defaultDurationMs (or the user-set cut duration).
154
- */
155
- updateProgress(filter: Filter, progress: number, params: ParamValues): void;
156
- }
157
-
158
- export { type Canvas2DEffectDefinition as C, type EffectDefinition as E, type GPUEffectTransitionCategory as G, type PixiEffectDefinition as P, type TransitionContext as T, type Canvas2DEngine as a, type Canvas2DEngineConstructor as b, type ParamSchema as c, type ParamType as d, type ParamValues as e, type PixiEffectContext as f, type PixiEffectSubtype as g, type PixiFilterSpec as h, type TransitionDefinition as i, isCanvas2DEffect as j, isCompositeEffect as k, isFilterEffect as l, isMotionEffect as m, isPixiEffect as n };