remotion 3.1.3 → 3.1.6

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 (39) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/dist/Still.d.ts +0 -1
  3. package/dist/audio/Audio.d.ts +2 -2
  4. package/dist/audio/AudioForDevelopment.d.ts +2 -2
  5. package/dist/audio/AudioForDevelopment.js +10 -1
  6. package/dist/audio/AudioForRendering.d.ts +1 -1
  7. package/dist/audio/shared-audio-tags.d.ts +3 -2
  8. package/dist/audio/shared-audio-tags.js +83 -40
  9. package/dist/config/index.d.ts +6 -2
  10. package/dist/config/index.js +5 -0
  11. package/dist/config/log.d.ts +1 -1
  12. package/dist/config/output-location.d.ts +2 -0
  13. package/dist/config/output-location.js +16 -0
  14. package/dist/internals.d.ts +6 -4
  15. package/dist/internals.js +2 -0
  16. package/dist/video/Video.d.ts +2 -2
  17. package/dist/video/VideoForDevelopment.d.ts +2 -2
  18. package/dist/video/VideoForRendering.d.ts +1 -1
  19. package/package.json +2 -2
  20. package/dist/config/bundle-out-dir.d.ts +0 -2
  21. package/dist/config/bundle-out-dir.js +0 -12
  22. package/dist/config/every-nth-file.d.ts +0 -2
  23. package/dist/config/every-nth-file.js +0 -12
  24. package/dist/config/loop.d.ts +0 -4
  25. package/dist/config/loop.js +0 -18
  26. package/dist/config/public-path.d.ts +0 -2
  27. package/dist/config/public-path.js +0 -12
  28. package/dist/config/skip-n-frames.d.ts +0 -2
  29. package/dist/config/skip-n-frames.js +0 -12
  30. package/dist/initial-frame.d.ts +0 -2
  31. package/dist/initial-frame.js +0 -12
  32. package/dist/interpolateColors.d.ts +0 -5
  33. package/dist/interpolateColors.js +0 -401
  34. package/dist/preload.d.ts +0 -7
  35. package/dist/preload.js +0 -39
  36. package/dist/sequencing/index.d.ts +0 -19
  37. package/dist/sequencing/index.js +0 -123
  38. package/dist/use-frame.d.ts +0 -7
  39. package/dist/use-frame.js +0 -25
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { RemotionVideoProps } from './props';
3
- export declare const VideoForRendering: React.ForwardRefExoticComponent<Pick<RemotionVideoProps, "id" | "height" | "width" | "children" | "src" | "volume" | "playbackRate" | "slot" | "style" | "title" | "property" | "key" | "is" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "poster" | "disablePictureInPicture" | "disableRemotePlayback"> & React.RefAttributes<HTMLVideoElement>>;
3
+ export declare const VideoForRendering: React.ForwardRefExoticComponent<Pick<RemotionVideoProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "width" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback"> & React.RefAttributes<HTMLVideoElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "3.1.3",
3
+ "version": "3.1.6",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "d57ec16eaf33280c89b0974997946ab9ea155372"
57
+ "gitHead": "188460243a533e1511b3f83fa8c77cd4c445553d"
58
58
  }
