@designcombo/video 0.1.16 → 0.1.17

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.
@@ -1,4 +1,4 @@
1
- import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-CmsRjoEr.js";
1
+ import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-DhYa39iK.js";
2
2
  import { B as de, c as Ze } from "./colorToUniform-C2jGzNe1.js";
3
3
  var et = `in vec2 vMaskCoord;
4
4
  in vec2 vTextureCoord;
@@ -1,6 +1,6 @@
1
- import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-CmsRjoEr.js";
1
+ import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-DhYa39iK.js";
2
2
  import { b as q } from "./colorToUniform-C2jGzNe1.js";
3
- import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-c89R2YB4.js";
3
+ import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-XCOGRjXb.js";
4
4
  class Q {
5
5
  constructor() {
6
6
  this._tempState = G.for2d(), this._didUploadHash = {};
@@ -1,6 +1,6 @@
1
- import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-CmsRjoEr.js";
1
+ import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-DhYa39iK.js";
2
2
  import { l as ge, a as me } from "./colorToUniform-C2jGzNe1.js";
3
- import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-c89R2YB4.js";
3
+ import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-XCOGRjXb.js";
4
4
  const y = E.for2d();
5
5
  class O {
6
6
  start(e, t, r) {
@@ -1,5 +1,5 @@
1
- import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-CmsRjoEr.js";
2
- import "./webworkerAll-BQqf01s5.js";
1
+ import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-DhYa39iK.js";
2
+ import "./webworkerAll-DMKSbUmt.js";
3
3
  class q {
4
4
  constructor(e) {
5
5
  this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
@@ -1,4 +1,4 @@
1
- import { BaseSprite } from '../sprite/base-sprite';
1
+ import { BaseSprite, BaseSpriteEvents } from '../sprite/base-sprite';
2
2
  import { IClip, IClipMeta, ITransitionInfo } from './iclip';
3
3
  import { ClipJSON } from '../json-serialization';
4
4
  /**
@@ -6,7 +6,7 @@ import { ClipJSON } from '../json-serialization';
6
6
  * Provides common functionality for sprite operations (position, animation, timing)
7
7
  * and frame management
8
8
  */
9
- export declare abstract class BaseClip extends BaseSprite implements IClip {
9
+ export declare abstract class BaseClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends BaseSprite<T> implements IClip<T> {
10
10
  abstract readonly type: string;
11
11
  private lastVf;
12
12
  protected destroyed: boolean;
@@ -2,6 +2,50 @@ import { BaseClip } from './base-clip';
2
2
  import { IClip } from './iclip';
3
3
  import { CaptionJSON } from '../json-serialization';
4
4
  import { Application, Texture } from 'pixi.js';
5
+ import { BaseSpriteEvents } from '../sprite/base-sprite';
6
+ export interface ICaptionStyle {
7
+ fontSize?: number;
8
+ fontFamily?: string;
9
+ fontWeight?: string | number;
10
+ fontStyle?: string;
11
+ color?: ICaptionOpts['fill'];
12
+ align?: ICaptionOpts['align'];
13
+ textCase?: ICaptionOpts['textCase'];
14
+ verticalAlign?: ICaptionOpts['verticalAlign'];
15
+ wordsPerLine?: ICaptionOpts['wordsPerLine'];
16
+ stroke?: {
17
+ color: string | number;
18
+ width: number;
19
+ };
20
+ shadow?: {
21
+ color: string | number;
22
+ alpha: number;
23
+ blur: number;
24
+ distance: number;
25
+ angle: number;
26
+ };
27
+ }
28
+ export interface ICaptionEvents extends BaseSpriteEvents {
29
+ propsChange: Partial<{
30
+ left: number;
31
+ top: number;
32
+ width: number;
33
+ height: number;
34
+ angle: number;
35
+ zIndex: number;
36
+ opacity: number;
37
+ volume: number;
38
+ text: string;
39
+ words: ICaptionOpts['words'];
40
+ fill: ICaptionOpts['fill'];
41
+ align: ICaptionOpts['align'];
42
+ textCase: ICaptionOpts['textCase'];
43
+ stroke: ICaptionOpts['stroke'];
44
+ dropShadow: ICaptionOpts['dropShadow'];
45
+ caption: ICaptionOpts['caption'];
46
+ wordsPerLine: ICaptionOpts['wordsPerLine'];
47
+ }>;
48
+ }
5
49
  export interface ICaptionOpts {
6
50
  /**
7
51
  * Font size in pixels
@@ -18,7 +62,7 @@ export interface ICaptionOpts {
18
62
  * Font weight (e.g., 'normal', 'bold', '400', '700')
19
63
  * @default 'normal'
20
64
  */
21
- fontWeight?: string;
65
+ fontWeight?: string | number;
22
66
  /**
23
67
  * Font style (e.g., 'normal', 'italic')
24
68
  * @default 'normal'
@@ -137,7 +181,17 @@ export interface ICaptionOpts {
137
181
  * Word wrap mode ('break-word' or 'normal')
138
182
  * @default 'break-word'
139
183
  */
184
+ wordWrapMode?: 'break-word' | 'normal';
185
+ /**
186
+ * Whether to enable word wrap
187
+ * @default true
188
+ */
140
189
  wordWrap?: boolean;
190
+ /**
191
+ * Vertical alignment ('top', 'center', 'bottom')
192
+ * @default 'bottom'
193
+ */
194
+ verticalAlign?: 'top' | 'center' | 'bottom';
141
195
  /**
142
196
  * Line height (multiplier)
143
197
  * @default 1
@@ -157,6 +211,15 @@ export interface ICaptionOpts {
157
211
  * Media ID to which the captions were applied
158
212
  */
159
213
  mediaId?: string;
214
+ /**
215
+ * Internal flag to skip automatic positioning
216
+ */
217
+ initialLayoutApplied?: boolean;
218
+ /**
219
+ * Words per line mode ('single' or 'multiple')
220
+ * @default 'multiple'
221
+ */
222
+ wordsPerLine?: 'single' | 'multiple';
160
223
  }
161
224
  /**
162
225
  * Caption clip using Canvas 2D for rendering
@@ -173,7 +236,7 @@ export interface ICaptionOpts {
173
236
  * captionClip.display.from = 0;
174
237
  * captionClip.duration = 3e6; // 3 seconds
175
238
  */
176
- export declare class Caption extends BaseClip implements IClip {
239
+ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
177
240
  readonly type = "Caption";
178
241
  ready: IClip['ready'];
179
242
  private _meta;
@@ -182,34 +245,55 @@ export declare class Caption extends BaseClip implements IClip {
182
245
  width: number;
183
246
  height: number;
184
247
  };
248
+ private _visualPaddingX;
249
+ private _visualPaddingY;
250
+ private _lastTickTime;
251
+ get width(): number;
252
+ set width(v: number);
253
+ get height(): number;
254
+ set height(v: number);
255
+ get left(): number;
256
+ set left(v: number);
257
+ get top(): number;
258
+ set top(v: number);
259
+ private _initialLayoutApplied;
260
+ private _isXPositionedManually;
261
+ private _isWidthConstrained;
262
+ private _lastContentWidth;
263
+ private _lastContentHeight;
264
+ private _lastProcessedText;
265
+ private _text;
185
266
  /**
186
267
  * Caption text content (hybrid JSON structure)
187
268
  */
188
- text: string;
189
- get style(): any;
190
- set style(v: any);
269
+ get text(): string;
270
+ set text(v: string);
271
+ get style(): ICaptionStyle;
272
+ set style(v: Partial<ICaptionOpts> | ICaptionStyle);
273
+ get wordsPerLine(): 'single' | 'multiple';
274
+ set wordsPerLine(v: 'single' | 'multiple');
191
275
  get fontFamily(): string;
192
276
  set fontFamily(v: string);
193
277
  get fontUrl(): string;
194
278
  set fontUrl(v: string);
195
279
  get fontSize(): number;
196
280
  set fontSize(v: number);
197
- get fontWeight(): string;
198
- set fontWeight(v: string);
199
- get fontStyle(): string;
200
- set fontStyle(v: string);
201
- get fill(): any;
202
- set fill(v: any);
281
+ get fontWeight(): string | number;
282
+ set fontWeight(v: string | number);
283
+ get fontStyle(): 'normal' | 'italic' | 'oblique';
284
+ set fontStyle(v: 'normal' | 'italic' | 'oblique');
285
+ get fill(): ICaptionOpts['fill'];
286
+ set fill(v: ICaptionOpts['fill']);
203
287
  get align(): 'left' | 'center' | 'right';
204
288
  set align(v: 'left' | 'center' | 'right');
205
- get stroke(): any;
206
- set stroke(v: any);
289
+ get stroke(): ICaptionOpts['stroke'];
290
+ set stroke(v: ICaptionOpts['stroke']);
207
291
  get strokeWidth(): number;
208
292
  set strokeWidth(v: number);
209
- get dropShadow(): any;
210
- set dropShadow(v: any);
211
- get caption(): any;
212
- set caption(v: any);
293
+ get dropShadow(): ICaptionOpts['dropShadow'];
294
+ set dropShadow(v: ICaptionOpts['dropShadow']);
295
+ get caption(): ICaptionOpts['caption'];
296
+ set caption(v: ICaptionOpts['caption']);
213
297
  /**
214
298
  * Bottom offset from video bottom (hybrid JSON structure)
215
299
  */
@@ -241,17 +325,19 @@ export declare class Caption extends BaseClip implements IClip {
241
325
  /**
242
326
  * Words getter for the clip
243
327
  */
244
- get words(): any[];
328
+ get words(): ICaptionOpts["words"];
245
329
  /**
246
330
  * Words setter that triggers re-render and ensures consistency
247
331
  */
248
- set words(v: any[]);
332
+ set words(v: ICaptionOpts['words']);
249
333
  private opts;
250
334
  private pixiTextContainer;
251
335
  private renderTexture;
252
336
  private wordTexts;
253
- private extraPadding;
254
337
  private textStyle;
338
+ private textStyleBase;
339
+ private _refreshing;
340
+ private _needsRefresh;
255
341
  private externalRenderer;
256
342
  private pixiApp;
257
343
  private originalOpts;
@@ -265,11 +351,12 @@ export declare class Caption extends BaseClip implements IClip {
265
351
  updateState(currentTime: number): void;
266
352
  /**
267
353
  * Get the PixiJS Texture (RenderTexture) for optimized rendering in Studio
268
- * This avoids ImageBitmap → Canvas → Texture conversion
269
- *
270
- * @returns The RenderTexture containing the rendered caption, or null if not ready
271
354
  */
272
355
  getTexture(): Promise<Texture | null>;
356
+ offscreenRender(ctx: CanvasRenderingContext2D, time: number): Promise<{
357
+ audio: Float32Array[];
358
+ done: boolean;
359
+ }>;
273
360
  /**
274
361
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
275
362
  */
@@ -301,4 +388,5 @@ export declare class Caption extends BaseClip implements IClip {
301
388
  * @returns Promise that resolves to a Caption instance
302
389
  */
303
390
  static fromObject(json: CaptionJSON): Promise<Caption>;
391
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
304
392
  }
@@ -1,4 +1,4 @@
1
- import { BaseSprite } from '../sprite/base-sprite';
1
+ import { BaseSprite, BaseSpriteEvents } from '../sprite/base-sprite';
2
2
  export interface IClipMeta {
3
3
  width: number;
4
4
  height: number;
@@ -23,7 +23,7 @@ export interface ITransitionInfo {
23
23
  * You only need to implement this interface to create custom clips, giving you maximum flexibility to generate video content such as animations and transition effects
24
24
  *
25
25
  */
26
- export interface IClip extends Omit<BaseSprite, 'destroy' | 'ready'> {
26
+ export interface IClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends Omit<BaseSprite<T>, 'destroy' | 'ready'> {
27
27
  destroy: () => void;
28
28
  readonly ready: Promise<IClipMeta>;
29
29
  /**
@@ -176,8 +176,10 @@ export declare class Text extends BaseClip {
176
176
  */
177
177
  get textCase(): string;
178
178
  set textCase(v: 'none' | 'uppercase' | 'lowercase' | 'title');
179
- private pixiText;
179
+ private pixiTextContainer;
180
+ private wordTexts;
180
181
  private textStyle;
182
+ private textStyleBase;
181
183
  private renderTexture;
182
184
  private externalRenderer;
183
185
  private pixiApp;