remotion 3.3.55 → 3.3.56

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 (143) hide show
  1. package/dist/cjs/audio/Audio.d.ts +1 -1
  2. package/dist/cjs/index.d.ts +1 -0
  3. package/dist/cjs/internals.d.ts +1 -1
  4. package/dist/cjs/use-video.d.ts +1 -1
  5. package/dist/cjs/version.d.ts +1 -1
  6. package/dist/cjs/version.js +1 -1
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/esm/version.mjs +1 -1
  9. package/dist/tsconfig-esm.tsbuildinfo +1 -0
  10. package/package.json +3 -3
  11. package/tsconfig-esm.json +12 -0
  12. package/dist/esm/AbsoluteFill.js +0 -25
  13. package/dist/esm/CanUseRemotionHooks.js +0 -6
  14. package/dist/esm/Clipper.js +0 -20
  15. package/dist/esm/Composition.js +0 -112
  16. package/dist/esm/CompositionManager.js +0 -137
  17. package/dist/esm/Folder.js +0 -33
  18. package/dist/esm/IFrame.js +0 -25
  19. package/dist/esm/Img.js +0 -53
  20. package/dist/esm/NativeLayers.js +0 -25
  21. package/dist/esm/Null.js +0 -21
  22. package/dist/esm/RemotionRoot.js +0 -69
  23. package/dist/esm/Sequence.js +0 -128
  24. package/dist/esm/SequenceContext.js +0 -2
  25. package/dist/esm/Still.js +0 -9
  26. package/dist/esm/absolute-src.js +0 -3
  27. package/dist/esm/asset-types.js +0 -1
  28. package/dist/esm/audio/Audio.js +0 -53
  29. package/dist/esm/audio/AudioForDevelopment.js +0 -91
  30. package/dist/esm/audio/AudioForRendering.js +0 -108
  31. package/dist/esm/audio/index.js +0 -2
  32. package/dist/esm/audio/props.js +0 -1
  33. package/dist/esm/audio/shared-audio-tags.js +0 -194
  34. package/dist/esm/audio/use-audio-frame.js +0 -18
  35. package/dist/esm/bezier.js +0 -110
  36. package/dist/esm/cancel-render.js +0 -43
  37. package/dist/esm/config/input-props.js +0 -27
  38. package/dist/esm/config.js +0 -17
  39. package/dist/esm/default-css.js +0 -44
  40. package/dist/esm/delay-render.js +0 -72
  41. package/dist/esm/easing.js +0 -77
  42. package/dist/esm/freeze.js +0 -34
  43. package/dist/esm/get-asset-file-name.js +0 -10
  44. package/dist/esm/get-environment.js +0 -29
  45. package/dist/esm/get-preview-dom-element.js +0 -3
  46. package/dist/esm/get-static-files.js +0 -31
  47. package/dist/esm/get-timeline-clip-name.js +0 -21
  48. package/dist/esm/index.js +0 -49
  49. package/dist/esm/internals.js +0 -75
  50. package/dist/esm/interpolate-colors.js +0 -401
  51. package/dist/esm/interpolate.js +0 -123
  52. package/dist/esm/is-approximately-the-same.js +0 -4
  53. package/dist/esm/is-player.js +0 -9
  54. package/dist/esm/loading-indicator.js +0 -31
  55. package/dist/esm/loop/index.js +0 -29
  56. package/dist/esm/multiple-versions-warning.js +0 -28
  57. package/dist/esm/nonce.js +0 -13
  58. package/dist/esm/play-and-handle-not-allowed-error.js +0 -40
  59. package/dist/esm/portal-node.js +0 -19
  60. package/dist/esm/prefetch-state.js +0 -22
  61. package/dist/esm/prefetch.js +0 -107
  62. package/dist/esm/random.js +0 -37
  63. package/dist/esm/register-root.js +0 -31
  64. package/dist/esm/series/flatten-children.js +0 -12
  65. package/dist/esm/series/index.js +0 -61
  66. package/dist/esm/setup-env-variables.js +0 -32
  67. package/dist/esm/spring/index.js +0 -50
  68. package/dist/esm/spring/measure-spring.js +0 -64
  69. package/dist/esm/spring/spring-utils.js +0 -99
  70. package/dist/esm/static-file.js +0 -29
  71. package/dist/esm/test/Img.test.js +0 -20
  72. package/dist/esm/test/absolute-src.test.js +0 -16
  73. package/dist/esm/test/audio-for-rendering.test.js +0 -83
  74. package/dist/esm/test/audio.test.js +0 -51
  75. package/dist/esm/test/bezier.test.js +0 -50
  76. package/dist/esm/test/composition-rules.test.js +0 -28
  77. package/dist/esm/test/composition-validation.test.js +0 -97
  78. package/dist/esm/test/easing.test.js +0 -189
  79. package/dist/esm/test/expect-to-throw.js +0 -11
  80. package/dist/esm/test/freeze.test.js +0 -63
  81. package/dist/esm/test/get-asset-file-name.test.js +0 -12
  82. package/dist/esm/test/get-current-time.test.js +0 -72
  83. package/dist/esm/test/input-props.test.js +0 -29
  84. package/dist/esm/test/interpolate.test.js +0 -136
  85. package/dist/esm/test/interpolateColors.test.js +0 -61
  86. package/dist/esm/test/loop-validation.test.js +0 -68
  87. package/dist/esm/test/measure-spring.test.js +0 -43
  88. package/dist/esm/test/media-validation.test.js +0 -45
  89. package/dist/esm/test/nested-sequences.test.js +0 -130
  90. package/dist/esm/test/not-all-props-in-media-tags.test.js +0 -28
  91. package/dist/esm/test/random.test.js +0 -58
  92. package/dist/esm/test/ready-manager.test.js +0 -27
  93. package/dist/esm/test/render-hook.js +0 -20
  94. package/dist/esm/test/sequence-from-initial-offset.test.js +0 -33
  95. package/dist/esm/test/sequence-validation.test.js +0 -45
  96. package/dist/esm/test/series.test.js +0 -113
  97. package/dist/esm/test/spring.test.js +0 -36
  98. package/dist/esm/test/truthy.test.js +0 -22
  99. package/dist/esm/test/use-audio-frame.test.js +0 -53
  100. package/dist/esm/test/use-media-in-timeline.test.js +0 -49
  101. package/dist/esm/test/use-media-tag-volume.test.js +0 -44
  102. package/dist/esm/test/use-sync-volume-with-media-tag.test.js +0 -53
  103. package/dist/esm/test/validate-start-from-props.test.js +0 -37
  104. package/dist/esm/test/video.test.js +0 -55
  105. package/dist/esm/test/volume-prop.test.js +0 -93
  106. package/dist/esm/test/wrap-sequence-context.js +0 -37
  107. package/dist/esm/timeline-position-state.js +0 -35
  108. package/dist/esm/truthy.js +0 -3
  109. package/dist/esm/use-current-frame.js +0 -23
  110. package/dist/esm/use-lazy-component.js +0 -22
  111. package/dist/esm/use-media-in-timeline.js +0 -125
  112. package/dist/esm/use-media-playback.js +0 -73
  113. package/dist/esm/use-media-tag-volume.js +0 -27
  114. package/dist/esm/use-sync-volume-with-media-tag.js +0 -17
  115. package/dist/esm/use-unsafe-video-config.js +0 -23
  116. package/dist/esm/use-video-config.js +0 -26
  117. package/dist/esm/use-video.js +0 -24
  118. package/dist/esm/validate-frame.js +0 -20
  119. package/dist/esm/validate-media-props.js +0 -20
  120. package/dist/esm/validate-start-from-props.js +0 -27
  121. package/dist/esm/validation/validate-composition-id.js +0 -8
  122. package/dist/esm/validation/validate-dimensions.js +0 -17
  123. package/dist/esm/validation/validate-duration-in-frames.js +0 -11
  124. package/dist/esm/validation/validate-folder-name.js +0 -14
  125. package/dist/esm/validation/validate-fps.js +0 -17
  126. package/dist/esm/validation/validate-offthreadvideo-image-format.js +0 -11
  127. package/dist/esm/validation/validation-spring-duration.js +0 -17
  128. package/dist/esm/version.js +0 -2
  129. package/dist/esm/video/OffthreadVideo.js +0 -33
  130. package/dist/esm/video/OffthreadVideoForRendering.js +0 -100
  131. package/dist/esm/video/Video.js +0 -51
  132. package/dist/esm/video/VideoForDevelopment.js +0 -110
  133. package/dist/esm/video/VideoForRendering.js +0 -200
  134. package/dist/esm/video/duration-state.js +0 -29
  135. package/dist/esm/video/get-current-time.js +0 -26
  136. package/dist/esm/video/index.js +0 -2
  137. package/dist/esm/video/props.js +0 -1
  138. package/dist/esm/video/video-fragment.js +0 -55
  139. package/dist/esm/video-config.js +0 -1
  140. package/dist/esm/volume-position-state.js +0 -27
  141. package/dist/esm/volume-prop.js +0 -20
  142. package/dist/esm/warn-about-non-seekable-media.js +0 -30
  143. package/dist/esm/wrap-remotion-context.js +0 -45
