@remotion/studio 4.0.471 → 4.0.473
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/dist/api/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +55 -5
- package/dist/components/AssetSelectorItem.js +153 -27
- package/dist/components/Canvas.js +147 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +99 -47
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/Editor.js +14 -6
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +8 -2
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +105 -4
- package/dist/components/SelectedOutlineOverlay.js +578 -59
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +65 -70
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/Timeline.js +50 -15
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +43 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +479 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +146 -26
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +41 -37
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.js +8 -7
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +282 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +161 -35
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +525 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.js +4 -0
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +7 -4
- package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.js +22 -8
- package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
- package/dist/components/Timeline/save-effect-prop.js +36 -18
- package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
- package/dist/components/Timeline/save-prop-queue.js +5 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
- package/dist/components/Timeline/save-sequence-prop.js +33 -30
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-translate-utils.js +9 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +22 -0
- package/dist/components/import-assets.js +294 -0
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-z0z9d4r0.js → chunk-q0jkt0zq.js} +23062 -17350
- package/dist/esm/internals.mjs +23062 -17350
- package/dist/esm/previewEntry.mjs +22351 -16615
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.js +5 -1
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +29 -2
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/package.json +10 -10
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineArrayField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const TimelinePrimitiveFieldValue_1 = require("./TimelinePrimitiveFieldValue");
|
|
7
|
+
const container = {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
alignItems: 'flex-start',
|
|
11
|
+
minWidth: 0,
|
|
12
|
+
};
|
|
13
|
+
const itemContainer = {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
gap: 6,
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
height: 22,
|
|
19
|
+
minWidth: 0,
|
|
20
|
+
};
|
|
21
|
+
const itemLabel = {
|
|
22
|
+
color: 'rgba(255, 255, 255, 0.45)',
|
|
23
|
+
fontSize: 11,
|
|
24
|
+
fontVariantNumeric: 'tabular-nums',
|
|
25
|
+
width: 18,
|
|
26
|
+
textAlign: 'right',
|
|
27
|
+
};
|
|
28
|
+
const button = {
|
|
29
|
+
background: 'rgba(255, 255, 255, 0.08)',
|
|
30
|
+
border: '1px solid rgba(255, 255, 255, 0.12)',
|
|
31
|
+
borderRadius: 3,
|
|
32
|
+
color: 'white',
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
fontSize: 10,
|
|
35
|
+
height: 18,
|
|
36
|
+
lineHeight: '16px',
|
|
37
|
+
padding: '0 5px',
|
|
38
|
+
};
|
|
39
|
+
const disabledButton = {
|
|
40
|
+
...button,
|
|
41
|
+
cursor: 'default',
|
|
42
|
+
opacity: 0.4,
|
|
43
|
+
};
|
|
44
|
+
const addButtonRow = {
|
|
45
|
+
...itemContainer,
|
|
46
|
+
paddingLeft: 24,
|
|
47
|
+
};
|
|
48
|
+
const getFallbackItemValue = (field) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (field.newItemDefault !== undefined) {
|
|
51
|
+
return field.newItemDefault;
|
|
52
|
+
}
|
|
53
|
+
if (field.item.type === 'number' || field.item.type === 'rotation-degrees') {
|
|
54
|
+
return (_a = field.item.min) !== null && _a !== void 0 ? _a : 0;
|
|
55
|
+
}
|
|
56
|
+
if (field.item.type === 'boolean') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (field.item.type === 'rotation-css') {
|
|
60
|
+
return '0deg';
|
|
61
|
+
}
|
|
62
|
+
if (field.item.type === 'translate') {
|
|
63
|
+
return '0px 0px';
|
|
64
|
+
}
|
|
65
|
+
if (field.item.type === 'uv-coordinate') {
|
|
66
|
+
return [0.5, 0.5];
|
|
67
|
+
}
|
|
68
|
+
if (field.item.type === 'color') {
|
|
69
|
+
return '#000000';
|
|
70
|
+
}
|
|
71
|
+
if (field.item.type === 'enum') {
|
|
72
|
+
const [firstVariant] = field.item.variants;
|
|
73
|
+
return firstVariant;
|
|
74
|
+
}
|
|
75
|
+
throw new Error(`Unsupported array item field: ${JSON.stringify(field.item)}`);
|
|
76
|
+
};
|
|
77
|
+
const isUvCoordinateDefault = (value) => {
|
|
78
|
+
return (Array.isArray(value) &&
|
|
79
|
+
value.length === 2 &&
|
|
80
|
+
value.every((item) => typeof item === 'number'));
|
|
81
|
+
};
|
|
82
|
+
const makeItemFieldSchema = ({ field, defaultValue, }) => {
|
|
83
|
+
var _a;
|
|
84
|
+
if (field.item.type === 'number') {
|
|
85
|
+
return {
|
|
86
|
+
...field.item,
|
|
87
|
+
default: typeof defaultValue === 'number' ? defaultValue : undefined,
|
|
88
|
+
hiddenFromList: false,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (field.item.type === 'boolean') {
|
|
92
|
+
return {
|
|
93
|
+
...field.item,
|
|
94
|
+
default: Boolean(defaultValue),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (field.item.type === 'rotation-css') {
|
|
98
|
+
return {
|
|
99
|
+
...field.item,
|
|
100
|
+
default: typeof defaultValue === 'string' ? defaultValue : undefined,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (field.item.type === 'rotation-degrees') {
|
|
104
|
+
return {
|
|
105
|
+
...field.item,
|
|
106
|
+
default: typeof defaultValue === 'number' ? defaultValue : undefined,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (field.item.type === 'translate') {
|
|
110
|
+
return {
|
|
111
|
+
...field.item,
|
|
112
|
+
default: typeof defaultValue === 'string' ? defaultValue : undefined,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (field.item.type === 'uv-coordinate') {
|
|
116
|
+
return {
|
|
117
|
+
...field.item,
|
|
118
|
+
default: isUvCoordinateDefault(defaultValue) ? defaultValue : undefined,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (field.item.type === 'color') {
|
|
122
|
+
return {
|
|
123
|
+
...field.item,
|
|
124
|
+
default: typeof defaultValue === 'string' ? defaultValue : undefined,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (field.item.type === 'enum') {
|
|
128
|
+
return {
|
|
129
|
+
type: 'enum',
|
|
130
|
+
default: typeof defaultValue === 'string'
|
|
131
|
+
? defaultValue
|
|
132
|
+
: ((_a = field.item.variants[0]) !== null && _a !== void 0 ? _a : ''),
|
|
133
|
+
variants: Object.fromEntries(field.item.variants.map((variant) => [variant, {}])),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
throw new Error(`Unsupported array item field: ${JSON.stringify(field.item)}`);
|
|
137
|
+
};
|
|
138
|
+
const replaceAtIndex = (items, index, value) => items.map((item, i) => (i === index ? value : item));
|
|
139
|
+
const ItemEditor = ({ field, arrayField, items, index, onSave, onDragValueChange, onDragEnd, }) => {
|
|
140
|
+
var _a;
|
|
141
|
+
const fallback = (0, react_1.useMemo)(() => getFallbackItemValue(arrayField), [arrayField]);
|
|
142
|
+
const value = (_a = items[index]) !== null && _a !== void 0 ? _a : fallback;
|
|
143
|
+
const itemField = (0, react_1.useMemo)(() => {
|
|
144
|
+
const fieldSchema = makeItemFieldSchema({
|
|
145
|
+
field: arrayField,
|
|
146
|
+
defaultValue: fallback,
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
...field,
|
|
150
|
+
key: `${field.key}[${index}]`,
|
|
151
|
+
typeName: fieldSchema.type,
|
|
152
|
+
fieldSchema,
|
|
153
|
+
};
|
|
154
|
+
}, [arrayField, fallback, field, index]);
|
|
155
|
+
const propStatus = (0, react_1.useMemo)(() => ({
|
|
156
|
+
status: 'static',
|
|
157
|
+
codeValue: value,
|
|
158
|
+
}), [value]);
|
|
159
|
+
const onSaveItem = (0, react_1.useCallback)((next) => onSave(replaceAtIndex(items, index, next)), [index, items, onSave]);
|
|
160
|
+
const onDragItem = (0, react_1.useCallback)((next) => onDragValueChange(replaceAtIndex(items, index, next)), [index, items, onDragValueChange]);
|
|
161
|
+
return (jsx_runtime_1.jsx(TimelinePrimitiveFieldValue_1.TimelinePrimitiveFieldValue, { effectiveValue: value, field: itemField, onDragEnd: onDragEnd, onDragValueChange: onDragItem, onSave: onSaveItem, propStatus: propStatus, scaleLockNodePath: null }));
|
|
162
|
+
};
|
|
163
|
+
const TimelineArrayField = ({ field, effectiveValue, onSave, onDragValueChange, onDragEnd }) => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
const arrayField = field.fieldSchema;
|
|
166
|
+
if (arrayField.type !== 'array') {
|
|
167
|
+
throw new Error('TimelineArrayField rendered for non-array field');
|
|
168
|
+
}
|
|
169
|
+
const items = (0, react_1.useMemo)(() => {
|
|
170
|
+
if (Array.isArray(effectiveValue)) {
|
|
171
|
+
return effectiveValue;
|
|
172
|
+
}
|
|
173
|
+
return Array.isArray(arrayField.default) ? arrayField.default : [];
|
|
174
|
+
}, [arrayField.default, effectiveValue]);
|
|
175
|
+
const minLength = (_a = arrayField.minLength) !== null && _a !== void 0 ? _a : 0;
|
|
176
|
+
const maxLength = (_b = arrayField.maxLength) !== null && _b !== void 0 ? _b : Infinity;
|
|
177
|
+
const canAdd = items.length < maxLength;
|
|
178
|
+
const canRemove = items.length > minLength;
|
|
179
|
+
const itemKeys = (0, react_1.useRef)([]);
|
|
180
|
+
const nextItemKey = (0, react_1.useRef)(0);
|
|
181
|
+
while (itemKeys.current.length < items.length) {
|
|
182
|
+
itemKeys.current.push(`${field.key}-${nextItemKey.current}`);
|
|
183
|
+
nextItemKey.current++;
|
|
184
|
+
}
|
|
185
|
+
if (itemKeys.current.length > items.length) {
|
|
186
|
+
itemKeys.current.length = items.length;
|
|
187
|
+
}
|
|
188
|
+
const onAdd = (0, react_1.useCallback)(() => {
|
|
189
|
+
if (!canAdd) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
itemKeys.current.push(`${field.key}-${nextItemKey.current}`);
|
|
193
|
+
nextItemKey.current++;
|
|
194
|
+
onSave([...items, getFallbackItemValue(arrayField)]);
|
|
195
|
+
}, [arrayField, canAdd, field.key, items, onSave]);
|
|
196
|
+
const onRemove = (0, react_1.useCallback)((index) => {
|
|
197
|
+
if (!canRemove) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
itemKeys.current.splice(index, 1);
|
|
201
|
+
onSave(items.filter((_item, i) => i !== index));
|
|
202
|
+
}, [canRemove, items, onSave]);
|
|
203
|
+
return (jsx_runtime_1.jsxs("span", { style: container, children: [items.map((_item, index) => {
|
|
204
|
+
const itemKey = itemKeys.current[index];
|
|
205
|
+
return (jsx_runtime_1.jsxs("span", { style: itemContainer, children: [
|
|
206
|
+
jsx_runtime_1.jsx("span", { style: itemLabel, children: index }), jsx_runtime_1.jsx(ItemEditor, { arrayField: arrayField, field: field, index: index, items: items, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave }), jsx_runtime_1.jsx("button", { disabled: !canRemove, onClick: () => onRemove(index), style: canRemove ? button : disabledButton, title: `Remove item ${index}`, type: "button", children: "-" })
|
|
207
|
+
] }, itemKey));
|
|
208
|
+
}), canAdd ? (jsx_runtime_1.jsx("span", { style: addButtonRow, children: jsx_runtime_1.jsx("button", { type: "button", style: button, onClick: onAdd, title: "Add item", children: "+" }) })) : null] }));
|
|
209
|
+
};
|
|
210
|
+
exports.TimelineArrayField = TimelineArrayField;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatusStatic } from 'remotion';
|
|
3
3
|
import type { SchemaFieldInfo, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const TimelineBooleanField: React.FC<{
|
|
5
5
|
readonly field: SchemaFieldInfo;
|
|
6
|
-
readonly propStatus:
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
7
7
|
readonly effectiveValue: unknown;
|
|
8
8
|
readonly onSave: TimelineFieldOnSave;
|
|
9
9
|
}>;
|
|
@@ -11,10 +11,10 @@ const TimelineBooleanField = ({ field, propStatus, effectiveValue, onSave }) =>
|
|
|
11
11
|
const checked = Boolean(effectiveValue);
|
|
12
12
|
const onChange = (0, react_1.useCallback)(() => {
|
|
13
13
|
const newValue = !checked;
|
|
14
|
-
if (
|
|
14
|
+
if (newValue !== propStatus.codeValue) {
|
|
15
15
|
onSave(newValue);
|
|
16
16
|
}
|
|
17
17
|
}, [propStatus, onSave, checked]);
|
|
18
|
-
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled:
|
|
18
|
+
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: false, variant: "small" }) }));
|
|
19
19
|
};
|
|
20
20
|
exports.TimelineBooleanField = TimelineBooleanField;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type EffectClipboardSnapshot, type EffectPropClipboardData } from '@remotion/studio-shared';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import { type CodeValues, type OverrideIdToNodePaths, type SequencePropsSubscriptionKey, type SequenceSchema, type TSequence } from 'remotion';
|
|
4
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
5
|
+
import { type TimelineSelection } from './TimelineSelection';
|
|
6
|
+
export type PasteEffectsTarget = {
|
|
7
|
+
readonly type: 'valid';
|
|
8
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: 'none';
|
|
11
|
+
} | {
|
|
12
|
+
readonly type: 'multiple';
|
|
13
|
+
} | {
|
|
14
|
+
readonly type: 'unsupported';
|
|
15
|
+
};
|
|
16
|
+
export type PasteEffectPropTarget = {
|
|
17
|
+
readonly type: 'valid';
|
|
18
|
+
readonly fileName: string;
|
|
19
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
20
|
+
readonly effectIndex: number;
|
|
21
|
+
readonly fieldKey: string;
|
|
22
|
+
readonly defaultValue: string | null;
|
|
23
|
+
readonly schema: SequenceSchema;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: 'none' | 'multiple' | 'unsupported' | 'effect-type-mismatch' | 'prop-mismatch' | 'uncopyable';
|
|
26
|
+
};
|
|
27
|
+
export declare const getPasteEffectsTarget: (selectedItems: readonly TimelineSelection[]) => PasteEffectsTarget;
|
|
28
|
+
export declare const getSnapshotsFromSelection: ({ selection, codeValues, }: {
|
|
29
|
+
selection: TimelineSelection;
|
|
30
|
+
codeValues: CodeValues;
|
|
31
|
+
}) => EffectClipboardSnapshot[] | null;
|
|
32
|
+
export declare const getEffectPropClipboardDataFromSelection: ({ selection, codeValues, }: {
|
|
33
|
+
selection: TimelineSelection;
|
|
34
|
+
codeValues: CodeValues;
|
|
35
|
+
}) => EffectPropClipboardData | null;
|
|
36
|
+
export declare const getPasteEffectPropTarget: ({ selectedItems, payload, codeValues, sequences, overrideIdsToNodePaths, }: {
|
|
37
|
+
readonly selectedItems: readonly TimelineSelection[];
|
|
38
|
+
readonly payload: EffectPropClipboardData;
|
|
39
|
+
readonly codeValues: CodeValues;
|
|
40
|
+
readonly sequences: TSequence[];
|
|
41
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
42
|
+
}) => PasteEffectPropTarget;
|
|
43
|
+
export declare const TimelineClipboardKeybindings: React.FC;
|