caravaggio-react
Advanced tools
Comparing version 1.2.1 to 1.2.2
import React from 'react'; | ||
export interface CaravaggioProviderProps { | ||
/** | ||
* Url for Caravaggio api. It can be absolute or relative | ||
* @example | ||
* Absolute url | ||
* url="https://caravaggio.vercel.app" | ||
* | ||
* Relative url (e.g. on Next.js) | ||
* url="/api/assets" | ||
*/ | ||
url: string; | ||
/** | ||
* Caravaggio can only transform images with absolute urls. If you want to use relative urls, | ||
* set this value and all the realtive image urls will be considered relative to this baseUrl. | ||
* Optional, default: undefined | ||
*/ | ||
baseUrl?: string; | ||
@@ -11,2 +25,2 @@ } | ||
export declare const CaravaggioContext: React.Context<CaravaggioContext | null>; | ||
export declare const CaravaggioProvider: React.SFC<CaravaggioProviderProps>; | ||
export declare const CaravaggioProvider: React.FC<CaravaggioProviderProps>; |
@@ -115,3 +115,3 @@ 'use strict'; | ||
if (typeof value !== 'object') { | ||
return operation + ":" + value; | ||
return "".concat(operation, ":").concat(value); | ||
} | ||
@@ -121,11 +121,11 @@ var valueString = Object.entries(value) | ||
var k = _a[0], v = _a[1]; | ||
return k + ":" + v; | ||
return "".concat(k, ":").concat(v); | ||
}) | ||
.join(','); | ||
return operation + "," + valueString; | ||
return "".concat(operation, ",").concat(valueString); | ||
}) | ||
.join('/'); | ||
var finalImageUrl = /^\.?\//.test(imageUrl) && baseUrl ? "" + baseUrl + imageUrl : imageUrl; | ||
var finalImageUrl = /^\.?\//.test(imageUrl) && baseUrl ? "".concat(baseUrl).concat(imageUrl) : imageUrl; | ||
return options | ||
? caravaggioUrl + "/" + options + "?image=" + encodeURIComponent(finalImageUrl) | ||
? "".concat(caravaggioUrl, "/").concat(options, "?image=").concat(encodeURIComponent(finalImageUrl)) | ||
: finalImageUrl; | ||
@@ -192,6 +192,6 @@ }; | ||
var rule = _a[0], _b = _a[1], opt = _b.opt, url = _b.url; | ||
return urlBuilder(context, url || otherProps.src, opt) + " " + rule; | ||
return "".concat(urlBuilder(context, url || otherProps.src, opt), " ").concat(rule); | ||
}) | ||
.join(','); | ||
return (React__default['default'].createElement("source", { type: set.type, srcSet: srcSet, key: otherProps.src + "-set-" + i })); | ||
return (React__default['default'].createElement("source", { type: set.type, srcSet: srcSet, key: "".concat(otherProps.src, "-set-").concat(i) })); | ||
}); | ||
@@ -198,0 +198,0 @@ return (React__default['default'].createElement("picture", null, |
@@ -107,3 +107,3 @@ import React, { useContext } from 'react'; | ||
if (typeof value !== 'object') { | ||
return operation + ":" + value; | ||
return "".concat(operation, ":").concat(value); | ||
} | ||
@@ -113,11 +113,11 @@ var valueString = Object.entries(value) | ||
var k = _a[0], v = _a[1]; | ||
return k + ":" + v; | ||
return "".concat(k, ":").concat(v); | ||
}) | ||
.join(','); | ||
return operation + "," + valueString; | ||
return "".concat(operation, ",").concat(valueString); | ||
}) | ||
.join('/'); | ||
var finalImageUrl = /^\.?\//.test(imageUrl) && baseUrl ? "" + baseUrl + imageUrl : imageUrl; | ||
var finalImageUrl = /^\.?\//.test(imageUrl) && baseUrl ? "".concat(baseUrl).concat(imageUrl) : imageUrl; | ||
return options | ||
? caravaggioUrl + "/" + options + "?image=" + encodeURIComponent(finalImageUrl) | ||
? "".concat(caravaggioUrl, "/").concat(options, "?image=").concat(encodeURIComponent(finalImageUrl)) | ||
: finalImageUrl; | ||
@@ -184,6 +184,6 @@ }; | ||
var rule = _a[0], _b = _a[1], opt = _b.opt, url = _b.url; | ||
return urlBuilder(context, url || otherProps.src, opt) + " " + rule; | ||
return "".concat(urlBuilder(context, url || otherProps.src, opt), " ").concat(rule); | ||
}) | ||
.join(','); | ||
return (React.createElement("source", { type: set.type, srcSet: srcSet, key: otherProps.src + "-set-" + i })); | ||
return (React.createElement("source", { type: set.type, srcSet: srcSet, key: "".concat(otherProps.src, "-set-").concat(i) })); | ||
}); | ||
@@ -190,0 +190,0 @@ return (React.createElement("picture", null, |
{ | ||
"name": "caravaggio-react", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Caravaggio react library", | ||
@@ -36,3 +36,3 @@ "main": "dist/index.cjs.js", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"typescript": "^3.9.7" | ||
"typescript": "^4.6.2" | ||
}, | ||
@@ -39,0 +39,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
660
33792
12