@remotion/studio 4.0.461 → 4.0.463

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.
Files changed (56) hide show
  1. package/dist/components/AssetSelector.js +2 -6
  2. package/dist/components/CompSelectorRef.js +2 -6
  3. package/dist/components/ExpandedTracksProvider.js +13 -23
  4. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +4 -3
  5. package/dist/components/Timeline/SubscribeToNodePaths.js +6 -1
  6. package/dist/components/Timeline/Timeline.js +1 -1
  7. package/dist/components/Timeline/TimelineColorField.d.ts +11 -0
  8. package/dist/components/Timeline/TimelineColorField.js +181 -0
  9. package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +11 -0
  10. package/dist/components/Timeline/TimelineEffectFieldRow.js +167 -0
  11. package/dist/components/Timeline/TimelineEffectGroupRow.d.ts +17 -0
  12. package/dist/components/Timeline/TimelineEffectGroupRow.js +73 -0
  13. package/dist/components/Timeline/TimelineExpandedRow.d.ts +3 -3
  14. package/dist/components/Timeline/TimelineExpandedRow.js +12 -1
  15. package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
  16. package/dist/components/Timeline/TimelineExpandedSection.js +7 -20
  17. package/dist/components/Timeline/TimelineFieldRow.d.ts +3 -3
  18. package/dist/components/Timeline/TimelineFieldRow.js +17 -45
  19. package/dist/components/Timeline/TimelineLayerEye.d.ts +5 -3
  20. package/dist/components/Timeline/TimelineLayerEye.js +18 -1
  21. package/dist/components/Timeline/TimelineListItem.js +61 -17
  22. package/dist/components/Timeline/TimelineNumberField.js +1 -1
  23. package/dist/components/Timeline/TimelineRotationField.js +1 -1
  24. package/dist/components/Timeline/TimelineSchemaField.d.ts +8 -2
  25. package/dist/components/Timeline/TimelineSchemaField.js +20 -11
  26. package/dist/components/Timeline/TimelineTracks.js +4 -4
  27. package/dist/components/Timeline/TimelineTranslateField.js +4 -2
  28. package/dist/components/Timeline/save-effect-prop.d.ts +12 -0
  29. package/dist/components/Timeline/save-effect-prop.js +42 -0
  30. package/dist/components/Timeline/save-prop-queue.d.ts +12 -0
  31. package/dist/components/Timeline/save-prop-queue.js +63 -0
  32. package/dist/components/Timeline/save-sequence-prop.d.ts +11 -0
  33. package/dist/components/Timeline/save-sequence-prop.js +38 -0
  34. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
  35. package/dist/components/Timeline/sequence-props-subscription-store.js +10 -4
  36. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
  37. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -1
  38. package/dist/components/Timeline/use-timeline-height.js +3 -3
  39. package/dist/esm/chunk-5gtx3pza.js +9 -0
  40. package/dist/esm/{chunk-yzh34sp0.js → chunk-b0m62frw.js} +4511 -3740
  41. package/dist/esm/index.mjs +20 -24
  42. package/dist/esm/internals.mjs +4509 -3753
  43. package/dist/esm/previewEntry.mjs +3190 -2445
  44. package/dist/esm/renderEntry.mjs +3 -4
  45. package/dist/helpers/calculate-timeline.js +13 -5
  46. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -2
  47. package/dist/helpers/persist-boolean-map.d.ts +5 -0
  48. package/dist/helpers/persist-boolean-map.js +56 -0
  49. package/dist/helpers/persist-open-folders.d.ts +4 -3
  50. package/dist/helpers/persist-open-folders.js +4 -7
  51. package/dist/helpers/timeline-layout.d.ts +13 -13
  52. package/dist/helpers/timeline-layout.js +23 -35
  53. package/dist/icons/eyedropper.d.ts +4 -0
  54. package/dist/icons/eyedropper.js +6 -0
  55. package/package.json +11 -12
  56. package/dist/esm/chunk-6jf1natv.js +0 -25
