@designcombo/video 0.0.0 → 0.0.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.
Files changed (32) hide show
  1. package/dist/{SharedSystems-BSw9neqH.js → SharedSystems-BWe03l6N.js} +20 -20
  2. package/dist/{WebGLRenderer-BrabW-VK.js → WebGLRenderer-CKduQ9yw.js} +22 -22
  3. package/dist/{WebGPURenderer-BKwBKkzk.js → WebGPURenderer-BSX8DZj-.js} +19 -19
  4. package/dist/{browserAll-C7HVZtqZ.js → browserAll-CwPYLzJJ.js} +2 -2
  5. package/dist/clips/audio-clip.d.ts +1 -1
  6. package/dist/clips/caption-clip.d.ts +33 -7
  7. package/dist/clips/iclip.d.ts +16 -4
  8. package/dist/clips/image-clip.d.ts +26 -0
  9. package/dist/clips/text-clip.d.ts +62 -7
  10. package/dist/clips/video-clip.d.ts +30 -4
  11. package/dist/colorToUniform-C2jGzNe1.js +97 -0
  12. package/dist/effect/effect.d.ts +6 -0
  13. package/dist/effect/glsl/custom-glsl.d.ts +523 -0
  14. package/dist/effect/glsl/gl-effect.d.ts +14 -0
  15. package/dist/effect/types.d.ts +24 -0
  16. package/dist/effect/vertex.d.ts +1 -0
  17. package/dist/event-emitter.d.ts +47 -0
  18. package/dist/{index-CjzowIhV.js → index-C333riU-.js} +9354 -6719
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.es.js +18 -16
  21. package/dist/index.umd.js +1498 -111
  22. package/dist/json-serialization.d.ts +21 -0
  23. package/dist/sprite/base-sprite.d.ts +7 -0
  24. package/dist/sprite/pixi-sprite-renderer.d.ts +3 -3
  25. package/dist/studio.d.ts +55 -1
  26. package/dist/transfomer/parts/wireframe.d.ts +1 -1
  27. package/dist/transfomer/transformer.d.ts +5 -0
  28. package/dist/utils/audio-codec-detector.d.ts +28 -0
  29. package/dist/utils/index.d.ts +1 -0
  30. package/dist/{webworkerAll-DsE6HIYE.js → webworkerAll-aNnyDpl9.js} +49 -49
  31. package/package.json +10 -9
  32. package/dist/colorToUniform-Du0ROyNd.js +0 -274
@@ -1,5 +1,13 @@
1
1
  import { IClip } from './clips';
