@remotion/gif 3.0.4 → 3.0.7
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/Gif.d.ts +0 -2
- package/dist/Gif.js +0 -1
- package/dist/GifForDevelopment.d.ts +0 -1
- package/dist/GifForDevelopment.js +4 -4
- package/dist/GifForRendering.d.ts +0 -1
- package/dist/GifForRendering.js +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/props.d.ts +0 -1
- package/dist/props.js +0 -1
- package/dist/useCurrentGifIndex.d.ts +0 -1
- package/dist/useCurrentGifIndex.js +0 -1
- package/package.json +3 -3
package/dist/Gif.d.ts
CHANGED
package/dist/Gif.js
CHANGED
|
@@ -8,8 +8,9 @@ const react_1 = require("react");
|
|
|
8
8
|
const useCurrentGifIndex_1 = require("./useCurrentGifIndex");
|
|
9
9
|
const cache = new lru_map_1.LRUMap(30);
|
|
10
10
|
exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onError, onLoad, fit = 'fill', ...props }, ref) => {
|
|
11
|
+
const resolvedSrc = new URL(src, window.location.origin).href;
|
|
11
12
|
const [state, update] = (0, react_1.useState)(() => {
|
|
12
|
-
const parsedGif = cache.get(
|
|
13
|
+
const parsedGif = cache.get(resolvedSrc);
|
|
13
14
|
if (parsedGif === undefined) {
|
|
14
15
|
return {
|
|
15
16
|
delays: [],
|
|
@@ -21,7 +22,7 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
|
|
|
21
22
|
return parsedGif;
|
|
22
23
|
});
|
|
23
24
|
// skip loading if frames exist
|
|
24
|
-
(0, tools_1.useWorkerParser)(Boolean(state.frames.length) ||
|
|
25
|
+
(0, tools_1.useWorkerParser)(Boolean(state.frames.length) || resolvedSrc, (info) => {
|
|
25
26
|
if ('error' in info) {
|
|
26
27
|
if (onError) {
|
|
27
28
|
onError(info.error);
|
|
@@ -32,11 +33,10 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
|
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
35
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(info);
|
|
35
|
-
cache.set(
|
|
36
|
+
cache.set(resolvedSrc, info);
|
|
36
37
|
update(info);
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays);
|
|
40
41
|
return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }, void 0));
|
|
41
42
|
});
|
|
42
|
-
//# sourceMappingURL=GifForDevelopment.js.map
|
package/dist/GifForRendering.js
CHANGED
|
@@ -7,15 +7,16 @@ const react_1 = require("react");
|
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const useCurrentGifIndex_1 = require("./useCurrentGifIndex");
|
|
9
9
|
exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad, onError, fit = 'fill', ...props }, ref) => {
|
|
10
|
+
const resolvedSrc = new URL(src, window.location.origin).href;
|
|
10
11
|
const [state, update] = (0, react_1.useState)({
|
|
11
12
|
delays: [],
|
|
12
13
|
frames: [],
|
|
13
14
|
width: 0,
|
|
14
15
|
height: 0,
|
|
15
16
|
});
|
|
16
|
-
const [id] = (0, react_1.useState)(() => (0, remotion_1.delayRender)(`Rendering <Gif/> with src="${
|
|
17
|
+
const [id] = (0, react_1.useState)(() => (0, remotion_1.delayRender)(`Rendering <Gif/> with src="${resolvedSrc}"`));
|
|
17
18
|
const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays);
|
|
18
|
-
(0, tools_1.useParser)(
|
|
19
|
+
(0, tools_1.useParser)(resolvedSrc, (info) => {
|
|
19
20
|
if ('error' in info) {
|
|
20
21
|
if (onError) {
|
|
21
22
|
onError(info.error);
|
|
@@ -32,4 +33,3 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
|
|
|
32
33
|
});
|
|
33
34
|
return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }, void 0));
|
|
34
35
|
});
|
|
35
|
-
//# sourceMappingURL=GifForRendering.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/props.d.ts
CHANGED
package/dist/props.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/gif",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Gif component for remotion",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@react-gifs/tools": "0.1.2",
|
|
25
25
|
"lru_map": "0.4.1",
|
|
26
|
-
"remotion": "3.0.
|
|
26
|
+
"remotion": "3.0.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@jonny/eslint-config": "3.0.259",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "e44469b9a64608db9bec219339bf93a0ac6e9655"
|
|
58
58
|
}
|