forked from remotion-dev/remotion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
558 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
"@types/node": "^20.6.5" | ||
}, | ||
"private": true, | ||
"version": "4.0.48" | ||
"version": "4.0.50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodTextareaEditor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import React, {useCallback} from 'react'; | ||
import type {z} from 'zod'; | ||
import { | ||
useZodIfPossible, | ||
useZodTypesIfPossible, | ||
} from '../../get-zod-if-possible'; | ||
import {RemTextarea} from '../../NewComposition/RemTextarea'; | ||
import {Fieldset} from './Fieldset'; | ||
import {useLocalState} from './local-state'; | ||
import {SchemaLabel} from './SchemaLabel'; | ||
import type {JSONPath} from './zod-types'; | ||
import {ZodFieldValidation} from './ZodFieldValidation'; | ||
import type {UpdaterFunction} from './ZodSwitch'; | ||
|
||
const fullWidth: React.CSSProperties = { | ||
width: '100%', | ||
}; | ||
|
||
const textareaStyle: React.CSSProperties = { | ||
resize: 'vertical', | ||
minHeight: 100, | ||
}; | ||
|
||
export const ZodTextareaEditor: React.FC<{ | ||
schema: z.ZodTypeAny; | ||
jsonPath: JSONPath; | ||
value: string; | ||
defaultValue: string; | ||
setValue: UpdaterFunction<string>; | ||
onSave: UpdaterFunction<string>; | ||
onRemove: null | (() => void); | ||
showSaveButton: boolean; | ||
saving: boolean; | ||
saveDisabledByParent: boolean; | ||
mayPad: boolean; | ||
}> = ({ | ||
jsonPath, | ||
value, | ||
setValue, | ||
showSaveButton, | ||
defaultValue, | ||
schema, | ||
onSave, | ||
onRemove, | ||
saving, | ||
saveDisabledByParent, | ||
mayPad, | ||
}) => { | ||
const z = useZodIfPossible(); | ||
if (!z) { | ||
throw new Error('expected zod'); | ||
} | ||
|
||
const zodTypes = useZodTypesIfPossible(); | ||
if (!zodTypes) { | ||
throw new Error('expected zod textarea'); | ||
} | ||
|
||
const { | ||
localValue, | ||
onChange: setLocalValue, | ||
reset, | ||
} = useLocalState({ | ||
schema, | ||
setValue, | ||
value, | ||
defaultValue, | ||
}); | ||
|
||
const onChange: React.ChangeEventHandler<HTMLTextAreaElement> = useCallback( | ||
(e) => { | ||
setLocalValue(() => e.target.value, false, false); | ||
}, | ||
[setLocalValue], | ||
); | ||
|
||
const save = useCallback(() => { | ||
onSave(() => value, false, false); | ||
}, [onSave, value]); | ||
|
||
return ( | ||
<Fieldset shouldPad={mayPad} success={localValue.zodValidation.success}> | ||
<SchemaLabel | ||
isDefaultValue={localValue.value === defaultValue} | ||
jsonPath={jsonPath} | ||
onReset={reset} | ||
onSave={save} | ||
showSaveButton={showSaveButton} | ||
onRemove={onRemove} | ||
saving={saving} | ||
valid={localValue.zodValidation.success} | ||
saveDisabledByParent={saveDisabledByParent} | ||
suffix={null} | ||
/> | ||
<div style={fullWidth}> | ||
<RemTextarea | ||
onChange={onChange} | ||
value={localValue.value} | ||
status={localValue.zodValidation ? 'ok' : 'error'} | ||
placeholder={jsonPath.join('.')} | ||
name={jsonPath.join('.')} | ||
style={textareaStyle} | ||
/> | ||
<ZodFieldValidation path={jsonPath} localValue={localValue} /> | ||
</div> | ||
</Fieldset> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-darwin-arm64", | ||
"os": [ | ||
"darwin" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-darwin-x64", | ||
"os": [ | ||
"darwin" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-linux-arm64-gnu", | ||
"os": [ | ||
"linux" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-linux-arm64-musl", | ||
"os": [ | ||
"linux" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-linux-x64-gnu", | ||
"os": [ | ||
"linux" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-linux-x64-musl", | ||
"os": [ | ||
"linux" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "4.0.48", | ||
"version": "4.0.50", | ||
"name": "@remotion/compositor-win32-x64-msvc", | ||
"os": [ | ||
"win32" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// Automatically generated on publish | ||
export const VERSION = '4.0.48'; | ||
export const VERSION = '4.0.50'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.