@@ -1,2 +0,0 @@
1
- export declare const getBundleOutDir: () => string | null;
2
- export declare const setBundleOutDir: (path: string) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setBundleOutDir = exports.getBundleOutDir = void 0;
4
- let bundleOutDir = null;
5
- const getBundleOutDir = () => {
6
- return bundleOutDir;
7
- };
8
- exports.getBundleOutDir = getBundleOutDir;
9
- const setBundleOutDir = (path) => {
10
- bundleOutDir = path;
11
- };
12
- exports.setBundleOutDir = setBundleOutDir;
@@ -1,2 +0,0 @@
1
- export declare const setEveryNthFrame: (frame: number) => void;
2
- export declare const getEveryNthFrame: () => number;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEveryNthFrame = exports.setEveryNthFrame = void 0;
4
- const validate_every_nth_frame_1 = require("../validation/validate-every-nth-frame");
5
- let everyNthFrame = 1;
6
- const setEveryNthFrame = (frame) => {
7
- (0, validate_every_nth_frame_1.validateEveryNthFrame)(frame);
8
- everyNthFrame = frame;
9
- };
10
- exports.setEveryNthFrame = setEveryNthFrame;
11
- const getEveryNthFrame = () => everyNthFrame;
12
- exports.getEveryNthFrame = getEveryNthFrame;
@@ -1,4 +0,0 @@
1
- import type { Codec } from './codec';
2
- export declare type Loop = number | null;
3
- export declare const setNumberOfGifLoops: (newLoop: Loop | null) => void;
4
- export declare const getAndValidateNumberOfGifLoops: (codec: Codec) => Loop;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAndValidateNumberOfGifLoops = exports.setNumberOfGifLoops = void 0;
4
- let currentLoop = null;
5
- const setNumberOfGifLoops = (newLoop) => {
6
- if (newLoop !== null && typeof newLoop !== 'number') {
7
- throw new Error('--number-of-gif-loops flag must be a number.');
8
- }
9
- currentLoop = newLoop;
10
- };
11
- exports.setNumberOfGifLoops = setNumberOfGifLoops;
12
- const getAndValidateNumberOfGifLoops = (codec) => {
13
- if (codec !== 'gif') {
14
- throw new Error(`The "numberOfGifLoops" setting can only be used for GIFs. The codec is set to ${codec}`);
15
- }
16
- return currentLoop;
17
- };
18
- exports.getAndValidateNumberOfGifLoops = getAndValidateNumberOfGifLoops;
@@ -1,2 +0,0 @@
1
- export declare const getPublicPath: () => string | null;
2
- export declare const setPublicPath: (path: string) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setPublicPath = exports.getPublicPath = void 0;
4
- let publicPath = null;
5
- const getPublicPath = () => {
6
- return publicPath;
7
- };
8
- exports.getPublicPath = getPublicPath;
9
- const setPublicPath = (path) => {
10
- publicPath = path;
11
- };
12
- exports.setPublicPath = setPublicPath;
@@ -1,2 +0,0 @@
1
- export declare const setSkipNFrames: (frame: number) => void;
2
- export declare const getSkipNFrames: () => number;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSkipNFrames = exports.setSkipNFrames = void 0;
4
- const validate_frame_1 = require("../validation/validate-frame");
5
- let skipNFrames = 0;
6
- const setSkipNFrames = (frame) => {
7
- (0, validate_frame_1.validateFrame)(frame, Infinity);
8
- skipNFrames = frame;
9
- };
10
- exports.setSkipNFrames = setSkipNFrames;
11
- const getSkipNFrames = () => skipNFrames;
12
- exports.getSkipNFrames = getSkipNFrames;
@@ -1,2 +0,0 @@
1
- export declare const INITIAL_FRAME_LOCAL_STORAGE_KEY = "remotion.initialFrame";
2
- export declare const setupInitialFrame: () => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupInitialFrame = exports.INITIAL_FRAME_LOCAL_STORAGE_KEY = void 0;
4
- exports.INITIAL_FRAME_LOCAL_STORAGE_KEY = 'remotion.initialFrame';
5
- const getInitialFrame = () => {
6
- const param = localStorage.getItem(exports.INITIAL_FRAME_LOCAL_STORAGE_KEY);
7
- return param ? Number(param) : 0;
8
- };
9
- const setupInitialFrame = () => {
10
- window.remotion_initialFrame = getInitialFrame();
11
- };
12
- exports.setupInitialFrame = setupInitialFrame;
@@ -1,5 +0,0 @@
1
- /**
2
- * Copied from:
3
- * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
4
- */
5
- export declare const interpolateColors: (input: number, inputRange: readonly number[], outputRange: readonly string[]) => string;
@@ -1,401 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copied from:
4
- * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.interpolateColors = void 0;
8
- /* eslint no-bitwise: 0 */
9
- const interpolate_1 = require("./interpolate");
10
- // var INTEGER = '[-+]?\\d+';
11
- const NUMBER = '[-+]?\\d*\\.?\\d+';
12
- const PERCENTAGE = NUMBER + '%';
13
- function call(...args) {
14
- return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
15
- }
16
- function getMatchers() {
17
- const cachedMatchers = {
18
- rgb: undefined,
19
- rgba: undefined,
20
- hsl: undefined,
21
- hsla: undefined,
22
- hex3: undefined,
23
- hex4: undefined,
24
- hex5: undefined,
25
- hex6: undefined,
26
- hex8: undefined,
27
- };
28
- if (cachedMatchers.rgb === undefined) {
29
- cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
30
- cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
31
- cachedMatchers.hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
32
- cachedMatchers.hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
33
- cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
34
- cachedMatchers.hex4 =
35
- /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
36
- cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
37
- cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
38
- }
39
- return cachedMatchers;
40
- }
41
- function hue2rgb(p, q, t) {
42
- if (t < 0) {
43
- t += 1;
44
- }
45
- if (t > 1) {
46
- t -= 1;
47
- }
48
- if (t < 1 / 6) {
49
- return p + (q - p) * 6 * t;
50
- }
51
- if (t < 1 / 2) {
52
- return q;
53
- }
54
- if (t < 2 / 3) {
55
- return p + (q - p) * (2 / 3 - t) * 6;
56
- }
57
- return p;
58
- }
59
- function hslToRgb(h, s, l) {
60
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
61
- const p = 2 * l - q;
62
- const r = hue2rgb(p, q, h + 1 / 3);
63
- const g = hue2rgb(p, q, h);
64
- const b = hue2rgb(p, q, h - 1 / 3);
65
- return ((Math.round(r * 255) << 24) |
66
- (Math.round(g * 255) << 16) |
67
- (Math.round(b * 255) << 8));
68
- }
69
- function parse255(str) {
70
- const int = Number.parseInt(str, 10);
71
- if (int < 0) {
72
- return 0;
73
- }
74
- if (int > 255) {
75
- return 255;
76
- }
77
- return int;
78
- }
79
- function parse360(str) {
80
- const int = Number.parseFloat(str);
81
- return (((int % 360) + 360) % 360) / 360;
82
- }
83
- function parse1(str) {
84
- const num = Number.parseFloat(str);
85
- if (num < 0) {
86
- return 0;
87
- }
88
- if (num > 1) {
89
- return 255;
90
- }
91
- return Math.round(num * 255);
92
- }
93
- function parsePercentage(str) {
94
- // parseFloat conveniently ignores the final %
95
- const int = Number.parseFloat(str);
96
- if (int < 0) {
97
- return 0;
98
- }
99
- if (int > 100) {
100
- return 1;
101
- }
102
- return int / 100;
103
- }
104
- const names = {
105
- transparent: 0x00000000,
106
- // http://www.w3.org/TR/css3-color/#svg-color
107
- aliceblue: 0xf0f8ffff,
108
- antiquewhite: 0xfaebd7ff,
109
- aqua: 0x00ffffff,
110
- aquamarine: 0x7fffd4ff,
111
- azure: 0xf0ffffff,
112
- beige: 0xf5f5dcff,
113
- bisque: 0xffe4c4ff,
114
- black: 0x000000ff,
115
- blanchedalmond: 0xffebcdff,
116
- blue: 0x0000ffff,
117
- blueviolet: 0x8a2be2ff,
118
- brown: 0xa52a2aff,
119
- burlywood: 0xdeb887ff,
120
- burntsienna: 0xea7e5dff,
121
- cadetblue: 0x5f9ea0ff,
122
- chartreuse: 0x7fff00ff,
123
- chocolate: 0xd2691eff,
124
- coral: 0xff7f50ff,
125
- cornflowerblue: 0x6495edff,
126
- cornsilk: 0xfff8dcff,
127
- crimson: 0xdc143cff,
128
- cyan: 0x00ffffff,
129
- darkblue: 0x00008bff,
130
- darkcyan: 0x008b8bff,
131
- darkgoldenrod: 0xb8860bff,
132
- darkgray: 0xa9a9a9ff,
133
- darkgreen: 0x006400ff,
134
- darkgrey: 0xa9a9a9ff,
135
- darkkhaki: 0xbdb76bff,
136
- darkmagenta: 0x8b008bff,
137
- darkolivegreen: 0x556b2fff,
138
- darkorange: 0xff8c00ff,
139
- darkorchid: 0x9932ccff,
140
- darkred: 0x8b0000ff,
141
- darksalmon: 0xe9967aff,
142
- darkseagreen: 0x8fbc8fff,
143
- darkslateblue: 0x483d8bff,
144
- darkslategray: 0x2f4f4fff,
145
- darkslategrey: 0x2f4f4fff,
146
- darkturquoise: 0x00ced1ff,
147
- darkviolet: 0x9400d3ff,
148
- deeppink: 0xff1493ff,
149
- deepskyblue: 0x00bfffff,
150
- dimgray: 0x696969ff,
151
- dimgrey: 0x696969ff,
152
- dodgerblue: 0x1e90ffff,
153
- firebrick: 0xb22222ff,
154
- floralwhite: 0xfffaf0ff,
155
- forestgreen: 0x228b22ff,
156
- fuchsia: 0xff00ffff,
157
- gainsboro: 0xdcdcdcff,
158
- ghostwhite: 0xf8f8ffff,
159
- gold: 0xffd700ff,
160
- goldenrod: 0xdaa520ff,
161
- gray: 0x808080ff,
162
- green: 0x008000ff,
163
- greenyellow: 0xadff2fff,
164
- grey: 0x808080ff,
165
- honeydew: 0xf0fff0ff,
166
- hotpink: 0xff69b4ff,
167
- indianred: 0xcd5c5cff,
168
- indigo: 0x4b0082ff,
169
- ivory: 0xfffff0ff,
170
- khaki: 0xf0e68cff,
171
- lavender: 0xe6e6faff,
172
- lavenderblush: 0xfff0f5ff,
173
- lawngreen: 0x7cfc00ff,
174
- lemonchiffon: 0xfffacdff,
175
- lightblue: 0xadd8e6ff,
176
- lightcoral: 0xf08080ff,
177
- lightcyan: 0xe0ffffff,
178
- lightgoldenrodyellow: 0xfafad2ff,
179
- lightgray: 0xd3d3d3ff,
180
- lightgreen: 0x90ee90ff,
181
- lightgrey: 0xd3d3d3ff,
182
- lightpink: 0xffb6c1ff,
183
- lightsalmon: 0xffa07aff,
184
- lightseagreen: 0x20b2aaff,
185
- lightskyblue: 0x87cefaff,
186
- lightslategray: 0x778899ff,
187
- lightslategrey: 0x778899ff,
188
- lightsteelblue: 0xb0c4deff,
189
- lightyellow: 0xffffe0ff,
190
- lime: 0x00ff00ff,
191
- limegreen: 0x32cd32ff,
192
- linen: 0xfaf0e6ff,
193
- magenta: 0xff00ffff,
194
- maroon: 0x800000ff,
195
- mediumaquamarine: 0x66cdaaff,
196
- mediumblue: 0x0000cdff,
197
- mediumorchid: 0xba55d3ff,
198
- mediumpurple: 0x9370dbff,
199
- mediumseagreen: 0x3cb371ff,
200
- mediumslateblue: 0x7b68eeff,
201
- mediumspringgreen: 0x00fa9aff,
202
- mediumturquoise: 0x48d1ccff,
203
- mediumvioletred: 0xc71585ff,
204
- midnightblue: 0x191970ff,
205
- mintcream: 0xf5fffaff,
206
- mistyrose: 0xffe4e1ff,
207
- moccasin: 0xffe4b5ff,
208
- navajowhite: 0xffdeadff,
209
- navy: 0x000080ff,
210
- oldlace: 0xfdf5e6ff,
211
- olive: 0x808000ff,
212
- olivedrab: 0x6b8e23ff,
213
- orange: 0xffa500ff,
214
- orangered: 0xff4500ff,
215
- orchid: 0xda70d6ff,
216
- palegoldenrod: 0xeee8aaff,
217
- palegreen: 0x98fb98ff,
218
- paleturquoise: 0xafeeeeff,
219
- palevioletred: 0xdb7093ff,
220
- papayawhip: 0xffefd5ff,
221
- peachpuff: 0xffdab9ff,
222
- peru: 0xcd853fff,
223
- pink: 0xffc0cbff,
224
- plum: 0xdda0ddff,
225
- powderblue: 0xb0e0e6ff,
226
- purple: 0x800080ff,
227
- rebeccapurple: 0x663399ff,
228
- red: 0xff0000ff,
229
- rosybrown: 0xbc8f8fff,
230
- royalblue: 0x4169e1ff,
231
- saddlebrown: 0x8b4513ff,
232
- salmon: 0xfa8072ff,
233
- sandybrown: 0xf4a460ff,
234
- seagreen: 0x2e8b57ff,
235
- seashell: 0xfff5eeff,
236
- sienna: 0xa0522dff,
237
- silver: 0xc0c0c0ff,
238
- skyblue: 0x87ceebff,
239
- slateblue: 0x6a5acdff,
240
- slategray: 0x708090ff,
241
- slategrey: 0x708090ff,
242
- snow: 0xfffafaff,
243
- springgreen: 0x00ff7fff,
244
- steelblue: 0x4682b4ff,
245
- tan: 0xd2b48cff,
246
- teal: 0x008080ff,
247
- thistle: 0xd8bfd8ff,
248
- tomato: 0xff6347ff,
249
- turquoise: 0x40e0d0ff,
250
- violet: 0xee82eeff,
251
- wheat: 0xf5deb3ff,
252
- white: 0xffffffff,
253
- whitesmoke: 0xf5f5f5ff,
254
- yellow: 0xffff00ff,
255
- yellowgreen: 0x9acd32ff,
256
- };
257
- function normalizeColor(color) {
258
- const matchers = getMatchers();
259
- let match;
260
- // Ordered based on occurrences on Facebook codebase
261
- if (matchers.hex6) {
262
- if ((match = matchers.hex6.exec(color))) {
263
- return Number.parseInt(match[1] + 'ff', 16) >>> 0;
264
- }
265
- }
266
- if (names[color] !== undefined) {
267
- return names[color];
268
- }
269
- if (matchers.rgb) {
270
- if ((match = matchers.rgb.exec(color))) {
271
- return (
272
- // b
273
- ((parse255(match[1]) << 24) | // r
274
- (parse255(match[2]) << 16) | // g
275
- (parse255(match[3]) << 8) |
276
- 0x000000ff) >>> // a
277
- 0);
278
- }
279
- }
280
- if (matchers.rgba) {
281
- if ((match = matchers.rgba.exec(color))) {
282
- return (
283
- // b
284
- ((parse255(match[1]) << 24) | // r
285
- (parse255(match[2]) << 16) | // g
286
- (parse255(match[3]) << 8) |
287
- parse1(match[4])) >>> // a
288
- 0);
289
- }
290
- }
291
- if (matchers.hex3) {
292
- if ((match = matchers.hex3.exec(color))) {
293
- return (Number.parseInt(match[1] +
294
- match[1] + // r
295
- match[2] +
296
- match[2] + // g
297
- match[3] +
298
- match[3] + // b
299
- 'ff', // a
300
- 16) >>> 0);
301
- }
302
- }
303
- // https://drafts.csswg.org/css-color-4/#hex-notation
304
- if (matchers.hex8) {
305
- if ((match = matchers.hex8.exec(color))) {
306
- return Number.parseInt(match[1], 16) >>> 0;
307
- }
308
- }
309
- if (matchers.hex4) {
310
- if ((match = matchers.hex4.exec(color))) {
311
- return (Number.parseInt(match[1] +
312
- match[1] + // r
313
- match[2] +
314
- match[2] + // g
315
- match[3] +
316
- match[3] + // b
317
- match[4] +
318
- match[4], // a
319
- 16) >>> 0);
320
- }
321
- }
322
- if (matchers.hsl) {
323
- if ((match = matchers.hsl.exec(color))) {
324
- return ((hslToRgb(parse360(match[1]), // h
325
- parsePercentage(match[2]), // s
326
- parsePercentage(match[3]) // l
327
- ) |
328
- 0x000000ff) >>> // a
329
- 0);
330
- }
331
- }
332
- if (matchers.hsla) {
333
- if ((match = matchers.hsla.exec(color))) {
334
- return ((hslToRgb(parse360(match[1]), // h
335
- parsePercentage(match[2]), // s
336
- parsePercentage(match[3]) // l
337
- ) |
338
- parse1(match[4])) >>> // a
339
- 0);
340
- }
341
- }
342
- throw new Error(`invalid color string ${color} provided`);
343
- }
344
- const opacity = (c) => {
345
- return ((c >> 24) & 255) / 255;
346
- };
347
- const red = (c) => {
348
- return (c >> 16) & 255;
349
- };
350
- const green = (c) => {
351
- return (c >> 8) & 255;
352
- };
353
- const blue = (c) => {
354
- return c & 255;
355
- };
356
- const rgbaColor = (r, g, b, alpha) => {
357
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
358
- };
359
- function processColorInitially(color) {
360
- let normalizedColor = normalizeColor(color);
361
- normalizedColor = ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
362
- return normalizedColor;
363
- }
364
- function processColor(color) {
365
- const normalizedColor = processColorInitially(color);
366
- return normalizedColor;
367
- }
368
- const interpolateColorsRGB = (value, inputRange, colors) => {
369
- const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
370
- const unrounded = (0, interpolate_1.interpolate)(value, inputRange, colors.map((c) => f(c)), {
371
- extrapolateLeft: 'clamp',
372
- extrapolateRight: 'clamp',
373
- });
374
- if (f === opacity) {
375
- return Number(unrounded.toFixed(3));
376
- }
377
- return Math.round(unrounded);
378
- });
379
- return rgbaColor(r, g, b, a);
380
- };
381
- const interpolateColors = (input, inputRange, outputRange) => {
382
- if (typeof input === 'undefined') {
383
- throw new TypeError('input can not be undefined');
384
- }
385
- if (typeof inputRange === 'undefined') {
386
- throw new TypeError('inputRange can not be undefined');
387
- }
388
- if (typeof outputRange === 'undefined') {
389
- throw new TypeError('outputRange can not be undefined');
390
- }
391
- if (inputRange.length !== outputRange.length) {
392
- throw new TypeError('inputRange (' +
393
- inputRange.length +
394
- ' values provided) and outputRange (' +
395
- outputRange.length +
396
- ' values provided) must have the same length');
397
- }
398
- const processedOutputRange = outputRange.map((c) => processColor(c));
399
- return interpolateColorsRGB(input, inputRange, processedOutputRange);
400
- };
401
- exports.interpolateColors = interpolateColors;
package/dist/preload.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- declare type PreloadProps = {
3
- for: number;
4
- children: React.ReactNode;
5
- };
6
- export declare const Preload: React.FC<PreloadProps>;
7
- export {};
package/dist/preload.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Preload = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Sequence_1 = require("./Sequence");
7
- const timeline_position_state_1 = require("./timeline-position-state");
8
- const Preload = ({ for: preloadFor, children, }) => {
9
- const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
10
- if (typeof preloadFor === 'undefined') {
11
- throw new Error(`The <Preload /> component requires a 'for' prop, but none was passed.`);
12
- }
13
- if (typeof preloadFor !== 'number') {
14
- throw new Error(`The 'for' prop of <Preload /> must be a number, but is of type ${typeof preloadFor}`);
15
- }
16
- if (Number.isNaN(preloadFor)) {
17
- throw new Error(`The 'for' prop of <Preload /> must be a real number, but it is NaN.`);
18
- }
19
- if (!Number.isFinite(preloadFor)) {
20
- throw new Error(`The 'for' prop of <Preload /> must be a finite number, but it is ${preloadFor}.`);
21
- }
22
- const context = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
23
- const value = (0, react_1.useMemo)(() => {
24
- const contextOffset = sequenceContext
25
- ? sequenceContext.cumulatedFrom + sequenceContext.relativeFrom
26
- : 0;
27
- const currentFrame = context.frame - contextOffset;
28
- return {
29
- ...context,
30
- playing: currentFrame < preloadFor ? false : context.playing,
31
- imperativePlaying: {
32
- current: currentFrame < preloadFor ? false : context.imperativePlaying.current,
33
- },
34
- frame: Math.max(0, currentFrame - preloadFor) + contextOffset,
35
- };
36
- }, [context, preloadFor, sequenceContext]);
37
- return ((0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: value, children: children }));
38
- };
39
- exports.Preload = Preload;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- export declare type SequenceContextType = {
3
- cumulatedFrom: number;
4
- relativeFrom: number;
5
- parentFrom: number;
6
- durationInFrames: number;
7
- id: string;
8
- };
9
- export declare const SequenceContext: React.Context<SequenceContextType | null>;
10
- export declare type SequenceProps = {
11
- children: React.ReactNode;
12
- from: number;
13
- durationInFrames?: number;
14
- name?: string;
15
- layout?: 'absolute-fill' | 'none';
16
- showInTimeline?: boolean;
17
- showLoopTimesInTimeline?: number;
18
- };
19
- export declare const Sequence: React.FC<SequenceProps>;