@zync/zync-screnplay-player 0.1.247 → 0.1.248
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.
|
@@ -118,6 +118,7 @@ var DIRECT_COMPONENT_DEPENDENCIES = Object.freeze({
|
|
|
118
118
|
CaptionColor: [FONT_FAMILIES.POPPINS],
|
|
119
119
|
CaptionColorInverse: [FONT_FAMILIES.POPPINS],
|
|
120
120
|
CaptionColorShadow: [FONT_FAMILIES.MONTSERRAT],
|
|
121
|
+
CaptionBold: [FONT_FAMILIES.MONTSERRAT],
|
|
121
122
|
CaptionElegant: [FONT_FAMILIES.MONTSERRAT, FONT_FAMILIES.ROCHESTER],
|
|
122
123
|
CaptionEmphasis: [FONT_FAMILIES.MONTSERRAT],
|
|
123
124
|
CaptionPunctuated: [FONT_FAMILIES.POPPINS],
|
|
@@ -32,6 +32,7 @@ import { CaptionWordBubble } from "./theme/themes/default/CaptionWordBubble";
|
|
|
32
32
|
import { CaptionWordPopup } from "./theme/themes/default/CaptionWordPopup";
|
|
33
33
|
import { CaptionEmphasis } from "./theme/themes/default/CaptionEmphasis";
|
|
34
34
|
import { CaptionElegant } from "./theme/themes/default/CaptionElegant";
|
|
35
|
+
import { CaptionBold } from "./theme/themes/default/CaptionBold";
|
|
35
36
|
import { BrollGreenScreen } from "./components/layouts/BrollGreenScreen";
|
|
36
37
|
import { IntroVideo } from "./components/layouts/IntroVideo";
|
|
37
38
|
import StretchText from "./components/utils/StretchText";
|
|
@@ -100,6 +101,7 @@ export var RegisteredComponents = {
|
|
|
100
101
|
CaptionWordBubble: CaptionWordBubble,
|
|
101
102
|
CaptionWordPopup: CaptionWordPopup,
|
|
102
103
|
CaptionElegant: CaptionElegant,
|
|
104
|
+
CaptionBold: CaptionBold,
|
|
103
105
|
CaptionColor: CaptionColor,
|
|
104
106
|
CaptionColorInverse: CaptionColorInverse,
|
|
105
107
|
CaptionColorShadow: CaptionColorShadow,
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FONT_FAMILIES } from "../../../fontRegistry.js";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
7
|
+
var fontFamily = FONT_FAMILIES.MONTSERRAT;
|
|
8
|
+
var getWordLength = function getWordLength(word) {
|
|
9
|
+
var sanitizedLength = word.replace(/[^A-Za-z0-9]/g, "").length;
|
|
10
|
+
return sanitizedLength || word.length;
|
|
11
|
+
};
|
|
12
|
+
export var CaptionBold = function CaptionBold(_ref) {
|
|
13
|
+
var transcripts = _ref.transcripts;
|
|
14
|
+
var _useVideoConfig = useVideoConfig(),
|
|
15
|
+
width = _useVideoConfig.width;
|
|
16
|
+
var _useOrientationBased = useOrientationBased({
|
|
17
|
+
portrait: {
|
|
18
|
+
fontSize: 75,
|
|
19
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
20
|
+
},
|
|
21
|
+
landscape: {
|
|
22
|
+
fontSize: 60,
|
|
23
|
+
bottom: 110
|
|
24
|
+
},
|
|
25
|
+
square: {
|
|
26
|
+
fontSize: 75,
|
|
27
|
+
bottom: 110
|
|
28
|
+
}
|
|
29
|
+
}),
|
|
30
|
+
bottom = _useOrientationBased.bottom,
|
|
31
|
+
fontSize = _useOrientationBased.fontSize;
|
|
32
|
+
var containerWidth = width * 0.8;
|
|
33
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
34
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
|
|
35
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
36
|
+
var words = transcript.text.split(/\s+/).filter(Boolean);
|
|
37
|
+
var longestWordIndex = words.reduce(function (longestIndex, word, wordIndex) {
|
|
38
|
+
if (longestIndex === -1) {
|
|
39
|
+
return wordIndex;
|
|
40
|
+
}
|
|
41
|
+
return getWordLength(word) > getWordLength(words[longestIndex]) ? wordIndex : longestIndex;
|
|
42
|
+
}, -1);
|
|
43
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
44
|
+
key: index,
|
|
45
|
+
from: transcript.from,
|
|
46
|
+
durationInFrames: transcript.durationInFrames
|
|
47
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
48
|
+
style: {
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
height: fontSize * 1.6,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
bottom: bottom,
|
|
55
|
+
left: "50%",
|
|
56
|
+
width: containerWidth,
|
|
57
|
+
margin: "0 auto",
|
|
58
|
+
transform: "translateX(-50%)",
|
|
59
|
+
color: "white",
|
|
60
|
+
fontSize: textFontSize,
|
|
61
|
+
fontFamily: fontFamily,
|
|
62
|
+
fontWeight: 900,
|
|
63
|
+
textTransform: "uppercase",
|
|
64
|
+
letterSpacing: "-1px",
|
|
65
|
+
textShadow: "-2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0px 4px 5px rgba(0, 0, 0, 0.75)",
|
|
66
|
+
textAlign: "center",
|
|
67
|
+
lineHeight: 1,
|
|
68
|
+
textWrap: "nowrap"
|
|
69
|
+
}
|
|
70
|
+
}, words.map(function (word, wordIndex) {
|
|
71
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
72
|
+
key: "".concat(word, "-").concat(wordIndex),
|
|
73
|
+
style: {
|
|
74
|
+
color: wordIndex === longestWordIndex ? "#ffff00" : "white",
|
|
75
|
+
marginRight: wordIndex < words.length - 1 ? textFontSize * 0.28 : 0
|
|
76
|
+
}
|
|
77
|
+
}, word);
|
|
78
|
+
})));
|
|
79
|
+
}));
|
|
80
|
+
};
|