@@ -0,0 +1,12 @@
1
+ import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey } from 'remotion';
2
+ type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
+ export type EnqueueSaveOptions<TResponse> = {
4
+ nodePath: SequencePropsSubscriptionKey;
5
+ setCodeValues: SetCodeValues;
6
+ applyOptimistic: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse;
7
+ apiCall: () => Promise<TResponse>;
8
+ mergeServerResponse: (prev: CanUpdateSequencePropsResponse, response: TResponse) => CanUpdateSequencePropsResponse;
9
+ errorLabel: string;
10
+ };
11
+ export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, apiCall, mergeServerResponse, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
12
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enqueueSavePropChange = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
6
+ const queues = new Map();
7
+ const getQueue = (nodePath) => {
8
+ const key = remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath);
9
+ let q = queues.get(key);
10
+ if (!q) {
11
+ q = { chain: Promise.resolve(), cancelled: false, committed: null };
12
+ queues.set(key, q);
13
+ }
14
+ return q;
15
+ };
16
+ const dropQueue = (nodePath, q) => {
17
+ const key = remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath);
18
+ if (queues.get(key) === q) {
19
+ queues.delete(key);
20
+ }
21
+ };
22
+ const enqueueSavePropChange = ({ nodePath, setCodeValues, applyOptimistic, apiCall, mergeServerResponse, errorLabel, }) => {
23
+ const q = getQueue(nodePath);
24
+ if (q.cancelled) {
25
+ return Promise.resolve();
26
+ }
27
+ setCodeValues(nodePath, (prev) => {
28
+ if (q.committed === null) {
29
+ q.committed = prev;
30
+ }
31
+ return applyOptimistic(prev);
32
+ });
33
+ const myQueue = q;
34
+ const next = myQueue.chain.then(async () => {
35
+ if (myQueue.cancelled) {
36
+ return;
37
+ }
38
+ try {
39
+ const response = await apiCall();
40
+ if (myQueue.cancelled) {
41
+ return;
42
+ }
43
+ setCodeValues(nodePath, (prev) => mergeServerResponse(prev, response));
44
+ myQueue.committed = mergeServerResponse(myQueue.committed, response);
45
+ // If nothing more is queued, reset baseline so the next round starts fresh.
46
+ if (myQueue.chain === next) {
47
+ dropQueue(nodePath, myQueue);
48
+ }
49
+ }
50
+ catch (err) {
51
+ myQueue.cancelled = true;
52
+ const { committed } = myQueue;
53
+ if (committed !== null) {
54
+ setCodeValues(nodePath, () => committed);
55
+ }
56
+ dropQueue(nodePath, myQueue);
57
+ (0, NotificationCenter_1.showNotification)(`${errorLabel}: ${err instanceof Error ? err.message : String(err)}`, 4000);
58
+ }
59
+ });
60
+ myQueue.chain = next;
61
+ return next;
62
+ };
63
+ exports.enqueueSavePropChange = enqueueSavePropChange;
@@ -0,0 +1,11 @@
1
+ import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
2
+ export type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
+ export declare const saveSequenceProp: ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, }: {
4
+ fileName: string;
5
+ nodePath: SequencePropsSubscriptionKey;
6
+ fieldKey: string;
7
+ value: unknown;
8
+ defaultValue: string | null;
9
+ schema: SequenceSchema;
10
+ setCodeValues: SetCodeValues;
11
+ }) => Promise<void>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveSequenceProp = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ const call_api_1 = require("../call-api");
6
+ const save_prop_queue_1 = require("./save-prop-queue");
7
+ const saveSequenceProp = ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, }) => {
8
+ return (0, save_prop_queue_1.enqueueSavePropChange)({
9
+ nodePath,
10
+ setCodeValues,
11
+ applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
12
+ previous: prev,
13
+ fieldKey,
14
+ value,
15
+ schema,
16
+ }),
17
+ apiCall: () => (0, call_api_1.callApi)('/api/save-sequence-props', {
18
+ fileName,
19
+ nodePath,
20
+ key: fieldKey,
21
+ value: JSON.stringify(value),
22
+ defaultValue,
23
+ schema,
24
+ }),
25
+ mergeServerResponse: (prev, data) => {
26
+ if (!data.canUpdate) {
27
+ return data;
28
+ }
29
+ return {
30
+ canUpdate: true,
31
+ props: data.props,
32
+ effects: prev.canUpdate ? prev.effects : [],
33
+ };
34
+ },
35
+ errorLabel: 'Could not save sequence prop',
36
+ });
37
+ };
38
+ exports.saveSequenceProp = saveSequenceProp;
@@ -2,11 +2,12 @@ import type { SequenceSchema } from 'remotion';
2
2
  import { callApi } from '../call-api';
3
3
  type SubscribeResult = Awaited<ReturnType<typeof callApi<'/api/subscribe-to-sequence-props'>>>;
4
4
  type ApplyResult = (result: SubscribeResult) => void;
