@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/dist/esm/renderEntry.mjs
CHANGED
|
@@ -19097,7 +19097,8 @@ var init_TimelineLayerEye = __esm(() => {
|
|
|
19097
19097
|
display: "inline-flex",
|
|
19098
19098
|
justifyContent: "center",
|
|
19099
19099
|
alignItems: "center",
|
|
19100
|
-
marginRight: 6
|
|
19100
|
+
marginRight: 6,
|
|
19101
|
+
flexShrink: 0
|
|
19101
19102
|
};
|
|
19102
19103
|
});
|
|
19103
19104
|
|
|
@@ -25324,7 +25325,7 @@ var init_MultiRangeSlider = __esm(() => {
|
|
|
25324
25325
|
// src/components/RenderModal/FrameRangeSetting.tsx
|
|
25325
25326
|
import { useCallback as useCallback113 } from "react";
|
|
25326
25327
|
import { jsx as jsx234, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
25327
|
-
var
|
|
25328
|
+
var INPUT_WIDTH = 40, FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
|
|
25328
25329
|
const minStartFrame = 0;
|
|
25329
25330
|
const maxEndFrame = durationInFrames - 1;
|
|
25330
25331
|
const onStartFrameChangedDirectly = useCallback113((newStartFrame) => {
|
|
@@ -25333,6 +25334,12 @@ var numberWrapper, FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, dur
|
|
|
25333
25334
|
const onEndFrameChangedDirectly = useCallback113((newEndFrame) => {
|
|
25334
25335
|
setEndFrame(newEndFrame);
|
|
25335
25336
|
}, [setEndFrame]);
|
|
25337
|
+
const onStartFrameChanged = useCallback113((newVal) => {
|
|
25338
|
+
onStartFrameChangedDirectly(parseInt(newVal, 10));
|
|
25339
|
+
}, [onStartFrameChangedDirectly]);
|
|
25340
|
+
const onEndFrameChanged = useCallback113((newVal) => {
|
|
25341
|
+
onEndFrameChangedDirectly(parseInt(newVal, 10));
|
|
25342
|
+
}, [onEndFrameChangedDirectly]);
|
|
25336
25343
|
return /* @__PURE__ */ jsxs120("div", {
|
|
25337
25344
|
style: optionRow,
|
|
25338
25345
|
children: [
|
|
@@ -25344,8 +25351,19 @@ var numberWrapper, FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, dur
|
|
|
25344
25351
|
style: rightRow,
|
|
25345
25352
|
children: [
|
|
25346
25353
|
/* @__PURE__ */ jsx234("div", {
|
|
25347
|
-
style:
|
|
25348
|
-
children:
|
|
25354
|
+
style: { width: INPUT_WIDTH },
|
|
25355
|
+
children: /* @__PURE__ */ jsx234(InputDragger, {
|
|
25356
|
+
min: minStartFrame,
|
|
25357
|
+
max: endFrame - 1,
|
|
25358
|
+
name: "Start frame",
|
|
25359
|
+
value: startFrame,
|
|
25360
|
+
step: 1,
|
|
25361
|
+
onTextChange: onStartFrameChanged,
|
|
25362
|
+
onValueChange: onStartFrameChangedDirectly,
|
|
25363
|
+
status: "ok",
|
|
25364
|
+
rightAlign: true,
|
|
25365
|
+
style: { width: INPUT_WIDTH }
|
|
25366
|
+
})
|
|
25349
25367
|
}),
|
|
25350
25368
|
/* @__PURE__ */ jsx234(MultiRangeSlider, {
|
|
25351
25369
|
min: minStartFrame,
|
|
@@ -25356,9 +25374,21 @@ var numberWrapper, FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, dur
|
|
|
25356
25374
|
onLeftThumbDrag: onStartFrameChangedDirectly,
|
|
25357
25375
|
onRightThumbDrag: onEndFrameChangedDirectly
|
|
25358
25376
|
}),
|
|
25377
|
+
" ",
|
|
25359
25378
|
/* @__PURE__ */ jsx234("div", {
|
|
25360
|
-
style:
|
|
25361
|
-
children:
|
|
25379
|
+
style: { width: INPUT_WIDTH },
|
|
25380
|
+
children: /* @__PURE__ */ jsx234(InputDragger, {
|
|
25381
|
+
min: startFrame + 1,
|
|
25382
|
+
max: maxEndFrame,
|
|
25383
|
+
name: "End frame",
|
|
25384
|
+
value: endFrame,
|
|
25385
|
+
step: 1,
|
|
25386
|
+
onTextChange: onEndFrameChanged,
|
|
25387
|
+
onValueChange: onEndFrameChangedDirectly,
|
|
25388
|
+
status: "ok",
|
|
25389
|
+
rightAlign: true,
|
|
25390
|
+
style: { width: INPUT_WIDTH }
|
|
25391
|
+
})
|
|
25362
25392
|
})
|
|
25363
25393
|
]
|
|
25364
25394
|
})
|
|
@@ -25366,15 +25396,9 @@ var numberWrapper, FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, dur
|
|
|
25366
25396
|
});
|
|
25367
25397
|
};
|
|
25368
25398
|
var init_FrameRangeSetting = __esm(() => {
|
|
25369
|
-
|
|
25399
|
+
init_InputDragger();
|
|
25370
25400
|
init_layout2();
|
|
25371
|
-
|
|
25372
|
-
minWidth: "39px",
|
|
25373
|
-
display: "flex",
|
|
25374
|
-
justifyContent: "flex-end",
|
|
25375
|
-
alignItems: "center",
|
|
25376
|
-
fontSize: "14px"
|
|
25377
|
-
};
|
|
25401
|
+
init_MultiRangeSlider();
|
|
25378
25402
|
});
|
|
25379
25403
|
|
|
25380
25404
|
// src/components/RenderModal/human-readable-codec.ts
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ZodTypeAny } from 'zod';
|
|
3
|
+
export type VisualControlValue = {
|
|
4
|
+
valueInCode: unknown;
|
|
5
|
+
unsavedValue: unknown;
|
|
6
|
+
schema: ZodTypeAny;
|
|
7
|
+
stack: string;
|
|
8
|
+
};
|
|
9
|
+
export type VisualControlHook = {
|
|
10
|
+
id: number;
|
|
11
|
+
stack: string;
|
|
12
|
+
};
|
|
13
|
+
type Handle = Record<string, VisualControlValue>;
|
|
14
|
+
export type Handles = Record<number, Handle>;
|
|
15
|
+
export type VisualControlsContextType = {
|
|
16
|
+
hooks: VisualControlHook[];
|
|
17
|
+
handles: Handles;
|
|
18
|
+
};
|
|
19
|
+
export declare const VisualControlsTabActivatedContext: React.Context<boolean>;
|
|
20
|
+
export type SetVisualControlsContextType = {
|
|
21
|
+
addHook: (hook: VisualControlHook) => void;
|
|
22
|
+
removeHook: (hook: VisualControlHook) => void;
|
|
23
|
+
setControl: (hook: VisualControlHook, key: string, value: VisualControlValue) => {
|
|
24
|
+
same: boolean;
|
|
25
|
+
currentValue: unknown;
|
|
26
|
+
};
|
|
27
|
+
updateHandles: () => void;
|
|
28
|
+
updateValue: (hook: VisualControlHook, key: string, value: unknown) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare const makeHook: (stack: string) => VisualControlHook;
|
|
31
|
+
export declare const VisualControlsContext: React.Context<VisualControlsContextType>;
|
|
32
|
+
export declare const SetVisualControlsContext: React.Context<SetVisualControlsContextType>;
|
|
33
|
+
export declare const VisualControlsProvider: React.FC<{
|
|
34
|
+
readonly children: React.ReactNode;
|
|
35
|
+
}>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlsProvider = exports.SetVisualControlsContext = exports.VisualControlsContext = exports.makeHook = exports.VisualControlsTabActivatedContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const get_current_edited_value_1 = require("./get-current-edited-value");
|
|
7
|
+
exports.VisualControlsTabActivatedContext = (0, react_1.createContext)(false);
|
|
8
|
+
const makeHook = (stack) => {
|
|
9
|
+
return { id: Math.random(), stack };
|
|
10
|
+
};
|
|
11
|
+
exports.makeHook = makeHook;
|
|
12
|
+
exports.VisualControlsContext = (0, react_1.createContext)({
|
|
13
|
+
hooks: [],
|
|
14
|
+
handles: {},
|
|
15
|
+
});
|
|
16
|
+
exports.SetVisualControlsContext = (0, react_1.createContext)({
|
|
17
|
+
addHook: () => {
|
|
18
|
+
throw new Error('addControl is not implemented');
|
|
19
|
+
},
|
|
20
|
+
removeHook: () => {
|
|
21
|
+
throw new Error('removeControl is not implemented');
|
|
22
|
+
},
|
|
23
|
+
setControl: () => {
|
|
24
|
+
throw new Error('addControl is not implemented');
|
|
25
|
+
},
|
|
26
|
+
updateHandles: () => {
|
|
27
|
+
throw new Error('updateHandles is not implemented');
|
|
28
|
+
},
|
|
29
|
+
updateValue: () => {
|
|
30
|
+
throw new Error('updateValue is not implemented');
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const VisualControlsProvider = ({ children }) => {
|
|
34
|
+
const [hooks, setHooks] = (0, react_1.useState)([]);
|
|
35
|
+
const imperativeHandles = (0, react_1.useRef)({});
|
|
36
|
+
const [handles, setHandles] = (0, react_1.useState)({});
|
|
37
|
+
const [tabActivated, setTabActivated] = (0, react_1.useState)(false);
|
|
38
|
+
const addHook = (0, react_1.useCallback)((hook) => {
|
|
39
|
+
setHooks((prev) => {
|
|
40
|
+
if (prev.find((c) => c.id === hook.id)) {
|
|
41
|
+
return prev;
|
|
42
|
+
}
|
|
43
|
+
return [...prev, hook];
|
|
44
|
+
});
|
|
45
|
+
setTabActivated(true);
|
|
46
|
+
}, [setHooks]);
|
|
47
|
+
const removeHook = (0, react_1.useCallback)((hook) => {
|
|
48
|
+
setHooks((prev) => prev.filter((c) => c !== hook));
|
|
49
|
+
}, [setHooks]);
|
|
50
|
+
const state = (0, react_1.useMemo)(() => {
|
|
51
|
+
return {
|
|
52
|
+
hooks,
|
|
53
|
+
handles,
|
|
54
|
+
};
|
|
55
|
+
}, [hooks, handles]);
|
|
56
|
+
const setControl = (0, react_1.useCallback)((hook, key, value) => {
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
58
|
+
const currentSaved = (_c = (_b = (_a = imperativeHandles.current) === null || _a === void 0 ? void 0 : _a[hook.id]) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c.valueInCode;
|
|
59
|
+
const currentUnsaved = (_f = (_e = (_d = imperativeHandles.current) === null || _d === void 0 ? void 0 : _d[hook.id]) === null || _e === void 0 ? void 0 : _e[key]) === null || _f === void 0 ? void 0 : _f.unsavedValue;
|
|
60
|
+
if (currentSaved === value.valueInCode) {
|
|
61
|
+
return {
|
|
62
|
+
same: true,
|
|
63
|
+
currentValue: (0, get_current_edited_value_1.getVisualControlEditedValue)({
|
|
64
|
+
hook,
|
|
65
|
+
key,
|
|
66
|
+
handles: imperativeHandles.current,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
imperativeHandles.current = {
|
|
71
|
+
...imperativeHandles.current,
|
|
72
|
+
[hook.id]: {
|
|
73
|
+
...imperativeHandles.current[hook.id],
|
|
74
|
+
[key]: {
|
|
75
|
+
...value,
|
|
76
|
+
unsavedValue: currentUnsaved !== null && currentUnsaved !== void 0 ? currentUnsaved : value.valueInCode,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
same: false,
|
|
82
|
+
currentValue: (0, get_current_edited_value_1.getVisualControlEditedValue)({
|
|
83
|
+
hook,
|
|
84
|
+
key,
|
|
85
|
+
handles: imperativeHandles.current,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
const updateHandles = (0, react_1.useCallback)(() => {
|
|
90
|
+
setHandles(() => {
|
|
91
|
+
return imperativeHandles.current;
|
|
92
|
+
});
|
|
93
|
+
}, []);
|
|
94
|
+
const updateValue = (0, react_1.useCallback)((hook, key, value) => {
|
|
95
|
+
imperativeHandles.current = {
|
|
96
|
+
...imperativeHandles.current,
|
|
97
|
+
[hook.id]: {
|
|
98
|
+
...imperativeHandles.current[hook.id],
|
|
99
|
+
[key]: {
|
|
100
|
+
...imperativeHandles.current[hook.id][key],
|
|
101
|
+
unsavedValue: value,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
updateHandles();
|
|
106
|
+
}, [updateHandles]);
|
|
107
|
+
const setState = (0, react_1.useMemo)(() => {
|
|
108
|
+
return {
|
|
109
|
+
addHook,
|
|
110
|
+
removeHook,
|
|
111
|
+
setControl,
|
|
112
|
+
updateHandles,
|
|
113
|
+
updateValue,
|
|
114
|
+
};
|
|
115
|
+
}, [addHook, removeHook, setControl, updateHandles, updateValue]);
|
|
116
|
+
return ((0, jsx_runtime_1.jsx)(exports.VisualControlsTabActivatedContext.Provider, { value: tabActivated, children: (0, jsx_runtime_1.jsx)(exports.VisualControlsContext.Provider, { value: state, children: (0, jsx_runtime_1.jsx)(exports.SetVisualControlsContext.Provider, { value: setState, children: children }) }) }));
|
|
117
|
+
};
|
|
118
|
+
exports.VisualControlsProvider = VisualControlsProvider;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVisualControlEditedValue = void 0;
|
|
4
|
+
const getVisualControlEditedValue = ({ handles, hook, key, }) => {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
// TODO: What if z.null()
|
|
7
|
+
return (_c = (_b = (_a = handles === null || handles === void 0 ? void 0 : handles[hook.id]) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.unsavedValue) !== null && _c !== void 0 ? _c : null;
|
|
8
|
+
};
|
|
9
|
+
exports.getVisualControlEditedValue = getVisualControlEditedValue;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.284",
|
|
7
7
|
"description": "APIs for interacting with the Remotion Studio",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
"source-map": "0.7.3",
|
|
24
24
|
"open": "^8.4.2",
|
|
25
25
|
"zod": "3.22.3",
|
|
26
|
-
"remotion": "4.0.
|
|
27
|
-
"@remotion/
|
|
28
|
-
"@remotion/
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"@remotion/
|
|
32
|
-
"@remotion/
|
|
26
|
+
"remotion": "4.0.284",
|
|
27
|
+
"@remotion/media-parser": "4.0.284",
|
|
28
|
+
"@remotion/player": "4.0.284",
|
|
29
|
+
"@remotion/renderer": "4.0.284",
|
|
30
|
+
"@remotion/studio-shared": "4.0.284",
|
|
31
|
+
"@remotion/zod-types": "4.0.284",
|
|
32
|
+
"@remotion/media-utils": "4.0.284"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"react": "19.0.0",
|
|
36
36
|
"react-dom": "19.0.0",
|
|
37
37
|
"@types/semver": "^7.3.4",
|
|
38
38
|
"eslint": "9.19.0",
|
|
39
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
39
|
+
"@remotion/eslint-config-internal": "4.0.284"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|