π₯ Make videos programmatically with React
fixes
Jonny Burger9577a809b703
diff --git a/packages/example/src/VisualControls/index.tsx b/packages/example/src/VisualControls/index.tsxindex be4dbf6886..7dc02e59a4 100644--- a/packages/example/src/VisualControls/index.tsx+++ b/packages/example/src/VisualControls/index.tsx@@ -1,26 +1,15 @@import {makeTransform, matrix3d} from '@remotion/animation-utils';import {visualControl} from '@remotion/studio';-import {zMatrix, zTextarea} from '@remotion/zod-types';-import {AbsoluteFill, staticFile} from 'remotion';+import {zMatrix} from '@remotion/zod-types';+import {AbsoluteFill} from 'remotion';export const VisualControls = () => {const matrix = visualControl('my-matrix',- [7.96,0.34,0,0,0,2.79,0,0,1.26,0.35,1,0,0,0,0,1] as const,+ [8.71, 0.83, 0, 0, 0, 2.79, 0, 0, 1.26, 0.35, 1, 0, 0, 0, 0, 1] as const,zMatrix(),);- const matrix2 = visualControl(- `my-matrix-3`,- [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] as const,- zMatrix(),- );- const val3 = visualControl(`my-matrix-4`, 1234);- const val4 = visualControl(`value π`, 'hi there');- const val5 = visualControl(`text π`, 'hi there', zTextarea());-- const val6 = visualControl('file', staticFile("clip001.mkv"));-return (<AbsoluteFillclassName="bg-red-300 text-7xl flex flex-1 items-center justify-center"@@ -29,7 +18,6 @@ export const VisualControls = () => {}}><p>{matrix.join(', ')}</p>- <p>{val5}</p></AbsoluteFill>);};diff --git a/packages/studio-shared/src/stringify-default-props.ts b/packages/studio-shared/src/stringify-default-props.tsindex ca66d45cab..5591229273 100644--- a/packages/studio-shared/src/stringify-default-props.ts+++ b/packages/studio-shared/src/stringify-default-props.ts@@ -63,14 +63,6 @@ export const stringifyDefaultProps = ({/* Don't replace with arrow function! This function uses `this` */const item = this[key];- console.log({- path,- enumPaths,- match: doesMatchPath(path, enumPaths),- item,- key,- value,- });if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {return `${item}__ADD_AS_CONST__`;}diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/SchemaLabel.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/SchemaLabel.tsxindex 0a0cbd57db..1bc1f97f16 100644--- a/packages/studio/src/components/RenderModal/SchemaEditor/SchemaLabel.tsx+++ b/packages/studio/src/components/RenderModal/SchemaEditor/SchemaLabel.tsx@@ -86,7 +86,7 @@ export const SchemaLabel: React.FC<{onPointerLeave={onClickablePointerLeave}type="button"onClick={handleClick}- style={{border: 'none', marginLeft: -6}}+ style={{border: 'none', padding: 0}}>{labelContent}</button>diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/ZodMatrixEditor.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/ZodMatrixEditor.tsxindex f8674b7725..fe290e1319 100644--- a/packages/studio/src/components/RenderModal/SchemaEditor/ZodMatrixEditor.tsx+++ b/packages/studio/src/components/RenderModal/SchemaEditor/ZodMatrixEditor.tsx@@ -90,28 +90,21 @@ export const ZodMatrixEditor: React.FC<{return (<Fieldset shouldPad={mayPad} success={localValue.zodValidation.success}>- <div- style={{- display: 'flex',- flexDirection: 'row',+ <SchemaLabel+ onReset={reset}+ isDefaultValue={isDefaultValue}+ jsonPath={jsonPath}+ onRemove={onRemove}+ suffix={suffix}+ onSave={() => {+ onSave(() => localValue.value, false, false);}}- >- <SchemaLabel- onReset={reset}- isDefaultValue={isDefaultValue}- jsonPath={jsonPath}- onRemove={onRemove}- suffix={suffix}- onSave={() => {- onSave(() => localValue.value, false, false);- }}- saveDisabledByParent={saveDisabledByParent}- saving={saving}- showSaveButton={showSaveButton}- valid={localValue.zodValidation.success}- handleClick={() => setExpanded(!expanded)}- />- </div>+ saveDisabledByParent={saveDisabledByParent}+ saving={saving}+ showSaveButton={showSaveButton}+ valid={localValue.zodValidation.success}+ handleClick={() => setExpanded(!expanded)}+ />{expanded ? (<RevisionContextProvider>diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/ZodObjectEditor.tsxindex 2585bdec10..1dbff01d5d 100644--- a/packages/studio/src/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx+++ b/packages/studio/src/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx@@ -168,7 +168,6 @@ export const ZodObjectEditor: React.FC<{</SchemaVerticalGuide></RevisionContextProvider>) : null}-{isRoot || !expanded ? null : <div style={fieldsetLabel}>{'}'}</div>}</Fieldset>);diff --git a/packages/studio/src/components/VisualControls/VisualControlHandle.tsx b/packages/studio/src/components/VisualControls/VisualControlHandle.tsxindex 67f3ca358b..4bfe21172d 100644--- a/packages/studio/src/components/VisualControls/VisualControlHandle.tsx+++ b/packages/studio/src/components/VisualControls/VisualControlHandle.tsx@@ -1,4 +1,4 @@-import React, {useCallback, useContext, useState} from 'react';+import React, {useCallback, useContext, useEffect, useState} from 'react';import {Internals} from 'remotion';import {NoReactInternals} from 'remotion/no-react';import {@@ -96,14 +96,8 @@ export const VisualControlHandle: React.FC<{],});})- .then(() => {- console.log('saved');- }).catch((e) => {showNotification(`Could not save visual control: ${e.message}`, 3000);- })- .finally(() => {- setSaving(false);});},[@@ -118,7 +112,9 @@ export const VisualControlHandle: React.FC<{],);- console.log({saving});+ useEffect(() => {+ setSaving(false);+ }, [fastRefreshes]);return (<>diff --git a/packages/studio/src/components/VisualControls/VisualControlsContent.tsx b/packages/studio/src/components/VisualControls/VisualControlsContent.tsxindex 9e2bdab07b..3da0eeec32 100644--- a/packages/studio/src/components/VisualControls/VisualControlsContent.tsx+++ b/packages/studio/src/components/VisualControls/VisualControlsContent.tsx@@ -1,20 +1,27 @@import React, {useContext} from 'react';import {VisualControlsContext} from '../../visual-controls/VisualControls';import {VERTICAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';+import {SchemaSeparationLine} from '../RenderModal/SchemaEditor/SchemaSeparationLine';import {VisualControlHandle} from './VisualControlHandle';const container: React.CSSProperties = {- padding: 12,overflowY: 'auto',};export const VisualControlsContent = () => {const {handles} = useContext(VisualControlsContext);+ const entries = Object.entries(handles);+return (<div style={container} className={VERTICAL_SCROLLBAR_CLASSNAME}>- {Object.entries(handles).map(([key, value]) => {- return <VisualControlHandle key={key} keyName={key} value={value} />;+ {entries.map(([key, value], i) => {+ return (+ <React.Fragment key={key}>+ <VisualControlHandle keyName={key} value={value} />+ {i === entries.length - 1 ? null : <SchemaSeparationLine />}+ </React.Fragment>+ );})}</div>);