@remotion/gif 3.3.63 → 3.3.64

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 (49) hide show
  1. package/dist/tsconfig-esm.tsbuildinfo +1 -1
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +3 -3
  4. package/dist/Gif.d.ts +0 -7
  5. package/dist/Gif.js +0 -19
  6. package/dist/GifForDevelopment.d.ts +0 -3
  7. package/dist/GifForDevelopment.js +0 -81
  8. package/dist/GifForRendering.d.ts +0 -3
  9. package/dist/GifForRendering.js +0 -80
  10. package/dist/canvas.d.ts +0 -13
  11. package/dist/canvas.js +0 -96
  12. package/dist/get-gif-duration-in-seconds.d.ts +0 -5
  13. package/dist/get-gif-duration-in-seconds.js +0 -34
  14. package/dist/gif-cache.d.ts +0 -4
  15. package/dist/gif-cache.js +0 -6
  16. package/dist/gifuct/deinterlace.d.ts +0 -4
  17. package/dist/gifuct/deinterlace.js +0 -26
  18. package/dist/gifuct/index.d.ts +0 -4
  19. package/dist/gifuct/index.js +0 -60
  20. package/dist/gifuct/lzw.d.ts +0 -5
  21. package/dist/gifuct/lzw.js +0 -119
  22. package/dist/gifuct/types.d.ts +0 -96
  23. package/dist/gifuct/types.js +0 -2
  24. package/dist/index.d.ts +0 -4
  25. package/dist/index.js +0 -9
  26. package/dist/is-cors-error.d.ts +0 -1
  27. package/dist/is-cors-error.js +0 -13
  28. package/dist/parse-generate.d.ts +0 -18
  29. package/dist/parse-generate.js +0 -96
  30. package/dist/parser/decompress-frames.d.ts +0 -2
  31. package/dist/parser/decompress-frames.js +0 -19
  32. package/dist/preload-gif.d.ts +0 -8
  33. package/dist/preload-gif.js +0 -41
  34. package/dist/props.d.ts +0 -24
  35. package/dist/props.js +0 -2
  36. package/dist/react-tools.d.ts +0 -9
  37. package/dist/react-tools.js +0 -39
  38. package/dist/resolve-gif-source.d.ts +0 -1
  39. package/dist/resolve-gif-source.js +0 -7
  40. package/dist/use-element-size.d.ts +0 -6
  41. package/dist/use-element-size.js +0 -73
  42. package/dist/useCurrentGifIndex.d.ts +0 -2
  43. package/dist/useCurrentGifIndex.js +0 -35
  44. package/dist/worker/index.d.ts +0 -1
  45. package/dist/worker/index.js +0 -12
  46. package/dist/worker/source.d.ts +0 -1
  47. package/dist/worker/source.js +0 -7
  48. package/dist/worker/worker.d.ts +0 -1
  49. package/dist/worker/worker.js +0 -39
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GifForRendering = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const remotion_1 = require("remotion");
7
- const canvas_1 = require("./canvas");
8
- const gif_cache_1 = require("./gif-cache");
9
- const is_cors_error_1 = require("./is-cors-error");
10
- const react_tools_1 = require("./react-tools");
11
- const resolve_gif_source_1 = require("./resolve-gif-source");
12
- const useCurrentGifIndex_1 = require("./useCurrentGifIndex");
13
- exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad, onError, loopBehavior = 'loop', fit = 'fill', ...props }, ref) => {
14
- const resolvedSrc = (0, resolve_gif_source_1.resolveGifSource)(src);
15
- const [state, update] = (0, react_1.useState)(() => {
16
- const parsedGif = gif_cache_1.volatileGifCache.get(resolvedSrc);
17
- if (parsedGif === undefined) {
18
- return {
19
- delays: [],
20
- frames: [],
21
- width: 0,
22
- height: 0,
23
- };
24
- }
25
- return parsedGif;
26
- });
27
- const [error, setError] = (0, react_1.useState)(null);
28
- const [id] = (0, react_1.useState)(() => (0, remotion_1.delayRender)(`Rendering <Gif/> with src="${resolvedSrc}"`));
29
- const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays, loopBehavior);
30
- const currentOnLoad = (0, react_1.useRef)(onLoad);
31
- const currentOnError = (0, react_1.useRef)(onError);
32
- currentOnLoad.current = onLoad;
33
- currentOnError.current = onError;
34
- (0, react_1.useEffect)(() => {
35
- const controller = new AbortController();
36
- let done = false;
37
- let aborted = false;
38
- const newHandle = (0, remotion_1.delayRender)('Loading <Gif /> with src=' + resolvedSrc);
39
- (0, react_tools_1.parseGif)({ controller, src: resolvedSrc })
40
- .then((parsed) => {
41
- var _a;
42
- (_a = currentOnLoad.current) === null || _a === void 0 ? void 0 : _a.call(currentOnLoad, parsed);
43
- update(parsed);
44
- gif_cache_1.volatileGifCache.set(resolvedSrc, parsed);
45
- done = true;
46
- (0, remotion_1.continueRender)(newHandle);
47
- (0, remotion_1.continueRender)(id);
48
- })
49
- .catch((err) => {
50
- if (aborted) {
51
- (0, remotion_1.continueRender)(newHandle);
52
- return;
53
- }
54
- if (currentOnError.current) {
55
- currentOnError.current(err);
56
- }
57
- else {
58
- setError(err);
59
- }
60
- });
61
- return () => {
62
- if (!done) {
63
- aborted = true;
64
- controller.abort();
65
- }
66
- (0, remotion_1.continueRender)(newHandle);
67
- };
68
- }, [id, resolvedSrc]);
69
- if (error) {
70
- console.error(error.stack);
71
- if ((0, is_cors_error_1.isCorsError)(error)) {
72
- throw new Error(`Failed to render GIF with source ${src}: "${error.message}". You must enable CORS for this URL.`);
73
- }
74
- throw new Error(`Failed to render GIF with source ${src}: "${error.message}". Render with --log=verbose to see the full stack.`);
75
- }
76
- if (index === -1) {
77
- return null;
78
- }
79
- return ((0, jsx_runtime_1.jsx)(canvas_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width, height: height, ...props, ref: ref }));
80
- });
package/dist/canvas.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { GifFillMode } from './props';
3
- declare type Props = {
4
- index: number;
5
- frames: ImageData[];
6
- width?: number;
7
- height?: number;
8
- fit: GifFillMode;
9
- className?: string;
10
- style?: React.CSSProperties;
11
- };
12
- export declare const Canvas: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<unknown>>;
13
- export {};
package/dist/canvas.js DELETED
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Canvas = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const use_element_size_1 = require("./use-element-size");
7
- const calcArgs = (fit, frameSize, canvasSize) => {
8
- switch (fit) {
9
- case 'fill': {
10
- return [
11
- 0,
12
- 0,
13
- frameSize.width,
14
- frameSize.height,
15
- 0,
16
- 0,
17
- canvasSize.width,
18
- canvasSize.height,
19
- ];
20
- }
21
- case 'contain': {
22
- const ratio = Math.min(canvasSize.width / frameSize.width, canvasSize.height / frameSize.height);
23
- const centerX = (canvasSize.width - frameSize.width * ratio) / 2;
24
- const centerY = (canvasSize.height - frameSize.height * ratio) / 2;
25
- return [
26
- 0,
27
- 0,
28
- frameSize.width,
29
- frameSize.height,
30
- centerX,
31
- centerY,
32
- frameSize.width * ratio,
33
- frameSize.height * ratio,
34
- ];
35
- }
36
- case 'cover': {
37
- const ratio = Math.max(canvasSize.width / frameSize.width, canvasSize.height / frameSize.height);
38
- const centerX = (canvasSize.width - frameSize.width * ratio) / 2;
39
- const centerY = (canvasSize.height - frameSize.height * ratio) / 2;
40
- return [
41
- 0,
42
- 0,
43
- frameSize.width,
44
- frameSize.height,
45
- centerX,
46
- centerY,
47
- frameSize.width * ratio,
48
- frameSize.height * ratio,
49
- ];
50
- }
51
- default:
52
- throw new Error('Unknown fit: ' + fit);
53
- }
54
- };
55
- const makeCanvas = () => {
56
- if (typeof document === 'undefined') {
57
- return null;
58
- }
59
- const canvas = document.createElement('canvas');
60
- const ctx = canvas.getContext('2d');
61
- canvas.width = 0;
62
- canvas.height = 0;
63
- return ctx;
64
- };
65
- exports.Canvas = (0, react_1.forwardRef)(({ index, frames, width, height, fit, className, style }, ref) => {
66
- const canvasRef = (0, react_1.useRef)(null);
67
- const [tempCtx] = (0, react_1.useState)(() => {
68
- return makeCanvas();
69
- });
70
- const size = (0, use_element_size_1.useElementSize)(canvasRef);
71
- (0, react_1.useImperativeHandle)(ref, () => {
72
- return canvasRef.current;
73
- }, []);
74
- (0, react_1.useEffect)(() => {
75
- var _a;
76
- if (!size) {
77
- return;
78
- }
79
- const imageData = frames[index];
80
- const ctx = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getContext('2d');
81
- if (imageData && tempCtx && ctx) {
82
- if (tempCtx.canvas.width < imageData.width ||
83
- tempCtx.canvas.height < imageData.height) {
84
- tempCtx.canvas.width = imageData.width;
85
- tempCtx.canvas.height = imageData.height;
86
- }
87
- if (size.width > 0 && size.height > 0) {
88
- ctx.clearRect(0, 0, size.width, size.height);
89
- tempCtx.clearRect(0, 0, tempCtx.canvas.width, tempCtx.canvas.height);
90
- }
91
- tempCtx.putImageData(imageData, 0, 0);
92
- ctx.drawImage(tempCtx.canvas, ...calcArgs(fit, imageData, { width: size.width, height: size.height }));
93
- }
94
- }, [index, frames, fit, tempCtx, size]);
95
- return ((0, jsx_runtime_1.jsx)("canvas", { ref: canvasRef, className: className, style: style, width: width !== null && width !== void 0 ? width : size === null || size === void 0 ? void 0 : size.width, height: height !== null && height !== void 0 ? height : size === null || size === void 0 ? void 0 : size.height }));
96
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @description Gets the duration in seconds of a GIF
3
- * @see [Documentation](https://www.remotion.dev/docs/gif/get-gif-duration-in-seconds)
4
- */
5
- export declare const getGifDurationInSeconds: (src: string) => Promise<number>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGifDurationInSeconds = void 0;
4
- const remotion_1 = require("remotion");
5
- const gif_cache_1 = require("./gif-cache");
6
- const react_tools_1 = require("./react-tools");
7
- const calcDuration = (parsed) => {
8
- return (parsed.delays.reduce((sum, delay) => sum + delay, 0) / 1000);
9
- };
10
- /**
11
- * @description Gets the duration in seconds of a GIF
12
- * @see [Documentation](https://www.remotion.dev/docs/gif/get-gif-duration-in-seconds)
13
- */
14
- const getGifDurationInSeconds = async (src) => {
15
- var _a;
16
- const resolvedSrc = new URL(src, window.location.origin).href;
17
- const inCache = (_a = gif_cache_1.volatileGifCache.get(resolvedSrc)) !== null && _a !== void 0 ? _a : gif_cache_1.manuallyManagedGifCache.get(resolvedSrc);
18
- if (inCache) {
19
- return calcDuration(inCache);
20
- }
21
- if (remotion_1.Internals.getRemotionEnvironment() === 'rendering') {
22
- const renderingParsed = (0, react_tools_1.parseWithWorker)(resolvedSrc);
23
- const resolved = await renderingParsed.prom;
24
- gif_cache_1.volatileGifCache.set(resolvedSrc, resolved);
25
- return calcDuration(resolved);
26
- }
27
- const parsed = await (0, react_tools_1.parseGif)({
28
- src: resolvedSrc,
29
- controller: new AbortController(),
30
- });
31
- gif_cache_1.volatileGifCache.set(resolvedSrc, parsed);
32
- return calcDuration(parsed);
33
- };
34
- exports.getGifDurationInSeconds = getGifDurationInSeconds;
@@ -1,4 +0,0 @@
1
- import { LRUMap } from 'lru_map';
2
- import type { GifState } from './props';
3
- export declare const volatileGifCache: LRUMap<string, GifState>;
4
- export declare const manuallyManagedGifCache: Map<string, GifState>;
package/dist/gif-cache.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.manuallyManagedGifCache = exports.volatileGifCache = void 0;
4
- const lru_map_1 = require("lru_map");
5
- exports.volatileGifCache = new lru_map_1.LRUMap(30);
6
- exports.manuallyManagedGifCache = new Map();
@@ -1,4 +0,0 @@
1
- /**
2
- * Deinterlace function from https://github.com/shachaf/jsgif
3
- */
4
- export declare const deinterlace: (pixels: number[], width: number) => any[];
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * Deinterlace function from https://github.com/shachaf/jsgif
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deinterlace = void 0;
7
- const deinterlace = (pixels, width) => {
8
- const newPixels = new Array(pixels.length);
9
- const rows = pixels.length / width;
10
- const cpRow = function (toRow, _fromRow) {
11
- const fromPixels = pixels.slice(_fromRow * width, (_fromRow + 1) * width);
12
- newPixels.splice(...[toRow * width, width].concat(fromPixels));
13
- };
14
- // See appendix E.
15
- const offsets = [0, 4, 2, 1];
16
- const steps = [8, 8, 4, 2];
17
- let fromRow = 0;
18
- for (let pass = 0; pass < 4; pass++) {
19
- for (let toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) {
20
- cpRow(toRow, fromRow);
21
- fromRow++;
22
- }
23
- }
24
- return newPixels;
25
- };
26
- exports.deinterlace = deinterlace;
@@ -1,4 +0,0 @@
1
- import type { Frame, ParsedFrameWithoutPatch, ParsedGif } from './types';
2
- export declare const parseGIF: (arrayBuffer: ArrayBuffer) => any;
3
- export declare const decompressFrame: (frame: Frame, gct: [number, number, number][]) => ParsedFrameWithoutPatch | undefined;
4
- export declare const decompressFrames: (parsedGif: ParsedGif) => (ParsedFrameWithoutPatch | undefined)[];
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.decompressFrames = exports.decompressFrame = exports.parseGIF = void 0;
7
- // @ts-expect-error
8
- const js_binary_schema_parser_1 = require("js-binary-schema-parser");
9
- // @ts-expect-error
10
- const uint8_1 = require("js-binary-schema-parser/lib/parsers/uint8");
11
- // @ts-expect-error
12
- const gif_1 = __importDefault(require("js-binary-schema-parser/lib/schemas/gif"));
13
- const deinterlace_1 = require("./deinterlace");
14
- const lzw_1 = require("./lzw");
15
- const parseGIF = (arrayBuffer) => {
16
- const byteData = new Uint8Array(arrayBuffer);
17
- return (0, js_binary_schema_parser_1.parse)((0, uint8_1.buildStream)(byteData), gif_1.default);
18
- };
19
- exports.parseGIF = parseGIF;
20
- const decompressFrame = (frame, gct) => {
21
- var _a, _b;
22
- if (!frame.image) {
23
- console.warn('gif frame does not have associated image.');
24
- return;
25
- }
26
- const { image } = frame;
27
- // get the number of pixels
28
- const totalPixels = image.descriptor.width * image.descriptor.height;
29
- // do lzw decompression
30
- let pixels = (0, lzw_1.lzw)(image.data.minCodeSize, image.data.blocks, totalPixels);
31
- // deal with interlacing if necessary
32
- if ((_a = image.descriptor.lct) === null || _a === void 0 ? void 0 : _a.interlaced) {
33
- pixels = (0, deinterlace_1.deinterlace)(pixels, image.descriptor.width);
34
- }
35
- const resultImage = {
36
- pixels,
37
- dims: {
38
- top: frame.image.descriptor.top,
39
- left: frame.image.descriptor.left,
40
- width: frame.image.descriptor.width,
41
- height: frame.image.descriptor.height,
42
- },
43
- colorTable: ((_b = image.descriptor.lct) === null || _b === void 0 ? void 0 : _b.exists)
44
- ? image.lct
45
- : gct,
46
- delay: (frame.gce.delay || 10) * 10,
47
- disposalType: frame.gce.extras.disposal,
48
- transparentIndex: frame.gce.extras.transparentColorGiven
49
- ? frame.gce.transparentColorIndex
50
- : -1,
51
- };
52
- return resultImage;
53
- };
54
- exports.decompressFrame = decompressFrame;
55
- const decompressFrames = (parsedGif) => {
56
- return parsedGif.frames
57
- .filter((f) => !('application' in f))
58
- .map((f) => (0, exports.decompressFrame)(f, parsedGif.gct));
59
- };
60
- exports.decompressFrames = decompressFrames;
@@ -1,5 +0,0 @@
1
- /**
2
- * javascript port of java LZW decompression
3
- * Original java author url: https://gist.github.com/devunwired/4479231
4
- */
5
- export declare const lzw: (minCodeSize: number, data: number[], pixelCount: number) => any[];
@@ -1,119 +0,0 @@
1
- "use strict";
2
- /* eslint-disable no-multi-assign */
3
- /* eslint-disable no-redeclare */
4
- /* eslint-disable no-bitwise */
5
- /* eslint-disable no-var */
6
- /**
7
- * javascript port of java LZW decompression
8
- * Original java author url: https://gist.github.com/devunwired/4479231
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.lzw = void 0;
12
- const lzw = (minCodeSize, data, pixelCount) => {
13
- const MAX_STACK_SIZE = 4096;
14
- const nullCode = -1;
15
- const npix = pixelCount;
16
- let available;
17
- let code_mask;
18
- let code_size;
19
- let in_code;
20
- let old_code;
21
- var bits;
22
- let code;
23
- let i;
24
- var datum;
25
- var first;
26
- var top;
27
- var bi;
28
- var pi;
29
- const dstPixels = new Array(pixelCount);
30
- const prefix = new Array(MAX_STACK_SIZE);
31
- const suffix = new Array(MAX_STACK_SIZE);
32
- const pixelStack = new Array(MAX_STACK_SIZE + 1);
33
- // Initialize GIF data stream decoder.
34
- const data_size = minCodeSize;
35
- const clear = 1 << data_size;
36
- const end_of_information = clear + 1;
37
- available = clear + 2;
38
- old_code = nullCode;
39
- code_size = data_size + 1;
40
- code_mask = (1 << code_size) - 1;
41
- for (code = 0; code < clear; code++) {
42
- prefix[code] = 0;
43
- suffix[code] = code;
44
- }
45
- // Decode GIF pixel stream.
46
- var datum;
47
- var bits;
48
- var first;
49
- var top;
50
- var pi;
51
- var bi;
52
- datum = bits = first = top = pi = bi = 0;
53
- for (i = 0; i < npix;) {
54
- if (top === 0) {
55
- if (bits < code_size) {
56
- // get the next byte
57
- datum += data[bi] << bits;
58
- bits += 8;
59
- bi++;
60
- continue;
61
- }
62
- // Get the next code.
63
- code = datum & code_mask;
64
- datum >>= code_size;
65
- bits -= code_size;
66
- // Interpret the code
67
- if (code > available || code === end_of_information) {
68
- break;
69
- }
70
- if (code === clear) {
71
- // Reset decoder.
72
- code_size = data_size + 1;
73
- code_mask = (1 << code_size) - 1;
74
- available = clear + 2;
75
- old_code = nullCode;
76
- continue;
77
- }
78
- if (old_code === nullCode) {
79
- pixelStack[top++] = suffix[code];
80
- old_code = code;
81
- first = code;
82
- continue;
83
- }
84
- in_code = code;
85
- if (code === available) {
86
- pixelStack[top++] = first;
87
- code = old_code;
88
- }
89
- while (code > clear) {
90
- pixelStack[top++] = suffix[code];
91
- code = prefix[code];
92
- }
93
- first = suffix[code] & 0xff;
94
- pixelStack[top++] = first;
95
- // add a new string to the table, but only if space is available
96
- // if not, just continue with current table until a clear code is found
97
- // (deferred clear code implementation as per GIF spec)
98
- if (available < MAX_STACK_SIZE) {
99
- prefix[available] = old_code;
100
- suffix[available] = first;
101
- available++;
102
- if ((available & code_mask) === 0 && available < MAX_STACK_SIZE) {
103
- code_size++;
104
- code_mask += available;
105
- }
106
- }
107
- old_code = in_code;
108
- }
109
- // Pop a pixel off the pixel stack.
110
- top--;
111
- dstPixels[pi++] = pixelStack[top];
112
- i++;
113
- }
114
- for (i = pi; i < npix; i++) {
115
- dstPixels[i] = 0; // clear missing pixels
116
- }
117
- return dstPixels;
118
- };
119
- exports.lzw = lzw;
@@ -1,96 +0,0 @@
1
- declare type Dimensions = {
2
- top: number;
3
- left: number;
4
- width: number;
5
- height: number;
6
- };
7
- declare type Application = {
8
- application: {
9
- blockSize: number;
10
- blocks: number[];
11
- codes: number[];
12
- id: string;
13
- };
14
- };
15
- declare type Lct = {
16
- exists: boolean;
17
- future: number;
18
- interlaced: boolean;
19
- size: number;
20
- sort: boolean;
21
- };
22
- export declare type Frame = {
23
- gce: {
24
- byteSize: number;
25
- codes: number[];
26
- delay: number;
27
- terminator: number;
28
- transparentColorIndex: number;
29
- extras: {
30
- userInput: boolean;
31
- transparentColorGiven: boolean;
32
- future: number;
33
- disposal: number;
34
- };
35
- };
36
- image: {
37
- code: number;
38
- data: {
39
- minCodeSize: number;
40
- blocks: number[];
41
- };
42
- descriptor: {
43
- top: number;
44
- left: number;
45
- width: number;
46
- height: number;
47
- lct: Lct;
48
- };
49
- lct: [number, number, number][] | undefined;
50
- };
51
- };
52
- export declare type ParsedFrame = {
53
- dims: {
54
- width: number;
55
- height: number;
56
- top: number;
57
- left: number;
58
- };
59
- colorTable: [number, number, number][];
60
- delay: number;
61
- disposalType: number;
62
- patch: Uint8ClampedArray;
63
- pixels: number[];
64
- transparentIndex: number;
65
- };
66
- export declare type ParsedFrameWithoutPatch = Omit<ParsedFrame, 'patch'>;
67
- export declare type ParsedGif = {
68
- frames: (Application | Frame)[];
69
- gct: [number, number, number][];
70
- header: {
71
- signature: string;
72
- version: string;
73
- };
74
- lsd: {
75
- backgroundColorIndex: number;
76
- gct: {
77
- exists: boolean;
78
- resolution: number;
79
- size: number;
80
- sort: boolean;
81
- };
82
- height: number;
83
- width: number;
84
- pixelAspectRatio: number;
85
- };
86
- };
87
- export declare type Image = {
88
- pixels: number[];
89
- dims: Dimensions;
90
- delay?: number;
91
- transparentIndex?: number;
92
- colorTable?: [number, number, number][] | Lct;
93
- disposalType?: unknown;
94
- patch?: Uint8ClampedArray;
95
- };
96
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { getGifDurationInSeconds } from './get-gif-duration-in-seconds';
2
- export { Gif } from './Gif';
3
- export { preloadGif } from './preload-gif';
4
- export { GifFillMode, RemotionGifProps } from './props';
package/dist/index.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.preloadGif = exports.Gif = exports.getGifDurationInSeconds = void 0;
4
- var get_gif_duration_in_seconds_1 = require("./get-gif-duration-in-seconds");
5
- Object.defineProperty(exports, "getGifDurationInSeconds", { enumerable: true, get: function () { return get_gif_duration_in_seconds_1.getGifDurationInSeconds; } });
6
- var Gif_1 = require("./Gif");
7
- Object.defineProperty(exports, "Gif", { enumerable: true, get: function () { return Gif_1.Gif; } });
8
- var preload_gif_1 = require("./preload-gif");
9
- Object.defineProperty(exports, "preloadGif", { enumerable: true, get: function () { return preload_gif_1.preloadGif; } });
@@ -1 +0,0 @@
1
- export declare const isCorsError: (error: Error) => boolean;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCorsError = void 0;
4
- const isCorsError = (error) => {
5
- return (
6
- // Chrome
7
- error.message.includes('Failed to fetch') ||
8
- // Safari
9
- error.message.includes('Load failed') ||
10
- // Firefox
11
- error.message.includes('NetworkError when attempting to fetch resource'));
12
- };
13
- exports.isCorsError = isCorsError;
@@ -1,18 +0,0 @@
1
- import type { GifState } from './props';
2
- export declare const parse: (src: string, { signal, }: {
3
- signal: AbortController['signal'];
4
- }) => Promise<{
5
- loaded: boolean;
6
- delays: number[];
7
- frames: Uint8ClampedArray[];
8
- width: any;
9
- height: any;
10
- }>;
11
- declare type ParserCallbackArgs = {
12
- width: number;
13
- height: number;
14
- delays: number[];
15
- frames: Uint8ClampedArray[];
16
- };
17
- export declare const generate: (info: ParserCallbackArgs) => GifState;
18
- export {};