@shotstack/shotstack-canvas 2.0.10 → 2.0.12
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/entry.node.cjs +2629 -2605
- package/dist/entry.node.d.cts +15 -3
- package/dist/entry.node.d.ts +15 -3
- package/dist/entry.node.js +2623 -2605
- package/dist/entry.web.d.ts +15 -2
- package/dist/entry.web.js +2849 -2824
- package/package.json +65 -65
package/dist/entry.node.d.cts
CHANGED
|
@@ -372,6 +372,7 @@ declare const richCaptionAssetSchema: z.ZodObject<{
|
|
|
372
372
|
down: "down";
|
|
373
373
|
}>>;
|
|
374
374
|
}, z.core.$strict>>;
|
|
375
|
+
pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
375
376
|
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
376
377
|
src: z.ZodString;
|
|
377
378
|
family: z.ZodString;
|
|
@@ -497,6 +498,7 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
|
497
498
|
down: "down";
|
|
498
499
|
}>>;
|
|
499
500
|
}, z.core.$strict>>;
|
|
501
|
+
pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
500
502
|
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
501
503
|
src: z.ZodString;
|
|
502
504
|
family: z.ZodString;
|
|
@@ -1060,6 +1062,11 @@ declare function renderSvgAssetToPng(asset: CanvasSvgAsset, options?: {
|
|
|
1060
1062
|
background?: string;
|
|
1061
1063
|
}): Promise<ResvgRenderResult>;
|
|
1062
1064
|
|
|
1065
|
+
declare const ASCENT_RATIO = 0.8;
|
|
1066
|
+
declare const DESCENT_RATIO = 0.2;
|
|
1067
|
+
declare const WORD_BG_OPACITY = 1;
|
|
1068
|
+
declare const WORD_BG_BORDER_RADIUS = 4;
|
|
1069
|
+
declare const WORD_BG_PADDING_RATIO = 0.12;
|
|
1063
1070
|
interface RichCaptionGeneratorConfig {
|
|
1064
1071
|
frameWidth: number;
|
|
1065
1072
|
frameHeight: number;
|
|
@@ -1093,7 +1100,13 @@ interface BackgroundConfig {
|
|
|
1093
1100
|
borderRadius: number;
|
|
1094
1101
|
padding: number;
|
|
1095
1102
|
}
|
|
1096
|
-
declare function
|
|
1103
|
+
declare function extractCaptionPadding(asset: CanvasRichCaptionAsset): {
|
|
1104
|
+
top: number;
|
|
1105
|
+
right: number;
|
|
1106
|
+
bottom: number;
|
|
1107
|
+
left: number;
|
|
1108
|
+
};
|
|
1109
|
+
declare function generateRichCaptionDrawOps(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): DrawOp[];
|
|
1097
1110
|
declare function generateRichCaptionFrame(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): {
|
|
1098
1111
|
ops: DrawOp[];
|
|
1099
1112
|
visibleWordCount: number;
|
|
@@ -1184,7 +1197,6 @@ declare class RichCaptionRenderer {
|
|
|
1184
1197
|
getStats(): RenderStats;
|
|
1185
1198
|
resetStats(): void;
|
|
1186
1199
|
clearCache(): void;
|
|
1187
|
-
private extractPadding;
|
|
1188
1200
|
private mapVerticalAlign;
|
|
1189
1201
|
private mapHorizontalAlign;
|
|
1190
1202
|
private extractAnimationStyle;
|
|
@@ -1319,4 +1331,4 @@ declare function createTextEngine(opts?: {
|
|
|
1319
1331
|
destroy(): void;
|
|
1320
1332
|
}>;
|
|
1321
1333
|
|
|
1322
|
-
export { type AnimationDirection, type AnimationStyle, type ArcCommand, type BackgroundConfig, type BoundingBox, type CanvasRichCaptionAsset, CanvasRichCaptionAssetSchema, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type CaptionGroup, type CaptionLayout, type CaptionLayoutConfig, CaptionLayoutEngine, type CaptionLine, type ClosePathCommand, type CubicBezierCommand, type DrawOp, type EngineInit, type FastVideoOptions, type FastVideoResult, type FontConfig, FontRegistry, type FrameSchedule, type Glyph, type GradientSpec, type IVideoEncoder, type LineToCommand, type MoveToCommand, NodeRawEncoder, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type PositionedWord, type QuadraticBezierCommand, type RGBA, type RenderFrame, type RenderStats, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type RichCaptionGeneratorConfig, RichCaptionRenderer, type RichCaptionRendererOptions, type ShadowConfig, type ShapedLine, type ShapedWord, type ShapedWordGlyph, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeConfig, type StrokeSpec, type ValidAsset, type VideoEncoderCapabilities, type VideoEncoderConfig, type VideoEncoderProgress, type WordAnimationConfig, type WordAnimationState, type WordTiming, WordTimingStore, arcToCubicBeziers, breakIntoLines, calculateAnimationStatesForGroup, commandsToPathString, computeSimplePathBounds, createDefaultGeneratorConfig, createFrameSchedule, createNodePainter, createNodeRawEncoder, createRichCaptionRenderer, createTextEngine, createVideoEncoder, detectPlatform, detectSubtitleFormat, findWordAtTime, generateRichCaptionDrawOps, generateRichCaptionFrame, generateShapePathData, getDefaultAnimationConfig, getDrawCaptionWordOps, getEncoderCapabilities, getEncoderWarning, groupWordsByPause, isDrawCaptionWordOp, isRTLText, isWebCodecsH264Supported, normalizePath, normalizePathString, parseSubtitleToWords, parseSvgPath, quadraticToCubic, renderSvgAssetToPng, renderSvgToPng, richCaptionAssetSchema, shapeToSvgString };
|
|
1334
|
+
export { ASCENT_RATIO, type AnimationDirection, type AnimationStyle, type ArcCommand, type BackgroundConfig, type BoundingBox, type CanvasRichCaptionAsset, CanvasRichCaptionAssetSchema, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type CaptionGroup, type CaptionLayout, type CaptionLayoutConfig, CaptionLayoutEngine, type CaptionLine, type ClosePathCommand, type CubicBezierCommand, DESCENT_RATIO, type DrawOp, type EngineInit, type FastVideoOptions, type FastVideoResult, type FontConfig, FontRegistry, type FrameSchedule, type Glyph, type GradientSpec, type IVideoEncoder, type LineToCommand, type MoveToCommand, NodeRawEncoder, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type PositionedWord, type QuadraticBezierCommand, type RGBA, type RenderFrame, type RenderStats, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type RichCaptionGeneratorConfig, RichCaptionRenderer, type RichCaptionRendererOptions, type ShadowConfig, type ShapedLine, type ShapedWord, type ShapedWordGlyph, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeConfig, type StrokeSpec, type ValidAsset, type VideoEncoderCapabilities, type VideoEncoderConfig, type VideoEncoderProgress, WORD_BG_BORDER_RADIUS, WORD_BG_OPACITY, WORD_BG_PADDING_RATIO, type WordAnimationConfig, type WordAnimationState, type WordTiming, WordTimingStore, arcToCubicBeziers, breakIntoLines, calculateAnimationStatesForGroup, commandsToPathString, computeSimplePathBounds, createDefaultGeneratorConfig, createFrameSchedule, createNodePainter, createNodeRawEncoder, createRichCaptionRenderer, createTextEngine, createVideoEncoder, detectPlatform, detectSubtitleFormat, extractCaptionPadding, findWordAtTime, generateRichCaptionDrawOps, generateRichCaptionFrame, generateShapePathData, getDefaultAnimationConfig, getDrawCaptionWordOps, getEncoderCapabilities, getEncoderWarning, groupWordsByPause, isDrawCaptionWordOp, isRTLText, isWebCodecsH264Supported, normalizePath, normalizePathString, parseSubtitleToWords, parseSvgPath, quadraticToCubic, renderSvgAssetToPng, renderSvgToPng, richCaptionAssetSchema, shapeToSvgString };
|
package/dist/entry.node.d.ts
CHANGED
|
@@ -372,6 +372,7 @@ declare const richCaptionAssetSchema: z.ZodObject<{
|
|
|
372
372
|
down: "down";
|
|
373
373
|
}>>;
|
|
374
374
|
}, z.core.$strict>>;
|
|
375
|
+
pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
375
376
|
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
376
377
|
src: z.ZodString;
|
|
377
378
|
family: z.ZodString;
|
|
@@ -497,6 +498,7 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
|
497
498
|
down: "down";
|
|
498
499
|
}>>;
|
|
499
500
|
}, z.core.$strict>>;
|
|
501
|
+
pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
500
502
|
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
501
503
|
src: z.ZodString;
|
|
502
504
|
family: z.ZodString;
|
|
@@ -1060,6 +1062,11 @@ declare function renderSvgAssetToPng(asset: CanvasSvgAsset, options?: {
|
|
|
1060
1062
|
background?: string;
|
|
1061
1063
|
}): Promise<ResvgRenderResult>;
|
|
1062
1064
|
|
|
1065
|
+
declare const ASCENT_RATIO = 0.8;
|
|
1066
|
+
declare const DESCENT_RATIO = 0.2;
|
|
1067
|
+
declare const WORD_BG_OPACITY = 1;
|
|
1068
|
+
declare const WORD_BG_BORDER_RADIUS = 4;
|
|
1069
|
+
declare const WORD_BG_PADDING_RATIO = 0.12;
|
|
1063
1070
|
interface RichCaptionGeneratorConfig {
|
|
1064
1071
|
frameWidth: number;
|
|
1065
1072
|
frameHeight: number;
|
|
@@ -1093,7 +1100,13 @@ interface BackgroundConfig {
|
|
|
1093
1100
|
borderRadius: number;
|
|
1094
1101
|
padding: number;
|
|
1095
1102
|
}
|
|
1096
|
-
declare function
|
|
1103
|
+
declare function extractCaptionPadding(asset: CanvasRichCaptionAsset): {
|
|
1104
|
+
top: number;
|
|
1105
|
+
right: number;
|
|
1106
|
+
bottom: number;
|
|
1107
|
+
left: number;
|
|
1108
|
+
};
|
|
1109
|
+
declare function generateRichCaptionDrawOps(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): DrawOp[];
|
|
1097
1110
|
declare function generateRichCaptionFrame(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): {
|
|
1098
1111
|
ops: DrawOp[];
|
|
1099
1112
|
visibleWordCount: number;
|
|
@@ -1184,7 +1197,6 @@ declare class RichCaptionRenderer {
|
|
|
1184
1197
|
getStats(): RenderStats;
|
|
1185
1198
|
resetStats(): void;
|
|
1186
1199
|
clearCache(): void;
|
|
1187
|
-
private extractPadding;
|
|
1188
1200
|
private mapVerticalAlign;
|
|
1189
1201
|
private mapHorizontalAlign;
|
|
1190
1202
|
private extractAnimationStyle;
|
|
@@ -1319,4 +1331,4 @@ declare function createTextEngine(opts?: {
|
|
|
1319
1331
|
destroy(): void;
|
|
1320
1332
|
}>;
|
|
1321
1333
|
|
|
1322
|
-
export { type AnimationDirection, type AnimationStyle, type ArcCommand, type BackgroundConfig, type BoundingBox, type CanvasRichCaptionAsset, CanvasRichCaptionAssetSchema, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type CaptionGroup, type CaptionLayout, type CaptionLayoutConfig, CaptionLayoutEngine, type CaptionLine, type ClosePathCommand, type CubicBezierCommand, type DrawOp, type EngineInit, type FastVideoOptions, type FastVideoResult, type FontConfig, FontRegistry, type FrameSchedule, type Glyph, type GradientSpec, type IVideoEncoder, type LineToCommand, type MoveToCommand, NodeRawEncoder, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type PositionedWord, type QuadraticBezierCommand, type RGBA, type RenderFrame, type RenderStats, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type RichCaptionGeneratorConfig, RichCaptionRenderer, type RichCaptionRendererOptions, type ShadowConfig, type ShapedLine, type ShapedWord, type ShapedWordGlyph, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeConfig, type StrokeSpec, type ValidAsset, type VideoEncoderCapabilities, type VideoEncoderConfig, type VideoEncoderProgress, type WordAnimationConfig, type WordAnimationState, type WordTiming, WordTimingStore, arcToCubicBeziers, breakIntoLines, calculateAnimationStatesForGroup, commandsToPathString, computeSimplePathBounds, createDefaultGeneratorConfig, createFrameSchedule, createNodePainter, createNodeRawEncoder, createRichCaptionRenderer, createTextEngine, createVideoEncoder, detectPlatform, detectSubtitleFormat, findWordAtTime, generateRichCaptionDrawOps, generateRichCaptionFrame, generateShapePathData, getDefaultAnimationConfig, getDrawCaptionWordOps, getEncoderCapabilities, getEncoderWarning, groupWordsByPause, isDrawCaptionWordOp, isRTLText, isWebCodecsH264Supported, normalizePath, normalizePathString, parseSubtitleToWords, parseSvgPath, quadraticToCubic, renderSvgAssetToPng, renderSvgToPng, richCaptionAssetSchema, shapeToSvgString };
|
|
1334
|
+
export { ASCENT_RATIO, type AnimationDirection, type AnimationStyle, type ArcCommand, type BackgroundConfig, type BoundingBox, type CanvasRichCaptionAsset, CanvasRichCaptionAssetSchema, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type CaptionGroup, type CaptionLayout, type CaptionLayoutConfig, CaptionLayoutEngine, type CaptionLine, type ClosePathCommand, type CubicBezierCommand, DESCENT_RATIO, type DrawOp, type EngineInit, type FastVideoOptions, type FastVideoResult, type FontConfig, FontRegistry, type FrameSchedule, type Glyph, type GradientSpec, type IVideoEncoder, type LineToCommand, type MoveToCommand, NodeRawEncoder, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type PositionedWord, type QuadraticBezierCommand, type RGBA, type RenderFrame, type RenderStats, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type RichCaptionGeneratorConfig, RichCaptionRenderer, type RichCaptionRendererOptions, type ShadowConfig, type ShapedLine, type ShapedWord, type ShapedWordGlyph, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeConfig, type StrokeSpec, type ValidAsset, type VideoEncoderCapabilities, type VideoEncoderConfig, type VideoEncoderProgress, WORD_BG_BORDER_RADIUS, WORD_BG_OPACITY, WORD_BG_PADDING_RATIO, type WordAnimationConfig, type WordAnimationState, type WordTiming, WordTimingStore, arcToCubicBeziers, breakIntoLines, calculateAnimationStatesForGroup, commandsToPathString, computeSimplePathBounds, createDefaultGeneratorConfig, createFrameSchedule, createNodePainter, createNodeRawEncoder, createRichCaptionRenderer, createTextEngine, createVideoEncoder, detectPlatform, detectSubtitleFormat, extractCaptionPadding, findWordAtTime, generateRichCaptionDrawOps, generateRichCaptionFrame, generateShapePathData, getDefaultAnimationConfig, getDrawCaptionWordOps, getEncoderCapabilities, getEncoderWarning, groupWordsByPause, isDrawCaptionWordOp, isRTLText, isWebCodecsH264Supported, normalizePath, normalizePathString, parseSubtitleToWords, parseSvgPath, quadraticToCubic, renderSvgAssetToPng, renderSvgToPng, richCaptionAssetSchema, shapeToSvgString };
|