Socket
Book a DemoInstallSign in
Socket

@bztes/svelte-rip

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bztes/svelte-rip

Svelte responsive image preview

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

svelte-rip

ALPHA: API may change at any time

Svelte components for responsive images and image previews (incl. BlurHash)

Demo

Examples

Responsive image with thumbnail preview

<script>
  import { Image } from '@bztes/svelte-rip';

  let imgData = {
    src: 'static/robert-katzki-unsplash_org.jpg',
    previewSrc: 'static/robert-katzki-unsplash_32.jpg',
    formats: [
        { src: 'static/robert-katzki-unsplash_400.jpg', width: 400 },
        { src: 'static/robert-katzki-unsplash_800.jpg', width: 800 },
        { src: 'static/robert-katzki-unsplash_1000.jpg', width: 1000 },
    ]
  }:
</script>

<Image data={imgData} />

Responsive image with blurhash preview

<script>
    import { Image, blurhashToData } from '@bztes/svelte-rip';

    let imgData = {
      src: 'static/robert-katzki-unsplash_org.jpg',
      hash: 'LGF5]+Yk^6#M@-5c,1J5@[or[Q6.',
      formats: [ ... ]
    };
</script>

<Image data={imgData} previewSrc={blurhashToData} />

Fixed background image


<script>
  import { Image, Stack } from '@bztes/svelte-rip';

  // ...
</script>

<Stack fixed>
  <Image slot="image" data={imgData} />
  <h1>Hello Bello</h1>
</Stack>

Adjustable default settings

import { ImageDefaults } from '@bztes/svelte-rip';

ImageDefaults.src = (data) => (data ? 'static/' + data.url : null);
ImageDefaults.alt = (data) => data?.alternativeText;

Keywords

svelte

FAQs

Package last updated on 07 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.