@remotion/studio 4.0.280 → 4.0.284
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-make.log +2 -2
- package/dist/api/get-zod-schema-from-primitive.d.ts +2 -0
- package/dist/api/get-zod-schema-from-primitive.js +13 -0
- package/dist/api/use-visual-control.d.ts +7 -0
- package/dist/api/use-visual-control.js +58 -0
- package/dist/components/RenderModal/FrameRangeSetting.js +10 -9
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +17 -0
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +91 -0
- package/dist/components/VisualControls/ClickableFileName.d.ts +3 -0
- package/dist/components/VisualControls/ClickableFileName.js +39 -0
- package/dist/components/VisualControls/VisualControlHandle.d.ts +8 -0
- package/dist/components/VisualControls/VisualControlHandle.js +34 -0
- package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -0
- package/dist/components/VisualControls/VisualControlsContent.js +29 -0
- package/dist/components/VisualControls/VisualControlsTabs.d.ts +1 -0
- package/dist/components/VisualControls/VisualControlsTabs.js +11 -0
- package/dist/components/VisualControls/get-original-stack-trace.d.ts +2 -0
- package/dist/components/VisualControls/get-original-stack-trace.js +23 -0
- package/dist/esm/internals.mjs +36 -12
- package/dist/esm/previewEntry.mjs +36 -12
- package/dist/esm/renderEntry.mjs +38 -14
- package/dist/visual-controls/VisualControls.d.ts +36 -0
- package/dist/visual-controls/VisualControls.js +118 -0
- package/dist/visual-controls/get-current-edited-value.d.ts +6 -0
- package/dist/visual-controls/get-current-edited-value.js +9 -0
- package/package.json +9 -9
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-make.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @remotion/studio@4.0.
|
|
3
|
+
> @remotion/studio@4.0.284 make /Users/jonathanburger/remotion/packages/studio
|
|
4
4
|
> tsc -d && bun --env-file=../.env.bundle bundle.ts
|
|
5
5
|
|
|
6
|
-
[0m[2m[[
|
|
6
|
+
[0m[2m[[1m139.47ms[0m[2m][0m Generated.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getZodSchemaFromPrimitive = void 0;
|
|
4
|
+
const getZodSchemaFromPrimitive = (value, z) => {
|
|
5
|
+
if (typeof value === 'string') {
|
|
6
|
+
return z.string();
|
|
7
|
+
}
|
|
8
|
+
if (typeof value === 'number') {
|
|
9
|
+
return z.number();
|
|
10
|
+
}
|
|
11
|
+
throw new Error('Unknown primitive type');
|
|
12
|
+
};
|
|
13
|
+
exports.getZodSchemaFromPrimitive = getZodSchemaFromPrimitive;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVisualControl = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const get_zod_if_possible_1 = require("../components/get-zod-if-possible");
|
|
7
|
+
const VisualControls_1 = require("../visual-controls/VisualControls");
|
|
8
|
+
const get_zod_schema_from_primitive_1 = require("./get-zod-schema-from-primitive");
|
|
9
|
+
const useVisualControl = () => {
|
|
10
|
+
const { addHook, removeHook, setControl, updateHandles } = (0, react_1.useContext)(VisualControls_1.SetVisualControlsContext);
|
|
11
|
+
const { handles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
12
|
+
const changed = (0, react_1.useRef)(false);
|
|
13
|
+
const [stack] = (0, react_1.useState)(() => {
|
|
14
|
+
return new Error().stack;
|
|
15
|
+
});
|
|
16
|
+
const [hook] = (0, react_1.useState)(() => {
|
|
17
|
+
return (0, VisualControls_1.makeHook)(stack);
|
|
18
|
+
});
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
addHook(hook);
|
|
24
|
+
}, [addHook, hook]);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
return () => {
|
|
27
|
+
removeHook(hook);
|
|
28
|
+
};
|
|
29
|
+
}, [hook, removeHook]);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
if (changed.current) {
|
|
32
|
+
updateHandles();
|
|
33
|
+
changed.current = false;
|
|
34
|
+
}
|
|
35
|
+
}, [updateHandles]);
|
|
36
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
37
|
+
return (0, react_1.useMemo)(() => ({
|
|
38
|
+
visualControl(key, value, schema) {
|
|
39
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
if (!z) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
const { same, currentValue } = setControl(hook, key, {
|
|
46
|
+
valueInCode: value,
|
|
47
|
+
unsavedValue: value,
|
|
48
|
+
schema: schema !== null && schema !== void 0 ? schema : (0, get_zod_schema_from_primitive_1.getZodSchemaFromPrimitive)(value, z),
|
|
49
|
+
stack: new Error().stack,
|
|
50
|
+
});
|
|
51
|
+
if (!same) {
|
|
52
|
+
changed.current = true;
|
|
53
|
+
}
|
|
54
|
+
return currentValue;
|
|
55
|
+
},
|
|
56
|
+
}), [handles, hook, setControl, z]);
|
|
57
|
+
};
|
|
58
|
+
exports.useVisualControl = useVisualControl;
|
|
@@ -3,15 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FrameRangeSetting = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
7
|
const layout_1 = require("./layout");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
display: 'flex',
|
|
11
|
-
justifyContent: 'flex-end',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
fontSize: '14px',
|
|
14
|
-
};
|
|
8
|
+
const MultiRangeSlider_1 = require("./MultiRangeSlider");
|
|
9
|
+
const INPUT_WIDTH = 40;
|
|
15
10
|
const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
|
|
16
11
|
const minStartFrame = 0;
|
|
17
12
|
const maxEndFrame = durationInFrames - 1;
|
|
@@ -21,6 +16,12 @@ const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames
|
|
|
21
16
|
const onEndFrameChangedDirectly = (0, react_1.useCallback)((newEndFrame) => {
|
|
22
17
|
setEndFrame(newEndFrame);
|
|
23
18
|
}, [setEndFrame]);
|
|
24
|
-
|
|
19
|
+
const onStartFrameChanged = (0, react_1.useCallback)((newVal) => {
|
|
20
|
+
onStartFrameChangedDirectly(parseInt(newVal, 10));
|
|
21
|
+
}, [onStartFrameChangedDirectly]);
|
|
22
|
+
const onEndFrameChanged = (0, react_1.useCallback)((newVal) => {
|
|
23
|
+
onEndFrameChangedDirectly(parseInt(newVal, 10));
|
|
24
|
+
}, [onEndFrameChangedDirectly]);
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame range" }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.rightRow, children: [(0, jsx_runtime_1.jsx)("div", { style: { width: INPUT_WIDTH }, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { min: minStartFrame, max: endFrame - 1, name: "Start frame", value: startFrame, step: 1, onTextChange: onStartFrameChanged, onValueChange: onStartFrameChangedDirectly, status: "ok", rightAlign: true, style: { width: INPUT_WIDTH } }) }), (0, jsx_runtime_1.jsx)(MultiRangeSlider_1.MultiRangeSlider, { min: minStartFrame, max: maxEndFrame, start: startFrame, end: endFrame, step: 1, onLeftThumbDrag: onStartFrameChangedDirectly, onRightThumbDrag: onEndFrameChangedDirectly }), ' ', (0, jsx_runtime_1.jsx)("div", { style: { width: INPUT_WIDTH }, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { min: startFrame + 1, max: maxEndFrame, name: "End frame", value: endFrame, step: 1, onTextChange: onEndFrameChanged, onValueChange: onEndFrameChangedDirectly, status: "ok", rightAlign: true, style: { width: INPUT_WIDTH } }) })] })] }));
|
|
25
26
|
};
|
|
26
27
|
exports.FrameRangeSetting = FrameRangeSetting;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
|
+
import type { JSONPath } from './zod-types';
|
|
5
|
+
export declare const ZodMatrixEditor: React.FC<{
|
|
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
|
+
}>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ZodMatrixEditor = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
30
|
+
const Fieldset_1 = require("./Fieldset");
|
|
31
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
32
|
+
const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
|
|
33
|
+
const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
|
|
34
|
+
const ZodArrayItemEditor_1 = require("./ZodArrayItemEditor");
|
|
35
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
36
|
+
const create_zod_values_1 = require("./create-zod-values");
|
|
37
|
+
const deep_equal_1 = require("./deep-equal");
|
|
38
|
+
const local_state_1 = require("./local-state");
|
|
39
|
+
const rowStyle = {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
width: '100%',
|
|
43
|
+
};
|
|
44
|
+
const ZodMatrixEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
45
|
+
const { localValue, onChange, RevisionContextProvider, reset } = (0, local_state_1.useLocalState)({
|
|
46
|
+
unsavedValue: value,
|
|
47
|
+
schema,
|
|
48
|
+
setValue,
|
|
49
|
+
savedValue: defaultValue,
|
|
50
|
+
});
|
|
51
|
+
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
52
|
+
const def = schema._def;
|
|
53
|
+
const suffix = (0, react_1.useMemo)(() => {
|
|
54
|
+
return expanded ? ' [' : ' [...] ';
|
|
55
|
+
}, [expanded]);
|
|
56
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
57
|
+
if (!z) {
|
|
58
|
+
throw new Error('expected zod');
|
|
59
|
+
}
|
|
60
|
+
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
61
|
+
const isDefaultValue = (0, react_1.useMemo)(() => {
|
|
62
|
+
return (0, deep_equal_1.deepEqual)(localValue.value, defaultValue);
|
|
63
|
+
}, [defaultValue, localValue]);
|
|
64
|
+
const dimensions = Math.sqrt(localValue.value.length);
|
|
65
|
+
if (!Number.isInteger(dimensions)) {
|
|
66
|
+
throw new Error('Invalid matrix');
|
|
67
|
+
}
|
|
68
|
+
const chunkedItems = (0, react_1.useMemo)(() => {
|
|
69
|
+
return localValue.value.reduce((acc, item, index) => {
|
|
70
|
+
const chunkIndex = Math.floor(index / dimensions);
|
|
71
|
+
acc[chunkIndex] = acc[chunkIndex] || [];
|
|
72
|
+
acc[chunkIndex].push(item);
|
|
73
|
+
return acc;
|
|
74
|
+
}, []);
|
|
75
|
+
}, [localValue.value, dimensions]);
|
|
76
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
}, children: (0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onReset: reset, isDefaultValue: isDefaultValue, jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, onSave: () => {
|
|
80
|
+
onSave(() => localValue.value, false, false);
|
|
81
|
+
}, saveDisabledByParent: saveDisabledByParent, saving: saving, showSaveButton: showSaveButton, valid: localValue.zodValidation.success, handleClick: () => setExpanded(!expanded) }) }), expanded ? ((0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsxs)(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [chunkedItems.map((row, rowIndex) => {
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment
|
|
83
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
84
|
+
, { children: (0, jsx_runtime_1.jsx)("div", { style: rowStyle, children: row.map((item, _index) => {
|
|
85
|
+
var _a;
|
|
86
|
+
const actualIndex = rowIndex * dimensions + _index;
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(ZodArrayItemEditor_1.ZodArrayItemEditor, { onChange: onChange, value: item, def: def, index: actualIndex, jsonPath: jsonPath, defaultValue: (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[actualIndex]) !== null && _a !== void 0 ? _a : (0, create_zod_values_1.createZodValues)(def.type, z, zodTypes), onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, mayRemove: false }) }, `${_index}${localValue.keyStabilityRevision}`));
|
|
88
|
+
}) }) }, `${rowIndex}${localValue.keyStabilityRevision}`));
|
|
89
|
+
}), value.length === 0 ? ((0, jsx_runtime_1.jsx)(SchemaSeparationLine_1.SchemaArrayItemSeparationLine, { schema: schema, index: 0, onChange: onChange, isLast: true, showAddButton: true })) : null] }) })) : null, (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] }));
|
|
90
|
+
};
|
|
91
|
+
exports.ZodMatrixEditor = ZodMatrixEditor;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClickableFileName = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
7
|
+
const source_attribution_1 = require("../Timeline/TimelineStack/source-attribution");
|
|
8
|
+
const get_original_stack_trace_1 = require("./get-original-stack-trace");
|
|
9
|
+
const label = {
|
|
10
|
+
fontSize: 13,
|
|
11
|
+
};
|
|
12
|
+
const ClickableFileName = ({ stack }) => {
|
|
13
|
+
const originalFileName = (0, get_original_stack_trace_1.useOriginalFileName)(stack);
|
|
14
|
+
const [titleHovered, setTitleHovered] = (0, react_1.useState)(false);
|
|
15
|
+
const hoverEffect = titleHovered && originalFileName;
|
|
16
|
+
const onTitlePointerEnter = (0, react_1.useCallback)(() => {
|
|
17
|
+
setTitleHovered(true);
|
|
18
|
+
}, []);
|
|
19
|
+
const onTitlePointerLeave = (0, react_1.useCallback)(() => {
|
|
20
|
+
setTitleHovered(false);
|
|
21
|
+
}, []);
|
|
22
|
+
const style = (0, react_1.useMemo)(() => {
|
|
23
|
+
return {
|
|
24
|
+
...label,
|
|
25
|
+
cursor: originalFileName ? 'pointer' : undefined,
|
|
26
|
+
borderBottom: hoverEffect ? '1px solid #fff' : 'none',
|
|
27
|
+
};
|
|
28
|
+
}, [originalFileName, hoverEffect]);
|
|
29
|
+
const onClick = (0, react_1.useCallback)(async () => {
|
|
30
|
+
if (!originalFileName) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await (0, open_in_editor_1.openOriginalPositionInEditor)(originalFileName);
|
|
34
|
+
}, [originalFileName]);
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("span", { style: style, onClick: onClick, onPointerEnter: onTitlePointerEnter, onPointerLeave: onTitlePointerLeave, children: originalFileName
|
|
36
|
+
? (0, source_attribution_1.getOriginalSourceAttribution)(originalFileName)
|
|
37
|
+
: 'Loading...' }));
|
|
38
|
+
};
|
|
39
|
+
exports.ClickableFileName = ClickableFileName;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { VisualControlHook } from '../../visual-controls/VisualControls';
|
|
3
|
+
import { type VisualControlValue } from '../../visual-controls/VisualControls';
|
|
4
|
+
export declare const VisualControlHandle: React.FC<{
|
|
5
|
+
readonly value: VisualControlValue;
|
|
6
|
+
readonly keyName: string;
|
|
7
|
+
readonly hook: VisualControlHook;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlHandle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
7
|
+
const get_current_edited_value_1 = require("../../visual-controls/get-current-edited-value");
|
|
8
|
+
const ZodSwitch_1 = require("../RenderModal/SchemaEditor/ZodSwitch");
|
|
9
|
+
const local_state_1 = require("../RenderModal/SchemaEditor/local-state");
|
|
10
|
+
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
11
|
+
const container = {
|
|
12
|
+
marginBottom: 10,
|
|
13
|
+
};
|
|
14
|
+
const VisualControlHandle = ({ value, keyName, hook }) => {
|
|
15
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
16
|
+
if (!z) {
|
|
17
|
+
throw new Error('expected zod');
|
|
18
|
+
}
|
|
19
|
+
const state = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
20
|
+
const { updateValue } = (0, react_1.useContext)(VisualControls_1.SetVisualControlsContext);
|
|
21
|
+
const currentValue = (0, get_current_edited_value_1.getVisualControlEditedValue)({
|
|
22
|
+
handles: state.handles,
|
|
23
|
+
hook,
|
|
24
|
+
key: keyName,
|
|
25
|
+
});
|
|
26
|
+
const { localValue, RevisionContextProvider, onChange } = (0, local_state_1.useLocalState)({
|
|
27
|
+
schema: value.schema,
|
|
28
|
+
setValue: (updater) => updateValue(hook, keyName, updater(currentValue)),
|
|
29
|
+
unsavedValue: currentValue,
|
|
30
|
+
savedValue: value.valueInCode,
|
|
31
|
+
});
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, schema: value.schema, showSaveButton: true, saving: false, saveDisabledByParent: false, onSave: () => undefined, jsonPath: [keyName], value: localValue.value, defaultValue: value.valueInCode, setValue: onChange, onRemove: null }) }) }));
|
|
33
|
+
};
|
|
34
|
+
exports.VisualControlHandle = VisualControlHandle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VisualControlsContent: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlsContent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
7
|
+
const layout_1 = require("../layout");
|
|
8
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
9
|
+
const ClickableFileName_1 = require("./ClickableFileName");
|
|
10
|
+
const VisualControlHandle_1 = require("./VisualControlHandle");
|
|
11
|
+
const Control = ({ hook }) => {
|
|
12
|
+
const { handles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
13
|
+
const handle = handles[hook.id];
|
|
14
|
+
if (!handle) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(ClickableFileName_1.ClickableFileName, { stack: hook.stack }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 1 }), Object.entries(handle).map(([key, value]) => {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(VisualControlHandle_1.VisualControlHandle, { keyName: key, value: value, hook: hook }, key));
|
|
19
|
+
})] }, hook.id));
|
|
20
|
+
};
|
|
21
|
+
const container = {
|
|
22
|
+
padding: 12,
|
|
23
|
+
overflowY: 'auto',
|
|
24
|
+
};
|
|
25
|
+
const VisualControlsContent = () => {
|
|
26
|
+
const { hooks: controls } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: controls.map((hook) => ((0, jsx_runtime_1.jsx)(Control, { hook: hook }, hook.id))) }));
|
|
28
|
+
};
|
|
29
|
+
exports.VisualControlsContent = VisualControlsContent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VisualControlsContent: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlsContent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
7
|
+
const VisualControlsContent = () => {
|
|
8
|
+
const { controls } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: controls.map((control) => ((0, jsx_runtime_1.jsx)("div", { children: control.id }, control.id))) }));
|
|
10
|
+
};
|
|
11
|
+
exports.VisualControlsContent = VisualControlsContent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOriginalFileName = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const get_stack_1 = require("../Timeline/TimelineStack/get-stack");
|
|
6
|
+
const useOriginalFileName = (stack) => {
|
|
7
|
+
const [originalFileName, setOriginalFileName] = (0, react_1.useState)(null);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if (!stack) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
(0, get_stack_1.getOriginalLocationFromStack)(stack, 'visual-control')
|
|
13
|
+
.then((frame) => {
|
|
14
|
+
setOriginalFileName(frame);
|
|
15
|
+
})
|
|
16
|
+
.catch((err) => {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.error('Could not get original location of Sequence', err);
|
|
19
|
+
});
|
|
20
|
+
}, [stack]);
|
|
21
|
+
return originalFileName;
|
|
22
|
+
};
|
|
23
|
+
exports.useOriginalFileName = useOriginalFileName;
|
package/dist/esm/internals.mjs
CHANGED
|
@@ -18426,7 +18426,8 @@ var container35 = {
|
|
|
18426
18426
|
display: "inline-flex",
|
|
18427
18427
|
justifyContent: "center",
|
|
18428
18428
|
alignItems: "center",
|
|
18429
|
-
marginRight: 6
|
|
18429
|
+
marginRight: 6,
|
|
18430
|
+
flexShrink: 0
|
|
18430
18431
|
};
|
|
18431
18432
|
var layerPointedDown = null;
|
|
18432
18433
|
var TimelineLayerEye = ({ onInvoked, hidden, type }) => {
|
|
@@ -24446,13 +24447,7 @@ var MultiRangeSlider = ({
|
|
|
24446
24447
|
|
|
24447
24448
|
// src/components/RenderModal/FrameRangeSetting.tsx
|
|
24448
24449
|
import { jsx as jsx234, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
24449
|
-
var
|
|
24450
|
-
minWidth: "39px",
|
|
24451
|
-
display: "flex",
|
|
24452
|
-
justifyContent: "flex-end",
|
|
24453
|
-
alignItems: "center",
|
|
24454
|
-
fontSize: "14px"
|
|
24455
|
-
};
|
|
24450
|
+
var INPUT_WIDTH = 40;
|
|
24456
24451
|
var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
|
|
24457
24452
|
const minStartFrame = 0;
|
|
24458
24453
|
const maxEndFrame = durationInFrames - 1;
|
|
@@ -24462,6 +24457,12 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24462
24457
|
const onEndFrameChangedDirectly = useCallback113((newEndFrame) => {
|
|
24463
24458
|
setEndFrame(newEndFrame);
|
|
24464
24459
|
}, [setEndFrame]);
|
|
24460
|
+
const onStartFrameChanged = useCallback113((newVal) => {
|
|
24461
|
+
onStartFrameChangedDirectly(parseInt(newVal, 10));
|
|
24462
|
+
}, [onStartFrameChangedDirectly]);
|
|
24463
|
+
const onEndFrameChanged = useCallback113((newVal) => {
|
|
24464
|
+
onEndFrameChangedDirectly(parseInt(newVal, 10));
|
|
24465
|
+
}, [onEndFrameChangedDirectly]);
|
|
24465
24466
|
return /* @__PURE__ */ jsxs120("div", {
|
|
24466
24467
|
style: optionRow,
|
|
24467
24468
|
children: [
|
|
@@ -24473,8 +24474,19 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24473
24474
|
style: rightRow,
|
|
24474
24475
|
children: [
|
|
24475
24476
|
/* @__PURE__ */ jsx234("div", {
|
|
24476
|
-
style:
|
|
24477
|
-
children:
|
|
24477
|
+
style: { width: INPUT_WIDTH },
|
|
24478
|
+
children: /* @__PURE__ */ jsx234(InputDragger, {
|
|
24479
|
+
min: minStartFrame,
|
|
24480
|
+
max: endFrame - 1,
|
|
24481
|
+
name: "Start frame",
|
|
24482
|
+
value: startFrame,
|
|
24483
|
+
step: 1,
|
|
24484
|
+
onTextChange: onStartFrameChanged,
|
|
24485
|
+
onValueChange: onStartFrameChangedDirectly,
|
|
24486
|
+
status: "ok",
|
|
24487
|
+
rightAlign: true,
|
|
24488
|
+
style: { width: INPUT_WIDTH }
|
|
24489
|
+
})
|
|
24478
24490
|
}),
|
|
24479
24491
|
/* @__PURE__ */ jsx234(MultiRangeSlider, {
|
|
24480
24492
|
min: minStartFrame,
|
|
@@ -24485,9 +24497,21 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24485
24497
|
onLeftThumbDrag: onStartFrameChangedDirectly,
|
|
24486
24498
|
onRightThumbDrag: onEndFrameChangedDirectly
|
|
24487
24499
|
}),
|
|
24500
|
+
" ",
|
|
24488
24501
|
/* @__PURE__ */ jsx234("div", {
|
|
24489
|
-
style:
|
|
24490
|
-
children:
|
|
24502
|
+
style: { width: INPUT_WIDTH },
|
|
24503
|
+
children: /* @__PURE__ */ jsx234(InputDragger, {
|
|
24504
|
+
min: startFrame + 1,
|
|
24505
|
+
max: maxEndFrame,
|
|
24506
|
+
name: "End frame",
|
|
24507
|
+
value: endFrame,
|
|
24508
|
+
step: 1,
|
|
24509
|
+
onTextChange: onEndFrameChanged,
|
|
24510
|
+
onValueChange: onEndFrameChangedDirectly,
|
|
24511
|
+
status: "ok",
|
|
24512
|
+
rightAlign: true,
|
|
24513
|
+
style: { width: INPUT_WIDTH }
|
|
24514
|
+
})
|
|
24491
24515
|
})
|
|
24492
24516
|
]
|
|
24493
24517
|
})
|
|
@@ -18708,7 +18708,8 @@ var container35 = {
|
|
|
18708
18708
|
display: "inline-flex",
|
|
18709
18709
|
justifyContent: "center",
|
|
18710
18710
|
alignItems: "center",
|
|
18711
|
-
marginRight: 6
|
|
18711
|
+
marginRight: 6,
|
|
18712
|
+
flexShrink: 0
|
|
18712
18713
|
};
|
|
18713
18714
|
var layerPointedDown = null;
|
|
18714
18715
|
var TimelineLayerEye = ({ onInvoked, hidden, type }) => {
|
|
@@ -24728,13 +24729,7 @@ var MultiRangeSlider = ({
|
|
|
24728
24729
|
|
|
24729
24730
|
// src/components/RenderModal/FrameRangeSetting.tsx
|
|
24730
24731
|
import { jsx as jsx235, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
24731
|
-
var
|
|
24732
|
-
minWidth: "39px",
|
|
24733
|
-
display: "flex",
|
|
24734
|
-
justifyContent: "flex-end",
|
|
24735
|
-
alignItems: "center",
|
|
24736
|
-
fontSize: "14px"
|
|
24737
|
-
};
|
|
24732
|
+
var INPUT_WIDTH = 40;
|
|
24738
24733
|
var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
|
|
24739
24734
|
const minStartFrame = 0;
|
|
24740
24735
|
const maxEndFrame = durationInFrames - 1;
|
|
@@ -24744,6 +24739,12 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24744
24739
|
const onEndFrameChangedDirectly = useCallback114((newEndFrame) => {
|
|
24745
24740
|
setEndFrame(newEndFrame);
|
|
24746
24741
|
}, [setEndFrame]);
|
|
24742
|
+
const onStartFrameChanged = useCallback114((newVal) => {
|
|
24743
|
+
onStartFrameChangedDirectly(parseInt(newVal, 10));
|
|
24744
|
+
}, [onStartFrameChangedDirectly]);
|
|
24745
|
+
const onEndFrameChanged = useCallback114((newVal) => {
|
|
24746
|
+
onEndFrameChangedDirectly(parseInt(newVal, 10));
|
|
24747
|
+
}, [onEndFrameChangedDirectly]);
|
|
24747
24748
|
return /* @__PURE__ */ jsxs120("div", {
|
|
24748
24749
|
style: optionRow,
|
|
24749
24750
|
children: [
|
|
@@ -24755,8 +24756,19 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24755
24756
|
style: rightRow,
|
|
24756
24757
|
children: [
|
|
24757
24758
|
/* @__PURE__ */ jsx235("div", {
|
|
24758
|
-
style:
|
|
24759
|
-
children:
|
|
24759
|
+
style: { width: INPUT_WIDTH },
|
|
24760
|
+
children: /* @__PURE__ */ jsx235(InputDragger, {
|
|
24761
|
+
min: minStartFrame,
|
|
24762
|
+
max: endFrame - 1,
|
|
24763
|
+
name: "Start frame",
|
|
24764
|
+
value: startFrame,
|
|
24765
|
+
step: 1,
|
|
24766
|
+
onTextChange: onStartFrameChanged,
|
|
24767
|
+
onValueChange: onStartFrameChangedDirectly,
|
|
24768
|
+
status: "ok",
|
|
24769
|
+
rightAlign: true,
|
|
24770
|
+
style: { width: INPUT_WIDTH }
|
|
24771
|
+
})
|
|
24760
24772
|
}),
|
|
24761
24773
|
/* @__PURE__ */ jsx235(MultiRangeSlider, {
|
|
24762
24774
|
min: minStartFrame,
|
|
@@ -24767,9 +24779,21 @@ var FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames,
|
|
|
24767
24779
|
onLeftThumbDrag: onStartFrameChangedDirectly,
|
|
24768
24780
|
onRightThumbDrag: onEndFrameChangedDirectly
|
|
24769
24781
|
}),
|
|
24782
|
+
" ",
|
|
24770
24783
|
/* @__PURE__ */ jsx235("div", {
|
|
24771
|
-
style:
|
|
24772
|
-
children:
|
|
24784
|
+
style: { width: INPUT_WIDTH },
|
|
24785
|
+
children: /* @__PURE__ */ jsx235(InputDragger, {
|
|
24786
|
+
min: startFrame + 1,
|
|
24787
|
+
max: maxEndFrame,
|
|
24788
|
+
name: "End frame",
|
|
24789
|
+
value: endFrame,
|
|
24790
|
+
step: 1,
|
|
24791
|
+
onTextChange: onEndFrameChanged,
|
|
24792
|
+
onValueChange: onEndFrameChangedDirectly,
|
|
24793
|
+
status: "ok",
|
|
24794
|
+
rightAlign: true,
|
|
24795
|
+
style: { width: INPUT_WIDTH }
|
|
24796
|
+
})
|
|
24773
24797
|
})
|
|
24774
24798
|
]
|
|
24775
24799
|
})
|