captions.js 0.4.1 → 0.4.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.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import Konva from 'konva';
2
+
1
3
  /**
2
4
  * Whitelisted Google Fonts that the renderer knows how to lazy-load.
3
5
  *
@@ -50,6 +52,10 @@ interface StylePreset {
50
52
  fitLayoutAspectRatio: string;
51
53
  };
52
54
  }
55
+ /**
56
+ * Names of all available style presets.
57
+ */
58
+ type StylePresetName = "Karaoke" | "Beasty" | "Safari" | "Acid" | "Popline" | "Desert" | "Hook" | "Sky" | "Flamingo" | "Deep Diver B&W" | "New" | "Banger" | "Catchy" | "Karaoke 2" | "Karaoke 3" | "From" | "Classic" | "Classic Big" | "Crazy" | "Acid 2" | "Marvel" | "Lovly" | "Old Money" | "Cinema" | "Marker";
53
59
  /**
54
60
  * Curated set of presets that ship with captions.js out of the box.
55
61
  *
@@ -220,6 +226,26 @@ type CaptionsInstance = Captions;
220
226
  */
221
227
  declare function captionsjs(options: CaptionsOptions): Captions;
222
228
 
229
+ declare enum LayoutType {
230
+ 'Fill' = "fill",
231
+ 'Fit' = "fit",
232
+ 'Split' = "split",
233
+ 'Three' = "three",
234
+ 'Four' = "four",
235
+ 'ScreenShare' = "screenShare"
236
+ }
237
+ type AspectRatioType = typeof aspectRatios[number];
238
+ interface LayoutSettings {
239
+ aspectRatio: AspectRatioType;
240
+ aIAutoLayout: LayoutType[];
241
+ fitLayoutCropAspectRatio: AspectRatioType;
242
+ }
243
+ declare const aspectRatios: readonly ["1:1", "9:16", "16:9"];
244
+
245
+ type RenderFrameFn = (captionsSettings: CaptionsSettings, layoutSettings: LayoutSettings, captions: Caption[], currentTime: number, targetSize: [number, number], layer: Konva.Layer, toCoef?: number, debug?: boolean) => void;
246
+
247
+ declare const renderFrame: RenderFrameFn;
248
+
223
249
  /**
224
250
  * Simple canvas demo renderer used only for the docs playground.
225
251
  *
@@ -233,4 +259,4 @@ declare function captionsjs(options: CaptionsOptions): Captions;
233
259
  */
234
260
  declare function renderCaptions(ctx: CanvasRenderingContext2D, text: string): boolean;
235
261
 
236
- export { type Caption, Captions, type CaptionsInstance, type CaptionsOptions, type CaptionsSettings, type StylePreset, captionsjs, captionsjs as default, googleFontsList, renderCaptions, renderString, stylePresets };
262
+ export { type Caption, Captions, type CaptionsInstance, type CaptionsOptions, type CaptionsSettings, type StylePreset, type StylePresetName, captionsjs, captionsjs as default, googleFontsList, renderCaptions, renderFrame, renderString, stylePresets };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import Konva from 'konva';
2
+
1
3
  /**
2
4
  * Whitelisted Google Fonts that the renderer knows how to lazy-load.
3
5
  *
@@ -50,6 +52,10 @@ interface StylePreset {
50
52
  fitLayoutAspectRatio: string;
51
53
  };
52
54
  }
55
+ /**
56
+ * Names of all available style presets.
57
+ */
58
+ type StylePresetName = "Karaoke" | "Beasty" | "Safari" | "Acid" | "Popline" | "Desert" | "Hook" | "Sky" | "Flamingo" | "Deep Diver B&W" | "New" | "Banger" | "Catchy" | "Karaoke 2" | "Karaoke 3" | "From" | "Classic" | "Classic Big" | "Crazy" | "Acid 2" | "Marvel" | "Lovly" | "Old Money" | "Cinema" | "Marker";
53
59
  /**
54
60
  * Curated set of presets that ship with captions.js out of the box.
55
61
  *
@@ -220,6 +226,26 @@ type CaptionsInstance = Captions;
220
226
  */
221
227
  declare function captionsjs(options: CaptionsOptions): Captions;
222
228
 
229
+ declare enum LayoutType {
230
+ 'Fill' = "fill",
231
+ 'Fit' = "fit",
232
+ 'Split' = "split",
233
+ 'Three' = "three",
234
+ 'Four' = "four",
235
+ 'ScreenShare' = "screenShare"
236
+ }
237
+ type AspectRatioType = typeof aspectRatios[number];
238
+ interface LayoutSettings {
239
+ aspectRatio: AspectRatioType;
240
+ aIAutoLayout: LayoutType[];
241
+ fitLayoutCropAspectRatio: AspectRatioType;
242
+ }
243
+ declare const aspectRatios: readonly ["1:1", "9:16", "16:9"];
244
+
245
+ type RenderFrameFn = (captionsSettings: CaptionsSettings, layoutSettings: LayoutSettings, captions: Caption[], currentTime: number, targetSize: [number, number], layer: Konva.Layer, toCoef?: number, debug?: boolean) => void;
246
+
247
+ declare const renderFrame: RenderFrameFn;
248
+
223
249
  /**
224
250
  * Simple canvas demo renderer used only for the docs playground.
225
251
  *
@@ -233,4 +259,4 @@ declare function captionsjs(options: CaptionsOptions): Captions;
233
259
  */
234
260
  declare function renderCaptions(ctx: CanvasRenderingContext2D, text: string): boolean;
235
261
 
236
- export { type Caption, Captions, type CaptionsInstance, type CaptionsOptions, type CaptionsSettings, type StylePreset, captionsjs, captionsjs as default, googleFontsList, renderCaptions, renderString, stylePresets };
262
+ export { type Caption, Captions, type CaptionsInstance, type CaptionsOptions, type CaptionsSettings, type StylePreset, type StylePresetName, captionsjs, captionsjs as default, googleFontsList, renderCaptions, renderFrame, renderString, stylePresets };
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  default: () => index_default,
36
36
  googleFontsList: () => googleFontsList,
37
37
  renderCaptions: () => renderCaptions,
38
+ renderFrame: () => renderFrame,
38
39
  renderString: () => renderString,
39
40
  stylePresets: () => stylePresets
40
41
  });
@@ -1795,6 +1796,7 @@ var index_default = captionsjs;
1795
1796
  captionsjs,
1796
1797
  googleFontsList,
1797
1798
  renderCaptions,
1799
+ renderFrame,
1798
1800
  renderString,
1799
1801
  stylePresets
1800
1802
  });
package/dist/index.mjs CHANGED
@@ -1753,6 +1753,7 @@ export {
1753
1753
  index_default as default,
1754
1754
  googleFontsList,
1755
1755
  renderCaptions,
1756
+ renderFrame,
1756
1757
  renderString,
1757
1758
  stylePresets
1758
1759
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captions.js",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {