@remotion/studio 4.0.153 → 4.0.154
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +85 -0
- package/dist/api/delete-static-file.d.ts +3 -0
- package/dist/api/delete-static-file.js +16 -0
- package/dist/api/helpers/calc-new-props.d.ts +11 -0
- package/dist/api/helpers/calc-new-props.js +36 -0
- package/dist/api/save-default-props.d.ts +7 -7
- package/dist/api/save-default-props.js +8 -27
- package/dist/api/update-default-props.d.ts +6 -0
- package/dist/api/update-default-props.js +21 -0
- package/dist/api/watch-public-folder.d.ts +13 -0
- package/dist/api/watch-public-folder.js +28 -0
- package/dist/api/watch-static-file.d.ts +1 -2
- package/dist/api/watch-static-file.js +5 -12
- package/dist/components/Editor.js +2 -1
- package/dist/components/PlayPause.js +1 -0
- package/dist/components/RenderModal/DataEditor.js +1 -1
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +7 -7
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +9 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +26 -9
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +10 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +9 -9
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +12 -12
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +6 -6
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +7 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +38 -15
- package/dist/components/RenderQueue/actions.js +15 -38
- package/dist/components/TopPanel.d.ts +5 -5
- package/dist/components/call-api.d.ts +2 -0
- package/dist/components/call-api.js +28 -0
- package/dist/esm/index.mjs +119 -57
- package/dist/esm/internals.mjs +428 -378
- package/dist/helpers/client-id.d.ts +2 -2
- package/dist/helpers/client-id.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -1
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
> @remotion/studio@4.0.149 test /Users/jonathanburger/remotion/packages/studio
|
|
3
|
+
> bun test src
|
|
4
|
+
|
|
5
|
+
[0m[1mbun test [0m[2mv1.1.7 (07cefe63)[0m
|
|
6
|
+
[0m
|
|
7
|
+
src/test/stringify-default-props.test.ts:
|
|
8
|
+
[0m[32m✓[0m[0m[1m Should stringify default props correctly[0m [0m[2m[1.64ms[0m[2m][0m
|
|
9
|
+
[0m[32m✓[0m[0m[1m Should stringify default props correctly[0m [0m[2m[1.24ms[0m[2m][0m
|
|
10
|
+
[0m
|
|
11
|
+
src/test/sequenced-timeline.test.ts:
|
|
12
|
+
[0m[32m✓[0m[0m[1m Should calculate sequences correctly[0m [0m[2m[3.46ms[0m[2m][0m
|
|
13
|
+
[0m
|
|
14
|
+
src/test/create-zod-values.test.ts:
|
|
15
|
+
[0m[32m✓[0m[0m[1m Should be able to create a string[0m [0m[2m[[1m12.48ms[0m[2m][0m
|
|
16
|
+
[0m[32m✓[0m[0m[1m Should be able to create a number[0m [0m[2m[0.48ms[0m[2m][0m
|
|
17
|
+
[0m[32m✓[0m[0m[1m Should be able to create an object[0m [0m[2m[0.28ms[0m[2m][0m
|
|
18
|
+
[0m[32m✓[0m[0m[1m Should be able to create an array[0m [0m[2m[0.36ms[0m[2m][0m
|
|
19
|
+
[0m[32m✓[0m[0m[1m Should be able to create a union[0m [0m[2m[0.20ms[0m[2m][0m
|
|
20
|
+
[0m[32m✓[0m[0m[1m Zod literal[0m [0m[2m[0.09ms[0m[2m][0m
|
|
21
|
+
[0m[32m✓[0m[0m[1m Should be able to create a discriminated union[0m [0m[2m[0.50ms[0m[2m][0m
|
|
22
|
+
[0m[32m✓[0m[0m[1m Zod instanceof[0m [0m[2m[0.13ms[0m[2m][0m
|
|
23
|
+
[0m[32m✓[0m[0m[1m Zod intersection[0m [0m[2m[0.29ms[0m[2m][0m
|
|
24
|
+
[0m[32m✓[0m[0m[1m Zod tuples[0m [0m[2m[0.16ms[0m[2m][0m
|
|
25
|
+
[0m[32m✓[0m[0m[1m Zod record[0m [0m[2m[0.27ms[0m[2m][0m
|
|
26
|
+
[0m[32m✓[0m[0m[1m Zod map[0m [0m[2m[0.08ms[0m[2m][0m
|
|
27
|
+
[0m[32m✓[0m[0m[1m Zod lazy[0m [0m[2m[0.08ms[0m[2m][0m
|
|
28
|
+
[0m[32m✓[0m[0m[1m Zod set[0m [0m[2m[0.10ms[0m[2m][0m
|
|
29
|
+
[0m[32m✓[0m[0m[1m Zod function[0m [0m[2m[0.15ms[0m[2m][0m
|
|
30
|
+
[0m[32m✓[0m[0m[1m Zod undefined[0m [0m[2m[0.07ms[0m[2m][0m
|
|
31
|
+
[0m[32m✓[0m[0m[1m Zod null[0m [0m[2m[0.07ms[0m[2m][0m
|
|
32
|
+
[0m[32m✓[0m[0m[1m Zod enum[0m [0m[2m[0.06ms[0m[2m][0m
|
|
33
|
+
[0m[32m✓[0m[0m[1m Zod nativeEnum[0m [0m[2m[0.09ms[0m[2m][0m
|
|
34
|
+
[0m[32m✓[0m[0m[1m Zod optional[0m [0m[2m[0.07ms[0m[2m][0m
|
|
35
|
+
[0m[32m✓[0m[0m[1m Zod nullable[0m [0m[2m[0.07ms[0m[2m][0m
|
|
36
|
+
[0m[32m✓[0m[0m[1m Zod undefined[0m [0m[2m[0.07ms[0m[2m][0m
|
|
37
|
+
[0m[32m✓[0m[0m[1m Zod catch[0m [0m[2m[0.06ms[0m[2m][0m
|
|
38
|
+
[0m[32m✓[0m[0m[1m Zod promise[0m [0m[2m[0.11ms[0m[2m][0m
|
|
39
|
+
[0m[32m✓[0m[0m[1m Zod transform[0m [0m[2m[0.07ms[0m[2m][0m
|
|
40
|
+
[0m[32m✓[0m[0m[1m Zod branded[0m [0m[2m[0.10ms[0m[2m][0m
|
|
41
|
+
[0m[32m✓[0m[0m[1m Zod lazy[0m [0m[2m[0.41ms[0m[2m][0m
|
|
42
|
+
[0m[32m✓[0m[0m[1m Zod coerce[0m [0m[2m[0.37ms[0m[2m][0m
|
|
43
|
+
[0m[32m✓[0m[0m[1m Zod strict[0m [0m[2m[0.12ms[0m[2m][0m
|
|
44
|
+
[0m[32m✓[0m[0m[1m Should create a color[0m [0m[2m[0.09ms[0m[2m][0m
|
|
45
|
+
[0m[32m✓[0m[0m[1m Should create a textarea[0m [0m[2m[0.05ms[0m[2m][0m
|
|
46
|
+
[0m
|
|
47
|
+
src/test/folder-tree.test.ts:
|
|
48
|
+
[0m[32m✓[0m[0m[1m Should create a good folder tree with 1 item inside and 1 item outside[0m [0m[2m[1.66ms[0m[2m][0m
|
|
49
|
+
[0m[32m✓[0m[0m[1m Should handle nested folders well[0m [0m[2m[0.49ms[0m[2m][0m
|
|
50
|
+
[0m[32m✓[0m[0m[1m Should throw if two folders with the same name[0m [0m[2m[0.30ms[0m[2m][0m
|
|
51
|
+
[0m
|
|
52
|
+
src/test/big-timeline.test.ts:
|
|
53
|
+
[0m[32m✓[0m[0m[1m Should calculate timeline as expected[0m [0m[2m[6.91ms[0m[2m][0m
|
|
54
|
+
[0m
|
|
55
|
+
src/test/smooth-zoom.test.ts:
|
|
56
|
+
[0m[32m✓[0m[0m[1m Smoothen zoom[0m [0m[2m[0.04ms[0m[2m][0m
|
|
57
|
+
[0m[32m✓[0m[0m[1m Unsmoothen zoom[0m [0m[2m[0.04ms[0m[2m][0m
|
|
58
|
+
[0m
|
|
59
|
+
src/test/validate-gui-output-filename.test.ts:
|
|
60
|
+
[0m[32m✓[0m[0m[1m Should catch dot after slash[0m [0m[2m[2.97ms[0m[2m][0m
|
|
61
|
+
[0m[32m✓[0m[0m[1m Should catch dot in front [0m [0m[2m[0.03ms[0m[2m][0m
|
|
62
|
+
[0m
|
|
63
|
+
src/test/timeline-sequence-layout.test.ts:
|
|
64
|
+
[0m[32m✓[0m[0m[1m Should test timeline sequence layout without max media duration[0m [0m[2m[0.31ms[0m[2m][0m
|
|
65
|
+
[0m[32m✓[0m[0m[1m Should test timeline sequence layout with max media duration[0m [0m[2m[0.05ms[0m[2m][0m
|
|
66
|
+
[0m
|
|
67
|
+
src/test/extract-zod-enums.test.ts:
|
|
68
|
+
[0m[32m✓[0m[0m[1m Extract Zod enums[0m [0m[2m[0.13ms[0m[2m][0m
|
|
69
|
+
[0m[32m✓[0m[0m[1m Extract Zod enums #2[0m [0m[2m[0.42ms[0m[2m][0m
|
|
70
|
+
[0m
|
|
71
|
+
src/test/color-math.test.ts:
|
|
72
|
+
[0m[32m✓[0m[0m[1m Color math[0m [0m[2m[0.74ms[0m[2m][0m
|
|
73
|
+
[0m
|
|
74
|
+
src/test/format-time.test.ts:
|
|
75
|
+
[0m[32m✓[0m[0m[1m Format time[0m [0m[2m[0.24ms[0m[2m][0m
|
|
76
|
+
[0m
|
|
77
|
+
src/test/timeline.test.ts:
|
|
78
|
+
[0m[32m✓[0m[0m[1m Should calculate timeline with no sequences[0m [0m[2m[0.05ms[0m[2m][0m
|
|
79
|
+
[0m[32m✓[0m[0m[1m Should calculate a basic timeline[0m [0m[2m[0.14ms[0m[2m][0m
|
|
80
|
+
[0m[32m✓[0m[0m[1m Should follow order of nesting[0m [0m[2m[0.13ms[0m[2m][0m
|
|
81
|
+
|
|
82
|
+
[0m[32m 51 pass[0m
|
|
83
|
+
[0m[2m 0 fail[0m
|
|
84
|
+
67 expect() calls
|
|
85
|
+
Ran 51 tests across 12 files. [0m[2m[[1m119.00ms[0m[2m][0m
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteStaticFile = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const call_api_1 = require("../components/call-api");
|
|
6
|
+
const deleteStaticFile = async (relativePath) => {
|
|
7
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
8
|
+
throw new Error('deleteStaticFile() is only available in the Studio');
|
|
9
|
+
}
|
|
10
|
+
if (relativePath.startsWith(window.remotion_staticBase)) {
|
|
11
|
+
relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
|
|
12
|
+
}
|
|
13
|
+
const res = await (0, call_api_1.callApi)('/api/delete-static-file', { relativePath });
|
|
14
|
+
return res;
|
|
15
|
+
};
|
|
16
|
+
exports.deleteStaticFile = deleteStaticFile;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnyComposition } from 'remotion';
|
|
2
|
+
import type { AnyZodObject } from 'zod';
|
|
3
|
+
export type UpdateDefaultPropsFunction = (currentValues: {
|
|
4
|
+
schema: AnyZodObject | null;
|
|
5
|
+
savedDefaultProps: Record<string, unknown>;
|
|
6
|
+
unsavedDefaultProps: Record<string, unknown>;
|
|
7
|
+
}) => Record<string, unknown>;
|
|
8
|
+
export declare const calcNewProps: (compositionId: string, defaultProps: UpdateDefaultPropsFunction) => {
|
|
9
|
+
composition: AnyComposition;
|
|
10
|
+
generatedDefaultProps: Record<string, unknown>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calcNewProps = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const calcNewProps = (compositionId, defaultProps) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
8
|
+
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
|
9
|
+
}
|
|
10
|
+
const { compositionsRef, editorPropsProviderRef } = remotion_1.Internals;
|
|
11
|
+
const compositionsStore = compositionsRef.current;
|
|
12
|
+
if (!compositionsStore) {
|
|
13
|
+
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
14
|
+
}
|
|
15
|
+
const compositions = compositionsStore.getCompositions();
|
|
16
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
17
|
+
if (!composition) {
|
|
18
|
+
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
const propsStore = editorPropsProviderRef.current;
|
|
21
|
+
if (!propsStore) {
|
|
22
|
+
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
23
|
+
}
|
|
24
|
+
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
|
26
|
+
const generatedDefaultProps = defaultProps({
|
|
27
|
+
schema: composition.schema,
|
|
28
|
+
savedDefaultProps,
|
|
29
|
+
unsavedDefaultProps,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
composition,
|
|
33
|
+
generatedDefaultProps,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.calcNewProps = calcNewProps;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { UpdateDefaultPropsFunction } from './helpers/calc-new-props';
|
|
2
|
+
/**
|
|
3
|
+
* Saves the defaultProps for a composition back to the root file.
|
|
4
|
+
* @param {string} compositionId The ID of the composition to save the defaultProps for.
|
|
5
|
+
* @param {SafeDefaultPropsFunction} defaultProps A function that returns the new defaultProps for the composition.
|
|
6
|
+
*/
|
|
7
7
|
export declare const saveDefaultProps: ({ compositionId, defaultProps, }: {
|
|
8
8
|
compositionId: string;
|
|
9
|
-
defaultProps:
|
|
9
|
+
defaultProps: UpdateDefaultPropsFunction;
|
|
10
10
|
}) => Promise<void>;
|
|
@@ -24,42 +24,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.saveDefaultProps = void 0;
|
|
27
|
-
const remotion_1 = require("remotion");
|
|
28
27
|
const extract_enum_json_paths_1 = require("../components/RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
29
28
|
const actions_1 = require("../components/RenderQueue/actions");
|
|
29
|
+
const calc_new_props_1 = require("./helpers/calc-new-props");
|
|
30
|
+
/**
|
|
31
|
+
* Saves the defaultProps for a composition back to the root file.
|
|
32
|
+
* @param {string} compositionId The ID of the composition to save the defaultProps for.
|
|
33
|
+
* @param {SafeDefaultPropsFunction} defaultProps A function that returns the new defaultProps for the composition.
|
|
34
|
+
*/
|
|
30
35
|
const saveDefaultProps = async ({ compositionId, defaultProps, }) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
33
|
-
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
|
34
|
-
}
|
|
35
36
|
try {
|
|
36
37
|
await Promise.resolve().then(() => __importStar(require('zod')));
|
|
37
38
|
}
|
|
38
|
-
catch (
|
|
39
|
+
catch (_a) {
|
|
39
40
|
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
|
|
40
41
|
}
|
|
41
42
|
const z = await Promise.resolve().then(() => __importStar(require('zod')));
|
|
42
|
-
const {
|
|
43
|
-
const compositionsStore = compositionsRef.current;
|
|
44
|
-
if (!compositionsStore) {
|
|
45
|
-
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
46
|
-
}
|
|
47
|
-
const compositions = compositionsStore.getCompositions();
|
|
48
|
-
const composition = compositions.find((c) => c.id === compositionId);
|
|
49
|
-
if (!composition) {
|
|
50
|
-
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
|
51
|
-
}
|
|
52
|
-
const propsStore = editorPropsProviderRef.current;
|
|
53
|
-
if (!propsStore) {
|
|
54
|
-
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
55
|
-
}
|
|
56
|
-
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
57
|
-
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
|
58
|
-
const generatedDefaultProps = defaultProps({
|
|
59
|
-
schema: composition.schema,
|
|
60
|
-
savedDefaultProps,
|
|
61
|
-
unsavedDefaultProps,
|
|
62
|
-
});
|
|
43
|
+
const { generatedDefaultProps, composition } = (0, calc_new_props_1.calcNewProps)(compositionId, defaultProps);
|
|
63
44
|
const res = await (0, actions_1.callUpdateDefaultPropsApi)(compositionId, generatedDefaultProps, composition.schema ? (0, extract_enum_json_paths_1.extractEnumJsonPaths)(composition.schema, z, []) : []);
|
|
64
45
|
if (res.success) {
|
|
65
46
|
return Promise.resolve();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UpdateDefaultPropsFunction } from './helpers/calc-new-props';
|
|
2
|
+
export declare const PROPS_UPDATED_EXTERNALLY = "remotion.propsUpdatedExternally";
|
|
3
|
+
export declare const updateDefaultProps: ({ compositionId, defaultProps, }: {
|
|
4
|
+
compositionId: string;
|
|
5
|
+
defaultProps: UpdateDefaultPropsFunction;
|
|
6
|
+
}) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateDefaultProps = exports.PROPS_UPDATED_EXTERNALLY = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const calc_new_props_1 = require("./helpers/calc-new-props");
|
|
6
|
+
exports.PROPS_UPDATED_EXTERNALLY = 'remotion.propsUpdatedExternally';
|
|
7
|
+
const updateDefaultProps = ({ compositionId, defaultProps, }) => {
|
|
8
|
+
const { generatedDefaultProps, composition } = (0, calc_new_props_1.calcNewProps)(compositionId, defaultProps);
|
|
9
|
+
const propsStore = remotion_1.Internals.editorPropsProviderRef.current;
|
|
10
|
+
if (!propsStore) {
|
|
11
|
+
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
12
|
+
}
|
|
13
|
+
propsStore.setProps((prev) => {
|
|
14
|
+
return {
|
|
15
|
+
...prev,
|
|
16
|
+
[composition.id]: generatedDefaultProps,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
window.dispatchEvent(new CustomEvent(exports.PROPS_UPDATED_EXTERNALLY));
|
|
20
|
+
};
|
|
21
|
+
exports.updateDefaultProps = updateDefaultProps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type StaticFile } from './get-static-files';
|
|
2
|
+
type WatcherCallback = (newFiles: StaticFile[]) => void;
|
|
3
|
+
export declare const WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
4
|
+
/**
|
|
5
|
+
* @description Watch for changes in the public folder.
|
|
6
|
+
* @param {Function} callback - A callback function to be called when the file changes.
|
|
7
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
8
|
+
* @see [Documentation](https://remotion.dev/docs/studio/watch-public-folder)
|
|
9
|
+
*/
|
|
10
|
+
export declare const watchPublicFolder: (callback: WatcherCallback) => {
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watchPublicFolder = exports.WATCH_REMOTION_STATIC_FILES = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const get_static_files_1 = require("./get-static-files");
|
|
6
|
+
exports.WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
7
|
+
/**
|
|
8
|
+
* @description Watch for changes in the public folder.
|
|
9
|
+
* @param {Function} callback - A callback function to be called when the file changes.
|
|
10
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
11
|
+
* @see [Documentation](https://remotion.dev/docs/studio/watch-public-folder)
|
|
12
|
+
*/
|
|
13
|
+
const watchPublicFolder = (callback) => {
|
|
14
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.warn('The API is only available while using the Remotion Studio.');
|
|
17
|
+
return { cancel: () => undefined };
|
|
18
|
+
}
|
|
19
|
+
const emitUpdate = () => {
|
|
20
|
+
callback((0, get_static_files_1.getStaticFiles)());
|
|
21
|
+
};
|
|
22
|
+
window.addEventListener(exports.WATCH_REMOTION_STATIC_FILES, emitUpdate);
|
|
23
|
+
const cancel = () => {
|
|
24
|
+
return window.removeEventListener(exports.WATCH_REMOTION_STATIC_FILES, emitUpdate);
|
|
25
|
+
};
|
|
26
|
+
return { cancel };
|
|
27
|
+
};
|
|
28
|
+
exports.watchPublicFolder = watchPublicFolder;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { StaticFile } from './get-static-files';
|
|
2
2
|
type WatcherCallback = (newData: StaticFile | null) => void;
|
|
3
|
-
export declare const WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
4
3
|
export type WatchRemotionStaticFilesPayload = {
|
|
5
4
|
files: StaticFile[];
|
|
6
5
|
};
|
|
@@ -9,7 +8,7 @@ export type WatchRemotionStaticFilesPayload = {
|
|
|
9
8
|
* @param {string} fileName - The name of the static file to watch for changes.
|
|
10
9
|
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
11
10
|
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
12
|
-
* @see [Documentation](https://
|
|
11
|
+
* @see [Documentation](https://remotion.dev/docs/studio/watch-static-file)
|
|
13
12
|
*/
|
|
14
13
|
export declare const watchStaticFile: (fileName: string, callback: WatcherCallback) => {
|
|
15
14
|
cancel: () => void;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.watchStaticFile =
|
|
3
|
+
exports.watchStaticFile = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
|
-
|
|
5
|
+
const watch_public_folder_1 = require("./watch-public-folder");
|
|
6
6
|
/**
|
|
7
7
|
* @description Watch for changes in a specific static file.
|
|
8
8
|
* @param {string} fileName - The name of the static file to watch for changes.
|
|
9
9
|
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
10
10
|
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
11
|
-
* @see [Documentation](https://
|
|
11
|
+
* @see [Documentation](https://remotion.dev/docs/studio/watch-static-file)
|
|
12
12
|
*/
|
|
13
13
|
const watchStaticFile = (fileName, callback) => {
|
|
14
|
-
// Check if function is called in Remotion Studio
|
|
15
14
|
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
16
15
|
// eslint-disable-next-line no-console
|
|
17
16
|
console.warn('The API is only available while using the Remotion Studio.');
|
|
@@ -24,9 +23,7 @@ const watchStaticFile = (fileName, callback) => {
|
|
|
24
23
|
? withoutStaticBase.slice(1)
|
|
25
24
|
: withoutStaticBase;
|
|
26
25
|
let prevFileData = window.remotion_staticFiles.find((file) => file.name === withoutLeadingSlash);
|
|
27
|
-
|
|
28
|
-
const checkFile = (event) => {
|
|
29
|
-
const staticFiles = event.detail.files;
|
|
26
|
+
const { cancel } = (0, watch_public_folder_1.watchPublicFolder)((staticFiles) => {
|
|
30
27
|
// Check for user specified file
|
|
31
28
|
const newFileData = staticFiles.find((file) => file.name === withoutLeadingSlash);
|
|
32
29
|
if (!newFileData) {
|
|
@@ -42,11 +39,7 @@ const watchStaticFile = (fileName, callback) => {
|
|
|
42
39
|
callback(newFileData); // File is added or modified
|
|
43
40
|
prevFileData = newFileData;
|
|
44
41
|
}
|
|
45
|
-
};
|
|
46
|
-
window.addEventListener(exports.WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
47
|
-
const cancel = () => {
|
|
48
|
-
return window.removeEventListener(exports.WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
49
|
-
};
|
|
42
|
+
});
|
|
50
43
|
return { cancel };
|
|
51
44
|
};
|
|
52
45
|
exports.watchStaticFile = watchStaticFile;
|
|
@@ -46,7 +46,8 @@ const background = {
|
|
|
46
46
|
position: 'absolute',
|
|
47
47
|
};
|
|
48
48
|
const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
|
|
49
|
-
exports.BUFFER_STATE_DELAY_IN_MILLISECONDS = typeof process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === 'undefined'
|
|
49
|
+
exports.BUFFER_STATE_DELAY_IN_MILLISECONDS = typeof process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === 'undefined' ||
|
|
50
|
+
process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === null
|
|
50
51
|
? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS
|
|
51
52
|
: Number(process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS);
|
|
52
53
|
const Editor = ({ Root, readOnlyStudio }) => {
|
|
@@ -208,6 +208,7 @@ const PlayPause = ({ playbackRate, loop, bufferStateDelayInMilliseconds }) => {
|
|
|
208
208
|
let stopped = false;
|
|
209
209
|
const onBuffer = () => {
|
|
210
210
|
requestAnimationFrame(() => {
|
|
211
|
+
stopped = false;
|
|
211
212
|
timeout = setTimeout(() => {
|
|
212
213
|
if (!stopped) {
|
|
213
214
|
setShowBufferState(true);
|
|
@@ -296,6 +296,6 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, mayS
|
|
|
296
296
|
}
|
|
297
297
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
298
298
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
299
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, {
|
|
299
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { unsavedDefaultProps: defaultProps, setValue: setDefaultProps, schema: schema, zodValidationResult: zodValidationResult, savedDefaultProps: unresolvedComposition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}, setValue: setDefaultProps, onSave: onUpdate, showSaveButton: showSaveButton, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema }))] }));
|
|
300
300
|
};
|
|
301
301
|
exports.DataEditor = DataEditor;
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import type { SerializedJSONWithCustomFields } from 'remotion';
|
|
3
3
|
import type { z } from 'zod';
|
|
4
4
|
export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
5
|
-
value: unknown;
|
|
6
|
-
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
|
-
onSave: () => void;
|
|
8
|
-
showSaveButton: boolean;
|
|
9
|
-
serializedJSON: SerializedJSONWithCustomFields | null;
|
|
10
|
-
defaultProps: Record<string, unknown>;
|
|
11
|
-
schema: z.ZodTypeAny;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
readonly setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
|
+
readonly onSave: () => void;
|
|
8
|
+
readonly showSaveButton: boolean;
|
|
9
|
+
readonly serializedJSON: SerializedJSONWithCustomFields | null;
|
|
10
|
+
readonly defaultProps: Record<string, unknown>;
|
|
11
|
+
readonly schema: z.ZodTypeAny;
|
|
12
12
|
}>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AnyZodObject, z } from 'zod';
|
|
3
3
|
export declare const SchemaEditor: React.FC<{
|
|
4
|
-
schema: AnyZodObject;
|
|
5
|
-
|
|
6
|
-
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
|
-
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
8
|
-
|
|
9
|
-
onSave: (updater: (oldState: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
10
|
-
showSaveButton: boolean;
|
|
11
|
-
saving: boolean;
|
|
12
|
-
saveDisabledByParent: boolean;
|
|
4
|
+
readonly schema: AnyZodObject;
|
|
5
|
+
readonly unsavedDefaultProps: Record<string, unknown>;
|
|
6
|
+
readonly setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
|
+
readonly zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
8
|
+
readonly savedDefaultProps: Record<string, unknown>;
|
|
9
|
+
readonly onSave: (updater: (oldState: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
10
|
+
readonly showSaveButton: boolean;
|
|
11
|
+
readonly saving: boolean;
|
|
12
|
+
readonly saveDisabledByParent: boolean;
|
|
13
13
|
}>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SchemaEditor = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const update_default_props_1 = require("../../../api/update-default-props");
|
|
6
7
|
const document_title_1 = require("../../../helpers/document-title");
|
|
7
8
|
const use_keybinding_1 = require("../../../helpers/use-keybinding");
|
|
8
9
|
const is_menu_item_1 = require("../../Menu/is-menu-item");
|
|
@@ -10,30 +11,46 @@ const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
|
10
11
|
const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
|
|
11
12
|
const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
12
13
|
const deep_equal_1 = require("./deep-equal");
|
|
14
|
+
const local_state_1 = require("./local-state");
|
|
13
15
|
const scrollable = {
|
|
14
16
|
display: 'flex',
|
|
15
17
|
flexDirection: 'column',
|
|
16
18
|
overflowY: 'auto',
|
|
17
19
|
};
|
|
18
|
-
const SchemaEditor = ({ schema,
|
|
20
|
+
const SchemaEditor = ({ schema, unsavedDefaultProps, setValue, zodValidationResult, savedDefaultProps, onSave, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
19
21
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
22
|
+
const [revision, setRevision] = (0, react_1.useState)(0);
|
|
23
|
+
const revisionState = (0, react_1.useMemo)(() => {
|
|
24
|
+
return {
|
|
25
|
+
childResetRevision: revision,
|
|
26
|
+
};
|
|
27
|
+
}, [revision]);
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
const bumpRevision = () => {
|
|
30
|
+
setRevision((old) => old + 1);
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener(update_default_props_1.PROPS_UPDATED_EXTERNALLY, bumpRevision);
|
|
33
|
+
return () => {
|
|
34
|
+
window.removeEventListener(update_default_props_1.PROPS_UPDATED_EXTERNALLY, bumpRevision);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
20
37
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
21
38
|
if (!z) {
|
|
22
39
|
throw new Error('expected zod');
|
|
23
40
|
}
|
|
24
41
|
const hasChanged = (0, react_1.useMemo)(() => {
|
|
25
|
-
return !(0, deep_equal_1.deepEqual)(
|
|
26
|
-
}, [
|
|
42
|
+
return !(0, deep_equal_1.deepEqual)(savedDefaultProps, unsavedDefaultProps);
|
|
43
|
+
}, [savedDefaultProps, unsavedDefaultProps]);
|
|
27
44
|
(0, react_1.useEffect)(() => {
|
|
28
45
|
(0, document_title_1.setUnsavedProps)(hasChanged);
|
|
29
46
|
}, [hasChanged]);
|
|
30
47
|
const onQuickSave = (0, react_1.useCallback)(() => {
|
|
31
48
|
if (hasChanged && showSaveButton) {
|
|
32
49
|
onSave(() => {
|
|
33
|
-
return
|
|
50
|
+
return unsavedDefaultProps;
|
|
34
51
|
});
|
|
35
52
|
}
|
|
36
|
-
}, [hasChanged, onSave, showSaveButton,
|
|
53
|
+
}, [hasChanged, onSave, showSaveButton, unsavedDefaultProps]);
|
|
37
54
|
(0, react_1.useEffect)(() => {
|
|
38
55
|
const save = keybindings.registerKeybinding({
|
|
39
56
|
event: 'keydown',
|
|
@@ -52,10 +69,10 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultPro
|
|
|
52
69
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
70
|
const typeName = def.typeName;
|
|
54
71
|
const reset = (0, react_1.useCallback)(() => {
|
|
55
|
-
setValue(
|
|
56
|
-
}, [
|
|
72
|
+
setValue(savedDefaultProps);
|
|
73
|
+
}, [savedDefaultProps, setValue]);
|
|
57
74
|
if (!zodValidationResult.success) {
|
|
58
|
-
const defaultPropsValid = schema.safeParse(
|
|
75
|
+
const defaultPropsValid = schema.safeParse(savedDefaultProps);
|
|
59
76
|
if (!defaultPropsValid.success) {
|
|
60
77
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidDefaultProps, { zodValidationResult: zodValidationResult });
|
|
61
78
|
}
|
|
@@ -64,6 +81,6 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultPro
|
|
|
64
81
|
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
65
82
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
66
83
|
}
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null,
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(local_state_1.RevisionContext.Provider, { value: revisionState, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, unsavedValue: unsavedDefaultProps, setValue: setValue, jsonPath: [], schema: schema, savedValue: savedDefaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }) }));
|
|
68
85
|
};
|
|
69
86
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -3,15 +3,15 @@ import type { z } from 'zod';
|
|
|
3
3
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodArrayEditor: React.FC<{
|
|
6
|
-
schema: z.ZodTypeAny;
|
|
7
|
-
jsonPath: JSONPath;
|
|
8
|
-
value: unknown[];
|
|
9
|
-
defaultValue: unknown[];
|
|
10
|
-
setValue: UpdaterFunction<unknown[]>;
|
|
11
|
-
onSave: UpdaterFunction<unknown[]>;
|
|
12
|
-
showSaveButton: boolean;
|
|
13
|
-
onRemove: null | (() => void);
|
|
14
|
-
saving: boolean;
|
|
15
|
-
saveDisabledByParent: boolean;
|
|
16
|
-
mayPad: boolean;
|
|
6
|
+
readonly schema: z.ZodTypeAny;
|
|
7
|
+
readonly jsonPath: JSONPath;
|
|
8
|
+
readonly value: unknown[];
|
|
9
|
+
readonly defaultValue: unknown[];
|
|
10
|
+
readonly setValue: UpdaterFunction<unknown[]>;
|
|
11
|
+
readonly onSave: UpdaterFunction<unknown[]>;
|
|
12
|
+
readonly showSaveButton: boolean;
|
|
13
|
+
readonly onRemove: null | (() => void);
|
|
14
|
+
readonly saving: boolean;
|
|
15
|
+
readonly saveDisabledByParent: boolean;
|
|
16
|
+
readonly mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -38,10 +38,10 @@ const deep_equal_1 = require("./deep-equal");
|
|
|
38
38
|
const local_state_1 = require("./local-state");
|
|
39
39
|
const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
40
40
|
const { localValue, onChange, RevisionContextProvider, reset } = (0, local_state_1.useLocalState)({
|
|
41
|
-
value,
|
|
41
|
+
unsavedValue: value,
|
|
42
42
|
schema,
|
|
43
43
|
setValue,
|
|
44
|
-
defaultValue,
|
|
44
|
+
savedValue: defaultValue,
|
|
45
45
|
});
|
|
46
46
|
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
47
47
|
const def = schema._def;
|
|
@@ -3,15 +3,15 @@ import type { z } from 'zod';
|
|
|
3
3
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodBooleanEditor: React.FC<{
|
|
6
|
-
schema: z.ZodTypeAny;
|
|
7
|
-
jsonPath: JSONPath;
|
|
8
|
-
value: boolean;
|
|
9
|
-
setValue: UpdaterFunction<boolean>;
|
|
10
|
-
defaultValue: boolean;
|
|
11
|
-
onSave: UpdaterFunction<boolean>;
|
|
12
|
-
onRemove: null | (() => void);
|
|
13
|
-
showSaveButton: boolean;
|
|
14
|
-
saving: boolean;
|
|
15
|
-
saveDisabledByParent: boolean;
|
|
16
|
-
mayPad: boolean;
|
|
6
|
+
readonly schema: z.ZodTypeAny;
|
|
7
|
+
readonly jsonPath: JSONPath;
|
|
8
|
+
readonly value: boolean;
|
|
9
|
+
readonly setValue: UpdaterFunction<boolean>;
|
|
10
|
+
readonly defaultValue: boolean;
|
|
11
|
+
readonly onSave: UpdaterFunction<boolean>;
|
|
12
|
+
readonly onRemove: null | (() => void);
|
|
13
|
+
readonly showSaveButton: boolean;
|
|
14
|
+
readonly saving: boolean;
|
|
15
|
+
readonly saveDisabledByParent: boolean;
|
|
16
|
+
readonly mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -14,8 +14,8 @@ const ZodBooleanEditor = ({ schema, jsonPath, value, setValue, onSave, defaultVa
|
|
|
14
14
|
const { localValue, onChange, reset } = (0, local_state_1.useLocalState)({
|
|
15
15
|
schema,
|
|
16
16
|
setValue,
|
|
17
|
-
value,
|
|
18
|
-
defaultValue,
|
|
17
|
+
unsavedValue: value,
|
|
18
|
+
savedValue: defaultValue,
|
|
19
19
|
});
|
|
20
20
|
const onToggle = (0, react_1.useCallback)((e) => {
|
|
21
21
|
onChange(() => e.target.checked, false, false);
|