@giphy/js-util
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,5 +0,10 @@ | ||
import { IGif } from '@giphy/js-types'; | ||
import { IGif, IRendition } from '@giphy/js-types'; | ||
import { IImages } from '@giphy/js-types/dist/gif'; | ||
export declare const checkIfWebP: () => Promise<{}>; | ||
export declare const getSpecificRendition: ({ images, is_sticker: isSticker }: IGif, renditionLabel: string, isStill?: boolean, useVideo?: boolean) => string; | ||
export declare const getBestRendition: ({ images }: IGif, gifWidth: number, gifHeight: number, isStill?: boolean, useVideo?: boolean) => any; | ||
interface IRenditionWithName extends IRendition { | ||
renditionName: keyof IImages; | ||
} | ||
export declare const getBestRendition: (images: IImages, gifWidth: number, gifHeight: number) => IRenditionWithName; | ||
export declare const getBestRenditionUrl: ({ images }: IGif, gifWidth: number, gifHeight: number, isStill?: boolean, useVideo?: boolean) => "" | "fixed_height_still" | "original_still" | "fixed_width" | "fixed_height_small_still" | "fixed_height_downsampled" | "preview" | "fixed_height_small" | "downsized_still" | "downsized" | "downsized_large" | "fixed_width_small_still" | "preview_webp" | "fixed_width_still" | "fixed_width_small" | "downsized_small" | "fixed_width_downsampled" | "downsized_medium" | "original" | "fixed_height" | "looping" | "original_mp4" | "preview_gif" | "480w_still"; | ||
export declare const getGifHeight: ({ images }: IGif, gifWidth: number) => number; | ||
@@ -13,1 +18,2 @@ /** | ||
export declare const getAltText: ({ user, tags, is_sticker, title }: IGif) => string; | ||
export {}; |
@@ -55,8 +55,3 @@ "use strict"; | ||
}; | ||
exports.getBestRendition = function (_a, gifWidth, gifHeight, isStill, useVideo) { | ||
var images = _a.images; | ||
if (isStill === void 0) { isStill = false; } | ||
if (useVideo === void 0) { useVideo = false; } | ||
if (!gifWidth || !gifHeight || !images) | ||
return ''; | ||
exports.getBestRendition = function (images, gifWidth, gifHeight) { | ||
var checkRenditions = collections_1.pick(images, [ | ||
@@ -73,3 +68,11 @@ 'original', | ||
}); | ||
var renditionName = bestfit_1.default(testImages, gifWidth, gifHeight).renditionName; | ||
return bestfit_1.default(testImages, gifWidth, gifHeight); | ||
}; | ||
exports.getBestRenditionUrl = function (_a, gifWidth, gifHeight, isStill, useVideo) { | ||
var images = _a.images; | ||
if (isStill === void 0) { isStill = false; } | ||
if (useVideo === void 0) { useVideo = false; } | ||
if (!gifWidth || !gifHeight || !images) | ||
return ''; | ||
var renditionName = exports.getBestRendition(images, gifWidth, gifHeight).renditionName; | ||
// @ts-ignore come back to this | ||
@@ -76,0 +79,0 @@ var rendition = images["" + renditionName + (isStill ? '_still' : '')]; |
@@ -1,4 +0,4 @@ | ||
export { checkIfWebP, getAltText, getBestRendition, getGifHeight, getSpecificRendition } from './gif-utils'; | ||
export { checkIfWebP, getAltText, getBestRenditionUrl, getBestRendition, getGifHeight, getSpecificRendition, } from './gif-utils'; | ||
export { default as bestfit } from './bestfit'; | ||
export { default as getClientRect } from './get-client-rect-from-el'; | ||
export * from './collections'; |
@@ -9,2 +9,3 @@ "use strict"; | ||
exports.getAltText = gif_utils_1.getAltText; | ||
exports.getBestRenditionUrl = gif_utils_1.getBestRenditionUrl; | ||
exports.getBestRendition = gif_utils_1.getBestRendition; | ||
@@ -11,0 +12,0 @@ exports.getGifHeight = gif_utils_1.getGifHeight; |
@@ -11,3 +11,3 @@ { | ||
"name": "@giphy/js-util", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "dist/index.js", | ||
@@ -20,3 +20,3 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@giphy/js-types": "^1.0.4" | ||
"@giphy/js-types": "^1.0.5" | ||
}, | ||
@@ -26,3 +26,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "f6e2fbddab087a498c971050e22ee18e8dbe06d2" | ||
"gitHead": "f05648f2d7571d864513dbc041447e328e163738" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20174
283
Updated@giphy/js-types@^1.0.5