Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-imgix

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-imgix - npm Package Compare versions

Comparing version 2.2.5 to 2.3.0

3

dist/index.d.ts

@@ -1,4 +0,5 @@

export declare function generateSrcset(src: string): string;
export declare function srcset(src: string): string;
export declare function placeholder(src: string): string;
export default function imgix(img: HTMLImageElement, src: string): {
destroy(): void;
};

@@ -591,3 +591,3 @@ (function (global, factory) {

}
function generateSrcset(src) {
function srcset(src) {
const resolutions = [], sets = [];

@@ -607,2 +607,5 @@ let prev = 100;

}
function placeholder(src) {
return `${trimSrc(src)}?w=0.5&blur=200&px=16&auto=format&colorquant=150`;
}
function imgix(img, src) {

@@ -614,3 +617,3 @@ let intersected = false;

img.src = src;
img.srcset = generateSrcset(src);
img.srcset = srcset(src);
}

@@ -621,3 +624,3 @@ if (intersected) {

});
img.src = `${trimSrc(src)}?w=0.5&blur=200&px=16&auto=format&colorquant=150`;
img.src = placeholder(src);
observer.observe(img);

@@ -632,3 +635,4 @@ return {

exports.default = imgix;
exports.generateSrcset = generateSrcset;
exports.placeholder = placeholder;
exports.srcset = srcset;

@@ -635,0 +639,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

{
"name": "svelte-imgix",
"description": "Svelte action for responsive, lazily-loaded images with Imgix",
"version": "2.2.5",
"version": "2.3.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "author": "Madeleine Ostoja",

@@ -26,2 +26,17 @@ # Svelt Imgix

### Helper functions
Svelte Imgix exports 2 additional helper functions that you can use to create LQIP placeholders and responsive srcsets yourself, `placeholder(src)` and `srcset(src`;
```svelte
<script>
import { placeholder, srcset } from 'svelte-imgix';
import { invew } from 'svelte-inview';
let intersected = false;
</script>
<img src={intersected ? srcset(imgixImg) : placeholder(imgixImg)} use:invew on:enter={() => intersected = true} />
```
### Adding Sizes

@@ -28,0 +43,0 @@

Sorry, the diff of this file is not supported yet

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