5
- export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, clientId, applyOnce, applyEach, }: {
5
+ export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, effects, clientId, applyOnce, applyEach, }: {
6
6
  fileName: string;
7
7
  line: number;
8
8
  column: number;
9
9
  schema: SequenceSchema;
10
+ effects: SequenceSchema[];
10
11
  clientId: string;
11
12
  applyOnce: ApplyResult;
12
13
  applyEach: ApplyResult;
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.acquireSequencePropsSubscription = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
4
5
  const remotion_1 = require("remotion");
5
6
  const call_api_1 = require("../call-api");
6
- const makeKey = (fileName, line, column) => `${fileName}\0${line}\0${column}`;
7
+ const makeKey = (fileName, line, column, sequenceKeys, effectKeys) => `${fileName}\0${line}\0${column}\0${sequenceKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}`;
7
8
  const entries = new Map();
8
- const acquireSequencePropsSubscription = ({ fileName, line, column, schema, clientId, applyOnce, applyEach, }) => {
9
- const key = makeKey(fileName, line, column);
9
+ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, effects, clientId, applyOnce, applyEach, }) => {
10
+ const sequenceKeys = (0, studio_shared_1.getAllSchemaKeys)(schema);
11
+ const effectKeys = effects.map((effect) => (0, studio_shared_1.getAllSchemaKeys)(effect));
12
+ const key = makeKey(fileName, line, column, sequenceKeys, effectKeys);
10
13
  let entry = entries.get(key);
11
14
  if (!entry) {
12
15
  const promise = (0, call_api_1.callApi)('/api/subscribe-to-sequence-props', {
13
16
  fileName,
14
17
  line,
15
18
  column,
16
- schema,
19
+ keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
20
+ effects: effectKeys,
17
21
  clientId,
18
22
  });
19
23
  const created = {
@@ -72,6 +76,8 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, clie
72
76
  fileName: acquired.fileName,
73
77
  nodePath: result.nodePath,
74
78
  clientId: acquired.clientId,
79
+ sequenceKeys,
80
+ effectKeys,
75
81
  });
76
82
  })
77
83
  .catch(() => {
@@ -1,7 +1,8 @@
1
1
  import type { SequenceSchema } from 'remotion';
2
2
  import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
3
- export declare const useSequencePropsSubscription: ({ originalLocation, overrideId, schema, }: {
3
+ export declare const useSequencePropsSubscription: ({ originalLocation, overrideId, schema, effects, }: {
4
4
  overrideId: string;
5
5
  schema: SequenceSchema;
6
+ effects: SequenceSchema[];
6
7
  originalLocation: OriginalPosition | null;
7
8
  }) => void;
@@ -5,7 +5,7 @@ const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const client_id_1 = require("../../helpers/client-id");
7
7
  const sequence_props_subscription_store_1 = require("./sequence-props-subscription-store");
8
- const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, }) => {
8
+ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, effects, }) => {
9
9
  var _a, _b, _c;
10
10
  const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
11
11
  const { setOverrideIdToNodePath } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsSettersContext);
@@ -40,6 +40,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, })
40
40
  line: locationLine,
41
41
  column: locationColumn,
42
42
  schema,
43
+ effects,
43
44
  clientId,
44
45
  applyOnce: (result) => {
45
46
  if (!result.success) {
@@ -59,6 +60,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, })
59
60
  };
60
61
  }, [
61
62
  clientId,
63
+ effects,
62
64
  locationColumn,
63
65
  locationLine,
64
66
  locationSource,
@@ -11,7 +11,7 @@ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
11
11
  const useTimelineHeight = ({ shown, hasBeenCut, }) => {
12
12
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
13
13
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
- const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
14
+ const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
15
15
  const previewServerConnected = previewServerState.type === 'connected';
16
16
  return (0, react_1.useMemo)(() => {
17
17
  const tracksHeight = shown.reduce((acc, track) => {
@@ -25,7 +25,7 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
25
25
  sequence: track.sequence,
26
26
  nodePathInfo: track.nodePathInfo,
27
27
  getIsExpanded,
28
- getCodeValues,
28
+ codeValues,
29
29
  }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM
30
30
  : 0;
31
31
  return acc + layerHeight + expandedHeight;
@@ -34,6 +34,6 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
34
34
  timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
35
35
  (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
36
36
  TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT);
37
- }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, getCodeValues]);
37
+ }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, codeValues]);
38
38
  };
39
39
  exports.useTimelineHeight = useTimelineHeight;
@@ -0,0 +1,9 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ export { __require };