@remotion/layout-utils 4.0.243 → 4.0.245
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/LICENSE.md
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import type { ModifyableCSSProperties, TextTransform } from '../layouts/measure-text';
|
|
2
|
-
/**
|
|
3
|
-
* @description Calculates the font size needed to fit text into a specified width container.
|
|
4
|
-
* @see [Documentation](https://remotion.dev/docs/layout-utils/fit-text)
|
|
5
|
-
* @param {Object} params - The parameters containing details to fit text.
|
|
6
|
-
* @param {string} params.text - The text content to fit.
|
|
7
|
-
* @param {number} params.withinWidth - The container width to fit the text into.
|
|
8
|
-
* @param {string} params.fontFamily - The font family to apply to the text.
|
|
9
|
-
* @param {string|number} [params.fontWeight] - The font weight to apply (optional).
|
|
10
|
-
* @param {string} [params.letterSpacing] - The spacing between letters (optional).
|
|
11
|
-
* @param {string} [params.fontVariantNumeric] - The numeric font variant to apply (optional).
|
|
12
|
-
* @param {boolean} [params.validateFontIsLoaded] - Validate if the font is loaded before rendering text (optional).
|
|
13
|
-
* @param {TextTransform} [params.textTransform] - Text transformation to apply (uppercase, lowercase) (optional).
|
|
14
|
-
* @param {ModifyableCSSProperties} [params.additionalStyles] - Additional CSS properties affecting text layout (optional).
|
|
15
|
-
* @returns {Object} An object containing the computed `fontSize` to use for the specified width.
|
|
16
|
-
*/
|
|
17
2
|
export declare const fitText: ({ text, withinWidth, fontFamily, fontVariantNumeric, fontWeight, letterSpacing, validateFontIsLoaded, additionalStyles, textTransform, }: {
|
|
18
3
|
text: string;
|
|
19
4
|
withinWidth: number;
|
|
@@ -3,20 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fitText = void 0;
|
|
4
4
|
const measure_text_1 = require("../layouts/measure-text");
|
|
5
5
|
const sampleSize = 100;
|
|
6
|
-
|
|
6
|
+
/*
|
|
7
7
|
* @description Calculates the font size needed to fit text into a specified width container.
|
|
8
8
|
* @see [Documentation](https://remotion.dev/docs/layout-utils/fit-text)
|
|
9
|
-
* @param {Object} params - The parameters containing details to fit text.
|
|
10
|
-
* @param {string} params.text - The text content to fit.
|
|
11
|
-
* @param {number} params.withinWidth - The container width to fit the text into.
|
|
12
|
-
* @param {string} params.fontFamily - The font family to apply to the text.
|
|
13
|
-
* @param {string|number} [params.fontWeight] - The font weight to apply (optional).
|
|
14
|
-
* @param {string} [params.letterSpacing] - The spacing between letters (optional).
|
|
15
|
-
* @param {string} [params.fontVariantNumeric] - The numeric font variant to apply (optional).
|
|
16
|
-
* @param {boolean} [params.validateFontIsLoaded] - Validate if the font is loaded before rendering text (optional).
|
|
17
|
-
* @param {TextTransform} [params.textTransform] - Text transformation to apply (uppercase, lowercase) (optional).
|
|
18
|
-
* @param {ModifyableCSSProperties} [params.additionalStyles] - Additional CSS properties affecting text layout (optional).
|
|
19
|
-
* @returns {Object} An object containing the computed `fontSize` to use for the specified width.
|
|
20
9
|
*/
|
|
21
10
|
const fitText = ({ text, withinWidth, fontFamily, fontVariantNumeric, fontWeight, letterSpacing, validateFontIsLoaded, additionalStyles, textTransform, }) => {
|
|
22
11
|
const estimate = (0, measure_text_1.measureText)({
|
|
@@ -19,12 +19,5 @@ export type Word = {
|
|
|
19
19
|
validateFontIsLoaded?: boolean;
|
|
20
20
|
additionalStyles?: ModifyableCSSProperties;
|
|
21
21
|
} & CSSPropertiesOnWord;
|
|
22
|
-
/**
|
|
23
|
-
* Calculates the width and height of specified text to be used for layout calculations.
|
|
24
|
-
* Only works in the browser, not in Node.js or Bun.
|
|
25
|
-
* @see [Documentation](https://remotion.dev/docs/layout-utils/measure-text)
|
|
26
|
-
* @param {Word} wordOptions - The text options to measure, including the text itself, font properties, and additional styles.
|
|
27
|
-
* @returns {Dimensions} The dimensions object containing the measured width and height of the text.
|
|
28
|
-
*/
|
|
29
22
|
export declare const measureText: ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, }: Word) => Dimensions;
|
|
30
23
|
export {};
|
|
@@ -43,12 +43,9 @@ const takeMeasurement = ({ text, fontFamily, fontSize, fontWeight, letterSpacing
|
|
|
43
43
|
computedFontFamily,
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
* Calculates the width and height of specified text to be used for layout calculations.
|
|
48
|
-
* Only works in the browser, not in Node.js or Bun.
|
|
46
|
+
/*
|
|
47
|
+
* @description Calculates the width and height of specified text to be used for layout calculations. Only works in the browser, not in Node.js or Bun.
|
|
49
48
|
* @see [Documentation](https://remotion.dev/docs/layout-utils/measure-text)
|
|
50
|
-
* @param {Word} wordOptions - The text options to measure, including the text itself, font properties, and additional styles.
|
|
51
|
-
* @returns {Dimensions} The dimensions object containing the measured width and height of the text.
|
|
52
49
|
*/
|
|
53
50
|
const measureText = ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, }) => {
|
|
54
51
|
const key = `${text}-${fontFamily}-${fontWeight}-${fontSize}-${letterSpacing}-${JSON.stringify(additionalStyles)}`;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/layout-utils"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/layout-utils",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.245",
|
|
7
7
|
"description": "Utilities for working with layouts",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"eslint": "9.14.0",
|
|
23
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
23
|
+
"@remotion/eslint-config-internal": "4.0.245"
|
|
24
24
|
},
|
|
25
25
|
"author": "Yehor Misiats (https://github.com/satelllte)",
|
|
26
26
|
"maintainers": [
|