UNPKG

remotion

Version:

Make videos programmatically

53 lines (52 loc) 3.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbsoluteFill = exports.absoluteFillSchema = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const AbsoluteFillElement_js_1 = require("./AbsoluteFillElement.js"); const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js"); const interactivity_schema_js_1 = require("./interactivity-schema.js"); const Sequence_js_1 = require("./Sequence.js"); const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js"); const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js"); exports.absoluteFillSchema = { ...interactivity_schema_js_1.baseSchema, ...interactivity_schema_js_1.transformSchema, ...interactivity_schema_js_1.backgroundSchema, ...interactivity_schema_js_1.borderSchema, ...interactivity_schema_js_1.borderRadiusSchema, ...interactivity_schema_js_1.textSchema, ...interactivity_schema_js_1.textContentSchema, }; const setRef = (ref, value) => { if (typeof ref === 'function') { ref(value); } else if (ref) { ref.current = value; } }; const AbsoluteFillInner = ({ ref, from, trimBefore, freeze, durationInFrames, hidden, name, showInTimeline, stack, controls, children, ...divProps }) => { const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)(); const refForOutline = (0, react_1.useRef)(null); const callbackRef = (0, react_1.useCallback)((element) => { refForOutline.current = element; setRef(ref, element); }, [ref]); if (videoConfig === null) { return hidden ? null : (jsx_runtime_1.jsx(AbsoluteFillElement_js_1.AbsoluteFillElement, { ref: callbackRef, ...divProps, children: children })); } return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, freeze: freeze, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, hidden: hidden, name: name !== null && name !== void 0 ? name : '<AbsoluteFill>', showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, controls: controls, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/absolute-fill", outlineRef: refForOutline, children: jsx_runtime_1.jsx(AbsoluteFillElement_js_1.AbsoluteFillElement, { ref: callbackRef, ...divProps, children: children }) })); }; /* * @description A helper component which renders an absolutely positioned <div> element with full width, height, and flex display suited for content layering. * @see [Documentation](https://remotion.dev/docs/absolute-fill) */ exports.AbsoluteFill = (0, with_interactivity_schema_js_1.withInteractivitySchema)({ Component: AbsoluteFillInner, componentName: '<AbsoluteFill>', componentIdentity: 'dev.remotion.remotion.AbsoluteFill', schema: exports.absoluteFillSchema, supportsEffects: false, }); (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.AbsoluteFill);