@@ -1,3 +0,0 @@
1
- export const getPreviewDomElement = () => {
2
- return document.getElementById('container');
3
- };
@@ -1,31 +0,0 @@
1
- let warnedServer = false;
2
- let warnedPlayer = false;
3
- const warnServerOnce = () => {
4
- if (warnedServer) {
5
- return;
6
- }
7
- warnedServer = true;
8
- console.warn('Called getStaticFiles() on the server. The API is only available in the browser. An empty array was returned.');
9
- };
10
- const warnPlayerOnce = () => {
11
- if (warnedPlayer) {
12
- return;
13
- }
14
- warnedPlayer = true;
15
- console.warn('Called getStaticFiles() while using the Remotion Player. The API is only available while using the Remotion Preview. An empty array was returned.');
16
- };
17
- /**
18
- * @description The function array containing all files in the public/ folder. You can reference them by using staticFile().
19
- * @see [Documentation](https://www.remotion.dev/docs/getstaticfiles)
20
- */
21
- export const getStaticFiles = () => {
22
- if (typeof document === 'undefined') {
23
- warnServerOnce();
24
- return [];
25
- }
26
- if (window.remotion_isPlayer) {
27
- warnPlayerOnce();
28
- return [];
29
- }
30
- return window.remotion_staticFiles;
31
- };
@@ -1,21 +0,0 @@
1
- import { Children, isValidElement } from 'react';
2
- const HIDDEN_NAMES = ['__WEBPACK_DEFAULT_EXPORT__'];
3
- export const getTimelineClipName = (children) => {
4
- var _a;
5
- const tree = (_a = Children.map(children, (ch) => {
6
- if (!isValidElement(ch)) {
7
- return null;
8
- }
9
- // Must be name, not ID
10
- const name = typeof ch.type !== 'string' && ch.type.name;
11
- if (name && !HIDDEN_NAMES.includes(name)) {
12
- return name;
13
- }
14
- if (ch.props.children) {
15
- const chName = getTimelineClipName(ch.props.children);
16
- return chName;
17
- }
18
- return null;
19
- })) === null || _a === void 0 ? void 0 : _a.filter(Boolean);
20
- return (tree === null || tree === void 0 ? void 0 : tree.length) ? tree[0] : '';
21
- };
package/dist/esm/index.js DELETED
@@ -1,49 +0,0 @@
1
- import './asset-types.js';
2
- import { Clipper } from './Clipper.js';
3
- import { useIsPlayer } from './is-player.js';
4
- import { checkMultipleRemotionVersions } from './multiple-versions-warning.js';
5
- import { Null } from './Null.js';
6
- checkMultipleRemotionVersions();
7
- export * from './AbsoluteFill.js';
8
- export * from './audio/index.js';
9
- export { cancelRender } from './cancel-render.js';
10
- export * from './Composition.js';
11
- export { Config } from './config.js';
12
- export { getInputProps } from './config/input-props.js';
13
- export { continueRender, delayRender } from './delay-render.js';
14
- export * from './easing.js';
15
- export * from './Folder.js';
16
- export * from './freeze.js';
17
- export { getStaticFiles } from './get-static-files.js';
18
- export * from './IFrame.js';
19
- export * from './Img.js';
20
- export * from './internals.js';
21
- export { interpolateColors } from './interpolate-colors.js';
22
- export * from './interpolate.js';
23
- export { Loop } from './loop/index.js';
24
- export { prefetch } from './prefetch.js';
25
- export { random } from './random.js';
26
- export { registerRoot } from './register-root.js';
27
- export { Sequence } from './Sequence.js';
28
- export { Series } from './series/index.js';
29
- export * from './spring/index.js';
30
- export { staticFile } from './static-file.js';
31
- export * from './Still.js';
32
- export { useCurrentFrame } from './use-current-frame.js';
33
- export * from './use-video-config.js';
34
- export * from './version.js';
35
- export * from './video-config.js';
36
- export * from './video/index.js';
37
- export const Experimental = {
38
- /**
39
- * @description This is a special component that will cause Remotion to only partially capture the frame of the video.
40
- * @see [Documentation](https://www.remotion.dev/docs/clipper)
41
- */
42
- Clipper,
43
- /**
44
- * @description This is a special component, that, when rendered, will skip rendering the frame altogether.
45
- * @see [Documentation](https://www.remotion.dev/docs/null)
46
- */
47
- Null,
48
- useIsPlayer,
49
- };
@@ -1,75 +0,0 @@
1
- import { enableLegacyRemotionConfig } from './config.js';
2
- import { SharedAudioContext, SharedAudioContextProvider, } from './audio/shared-audio-tags.js';
3
- import { CanUseRemotionHooks, CanUseRemotionHooksProvider, } from './CanUseRemotionHooks.js';
4
- import { CompositionManager, compositionsRef } from './CompositionManager.js';
5
- import * as CSSUtils from './default-css.js';
6
- import { DELAY_RENDER_CALLSTACK_TOKEN } from './delay-render.js';
7
- import { getRemotionEnvironment, useRemotionEnvironment, } from './get-environment.js';
8
- import { getPreviewDomElement } from './get-preview-dom-element.js';
9
- import { IsPlayerContextProvider, useIsPlayer } from './is-player.js';
10
- import { portalNode } from './portal-node.js';
11
- import { PrefetchProvider } from './prefetch-state.js';
12
- import { getRoot, waitForRoot } from './register-root.js';
13
- import { RemotionRoot } from './RemotionRoot.js';
14
- import { SequenceContext } from './SequenceContext.js';
15
- import { ENV_VARIABLES_ENV_NAME, setupEnvVariables, } from './setup-env-variables.js';
16
- import * as TimelinePosition from './timeline-position-state.js';
17
- import { truthy } from './truthy.js';
18
- import { useLazyComponent } from './use-lazy-component.js';
19
- import { useUnsafeVideoConfig } from './use-unsafe-video-config.js';
20
- import { useVideo } from './use-video.js';
21
- import { validateFrame } from './validate-frame.js';
22
- import { invalidCompositionErrorMessage, isCompositionIdValid, } from './validation/validate-composition-id.js';
23
- import { validateDimension } from './validation/validate-dimensions.js';
24
- import { validateDurationInFrames } from './validation/validate-duration-in-frames.js';
25
- import { validateFps } from './validation/validate-fps.js';
26
- import { validateOffthreadVideoImageFormat } from './validation/validate-offthreadvideo-image-format.js';
27
- import { DurationsContextProvider } from './video/duration-state.js';
28
- import { MediaVolumeContext, SetMediaVolumeContext, useMediaMutedState, useMediaVolumeState, } from './volume-position-state.js';
29
- import { RemotionContextProvider, useRemotionContexts, } from './wrap-remotion-context.js';
30
- const Timeline = TimelinePosition;
31
- // Mark them as Internals so use don't assume this is public
32
- // API and are less likely to use it
33
- export const Internals = {
34
- useUnsafeVideoConfig,
35
- Timeline,
36
- CompositionManager,
37
- RemotionRoot,
38
- useVideo,
39
- getRoot,
40
- useMediaVolumeState,
41
- useMediaMutedState,
42
- useLazyComponent,
43
- truthy,
44
- SequenceContext,
45
- useRemotionContexts,
46
- RemotionContextProvider,
47
- CSSUtils,
48
- setupEnvVariables,
49
- ENV_VARIABLES_ENV_NAME,
50
- MediaVolumeContext,
51
- SetMediaVolumeContext,
52
- validateDurationInFrames,
53
- validateFps,
54
- validateDimension,
55
- getRemotionEnvironment,
56
- SharedAudioContext,
57
- SharedAudioContextProvider,
58
- invalidCompositionErrorMessage,
59
- isCompositionIdValid,
60
- getPreviewDomElement,
61
- compositionsRef,
62
- DELAY_RENDER_CALLSTACK_TOKEN,
63
- portalNode,
64
- waitForRoot,
65
- validateOffthreadVideoImageFormat,
66
- CanUseRemotionHooksProvider,
67
- CanUseRemotionHooks,
68
- enableLegacyRemotionConfig,
69
- PrefetchProvider,
70
- DurationsContextProvider,
71
- IsPlayerContextProvider,
72
- useIsPlayer,
73
- useRemotionEnvironment,
74
- validateFrame,
75
- };
@@ -1,401 +0,0 @@
1
- /**
2
- * Copied from:
3
- * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
4
- */
5
- /* eslint no-bitwise: 0 */
6
- import { interpolate } from './interpolate.js';
7
- // var INTEGER = '[-+]?\\d+';
8
- const NUMBER = '[-+]?\\d*\\.?\\d+';
9
- const PERCENTAGE = NUMBER + '%';
10
- function call(...args) {
11
- return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
12
- }
13
- function getMatchers() {
14
- const cachedMatchers = {
15
- rgb: undefined,
16
- rgba: undefined,
17
- hsl: undefined,
18
- hsla: undefined,
19
- hex3: undefined,
20
- hex4: undefined,
21
- hex5: undefined,
22
- hex6: undefined,
23
- hex8: undefined,
24
- };
25
- if (cachedMatchers.rgb === undefined) {
26
- cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
27
- cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
28
- cachedMatchers.hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
29
- cachedMatchers.hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
30
- cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
31
- cachedMatchers.hex4 =
32
- /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
33
- cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
34
- cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
35
- }
36
- return cachedMatchers;
37
- }
38
- function hue2rgb(p, q, t) {
39
- if (t < 0) {
40
- t += 1;
41
- }
42
- if (t > 1) {
43
- t -= 1;
44
- }
45
- if (t < 1 / 6) {
46
- return p + (q - p) * 6 * t;
47
- }
48
- if (t < 1 / 2) {
49
- return q;
50
- }
51
- if (t < 2 / 3) {
52
- return p + (q - p) * (2 / 3 - t) * 6;
53
- }
54
- return p;
55
- }
56
- function hslToRgb(h, s, l) {
57
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
58
- const p = 2 * l - q;
59
- const r = hue2rgb(p, q, h + 1 / 3);
60
- const g = hue2rgb(p, q, h);
61
- const b = hue2rgb(p, q, h - 1 / 3);
62
- return ((Math.round(r * 255) << 24) |
63
- (Math.round(g * 255) << 16) |
64
- (Math.round(b * 255) << 8));
65
- }
66
- function parse255(str) {
67
- const int = Number.parseInt(str, 10);
68
- if (int < 0) {
69
- return 0;
70
- }
71
- if (int > 255) {
72
- return 255;
73
- }
74
- return int;
75
- }
76
- function parse360(str) {
77
- const int = Number.parseFloat(str);
78
- return (((int % 360) + 360) % 360) / 360;
79
- }
80
- function parse1(str) {
81
- const num = Number.parseFloat(str);
82
- if (num < 0) {
83
- return 0;
84
- }
85
- if (num > 1) {
86
- return 255;
87
- }
88
- return Math.round(num * 255);
89
- }
90
- function parsePercentage(str) {
91
- // parseFloat conveniently ignores the final %
92
- const int = Number.parseFloat(str);
93
- if (int < 0) {
94
- return 0;
95
- }
96
- if (int > 100) {
97
- return 1;
98
- }
99
- return int / 100;
100
- }
101
- const names = {
102
- transparent: 0x00000000,
103
- // http://www.w3.org/TR/css3-color/#svg-color
104
- aliceblue: 0xf0f8ffff,
105
- antiquewhite: 0xfaebd7ff,
106
- aqua: 0x00ffffff,
107
- aquamarine: 0x7fffd4ff,
108
- azure: 0xf0ffffff,
109
- beige: 0xf5f5dcff,
110
- bisque: 0xffe4c4ff,
111
- black: 0x000000ff,
112
- blanchedalmond: 0xffebcdff,
113
- blue: 0x0000ffff,
114
- blueviolet: 0x8a2be2ff,
115
- brown: 0xa52a2aff,
116
- burlywood: 0xdeb887ff,
117
- burntsienna: 0xea7e5dff,
118
- cadetblue: 0x5f9ea0ff,
119
- chartreuse: 0x7fff00ff,
120
- chocolate: 0xd2691eff,
121
- coral: 0xff7f50ff,
122
- cornflowerblue: 0x6495edff,
123
- cornsilk: 0xfff8dcff,
124
- crimson: 0xdc143cff,
125
- cyan: 0x00ffffff,
126
- darkblue: 0x00008bff,
127
- darkcyan: 0x008b8bff,
128
- darkgoldenrod: 0xb8860bff,
129
- darkgray: 0xa9a9a9ff,
130
- darkgreen: 0x006400ff,
131
- darkgrey: 0xa9a9a9ff,
132
- darkkhaki: 0xbdb76bff,
133
- darkmagenta: 0x8b008bff,
134
- darkolivegreen: 0x556b2fff,
135
- darkorange: 0xff8c00ff,
136
- darkorchid: 0x9932ccff,
137
- darkred: 0x8b0000ff,
138
- darksalmon: 0xe9967aff,
139
- darkseagreen: 0x8fbc8fff,
140
- darkslateblue: 0x483d8bff,
141
- darkslategray: 0x2f4f4fff,
142
- darkslategrey: 0x2f4f4fff,
143
- darkturquoise: 0x00ced1ff,
144
- darkviolet: 0x9400d3ff,
145
- deeppink: 0xff1493ff,
146
- deepskyblue: 0x00bfffff,
147
- dimgray: 0x696969ff,
148
- dimgrey: 0x696969ff,
149
- dodgerblue: 0x1e90ffff,
150
- firebrick: 0xb22222ff,
151
- floralwhite: 0xfffaf0ff,
152
- forestgreen: 0x228b22ff,
153
- fuchsia: 0xff00ffff,
154
- gainsboro: 0xdcdcdcff,
155
- ghostwhite: 0xf8f8ffff,
156
- gold: 0xffd700ff,
157
- goldenrod: 0xdaa520ff,
158
- gray: 0x808080ff,
159
- green: 0x008000ff,
160
- greenyellow: 0xadff2fff,
161
- grey: 0x808080ff,
162
- honeydew: 0xf0fff0ff,
163
- hotpink: 0xff69b4ff,
164
- indianred: 0xcd5c5cff,
165
- indigo: 0x4b0082ff,
166
- ivory: 0xfffff0ff,
167
- khaki: 0xf0e68cff,
168
- lavender: 0xe6e6faff,
169
- lavenderblush: 0xfff0f5ff,
170
- lawngreen: 0x7cfc00ff,
171
- lemonchiffon: 0xfffacdff,
172
- lightblue: 0xadd8e6ff,
173
- lightcoral: 0xf08080ff,
174
- lightcyan: 0xe0ffffff,
175
- lightgoldenrodyellow: 0xfafad2ff,
176
- lightgray: 0xd3d3d3ff,
177
- lightgreen: 0x90ee90ff,
178
- lightgrey: 0xd3d3d3ff,
179
- lightpink: 0xffb6c1ff,
180
- lightsalmon: 0xffa07aff,
181
- lightseagreen: 0x20b2aaff,
182
- lightskyblue: 0x87cefaff,
183
- lightslategray: 0x778899ff,
184
- lightslategrey: 0x778899ff,
185
- lightsteelblue: 0xb0c4deff,
186
- lightyellow: 0xffffe0ff,
187
- lime: 0x00ff00ff,
188
- limegreen: 0x32cd32ff,
189
- linen: 0xfaf0e6ff,
190
- magenta: 0xff00ffff,
191
- maroon: 0x800000ff,
192
- mediumaquamarine: 0x66cdaaff,
193
- mediumblue: 0x0000cdff,
194
- mediumorchid: 0xba55d3ff,
195
- mediumpurple: 0x9370dbff,
196
- mediumseagreen: 0x3cb371ff,
197
- mediumslateblue: 0x7b68eeff,
198
- mediumspringgreen: 0x00fa9aff,
199
- mediumturquoise: 0x48d1ccff,
200
- mediumvioletred: 0xc71585ff,
201
- midnightblue: 0x191970ff,
202
- mintcream: 0xf5fffaff,
203
- mistyrose: 0xffe4e1ff,
204
- moccasin: 0xffe4b5ff,
205
- navajowhite: 0xffdeadff,
206
- navy: 0x000080ff,
207
- oldlace: 0xfdf5e6ff,
208
- olive: 0x808000ff,
209
- olivedrab: 0x6b8e23ff,
210
- orange: 0xffa500ff,
211
- orangered: 0xff4500ff,
212
- orchid: 0xda70d6ff,
213
- palegoldenrod: 0xeee8aaff,
214
- palegreen: 0x98fb98ff,
215
- paleturquoise: 0xafeeeeff,
216
- palevioletred: 0xdb7093ff,
217
- papayawhip: 0xffefd5ff,
218
- peachpuff: 0xffdab9ff,
219
- peru: 0xcd853fff,
220
- pink: 0xffc0cbff,
221
- plum: 0xdda0ddff,
222
- powderblue: 0xb0e0e6ff,
223
- purple: 0x800080ff,
224
- rebeccapurple: 0x663399ff,
225
- red: 0xff0000ff,
226
- rosybrown: 0xbc8f8fff,
227
- royalblue: 0x4169e1ff,
228
- saddlebrown: 0x8b4513ff,
229
- salmon: 0xfa8072ff,
230
- sandybrown: 0xf4a460ff,
231
- seagreen: 0x2e8b57ff,
232
- seashell: 0xfff5eeff,
233
- sienna: 0xa0522dff,
234
- silver: 0xc0c0c0ff,
235
- skyblue: 0x87ceebff,
236
- slateblue: 0x6a5acdff,
237
- slategray: 0x708090ff,
238
- slategrey: 0x708090ff,
239
- snow: 0xfffafaff,
240
- springgreen: 0x00ff7fff,
241
- steelblue: 0x4682b4ff,
242
- tan: 0xd2b48cff,
243
- teal: 0x008080ff,
244
- thistle: 0xd8bfd8ff,
245
- tomato: 0xff6347ff,
246
- turquoise: 0x40e0d0ff,
247
- violet: 0xee82eeff,
248
- wheat: 0xf5deb3ff,
249
- white: 0xffffffff,
250
- whitesmoke: 0xf5f5f5ff,
251
- yellow: 0xffff00ff,
252
- yellowgreen: 0x9acd32ff,
253
- };
254
- function normalizeColor(color) {
255
- const matchers = getMatchers();
256
- let match;
257
- // Ordered based on occurrences on Facebook codebase
258
- if (matchers.hex6) {
259
- if ((match = matchers.hex6.exec(color))) {
260
- return Number.parseInt(match[1] + 'ff', 16) >>> 0;
261
- }
262
- }
263
- if (names[color] !== undefined) {
264
- return names[color];
265
- }
266
- if (matchers.rgb) {
267
- if ((match = matchers.rgb.exec(color))) {
268
- return (
269
- // b
270
- ((parse255(match[1]) << 24) | // r
271
- (parse255(match[2]) << 16) | // g
272
- (parse255(match[3]) << 8) |
273
- 0x000000ff) >>> // a
274
- 0);
275
- }
276
- }
277
- if (matchers.rgba) {
278
- if ((match = matchers.rgba.exec(color))) {
279
- return (
280
- // b
281
- ((parse255(match[1]) << 24) | // r
282
- (parse255(match[2]) << 16) | // g
283
- (parse255(match[3]) << 8) |
284
- parse1(match[4])) >>> // a
285
- 0);
286
- }
287
- }
288
- if (matchers.hex3) {
289
- if ((match = matchers.hex3.exec(color))) {
290
- return (Number.parseInt(match[1] +
291
- match[1] + // r
292
- match[2] +
293
- match[2] + // g
294
- match[3] +
295
- match[3] + // b
296
- 'ff', // a
297
- 16) >>> 0);
298
- }
299
- }
300
- // https://drafts.csswg.org/css-color-4/#hex-notation
301
- if (matchers.hex8) {
302
- if ((match = matchers.hex8.exec(color))) {
303
- return Number.parseInt(match[1], 16) >>> 0;
304
- }
305
- }
306
- if (matchers.hex4) {
307
- if ((match = matchers.hex4.exec(color))) {
308
- return (Number.parseInt(match[1] +
309
- match[1] + // r
310
- match[2] +
311
- match[2] + // g
312
- match[3] +
313
- match[3] + // b
314
- match[4] +
315
- match[4], // a
316
- 16) >>> 0);
317
- }
318
- }
319
- if (matchers.hsl) {
320
- if ((match = matchers.hsl.exec(color))) {
321
- return ((hslToRgb(parse360(match[1]), // h
322
- parsePercentage(match[2]), // s
323
- parsePercentage(match[3]) // l
324
- ) |
325
- 0x000000ff) >>> // a
326
- 0);
327
- }
328
- }
329
- if (matchers.hsla) {
330
- if ((match = matchers.hsla.exec(color))) {
331
- return ((hslToRgb(parse360(match[1]), // h
332
- parsePercentage(match[2]), // s
333
- parsePercentage(match[3]) // l
334
- ) |
335
- parse1(match[4])) >>> // a
336
- 0);
337
- }
338
- }
339
- throw new Error(`invalid color string ${color} provided`);
340
- }
341
- const opacity = (c) => {
342
- return ((c >> 24) & 255) / 255;
343
- };
344
- const red = (c) => {
345
- return (c >> 16) & 255;
346
- };
347
- const green = (c) => {
348
- return (c >> 8) & 255;
349
- };
350
- const blue = (c) => {
351
- return c & 255;
352
- };
353
- const rgbaColor = (r, g, b, alpha) => {
354
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
355
- };
356
- function processColorInitially(color) {
357
- let normalizedColor = normalizeColor(color);
358
- normalizedColor = ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
359
- return normalizedColor;
360
- }
361
- function processColor(color) {
362
- const normalizedColor = processColorInitially(color);
363
- return normalizedColor;
364
- }
365
- const interpolateColorsRGB = (value, inputRange, colors) => {
366
- const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
367
- const unrounded = interpolate(value, inputRange, colors.map((c) => f(c)), {
368
- extrapolateLeft: 'clamp',
369
- extrapolateRight: 'clamp',
370
- });
371
- if (f === opacity) {
372
- return Number(unrounded.toFixed(3));
373
- }
374
- return Math.round(unrounded);
375
- });
376
- return rgbaColor(r, g, b, a);
377
- };
378
- /**
379
- * @description This function allows you to map a range of values to colors using a concise syntax.
380
- * @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
381
- */
382
- export const interpolateColors = (input, inputRange, outputRange) => {
383
- if (typeof input === 'undefined') {
384
- throw new TypeError('input can not be undefined');
385
- }
386
- if (typeof inputRange === 'undefined') {
387
- throw new TypeError('inputRange can not be undefined');
388
- }
389
- if (typeof outputRange === 'undefined') {
390
- throw new TypeError('outputRange can not be undefined');
391
- }
392
- if (inputRange.length !== outputRange.length) {
393
- throw new TypeError('inputRange (' +
394
- inputRange.length +
395
- ' values provided) and outputRange (' +
396
- outputRange.length +
397
- ' values provided) must have the same length');
398
- }
399
- const processedOutputRange = outputRange.map((c) => processColor(c));
400
- return interpolateColorsRGB(input, inputRange, processedOutputRange);
401
- };