2
2
  interface BaseClipJSON {
3
+ id?: string;
4
+ effects?: Array<{
5
+ id: string;
6
+ key: string;
7
+ startTime: number;
8
+ duration: number;
9
+ targets?: number[];
10
+ }>;
3
11
  src: string;
4
12
  display: {
5
13
  from: number;
@@ -55,6 +63,9 @@ export interface TextStyleJSON {
55
63
  stroke?: {
56
64
  color: string;
57
65
  width: number;
66
+ join?: 'miter' | 'round' | 'bevel';
67
+ cap?: 'butt' | 'round' | 'square';
68
+ miterLimit?: number;
58
69
  };
59
70
  shadow?: {
60
71
  color: string;
@@ -63,6 +74,10 @@ export interface TextStyleJSON {
63
74
  offsetX: number;
64
75
  offsetY: number;
65
76
  };
77
+ wordWrap?: boolean;
78
+ wordWrapWidth?: number;
79
+ lineHeight?: number;
80
+ letterSpacing?: number;
66
81
  }
67
82
  export interface TextClipJSON extends BaseClipJSON {
68
83
  type: 'Text';
@@ -117,6 +132,12 @@ export interface CaptionClipJSON extends BaseClipJSON {
117
132
  export type ClipJSON = VideoClipJSON | AudioClipJSON | ImageClipJSON | TextClipJSON | CaptionClipJSON;
118
133
  export interface ProjectJSON {
119
134
  clips: ClipJSON[];
135
+ globalEffects?: Array<{
136
+ id: string;
137
+ key: string;
138
+ startTime: number;
139
+ duration: number;
140
+ }>;
120
141
  settings?: {
121
142
  width?: number;
122
143
  height?: number;
@@ -104,6 +104,13 @@ export declare abstract class BaseSprite {
104
104
  * Flip clip horizontally or vertically
105
105
  */
106
106
  flip: 'horizontal' | 'vertical' | null;
107
+ effects: Array<{
108
+ id: string;
109
+ key: string;
110
+ startTime: number;
111
+ duration: number;
112
+ targets?: number[];
113
+ }>;
107
114
  private animatKeyFrame;
108
115
  private animatOpts;
109
116
  /**
@@ -1,4 +1,4 @@
1
- import { Application, Sprite, Texture } from 'pixi.js';
1
+ import { Application, Sprite, Texture, Container } from 'pixi.js';
2
2
  import { IClip } from '../clips/iclip';
3
3
  /**
4
4
  * Update sprite transform based on clip properties
@@ -12,14 +12,14 @@ export declare function updateSpriteTransform(clip: IClip, sprite: Sprite): void
12
12
  * This matches the pattern used in other video rendering libraries
13
13
  */
14
14
  export declare class PixiSpriteRenderer {
15
- private pixiApp;
16
15
  private sprite;
16
+ private targetContainer;
17
17
  private pixiSprite;
18
18
  private texture;
19
19
  private canvas;
20
20
  private context;
21
21
  private destroyed;
22
- constructor(pixiApp: Application, sprite: IClip);
22
+ constructor(_pixiApp: Application | null, sprite: IClip, targetContainer?: Container | null);
23
23
  /**
24
24
  * Update the sprite with a new video frame or Texture
25
25
  * @param frame ImageBitmap, Texture, or null to render
package/dist/studio.d.ts CHANGED
@@ -1,11 +1,27 @@
1
1
  import { IClip } from './clips/iclip';
2
2
  import { ProjectJSON } from './json-serialization';
3
+ import { EffectKey } from './effect/glsl/gl-effect';
4
+ import { default as EventEmitter } from './event-emitter';
3
5
  export interface IStudioOpts {
4
6
  width: number;
5
7
  height: number;
6
8
  fps?: number;
7
9
  bgColor?: string;
8
10
  canvas?: HTMLCanvasElement;
11
+ interactivity?: boolean;
12
+ }
13
+ export interface StudioEvents {
14
+ "selection:created": {
15
+ selected: IClip[];
16
+ };
17
+ "selection:updated": {
18
+ selected: IClip[];
19
+ };
20
+ "selection:cleared": {
21
+ deselected: IClip[];
22
+ };
23
+ [key: string]: any;
24
+ [key: symbol]: any;
9
25
  }
10
26
  /**
11
27
  * Interactive preview studio for clips with playback controls
@@ -22,11 +38,19 @@ export interface IStudioOpts {
22
38
  * await studio.addClip(spr1);
23
39
  * await studio.addClip(spr2);
24
40
  * studio.play();
41
+ *
42
+ * studio.on('selection:created', ({ selected }) => {
43
+ * console.log('Selection created', selected);
44
+ * });
25
45
  */
26
- export declare class Studio {
46
+ export declare class Studio extends EventEmitter<StudioEvents> {
27
47
  private pixiApp;
28
48
  private clips;
29
49
  private spriteRenderers;
50
+ private artboard;
51
+ private clipContainer;
52
+ private artboardMask;
53
+ private artboardBg;
30
54
  private activeTransformer;
31
55
  private selectedClips;
32
56
  private interactiveClips;
@@ -40,6 +64,13 @@ export declare class Studio {
40
64
  private maxDuration;
41
65
  private opts;
42
66
  private destroyed;
67
+ private globalEffects;
68
+ private activeGlobalEffect;
69
+ private postProcessContainer;
70
+ private effectFilters;
71
+ private scale;
72
+ private clipsNormalContainer;
73
+ private clipsEffectContainer;
43
74
  /**
44
75
  * Convert hex color string to number
45
76
  */
@@ -49,6 +80,8 @@ export declare class Studio {
49
80
  */
50
81
  constructor(opts: IStudioOpts);
51
82
  private initPixiApp;
83
+ private handleResize;
84
+ private updateArtboardLayout;
52
85
  /**
53
86
  * Get the canvas element (creates one if not provided)
54
87
  */
@@ -108,6 +141,19 @@ export declare class Studio {
108
141
  private renderLoop;
109
142
  private updateFrame;
110
143
  private recalculateMaxDuration;
144
+ /**
145
+ * Apply global effect to the current scene
146
+ */
147
+ moveClipToEffectContainer(clip: IClip, toEffect?: boolean): void;
148
+ applyGlobalEffect(key: EffectKey, options: {
149
+ startTime: number;
150
+ duration?: number;
151
+ id?: string;
152
+ }, clips: IClip[]): string;
153
+ removeGlobalEffect(id: string): void;
154
+ clearGlobalEffects(): void;
155
+ private updateActiveGlobalEffect;
156
+ private applyGlobalEffectIfNeeded;
111
157
  /**
112
158
  * Destroy the studio and clean up resources
113
159
  */
@@ -120,6 +166,14 @@ export declare class Studio {
120
166
  * Create transformer for currently selected clips
121
167
  */
122
168
  private createTransformer;
169
+ private isUpdatingTextClipRealtime;
170
+ private textClipResizedWidth;
171
+ /**
172
+ * Sync sprite transforms in real-time during drag (for TextClip reflow)
173
+ * This is called during the drag operation to prevent visual scaling
174
+ * Only works for mid-right handle (mr)
175
+ */
176
+ private syncSelectedClipsTransformsRealtime;
123
177
  /**
124
178
  * Sync sprite transforms back to clip properties for all selected clips
125
179
  * This ensures clip properties are always up-to-date during transformations
@@ -1,5 +1,5 @@
1
1
  import { Graphics, Rectangle } from 'pixi.js';
2
2
  export declare class Wireframe extends Graphics {
3
3
  constructor();
4
- draw(bounds: Rectangle): void;
4
+ draw(bounds: Rectangle, scale?: number): void;
5
5
  }
@@ -18,4 +18,9 @@ export declare class Transformer extends Container {
18
18
  centeredScaling?: boolean;
19
19
  clip?: any;
20
20
  });
21
+ /**
22
+ * Public method to update transformer bounds without recreating it
23
+ * Useful for updating bounds after clip dimensions change
24
+ */
25
+ updateBounds(): void;
21
26
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Audio codec detection utility
3
+ * Detects the best supported audio codec based on browser capabilities
4
+ */
5
+ export interface AudioCodecConfig {
6
+ codec: string;
7
+ codecType: 'aac' | 'opus';
8
+ sampleRate: number;
9
+ channelCount: number;
10
+ }
11
+ /**
12
+ * Get the default audio codec configuration based on browser support
13
+ * Prefers AAC (mp4a.40.2) but falls back to Opus if not supported
14
+ *
15
+ * @returns Promise resolving to the best supported audio codec configuration
16
+ */
17
+ export declare function getDefaultAudioCodec(): Promise<AudioCodecConfig>;
18
+ /**
19
+ * Synchronously get the cached codec configuration
20
+ * Returns null if detection hasn't been performed yet
21
+ *
22
+ * @returns The cached audio codec configuration or null
23
+ */
24
+ export declare function getCachedAudioCodec(): AudioCodecConfig | null;
25
+ /**
26
+ * Reset the cached codec (useful for testing)
27
+ */
28
+ export declare function resetCodecCache(): void;
@@ -1,4 +1,5 @@
1
1
  export * from './audio';
2
+ export * from './audio-codec-detector';
2
3
  export * from './chromakey';
3
4
  export * from './common';
4
5
  export * from './dom';
@@ -1,5 +1,5 @@
1
- import { E as p, U as $e, T as ee, G as he, a as fe, M as P, m as C, h as pe, F as v, t as w, a6 as N, R as $, w as Y, z as me, a3 as G, a4 as ge, d as F, B as T, D as j, x as M, ad as je, ae as q, J as L, af as U, S as Q, _ as qe, Z as X, o as xe, s as _e, a8 as be, ab as ye, p as Qe, q as Je, a9 as Ze, aa as et, ac as tt, ag as rt, ah as nt, ai as st, aj as H, ak as it, al as at, n as ve, am as te, an as k, e as b, ao as ot } from "./index-CjzowIhV.js";
2
- import { F as ut, S as D, c as z, a as lt, b as ct, B as Te } from "./colorToUniform-Du0ROyNd.js";
1
+ import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D, af as qe, ag as q, L as Y, ah as U, s as Q, a0 as Qe, $ as X, n as xe, q as _e, aa as be, ad as ye, o as Je, p as Ze, ab as et, ac as tt, ae as rt, ai as nt, aj as st, ak as it, al as H, am as at, an as ot, m as ve, ao as te, ap as k, e as b, aq as ut } from "./index-C333riU-.js";
2
+ import { c as z, a as lt, b as ct, B as Te } from "./colorToUniform-C2jGzNe1.js";
3
3
  class Pe {
4
4
  /**
5
5
  * Initialize the plugin with scope of application instance
@@ -62,7 +62,7 @@ class we {
62
62
  {
63
63
  configurable: !0,
64
64
  set(t) {
65
- this._ticker && this._ticker.remove(this.render, this), this._ticker = t, t && t.add(this.render, this, $e.LOW);
65
+ this._ticker && this._ticker.remove(this.render, this), this._ticker = t, t && t.add(this.render, this, Ne.LOW);
66
66
  },
67
67
  get() {
68
68
  return this._ticker;
@@ -169,7 +169,7 @@ fn mainFragment(
169
169
  return textureSample(uTexture, uSampler, uv);
170
170
  }
171
171
  `;
172
- class ft extends ut {
172
+ class ft extends je {
173
173
  constructor() {
174
174
  const e = he.from({
175
175
  vertex: { source: re, entryPoint: "mainVertex" },
@@ -234,7 +234,7 @@ function pt(a, e) {
234
234
  }
235
235
  return e.matrix = t, e;
236
236
  }
237
- const mt = new N({
237
+ const mt = new $({
238
238
  attributes: {
239
239
  aPosition: {
240
240
  buffer: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
@@ -440,7 +440,7 @@ class Se {
440
440
  shader: e,
441
441
  state: e._state,
442
442
  topology: "triangle-list"
443
- }), r.type === $.WEBGL && r.renderTarget.finishRenderPass();
443
+ }), r.type === N.WEBGL && r.renderTarget.finishRenderPass();
444
444
  }
445
445
  /**
446
446
  * Sets up the filter textures including input texture and back texture if needed.
@@ -570,7 +570,7 @@ class Se {
570
570
  break;
571
571
  }
572
572
  if (y.blendRequired && !(i.backBuffer?.useBackBuffer ?? !0)) {
573
- Y("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."), f = !1;
573
+ L("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."), f = !1;
574
574
  break;
575
575
  }
576
576
  f = !0, d || (d = y.blendRequired);
@@ -606,7 +606,7 @@ Se.extension = {
606
606
  ],
607
607
  name: "filter"
608
608
  };
609
- const Fe = class Re extends N {
609
+ const Fe = class Re extends $ {
610
610
  constructor(...e) {
611
611
  let t = e[0] ?? {};
612
612
  t instanceof Float32Array && (G(ge, "use new MeshGeometry({ positions, uvs, indices }) instead"), t = {
@@ -721,13 +721,13 @@ class _t {
721
721
  }
722
722
  destroy() {
723
723
  this.batches.forEach((e) => {
724
- M.return(e);
724
+ D.return(e);
725
725
  }), this.batches.length = 0;
726
726
  }
727
727
  }
728
728
  class Be {
729
729
  constructor(e, t) {
730
- this.state = D.for2d(), this.renderer = e, this._adaptor = t, this.renderer.runners.contextChange.add(this);
730
+ this.state = M.for2d(), this.renderer = e, this._adaptor = t, this.renderer.runners.contextChange.add(this);
731
731
  }
732
732
  contextChange() {
733
733
  this._adaptor.contextChange(this.renderer);
@@ -783,7 +783,7 @@ class Be {
783
783
  _updateBatchesForRenderable(e, t) {
784
784
  const r = e.context, n = this.renderer.graphicsContext.getGpuContext(r), s = this.renderer._roundPixels | e._roundPixels;
785
785
  t.batches = n.batches.map((i) => {
786
- const o = M.get(je);
786
+ const o = D.get(qe);
787
787
  return i.copyTo(o), o.renderable = e, o.roundPixels = s, o;
788
788
  });
789
789
  }
@@ -1033,7 +1033,7 @@ function le(a, e) {
1033
1033
  if (e !== i.dynamic)
1034
1034
  continue;
1035
1035
  t.push(`offset = index + ${r}`), t.push(i.code);
1036
- const o = L(i.format);
1036
+ const o = Y(i.format);
1037
1037
  r += o.stride / 4;
1038
1038
  }
1039
1039
  t.push(`
@@ -1052,11 +1052,11 @@ class Pt {
1052
1052
  const t = this._size = e.size ?? 1e3, r = e.properties;
1053
1053
  let n = 0, s = 0;
1054
1054
  for (const h in r) {
1055
- const l = r[h], d = L(l.format);
1055
+ const l = r[h], d = Y(l.format);
1056
1056
  l.dynamic ? s += d.stride : n += d.stride;
1057
1057
  }
1058
1058
  this._dynamicStride = s / 4, this._staticStride = n / 4, this.staticAttributeBuffer = new U(t * 4 * n), this.dynamicAttributeBuffer = new U(t * 4 * s), this.indexBuffer = ue(t);
1059
- const i = new N();
1059
+ const i = new $();
1060
1060
  let o = 0, u = 0;
1061
1061
  this._staticBuffer = new F({
1062
1062
  data: new Float32Array(1),
@@ -1070,7 +1070,7 @@ class Pt {
1070
1070
  usage: T.VERTEX | T.COPY_DST
1071
1071
  });
1072
1072
  for (const h in r) {
1073
- const l = r[h], d = L(l.format);
1073
+ const l = r[h], d = Y(l.format);
1074
1074
  l.dynamic ? (i.addAttribute(l.attributeName, {
1075
1075
  buffer: this._dynamicBuffer,
1076
1076
  stride: this._dynamicStride * 4,
@@ -1262,7 +1262,7 @@ class Ft extends Q {
1262
1262
  // this will be replaced with the local uniforms from the particle container
1263
1263
  uniforms: {
1264
1264
  uTranslationMatrix: { value: new P(), type: "mat3x3<f32>" },
1265
- uColor: { value: new qe(16777215), type: "vec4<f32>" },
1265
+ uColor: { value: new Qe(16777215), type: "vec4<f32>" },
1266
1266
  uRound: { value: 1, type: "f32" },
1267
1267
  uResolution: { value: [0, 0], type: "vec2<f32>" }
1268
1268
  }
@@ -1276,12 +1276,12 @@ class ze {
1276
1276
  * @param adaptor
1277
1277
  */
1278
1278
  constructor(e, t) {
1279
- this.state = D.for2d(), this.localUniforms = new C({
1279
+ this.state = M.for2d(), this.localUniforms = new C({
1280
1280
  uTranslationMatrix: { value: new P(), type: "mat3x3<f32>" },
1281
1281
  uColor: { value: new Float32Array(4), type: "vec4<f32>" },
1282
1282
  uRound: { value: 1, type: "f32" },
1283
1283
  uResolution: { value: [0, 0], type: "vec2<f32>" }
1284
- }), this.renderer = e, this.adaptor = t, this.defaultShader = new Ft(), this.state = D.for2d();
1284
+ }), this.renderer = e, this.adaptor = t, this.defaultShader = new Ft(), this.state = M.for2d();
1285
1285
  }
1286
1286
  validateRenderable(e) {
1287
1287
  return !1;
@@ -1653,7 +1653,7 @@ class Ot {
1653
1653
  }
1654
1654
  class Ve {
1655
1655
  constructor(e) {
1656
- this._state = D.default2d, this._renderer = e;
1656
+ this._state = M.default2d, this._renderer = e;
1657
1657
  }
1658
1658
  validateRenderable(e) {
1659
1659
  const t = this._getTilingSpriteData(e), r = t.canBatch;
@@ -1727,7 +1727,7 @@ class Ve {
1727
1727
  _updateCanBatch(e) {
1728
1728
  const t = this._getTilingSpriteData(e), r = e.texture;
1729
1729
  let n = !0;
1730
- return this._renderer.type === $.WEBGL && (n = this._renderer.context.supports.nonPowOf2wrapping), t.canBatch = r.textureMatrix.isSimple && (n || r.source.isPowerOfTwo), t.canBatch;
1730
+ return this._renderer.type === N.WEBGL && (n = this._renderer.context.supports.nonPowOf2wrapping), t.canBatch = r.textureMatrix.isSimple && (n || r.source.isPowerOfTwo), t.canBatch;
1731
1731
  }
1732
1732
  }
1733
1733
  Ve.extension = {
@@ -1905,7 +1905,7 @@ const It = {
1905
1905
  }
1906
1906
  };
1907
1907
  let E, V;
1908
- class Yt extends Q {
1908
+ class Lt extends Q {
1909
1909
  constructor(e) {
1910
1910
  const t = new C({
1911
1911
  uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
@@ -1916,8 +1916,8 @@ class Yt extends Q {
1916
1916
  E ?? (E = xe({
1917
1917
  name: "sdf-shader",
1918
1918
  bits: [
1919
- Qe,
1920
- Je(e),
1919
+ Je,
1920
+ Ze(e),
1921
1921
  It,
1922
1922
  Vt,
1923
1923
  _e
@@ -1925,8 +1925,8 @@ class Yt extends Q {
1925
1925
  })), V ?? (V = be({
1926
1926
  name: "sdf-shader",
1927
1927
  bits: [
1928
- Ze,
1929
- et(e),
1928
+ et,
1929
+ tt(e),
1930
1930
  Et,
1931
1931
  Wt,
1932
1932
  ye
@@ -1936,12 +1936,12 @@ class Yt extends Q {
1936
1936
  gpuProgram: E,
1937
1937
  resources: {
1938
1938
  localUniforms: t,
1939
- batchSamplers: tt(e)
1939
+ batchSamplers: rt(e)
1940
1940
  }
1941
1941
  });
1942
1942
  }
1943
1943
  }
1944
- class Lt extends it {
1944
+ class Yt extends at {
1945
1945
  destroy() {
1946
1946
  this.context.customShader && this.context.customShader.destroy(), super.destroy();
1947
1947
  }
@@ -1963,11 +1963,11 @@ class We {
1963
1963
  de(e, t), this._renderer.renderPipes.graphics.updateRenderable(t), t.context.customShader && this._updateDistanceField(e);
1964
1964
  }
1965
1965
  _updateContext(e, t) {
1966
- const { context: r } = t, n = rt.getFont(e.text, e._style);
1967
- r.clear(), n.distanceField.type !== "none" && (r.customShader || (r.customShader = new Yt(this._renderer.limits.maxBatchableTextures)));
1968
- const s = nt.graphemeSegmenter(e.text), i = e._style;
1966
+ const { context: r } = t, n = nt.getFont(e.text, e._style);
1967
+ r.clear(), n.distanceField.type !== "none" && (r.customShader || (r.customShader = new Lt(this._renderer.limits.maxBatchableTextures)));
1968
+ const s = st.graphemeSegmenter(e.text), i = e._style;
1969
1969
  let o = n.baseLineOffset;
1970
- const u = st(s, i, n, !0), c = i.padding, h = u.scale;
1970
+ const u = it(s, i, n, !0), c = i.padding, h = u.scale;
1971
1971
  let l = u.width, d = u.height + u.offsetY;
1972
1972
  i._stroke && (l += i._stroke.width / h, d += i._stroke.width / h), r.translate(-e._anchor._x * l - c, -e._anchor._y * d - c).scale(h, h);
1973
1973
  const f = n.applyFillAsTint ? i._fill.color : 16777215;
@@ -1978,7 +1978,7 @@ class We {
1978
1978
  for (let _ = 0; _ < u.lines.length; _++) {
1979
1979
  const y = u.lines[_];
1980
1980
  for (let S = 0; S < y.charPositions.length; S++) {
1981
- const Ne = y.chars[S], R = n.chars[Ne];
1981
+ const $e = y.chars[S], R = n.chars[$e];
1982
1982
  if (R?.texture) {
1983
1983
  const A = R.texture;
1984
1984
  r.texture(
@@ -1998,7 +1998,7 @@ class We {
1998
1998
  return e._gpuData[this._renderer.uid] || this.initGpuText(e);
1999
1999
  }
2000
2000
  initGpuText(e) {
2001
- const t = new Lt();
2001
+ const t = new Yt();
2002
2002
  return e._gpuData[this._renderer.uid] = t, this._updateContext(e, t), t;
2003
2003
  }
2004
2004
  _updateDistanceField(e) {
@@ -2041,11 +2041,11 @@ class Xt extends Te {
2041
2041
  }
2042
2042
  function K(a, e) {
2043
2043
  const { texture: t, bounds: r } = a, n = e._style._getFinalPadding();
2044
- at(r, e._anchor, t);
2044
+ ot(r, e._anchor, t);
2045
2045
  const s = e._anchor._x * n * 2, i = e._anchor._y * n * 2;
2046
2046
  r.minX -= n - s, r.minY -= n - i, r.maxX -= n - s, r.maxY -= n - i;
2047
2047
  }
2048
- class Ye {
2048
+ class Le {
2049
2049
  constructor(e) {
2050
2050
  this._renderer = e;
2051
2051
  }
@@ -2092,7 +2092,7 @@ class Ye {
2092
2092
  this._renderer = null;
2093
2093
  }
2094
2094
  }
2095
- Ye.extension = {
2095
+ Le.extension = {
2096
2096
  type: [
2097
2097
  p.WebGLPipes,
2098
2098
  p.WebGPUPipes,
@@ -2105,7 +2105,7 @@ function Ht() {
2105
2105
  return /^((?!chrome|android).)*safari/i.test(a);
2106
2106
  }
2107
2107
  const Kt = new me();
2108
- function Le(a, e, t, r) {
2108
+ function Ye(a, e, t, r) {
2109
2109
  const n = Kt;
2110
2110
  n.minX = 0, n.minY = 0, n.maxX = a.width / r | 0, n.maxY = a.height / r | 0;
2111
2111
  const s = v.getOptimalTexture(
@@ -2116,7 +2116,7 @@ function Le(a, e, t, r) {
2116
2116
  );
2117
2117
  return s.source.uploadMethodId = "image", s.source.resource = a, s.source.alphaMode = "premultiply-alpha-on-upload", s.frame.width = e / r, s.frame.height = t / r, s.source.emit("update", s.source), s.updateUvs(), s;
2118
2118
  }
2119
- function Nt(a, e) {
2119
+ function $t(a, e) {
2120
2120
  const t = e.fontFamily, r = [], n = {}, s = /font-family:([^;"\s]+)/g, i = a.match(s);
2121
2121
  function o(u) {
2122
2122
  n[u] || (r.push(u), n[u] = !0);
@@ -2136,14 +2136,14 @@ function Nt(a, e) {
2136
2136
  }
2137
2137
  return r;
2138
2138
  }
2139
- async function $t(a) {
2139
+ async function Nt(a) {
2140
2140
  const t = await (await j.get().fetch(a)).blob(), r = new FileReader();
2141
2141
  return await new Promise((s, i) => {
2142
2142
  r.onloadend = () => s(r.result), r.onerror = i, r.readAsDataURL(t);
2143
2143
  });
2144
2144
  }
2145
2145
  async function jt(a, e) {
2146
- const t = await $t(e);
2146
+ const t = await Nt(e);
2147
2147
  return `@font-face {
2148
2148
  font-family: "${a.fontFamily}";
2149
2149
  font-weight: ${a.fontWeight};
@@ -2204,7 +2204,7 @@ function Zt(a, e, t) {
2204
2204
  }
2205
2205
  class Xe {
2206
2206
  constructor(e) {
2207
- this._activeTextures = {}, this._renderer = e, this._createCanvas = e.type === $.WEBGPU;
2207
+ this._activeTextures = {}, this._renderer = e, this._createCanvas = e.type === N.WEBGPU;
2208
2208
  }
2209
2209
  /**
2210
2210
  * @param options
@@ -2249,7 +2249,7 @@ class Xe {
2249
2249
  t && (t.usageCount--, t.usageCount === 0 && (t.texture ? this._cleanUp(t.texture) : t.promise.then((r) => {
2250
2250
  t.texture = r, this._cleanUp(t.texture);
2251
2251
  }).catch(() => {
2252
- Y("HTMLTextSystem: Failed to clean texture");
2252
+ L("HTMLTextSystem: Failed to clean texture");
2253
2253
  }), this._activeTextures[e] = null));
2254
2254
  }
2255
2255
  /**
@@ -2261,26 +2261,26 @@ class Xe {
2261
2261
  return this._buildTexturePromise(e);
2262
2262
  }
2263
2263
  async _buildTexturePromise(e) {
2264
- const { text: t, style: r, resolution: n, textureStyle: s } = e, i = M.get(Ue), o = Nt(t, r), u = await qt(o), c = xt(t, r, u, i), h = Math.ceil(Math.ceil(Math.max(1, c.width) + r.padding * 2) * n), l = Math.ceil(Math.ceil(Math.max(1, c.height) + r.padding * 2) * n), d = i.image, f = 2;
2264
+ const { text: t, style: r, resolution: n, textureStyle: s } = e, i = D.get(Ue), o = $t(t, r), u = await qt(o), c = xt(t, r, u, i), h = Math.ceil(Math.ceil(Math.max(1, c.width) + r.padding * 2) * n), l = Math.ceil(Math.ceil(Math.max(1, c.height) + r.padding * 2) * n), d = i.image, f = 2;
2265
2265
  d.width = (h | 0) + f, d.height = (l | 0) + f;
2266
2266
  const g = Qt(t, r, n, u, i);
2267
2267
  await Zt(d, g, Ht() && o.length > 0);
2268
2268
  const m = d;
2269
2269
  let x;
2270
2270
  this._createCanvas && (x = Jt(d, n));
2271
- const _ = Le(
2271
+ const _ = Ye(
2272
2272
  x ? x.canvas : m,
2273
2273
  d.width - f,
2274
2274
  d.height - f,
2275
2275
  n
2276
2276
  );
2277
- return s && (_.source.style = s), this._createCanvas && (this._renderer.texture.initSource(_.source), ve.returnCanvasAndContext(x)), M.return(i), _;
2277
+ return s && (_.source.style = s), this._createCanvas && (this._renderer.texture.initSource(_.source), ve.returnCanvasAndContext(x)), D.return(i), _;
2278
2278
  }
2279
2279
  returnTexturePromise(e) {
2280
2280
  e.then((t) => {
2281
2281
  this._cleanUp(t);
2282
2282
  }).catch(() => {
2283
- Y("HTMLTextSystem: Failed to clean texture");
2283
+ L("HTMLTextSystem: Failed to clean texture");
2284
2284
  });
2285
2285
  }
2286
2286
  _cleanUp(e) {
@@ -2371,7 +2371,7 @@ class Ke {
2371
2371
  text: s,
2372
2372
  style: i,
2373
2373
  resolution: u
2374
- }), l = Le(h.canvas, c.width, c.height, u);
2374
+ }), l = Ye(h.canvas, c.width, c.height, u);
2375
2375
  if (o && (l.source.style = o), i.trim && (c.pad(i.padding), l.frame.copyFrom(c), l.frame.scale(1 / u), l.updateUvs()), i.filters) {
2376
2376
  const d = this._applyFilters(l, i.filters);
2377
2377
  return this.returnTexture(l), k.returnCanvasAndContext(h), d;
@@ -2482,7 +2482,7 @@ Ke.extension = {
2482
2482
  b.add(Pe);
2483
2483
  b.add(we);
2484
2484
  b.add(Be);
2485
- b.add(ot);
2485
+ b.add(ut);
2486
2486
  b.add(De);
2487
2487
  b.add(Ae);
2488
2488
  b.add(ke);
@@ -2490,7 +2490,7 @@ b.add(Ke);
2490
2490
  b.add(He);
2491
2491
  b.add(We);
2492
2492
  b.add(Xe);
2493
- b.add(Ye);
2493
+ b.add(Le);
2494
2494
  b.add(Ve);
2495
2495
  b.add(Ee);
2496
2496
  b.add(Se);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcombo/video",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "Video rendering and processing library",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,9 +32,13 @@
32
32
  "require": "./dist/index.umd.js"
33
33
  }
34
34
  },
35
+ "scripts": {
36
+ "dev": "vite",
37
+ "build": "tsc && vite build"
38
+ },
35
39
  "devDependencies": {
36
- "@types/rollup-plugin-peer-deps-external": "^2.2.6",
37
40
  "@types/dom-webcodecs": "^0.1.17",
41
+ "@types/rollup-plugin-peer-deps-external": "^2.2.6",
38
42
  "@webav/mp4box.js": "^0.5.7",
39
43
  "rollup-plugin-peer-deps-external": "^2.2.4",
40
44
  "typescript": "~5.9.2",
@@ -42,12 +46,9 @@
42
46
  "vite-plugin-dts": "^4.5.4"
43
47
  },
44
48
  "dependencies": {
45
- "wave-resampler": "^1.0.0",
49
+ "@pixi/layout": "^3.2.0",
46
50
  "opfs-tools": "^0.7.2",
47
- "pixi.js": "^8.14.3"
48
- },
49
- "scripts": {
50
- "dev": "vite",
51
- "build": "tsc && vite build"
51
+ "pixi.js": "^8.14.3",
52
+ "wave-resampler": "^1.0.0"
52
53
  }
53
- }
54
+ }