Socket
Socket
Sign inDemoInstall

@uxf/core

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uxf/core - npm Package Compare versions

Comparing version 10.10.1 to 11.9.0

2

package.json
{
"name": "@uxf/core",
"version": "10.10.1",
"version": "11.9.0",
"description": "UXF Core",

@@ -5,0 +5,0 @@ "author": "Petr Vejvoda <vejvoda@uxf.cz>",

@@ -11,3 +11,10 @@ import { FC } from "react";

export declare function getImgElementWidth(src: ImageSource, width: number | undefined, height: number | undefined): number | undefined;
export declare function getImgSrcSet(src?: ImageSource, width?: Dimension, height?: Dimension, options?: ResizerImageProps): string | undefined;
export type GetImgSrcSetOptions = ResizerImageProps & {
maxHiDpi?: 3 | 2 | 1;
};
export declare function getImgSrcSet(src?: ImageSource, width?: Dimension, height?: Dimension, options?: GetImgSrcSetOptions): string | undefined;
export type ImageSourcesOptions = Omit<GetImgSrcSetOptions, "quality" | "toFormat"> & {
isAvifDisabled?: boolean;
isWebPDisabled?: boolean;
};
interface ImageSourcesProps {

@@ -17,3 +24,3 @@ breakpointIndex?: number;

height: Dimension;
options?: Omit<ResizerImageProps, "quality" | "toFormat">;
options?: ImageSourcesOptions;
quality?: Quality;

@@ -20,0 +27,0 @@ src: ImageSource;

@@ -8,2 +8,3 @@ "use strict";

const react_1 = __importDefault(require("react"));
const hide_1 = require("../components/hide");
const file_1 = require("./file");

@@ -89,13 +90,16 @@ const resizer_1 = require("./resizer");

}
const { maxHiDpi, ...restOptions } = options;
if (typeof h === "number" || typeof w === "number") {
return HIDPI_SIZES.map((size) => (0, resizer_1.resizerImageUrl)(src, typeof w === "number" ? w * size : "auto", typeof h === "number" ? h * size : "auto", {
return (maxHiDpi ? HIDPI_SIZES.slice(-maxHiDpi) : HIDPI_SIZES)
.map((size) => (0, resizer_1.resizerImageUrl)(src, typeof w === "number" ? w * size : "auto", typeof h === "number" ? h * size : "auto", {
toFormat,
...options,
}) + (size > 1 ? ` ${size}x` : "")).join(", ");
...restOptions,
}) + (size > 1 ? ` ${size}x` : ""))
.join(", ");
}
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...options });
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...restOptions });
}
exports.getImgSrcSet = getImgSrcSet;
const ImgSources = (props) => {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
if (!props.src) {

@@ -117,14 +121,16 @@ return null;

return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement(hide_1.Hide, { when: Boolean((_a = props.options) === null || _a === void 0 ? void 0 : _a.isAvifDisabled) },
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_b = props.options) !== null && _b !== void 0 ? _b : {}),
quality: getImgQuality(props.quality, "avif"),
toFormat: "avif",
}), type: "image/avif" })),
react_1.default.createElement(hide_1.Hide, { when: Boolean((_c = props.options) === null || _c === void 0 ? void 0 : _c.isWebPDisabled) },
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_d = props.options) !== null && _d !== void 0 ? _d : {}),
quality: getImgQuality(props.quality, "webp"),
toFormat: "webp",
}), type: "image/webp" })),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_a = props.options) !== null && _a !== void 0 ? _a : {}),
quality: getImgQuality(props.quality, "avif"),
toFormat: "avif",
}), type: "image/avif" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_b = props.options) !== null && _b !== void 0 ? _b : {}),
quality: getImgQuality(props.quality, "webp"),
toFormat: "webp",
}), type: "image/webp" }),
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
...((_c = props.options) !== null && _c !== void 0 ? _c : {}),
...((_e = props.options) !== null && _e !== void 0 ? _e : {}),
quality: getImgQuality(props.quality, "original"),

@@ -131,0 +137,0 @@ }) })));

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc