Comparing version 0.0.16 to 0.0.17
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"scripts": { | ||
@@ -27,12 +27,13 @@ "lint": "tslint --project ./tsconfig.json", | ||
"devDependencies": { | ||
"prettier": "^1.15.3", | ||
"prettier": "^2.4.1", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-auto-external": "^2.0.0", | ||
"rollup-plugin-typescript2": "^0.27.0", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"source-map-support": "^0.5.9", | ||
"tslib": "^2.3.1", | ||
"tslint": "^5.11.0", | ||
"tslint-language-service": "^0.9.9", | ||
"tslint-no-unused": "^0.2.0-alpha.1", | ||
"typescript": "^3.2.2" | ||
"typescript": "^4.4.4" | ||
} | ||
} |
@@ -7,2 +7,23 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __spreadArray(to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
} | ||
var tuple = function () { | ||
@@ -25,5 +46,5 @@ var args = []; | ||
// `Object.assign` is poorly typed: it returns `any` when spreading. Use cast to workaround. | ||
return Object.assign.apply(Object, [{}].concat(arr.map(function (_a) { | ||
return Object.assign.apply(Object, __spreadArray([{}], arr.map(function (_a) { | ||
var _b; | ||
var k = _a[0], v = _a[1]; | ||
var _b; | ||
return (_b = {}, _b[k] = v, _b); | ||
@@ -40,2 +61,42 @@ }))); | ||
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) { | ||
switch (arguments.length) { | ||
case 1: | ||
return ab; | ||
case 2: | ||
return function () { | ||
return bc(ab.apply(this, arguments)); | ||
}; | ||
case 3: | ||
return function () { | ||
return cd(bc(ab.apply(this, arguments))); | ||
}; | ||
case 4: | ||
return function () { | ||
return de(cd(bc(ab.apply(this, arguments)))); | ||
}; | ||
case 5: | ||
return function () { | ||
return ef(de(cd(bc(ab.apply(this, arguments))))); | ||
}; | ||
case 6: | ||
return function () { | ||
return fg(ef(de(cd(bc(ab.apply(this, arguments)))))); | ||
}; | ||
case 7: | ||
return function () { | ||
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))); | ||
}; | ||
case 8: | ||
return function () { | ||
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))); | ||
}; | ||
case 9: | ||
return function () { | ||
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))); | ||
}; | ||
} | ||
return; | ||
} | ||
var isMaybeDefined = function (maybeT) { return maybeT !== undefined; }; | ||
@@ -55,18 +116,2 @@ /** Takes a dictionary containing `Maybe`s and returns a dictionary of all the non-empty values. */ | ||
function pipe() { | ||
var fns = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
fns[_i] = arguments[_i]; | ||
} | ||
var len = fns.length - 1; | ||
// tslint:disable-next-line no-any | ||
return function (x) { | ||
var y = x; | ||
for (var i = 0; i <= len; i++) { | ||
y = fns[i].call(this, y); | ||
} | ||
return y; | ||
}; | ||
} | ||
(function (ImgixFit) { | ||
@@ -99,2 +144,20 @@ ImgixFit["clamp"] = "clamp"; | ||
})(exports.ImgixFormat || (exports.ImgixFormat = {})); | ||
(function (ImgixBlendMode) { | ||
ImgixBlendMode["normal"] = "normal"; | ||
ImgixBlendMode["darken"] = "darken"; | ||
ImgixBlendMode["multiply"] = "multiply"; | ||
ImgixBlendMode["burn"] = "burn"; | ||
ImgixBlendMode["lighten"] = "lighten"; | ||
ImgixBlendMode["screen"] = "screen"; | ||
ImgixBlendMode["dodge"] = "dodge"; | ||
ImgixBlendMode["overlay"] = "overlay"; | ||
ImgixBlendMode["softlight"] = "softlight"; | ||
ImgixBlendMode["hardlight"] = "hardlight"; | ||
ImgixBlendMode["difference"] = "difference"; | ||
ImgixBlendMode["exclusion"] = "exclusion"; | ||
ImgixBlendMode["color"] = "color"; | ||
ImgixBlendMode["hue"] = "hue"; | ||
ImgixBlendMode["saturation"] = "saturation"; | ||
ImgixBlendMode["luminosity"] = "luminosity"; | ||
})(exports.ImgixBlendMode || (exports.ImgixBlendMode = {})); | ||
(function (ImgixColorSpace) { | ||
@@ -106,6 +169,12 @@ ImgixColorSpace["srgb"] = "srgb"; | ||
})(exports.ImgixColorSpace || (exports.ImgixColorSpace = {})); | ||
(function (ImgixTxtClip) { | ||
ImgixTxtClip["start"] = "start"; | ||
ImgixTxtClip["middle"] = "middle"; | ||
ImgixTxtClip["end"] = "end"; | ||
ImgixTxtClip["ellipsis"] = "ellipsis"; | ||
})(exports.ImgixTxtClip || (exports.ImgixTxtClip = {})); | ||
var pickTrueInObject = function (obj) { | ||
return pickBy(obj, function (_key, value) { return value; }); | ||
}; | ||
var pickTrueObjectKeys = pipe(pickTrueInObject, | ||
var pickTrueObjectKeys = flow(pickTrueInObject, | ||
// tslint:disable-next-line no-unbound-method | ||
@@ -115,6 +184,6 @@ Object.keys); | ||
var joinWithComma = function (strs) { return strs.join(','); }; | ||
var serializeImgixUrlQueryParamListValue = pipe(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var serializeImgixUrlQueryParamListValue = flow(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var mapToSerializedListValueIfDefined = mapValueIfDefined(serializeImgixUrlQueryParamListValue); | ||
var serializeImgixUrlQueryParamValues = function (query) { | ||
return pipe(function () { return ({ | ||
var imgixUrlQueryParams = { | ||
ar: mapValueIfDefined(function (ar) { return ar.w + ":" + ar.h; })(query.ar), | ||
@@ -136,7 +205,30 @@ dpr: query.dpr, | ||
'min-h': query.minH, | ||
'mark-w': query.markW, | ||
'mark-align': query.markAlign, | ||
'mark-pad': query.markPad, | ||
'mark-y': query.markY, | ||
mark64: query.mark64, | ||
blend64: query.blend64, | ||
txt64: query.txt64, | ||
'txt-color': query.txtColor, | ||
'txt-size': query.txtSize, | ||
'txt-align': query.txtAlign, | ||
'txt-pad': query.txtPad, | ||
'txt-width': query.txtWidth, | ||
'txt-clip': query.txtClip, | ||
fm: query.fm, | ||
}); }, catMaybesDictionary)({}); | ||
'txt-font': query.txtFont, | ||
'blend-mode': query.blendMode, | ||
'blend-alpha': query.blendAlpha, | ||
'blend-pad': query.blendPad, | ||
'blend-w': query.blendW, | ||
mask: query.mask, | ||
'blend-align': query.blendAlign, | ||
'blend-x': query.blendX, | ||
'mark-x': query.markX, | ||
}; | ||
return catMaybesDictionary(imgixUrlQueryParams); | ||
}; | ||
var buildImgixUrl = function (url) { | ||
return pipe(serializeImgixUrlQueryParamValues, function (query) { return urlTransformers.addQueryToUrl(query)(url); }); | ||
return flow(serializeImgixUrlQueryParamValues, function (query) { return urlTransformers.addQueryToUrl(query)(url); }); | ||
}; | ||
@@ -143,0 +235,0 @@ |
@@ -1,2 +0,1 @@ | ||
declare type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>; | ||
export declare enum ImgixFit { | ||
@@ -29,2 +28,20 @@ clamp = "clamp", | ||
} | ||
export declare enum ImgixBlendMode { | ||
normal = "normal", | ||
darken = "darken", | ||
multiply = "multiply", | ||
burn = "burn", | ||
lighten = "lighten", | ||
screen = "screen", | ||
dodge = "dodge", | ||
overlay = "overlay", | ||
softlight = "softlight", | ||
hardlight = "hardlight", | ||
difference = "difference", | ||
exclusion = "exclusion", | ||
color = "color", | ||
hue = "hue", | ||
saturation = "saturation", | ||
luminosity = "luminosity" | ||
} | ||
export declare type ImgixCrop = Partial<Record<'top' | 'bottom' | 'left' | 'right' | 'faces' | 'focalpoint' | 'edges' | 'entropy', boolean>>; | ||
@@ -49,2 +66,11 @@ export declare enum ImgixColorSpace { | ||
}; | ||
declare type Combinations<T extends string, U extends string = T> = T extends String ? T | `${T},${Exclude<U, T>}` : never; | ||
export declare type ImgixMarkAlignBase = 'top' | 'middle' | 'bottom' | 'left' | 'center' | 'right'; | ||
declare type ImgixMarkAlign = Combinations<ImgixMarkAlignBase>; | ||
export declare enum ImgixTxtClip { | ||
start = "start", | ||
middle = "middle", | ||
end = "end", | ||
ellipsis = "ellipsis" | ||
} | ||
export declare type ImgixUrlQueryParams = { | ||
@@ -67,8 +93,31 @@ ar?: ImgixAspectRatio; | ||
'min-h'?: number; | ||
'mark-w'?: number; | ||
'mark-align'?: ImgixMarkAlign; | ||
'mark-pad'?: number; | ||
'mark-y'?: number; | ||
mark64?: string; | ||
'mark-x'?: number; | ||
blend64?: string; | ||
txt64?: string; | ||
'txt-color'?: string; | ||
'txt-size'?: number; | ||
'txt-align'?: ImgixMarkAlign; | ||
'txt-font'?: string; | ||
'txt-pad'?: number; | ||
'txt-width'?: number; | ||
'txt-clip'?: ImgixTxtClip; | ||
'blend-align'?: ImgixMarkAlign; | ||
'blend-mode'?: ImgixBlendMode; | ||
'blend-pad'?: number; | ||
'blend-alpha'?: number; | ||
mask?: string; | ||
'blend-w'?: number; | ||
'blend-x'?: number; | ||
fm?: ImgixFormat; | ||
}; | ||
export declare type QueryParamsInput = Omit<ImgixUrlQueryParams, 'min-h'> & { | ||
minH?: number; | ||
declare type KebabToCamelCase<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamelCase<U>>}` : S; | ||
export declare type QueryParamsInput = { | ||
[K in keyof ImgixUrlQueryParams as KebabToCamelCase<K>]: ImgixUrlQueryParams[K]; | ||
}; | ||
export declare const buildImgixUrl: (url: string) => (a: QueryParamsInput) => string; | ||
export declare const buildImgixUrl: (url: string) => (query: QueryParamsInput) => string; | ||
export {}; |
import { addQueryToUrl } from 'url-transformers'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __spreadArray(to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
} | ||
var tuple = function () { | ||
@@ -20,5 +41,5 @@ var args = []; | ||
// `Object.assign` is poorly typed: it returns `any` when spreading. Use cast to workaround. | ||
return Object.assign.apply(Object, [{}].concat(arr.map(function (_a) { | ||
return Object.assign.apply(Object, __spreadArray([{}], arr.map(function (_a) { | ||
var _b; | ||
var k = _a[0], v = _a[1]; | ||
var _b; | ||
return (_b = {}, _b[k] = v, _b); | ||
@@ -35,2 +56,42 @@ }))); | ||
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) { | ||
switch (arguments.length) { | ||
case 1: | ||
return ab; | ||
case 2: | ||
return function () { | ||
return bc(ab.apply(this, arguments)); | ||
}; | ||
case 3: | ||
return function () { | ||
return cd(bc(ab.apply(this, arguments))); | ||
}; | ||
case 4: | ||
return function () { | ||
return de(cd(bc(ab.apply(this, arguments)))); | ||
}; | ||
case 5: | ||
return function () { | ||
return ef(de(cd(bc(ab.apply(this, arguments))))); | ||
}; | ||
case 6: | ||
return function () { | ||
return fg(ef(de(cd(bc(ab.apply(this, arguments)))))); | ||
}; | ||
case 7: | ||
return function () { | ||
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))); | ||
}; | ||
case 8: | ||
return function () { | ||
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))); | ||
}; | ||
case 9: | ||
return function () { | ||
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))); | ||
}; | ||
} | ||
return; | ||
} | ||
var isMaybeDefined = function (maybeT) { return maybeT !== undefined; }; | ||
@@ -50,18 +111,2 @@ /** Takes a dictionary containing `Maybe`s and returns a dictionary of all the non-empty values. */ | ||
function pipe() { | ||
var fns = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
fns[_i] = arguments[_i]; | ||
} | ||
var len = fns.length - 1; | ||
// tslint:disable-next-line no-any | ||
return function (x) { | ||
var y = x; | ||
for (var i = 0; i <= len; i++) { | ||
y = fns[i].call(this, y); | ||
} | ||
return y; | ||
}; | ||
} | ||
// https://docs.imgix.com/apis/url/size/fit | ||
@@ -97,2 +142,21 @@ var ImgixFit; | ||
})(ImgixFormat || (ImgixFormat = {})); | ||
var ImgixBlendMode; | ||
(function (ImgixBlendMode) { | ||
ImgixBlendMode["normal"] = "normal"; | ||
ImgixBlendMode["darken"] = "darken"; | ||
ImgixBlendMode["multiply"] = "multiply"; | ||
ImgixBlendMode["burn"] = "burn"; | ||
ImgixBlendMode["lighten"] = "lighten"; | ||
ImgixBlendMode["screen"] = "screen"; | ||
ImgixBlendMode["dodge"] = "dodge"; | ||
ImgixBlendMode["overlay"] = "overlay"; | ||
ImgixBlendMode["softlight"] = "softlight"; | ||
ImgixBlendMode["hardlight"] = "hardlight"; | ||
ImgixBlendMode["difference"] = "difference"; | ||
ImgixBlendMode["exclusion"] = "exclusion"; | ||
ImgixBlendMode["color"] = "color"; | ||
ImgixBlendMode["hue"] = "hue"; | ||
ImgixBlendMode["saturation"] = "saturation"; | ||
ImgixBlendMode["luminosity"] = "luminosity"; | ||
})(ImgixBlendMode || (ImgixBlendMode = {})); | ||
// https://docs.imgix.com/apis/url/format/cs | ||
@@ -106,6 +170,13 @@ var ImgixColorSpace; | ||
})(ImgixColorSpace || (ImgixColorSpace = {})); | ||
var ImgixTxtClip; | ||
(function (ImgixTxtClip) { | ||
ImgixTxtClip["start"] = "start"; | ||
ImgixTxtClip["middle"] = "middle"; | ||
ImgixTxtClip["end"] = "end"; | ||
ImgixTxtClip["ellipsis"] = "ellipsis"; | ||
})(ImgixTxtClip || (ImgixTxtClip = {})); | ||
var pickTrueInObject = function (obj) { | ||
return pickBy(obj, function (_key, value) { return value; }); | ||
}; | ||
var pickTrueObjectKeys = pipe(pickTrueInObject, | ||
var pickTrueObjectKeys = flow(pickTrueInObject, | ||
// tslint:disable-next-line no-unbound-method | ||
@@ -115,6 +186,6 @@ Object.keys); | ||
var joinWithComma = function (strs) { return strs.join(','); }; | ||
var serializeImgixUrlQueryParamListValue = pipe(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var serializeImgixUrlQueryParamListValue = flow(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var mapToSerializedListValueIfDefined = mapValueIfDefined(serializeImgixUrlQueryParamListValue); | ||
var serializeImgixUrlQueryParamValues = function (query) { | ||
return pipe(function () { return ({ | ||
var imgixUrlQueryParams = { | ||
ar: mapValueIfDefined(function (ar) { return ar.w + ":" + ar.h; })(query.ar), | ||
@@ -136,10 +207,33 @@ dpr: query.dpr, | ||
'min-h': query.minH, | ||
'mark-w': query.markW, | ||
'mark-align': query.markAlign, | ||
'mark-pad': query.markPad, | ||
'mark-y': query.markY, | ||
mark64: query.mark64, | ||
blend64: query.blend64, | ||
txt64: query.txt64, | ||
'txt-color': query.txtColor, | ||
'txt-size': query.txtSize, | ||
'txt-align': query.txtAlign, | ||
'txt-pad': query.txtPad, | ||
'txt-width': query.txtWidth, | ||
'txt-clip': query.txtClip, | ||
fm: query.fm, | ||
}); }, catMaybesDictionary)({}); | ||
'txt-font': query.txtFont, | ||
'blend-mode': query.blendMode, | ||
'blend-alpha': query.blendAlpha, | ||
'blend-pad': query.blendPad, | ||
'blend-w': query.blendW, | ||
mask: query.mask, | ||
'blend-align': query.blendAlign, | ||
'blend-x': query.blendX, | ||
'mark-x': query.markX, | ||
}; | ||
return catMaybesDictionary(imgixUrlQueryParams); | ||
}; | ||
var buildImgixUrl = function (url) { | ||
return pipe(serializeImgixUrlQueryParamValues, function (query) { return addQueryToUrl(query)(url); }); | ||
return flow(serializeImgixUrlQueryParamValues, function (query) { return addQueryToUrl(query)(url); }); | ||
}; | ||
export { ImgixColorSpace, ImgixFit, ImgixFormat, buildImgixUrl }; | ||
export { ImgixBlendMode, ImgixColorSpace, ImgixFit, ImgixFormat, ImgixTxtClip, buildImgixUrl }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -6,2 +6,23 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __spreadArray(to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
} | ||
var tuple = function () { | ||
@@ -24,5 +45,5 @@ var args = []; | ||
// `Object.assign` is poorly typed: it returns `any` when spreading. Use cast to workaround. | ||
return Object.assign.apply(Object, [{}].concat(arr.map(function (_a) { | ||
return Object.assign.apply(Object, __spreadArray([{}], arr.map(function (_a) { | ||
var _b; | ||
var k = _a[0], v = _a[1]; | ||
var _b; | ||
return (_b = {}, _b[k] = v, _b); | ||
@@ -39,2 +60,42 @@ }))); | ||
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) { | ||
switch (arguments.length) { | ||
case 1: | ||
return ab; | ||
case 2: | ||
return function () { | ||
return bc(ab.apply(this, arguments)); | ||
}; | ||
case 3: | ||
return function () { | ||
return cd(bc(ab.apply(this, arguments))); | ||
}; | ||
case 4: | ||
return function () { | ||
return de(cd(bc(ab.apply(this, arguments)))); | ||
}; | ||
case 5: | ||
return function () { | ||
return ef(de(cd(bc(ab.apply(this, arguments))))); | ||
}; | ||
case 6: | ||
return function () { | ||
return fg(ef(de(cd(bc(ab.apply(this, arguments)))))); | ||
}; | ||
case 7: | ||
return function () { | ||
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))); | ||
}; | ||
case 8: | ||
return function () { | ||
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))); | ||
}; | ||
case 9: | ||
return function () { | ||
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))); | ||
}; | ||
} | ||
return; | ||
} | ||
var isMaybeDefined = function (maybeT) { return maybeT !== undefined; }; | ||
@@ -54,18 +115,2 @@ /** Takes a dictionary containing `Maybe`s and returns a dictionary of all the non-empty values. */ | ||
function pipe() { | ||
var fns = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
fns[_i] = arguments[_i]; | ||
} | ||
var len = fns.length - 1; | ||
// tslint:disable-next-line no-any | ||
return function (x) { | ||
var y = x; | ||
for (var i = 0; i <= len; i++) { | ||
y = fns[i].call(this, y); | ||
} | ||
return y; | ||
}; | ||
} | ||
// https://docs.imgix.com/apis/url/size/fit | ||
@@ -101,2 +146,21 @@ var ImgixFit; | ||
})(ImgixFormat || (ImgixFormat = {})); | ||
var ImgixBlendMode; | ||
(function (ImgixBlendMode) { | ||
ImgixBlendMode["normal"] = "normal"; | ||
ImgixBlendMode["darken"] = "darken"; | ||
ImgixBlendMode["multiply"] = "multiply"; | ||
ImgixBlendMode["burn"] = "burn"; | ||
ImgixBlendMode["lighten"] = "lighten"; | ||
ImgixBlendMode["screen"] = "screen"; | ||
ImgixBlendMode["dodge"] = "dodge"; | ||
ImgixBlendMode["overlay"] = "overlay"; | ||
ImgixBlendMode["softlight"] = "softlight"; | ||
ImgixBlendMode["hardlight"] = "hardlight"; | ||
ImgixBlendMode["difference"] = "difference"; | ||
ImgixBlendMode["exclusion"] = "exclusion"; | ||
ImgixBlendMode["color"] = "color"; | ||
ImgixBlendMode["hue"] = "hue"; | ||
ImgixBlendMode["saturation"] = "saturation"; | ||
ImgixBlendMode["luminosity"] = "luminosity"; | ||
})(ImgixBlendMode || (ImgixBlendMode = {})); | ||
// https://docs.imgix.com/apis/url/format/cs | ||
@@ -110,6 +174,13 @@ var ImgixColorSpace; | ||
})(ImgixColorSpace || (ImgixColorSpace = {})); | ||
var ImgixTxtClip; | ||
(function (ImgixTxtClip) { | ||
ImgixTxtClip["start"] = "start"; | ||
ImgixTxtClip["middle"] = "middle"; | ||
ImgixTxtClip["end"] = "end"; | ||
ImgixTxtClip["ellipsis"] = "ellipsis"; | ||
})(ImgixTxtClip || (ImgixTxtClip = {})); | ||
var pickTrueInObject = function (obj) { | ||
return pickBy(obj, function (_key, value) { return value; }); | ||
}; | ||
var pickTrueObjectKeys = pipe(pickTrueInObject, | ||
var pickTrueObjectKeys = flow(pickTrueInObject, | ||
// tslint:disable-next-line no-unbound-method | ||
@@ -119,6 +190,6 @@ Object.keys); | ||
var joinWithComma = function (strs) { return strs.join(','); }; | ||
var serializeImgixUrlQueryParamListValue = pipe(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var serializeImgixUrlQueryParamListValue = flow(pickTrueObjectKeys, joinWithComma, undefinedIfEmptyString); | ||
var mapToSerializedListValueIfDefined = mapValueIfDefined(serializeImgixUrlQueryParamListValue); | ||
var serializeImgixUrlQueryParamValues = function (query) { | ||
return pipe(function () { return ({ | ||
var imgixUrlQueryParams = { | ||
ar: mapValueIfDefined(function (ar) { return ar.w + ":" + ar.h; })(query.ar), | ||
@@ -140,7 +211,30 @@ dpr: query.dpr, | ||
'min-h': query.minH, | ||
'mark-w': query.markW, | ||
'mark-align': query.markAlign, | ||
'mark-pad': query.markPad, | ||
'mark-y': query.markY, | ||
mark64: query.mark64, | ||
blend64: query.blend64, | ||
txt64: query.txt64, | ||
'txt-color': query.txtColor, | ||
'txt-size': query.txtSize, | ||
'txt-align': query.txtAlign, | ||
'txt-pad': query.txtPad, | ||
'txt-width': query.txtWidth, | ||
'txt-clip': query.txtClip, | ||
fm: query.fm, | ||
}); }, catMaybesDictionary)({}); | ||
'txt-font': query.txtFont, | ||
'blend-mode': query.blendMode, | ||
'blend-alpha': query.blendAlpha, | ||
'blend-pad': query.blendPad, | ||
'blend-w': query.blendW, | ||
mask: query.mask, | ||
'blend-align': query.blendAlign, | ||
'blend-x': query.blendX, | ||
'mark-x': query.markX, | ||
}; | ||
return catMaybesDictionary(imgixUrlQueryParams); | ||
}; | ||
var buildImgixUrl = function (url) { | ||
return pipe(serializeImgixUrlQueryParamValues, function (query) { return urlTransformers.addQueryToUrl(query)(url); }); | ||
return flow(serializeImgixUrlQueryParamValues, function (query) { return urlTransformers.addQueryToUrl(query)(url); }); | ||
}; | ||
@@ -147,0 +241,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72335
815
10