@remotion/web-renderer 4.0.425 → 4.0.427
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/create-scaffold.d.ts +2 -2
- package/dist/drawing/draw-box-shadow.d.ts +2 -5
- package/dist/drawing/parse-shadow.d.ts +7 -0
- package/dist/drawing/text/parse-text-shadow.d.ts +3 -0
- package/dist/esm/index.mjs +42 -8
- package/dist/props-if-has-props.d.ts +7 -6
- package/dist/render-media-on-web.d.ts +9 -6
- package/dist/render-still-on-web.d.ts +7 -5
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentType } from 'react';
|
|
2
2
|
import type { Codec, DelayRenderScope, LogLevel, TRenderAsset } from 'remotion';
|
|
3
|
-
import type {
|
|
3
|
+
import type { $ZodObject } from 'zod/v4/core';
|
|
4
4
|
import type { TimeUpdaterRef } from './update-time';
|
|
5
5
|
export type ErrorHolder = {
|
|
6
6
|
error: Error | null;
|
|
@@ -17,7 +17,7 @@ export declare function createScaffold<Props extends Record<string, unknown>>({
|
|
|
17
17
|
initialFrame: number;
|
|
18
18
|
durationInFrames: number;
|
|
19
19
|
fps: number;
|
|
20
|
-
schema:
|
|
20
|
+
schema: $ZodObject | null;
|
|
21
21
|
Component: ComponentType<Props>;
|
|
22
22
|
audioEnabled: boolean;
|
|
23
23
|
videoEnabled: boolean;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { BorderRadiusCorners } from './border-radius';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
offsetY: number;
|
|
5
|
-
blurRadius: number;
|
|
6
|
-
color: string;
|
|
2
|
+
import type { ShadowBase } from './parse-shadow';
|
|
3
|
+
interface BoxShadow extends ShadowBase {
|
|
7
4
|
inset: boolean;
|
|
8
5
|
}
|
|
9
6
|
export declare const parseBoxShadow: (boxShadowValue: string) => BoxShadow[];
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2425,12 +2425,14 @@ var drawBorder = ({
|
|
|
2425
2425
|
|
|
2426
2426
|
// src/drawing/draw-box-shadow.ts
|
|
2427
2427
|
import { Internals as Internals5 } from "remotion";
|
|
2428
|
-
|
|
2429
|
-
|
|
2428
|
+
|
|
2429
|
+
// src/drawing/parse-shadow.ts
|
|
2430
|
+
var parseShadowValues = (shadowValue) => {
|
|
2431
|
+
if (!shadowValue || shadowValue === "none") {
|
|
2430
2432
|
return [];
|
|
2431
2433
|
}
|
|
2432
2434
|
const shadows = [];
|
|
2433
|
-
const shadowStrings =
|
|
2435
|
+
const shadowStrings = shadowValue.split(/,(?![^(]*\))/);
|
|
2434
2436
|
for (const shadowStr of shadowStrings) {
|
|
2435
2437
|
const trimmed = shadowStr.trim();
|
|
2436
2438
|
if (!trimmed || trimmed === "none") {
|
|
@@ -2440,10 +2442,8 @@ var parseBoxShadow = (boxShadowValue) => {
|
|
|
2440
2442
|
offsetX: 0,
|
|
2441
2443
|
offsetY: 0,
|
|
2442
2444
|
blurRadius: 0,
|
|
2443
|
-
color: "rgba(0, 0, 0, 0.5)"
|
|
2444
|
-
inset: false
|
|
2445
|
+
color: "rgba(0, 0, 0, 0.5)"
|
|
2445
2446
|
};
|
|
2446
|
-
shadow.inset = /\binset\b/i.test(trimmed);
|
|
2447
2447
|
let remaining = trimmed.replace(/\binset\b/gi, "").trim();
|
|
2448
2448
|
const colorMatch = remaining.match(/(rgba?\([^)]+\)|hsla?\([^)]+\)|#[0-9a-f]{3,8}|[a-z]+)/i);
|
|
2449
2449
|
if (colorMatch) {
|
|
@@ -2463,6 +2463,19 @@ var parseBoxShadow = (boxShadowValue) => {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
return shadows;
|
|
2465
2465
|
};
|
|
2466
|
+
|
|
2467
|
+
// src/drawing/draw-box-shadow.ts
|
|
2468
|
+
var parseBoxShadow = (boxShadowValue) => {
|
|
2469
|
+
if (!boxShadowValue || boxShadowValue === "none") {
|
|
2470
|
+
return [];
|
|
2471
|
+
}
|
|
2472
|
+
const baseShadows = parseShadowValues(boxShadowValue);
|
|
2473
|
+
const shadowStrings = boxShadowValue.split(/,(?![^(]*\))/);
|
|
2474
|
+
return baseShadows.map((base, i) => ({
|
|
2475
|
+
...base,
|
|
2476
|
+
inset: /\binset\b/i.test(shadowStrings[i] || "")
|
|
2477
|
+
}));
|
|
2478
|
+
};
|
|
2466
2479
|
var drawBorderRadius = ({
|
|
2467
2480
|
ctx,
|
|
2468
2481
|
rect,
|
|
@@ -3295,6 +3308,11 @@ var findWords = (span) => {
|
|
|
3295
3308
|
return tokens;
|
|
3296
3309
|
};
|
|
3297
3310
|
|
|
3311
|
+
// src/drawing/text/parse-text-shadow.ts
|
|
3312
|
+
var parseTextShadow = (textShadowValue) => {
|
|
3313
|
+
return parseShadowValues(textShadowValue);
|
|
3314
|
+
};
|
|
3315
|
+
|
|
3298
3316
|
// src/drawing/text/draw-text.ts
|
|
3299
3317
|
var drawText = ({
|
|
3300
3318
|
span,
|
|
@@ -3311,7 +3329,8 @@ var drawText = ({
|
|
|
3311
3329
|
writingMode,
|
|
3312
3330
|
letterSpacing,
|
|
3313
3331
|
textTransform,
|
|
3314
|
-
webkitTextFillColor
|
|
3332
|
+
webkitTextFillColor,
|
|
3333
|
+
textShadow: textShadowValue
|
|
3315
3334
|
} = computedStyle;
|
|
3316
3335
|
const isVertical = writingMode !== "horizontal-tb";
|
|
3317
3336
|
if (isVertical) {
|
|
@@ -3333,13 +3352,28 @@ var drawText = ({
|
|
|
3333
3352
|
const transformedText = applyTextTransform(originalText, textTransform);
|
|
3334
3353
|
span.textContent = transformedText;
|
|
3335
3354
|
const tokens = findWords(span);
|
|
3355
|
+
const textShadows = parseTextShadow(textShadowValue);
|
|
3336
3356
|
for (const token of tokens) {
|
|
3337
3357
|
const measurements = contextToDraw.measureText(originalText);
|
|
3338
3358
|
const { fontBoundingBoxDescent, fontBoundingBoxAscent } = measurements;
|
|
3339
3359
|
const fontHeight = fontBoundingBoxAscent + fontBoundingBoxDescent;
|
|
3340
3360
|
const leading = token.rect.height - fontHeight;
|
|
3341
3361
|
const halfLeading = leading / 2;
|
|
3342
|
-
|
|
3362
|
+
const x = (isRTL ? token.rect.right : token.rect.left) - parentRect.x;
|
|
3363
|
+
const y = token.rect.top + fontBoundingBoxAscent + halfLeading - parentRect.y;
|
|
3364
|
+
for (let i = textShadows.length - 1;i >= 0; i--) {
|
|
3365
|
+
const shadow = textShadows[i];
|
|
3366
|
+
contextToDraw.shadowColor = shadow.color;
|
|
3367
|
+
contextToDraw.shadowBlur = shadow.blurRadius;
|
|
3368
|
+
contextToDraw.shadowOffsetX = shadow.offsetX;
|
|
3369
|
+
contextToDraw.shadowOffsetY = shadow.offsetY;
|
|
3370
|
+
contextToDraw.fillText(token.text, x, y);
|
|
3371
|
+
}
|
|
3372
|
+
contextToDraw.shadowColor = "transparent";
|
|
3373
|
+
contextToDraw.shadowBlur = 0;
|
|
3374
|
+
contextToDraw.shadowOffsetX = 0;
|
|
3375
|
+
contextToDraw.shadowOffsetY = 0;
|
|
3376
|
+
contextToDraw.fillText(token.text, x, y);
|
|
3343
3377
|
}
|
|
3344
3378
|
span.textContent = originalText;
|
|
3345
3379
|
contextToDraw.restore();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { CalculateMetadataFunction } from 'remotion';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export type
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { $ZodObject } from 'zod/v4/core';
|
|
5
|
+
export type InferProps<Schema extends $ZodObject, Props extends Record<string, unknown>> = $ZodObject extends Schema ? {} extends Props ? Record<string, unknown> : Props : {} extends Props ? z.input<Schema> : z.input<Schema> & Props;
|
|
6
|
+
export type DefaultPropsIfHasProps<Schema extends $ZodObject, Props> = $ZodObject extends Schema ? {} extends Props ? {
|
|
6
7
|
defaultProps?: z.input<Schema> & Props;
|
|
7
8
|
} : {
|
|
8
9
|
defaultProps: Props;
|
|
@@ -12,21 +13,21 @@ export type DefaultPropsIfHasProps<Schema extends AnyZodObject, Props> = AnyZodO
|
|
|
12
13
|
defaultProps: z.input<Schema> & Props;
|
|
13
14
|
};
|
|
14
15
|
type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
15
|
-
type OptionalDimensions<Schema extends
|
|
16
|
+
type OptionalDimensions<Schema extends $ZodObject, Props extends Record<string, unknown>> = {
|
|
16
17
|
component: LooseComponentType<Props>;
|
|
17
18
|
id: string;
|
|
18
19
|
width?: number;
|
|
19
20
|
height?: number;
|
|
20
21
|
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>>;
|
|
21
22
|
};
|
|
22
|
-
type MandatoryDimensions<Schema extends
|
|
23
|
+
type MandatoryDimensions<Schema extends $ZodObject, Props extends Record<string, unknown>> = {
|
|
23
24
|
component: LooseComponentType<Props>;
|
|
24
25
|
id: string;
|
|
25
26
|
width: number;
|
|
26
27
|
height: number;
|
|
27
28
|
calculateMetadata?: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
|
|
28
29
|
};
|
|
29
|
-
export type CompositionCalculateMetadataOrExplicit<Schema extends
|
|
30
|
+
export type CompositionCalculateMetadataOrExplicit<Schema extends $ZodObject, Props extends Record<string, unknown>> = ((OptionalDimensions<Schema, Props> & {
|
|
30
31
|
fps?: number;
|
|
31
32
|
durationInFrames?: number;
|
|
32
33
|
}) | (MandatoryDimensions<Schema, Props> & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LogLevel } from 'remotion';
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { $ZodObject } from 'zod/v4/core';
|
|
3
4
|
import { type WebRendererOnArtifact } from './artifact';
|
|
4
5
|
import { type FrameRange } from './frame-range';
|
|
5
6
|
import type { InternalState } from './internal-state';
|
|
@@ -8,7 +9,7 @@ import { type WebRendererVideoCodec } from './mediabunny-mappings';
|
|
|
8
9
|
import type { WebRendererOutputTarget } from './output-target';
|
|
9
10
|
import type { CompositionCalculateMetadataOrExplicit } from './props-if-has-props';
|
|
10
11
|
import { type OnFrameCallback } from './validate-video-frame';
|
|
11
|
-
export type InputPropsIfHasProps<Schema extends
|
|
12
|
+
export type InputPropsIfHasProps<Schema extends $ZodObject, Props> = $ZodObject extends Schema ? {} extends Props ? {
|
|
12
13
|
inputProps?: z.input<Schema> & Props;
|
|
13
14
|
} : {
|
|
14
15
|
inputProps: Props;
|
|
@@ -17,7 +18,7 @@ export type InputPropsIfHasProps<Schema extends AnyZodObject, Props> = AnyZodObj
|
|
|
17
18
|
} : {
|
|
18
19
|
inputProps: z.input<Schema> & Props;
|
|
19
20
|
};
|
|
20
|
-
type MandatoryRenderMediaOnWebOptions<Schema extends
|
|
21
|
+
type MandatoryRenderMediaOnWebOptions<Schema extends $ZodObject, Props extends Record<string, unknown>> = {
|
|
21
22
|
composition: CompositionCalculateMetadataOrExplicit<Schema, Props>;
|
|
22
23
|
};
|
|
23
24
|
export type RenderMediaOnWebProgress = {
|
|
@@ -30,7 +31,7 @@ export type RenderMediaOnWebResult = {
|
|
|
30
31
|
};
|
|
31
32
|
export type RenderMediaOnWebProgressCallback = (progress: RenderMediaOnWebProgress) => void;
|
|
32
33
|
export type WebRendererHardwareAcceleration = 'no-preference' | 'prefer-hardware' | 'prefer-software';
|
|
33
|
-
type OptionalRenderMediaOnWebOptions<Schema extends
|
|
34
|
+
type OptionalRenderMediaOnWebOptions<Schema extends $ZodObject> = {
|
|
34
35
|
delayRenderTimeoutInMilliseconds: number;
|
|
35
36
|
logLevel: LogLevel;
|
|
36
37
|
schema: Schema | undefined;
|
|
@@ -54,6 +55,8 @@ type OptionalRenderMediaOnWebOptions<Schema extends AnyZodObject> = {
|
|
|
54
55
|
muted: boolean;
|
|
55
56
|
scale: number;
|
|
56
57
|
};
|
|
57
|
-
export type RenderMediaOnWebOptions<Schema extends
|
|
58
|
-
export declare const renderMediaOnWeb: <Schema extends
|
|
58
|
+
export type RenderMediaOnWebOptions<Schema extends $ZodObject, Props extends Record<string, unknown>> = MandatoryRenderMediaOnWebOptions<Schema, Props> & Partial<OptionalRenderMediaOnWebOptions<Schema>> & InputPropsIfHasProps<Schema, Props>;
|
|
59
|
+
export declare const renderMediaOnWeb: <Schema extends $ZodObject<Readonly<Readonly<{
|
|
60
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
61
|
+
}>>, z.core.$ZodObjectConfig>, Props extends Record<string, unknown>>(options: RenderMediaOnWebOptions<Schema, Props>) => Promise<RenderMediaOnWebResult>;
|
|
59
62
|
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type LogLevel } from 'remotion';
|
|
2
|
-
import type {
|
|
2
|
+
import type { $ZodObject } from 'zod/v4/core';
|
|
3
3
|
import type { WebRendererOnArtifact } from './artifact';
|
|
4
4
|
import type { CompositionCalculateMetadataOrExplicit } from './props-if-has-props';
|
|
5
5
|
import type { InputPropsIfHasProps } from './render-media-on-web';
|
|
6
6
|
export type RenderStillOnWebImageFormat = 'png' | 'jpeg' | 'webp';
|
|
7
|
-
type MandatoryRenderStillOnWebOptions<Schema extends
|
|
7
|
+
type MandatoryRenderStillOnWebOptions<Schema extends $ZodObject, Props extends Record<string, unknown>> = {
|
|
8
8
|
frame: number;
|
|
9
9
|
imageFormat: RenderStillOnWebImageFormat;
|
|
10
10
|
} & {
|
|
11
11
|
composition: CompositionCalculateMetadataOrExplicit<Schema, Props>;
|
|
12
12
|
};
|
|
13
|
-
type OptionalRenderStillOnWebOptions<Schema extends
|
|
13
|
+
type OptionalRenderStillOnWebOptions<Schema extends $ZodObject> = {
|
|
14
14
|
delayRenderTimeoutInMilliseconds: number;
|
|
15
15
|
logLevel: LogLevel;
|
|
16
16
|
schema: Schema | undefined;
|
|
@@ -21,8 +21,10 @@ type OptionalRenderStillOnWebOptions<Schema extends AnyZodObject> = {
|
|
|
21
21
|
scale: number;
|
|
22
22
|
isProduction: boolean;
|
|
23
23
|
};
|
|
24
|
-
export type RenderStillOnWebOptions<Schema extends
|
|
25
|
-
export declare const renderStillOnWeb: <Schema extends
|
|
24
|
+
export type RenderStillOnWebOptions<Schema extends $ZodObject, Props extends Record<string, unknown>> = MandatoryRenderStillOnWebOptions<Schema, Props> & Partial<OptionalRenderStillOnWebOptions<Schema>> & InputPropsIfHasProps<Schema, Props>;
|
|
25
|
+
export declare const renderStillOnWeb: <Schema extends $ZodObject<Readonly<Readonly<{
|
|
26
|
+
[k: string]: import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
27
|
+
}>>, import("zod/v4/core").$ZodObjectConfig>, Props extends Record<string, unknown>>(options: RenderStillOnWebOptions<Schema, Props>) => Promise<{
|
|
26
28
|
blob: Blob;
|
|
27
29
|
internalState: {
|
|
28
30
|
getDrawn3dPixels: () => number;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/web-renderer"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/web-renderer",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.427",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"author": "Remotion <jonny@remotion.dev>",
|
|
19
19
|
"license": "UNLICENSED",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@remotion/licensing": "4.0.
|
|
22
|
-
"remotion": "4.0.
|
|
21
|
+
"@remotion/licensing": "4.0.427",
|
|
22
|
+
"remotion": "4.0.427",
|
|
23
23
|
"mediabunny": "1.34.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@react-three/fiber": "9.2.0",
|
|
27
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
28
|
-
"@remotion/player": "4.0.
|
|
29
|
-
"@remotion/media": "4.0.
|
|
30
|
-
"@remotion/three": "4.0.
|
|
27
|
+
"@remotion/eslint-config-internal": "4.0.427",
|
|
28
|
+
"@remotion/player": "4.0.427",
|
|
29
|
+
"@remotion/media": "4.0.427",
|
|
30
|
+
"@remotion/three": "4.0.427",
|
|
31
31
|
"@types/three": "0.170.0",
|
|
32
32
|
"@typescript/native-preview": "7.0.0-dev.20260217.1",
|
|
33
33
|
"@vitejs/plugin-react": "4.3.4",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"three": "0.178.0",
|
|
40
40
|
"vitest": "4.0.9",
|
|
41
41
|
"vitest-browser-react": "^2.0.2",
|
|
42
|
-
"zod": "3.
|
|
42
|
+
"zod": "4.3.6"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=18.0.0",
|