npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cloak-app/visual

v1.3.0

Published

Adpaters for vue-visual using @nuxt/image.

Downloads

124

Readme

@cloak-app/visual

Adpaters for vue-visual using @nuxt/image.

Install

  1. Install with yarn add @cloak-app/visual
  2. Add to nuxt.config with buildModules: ['@cloak-app/visual']

Also, you'll likely want to add a provider to @nuxt/image as well. Here is an example configuration using imgix with a source images uploaded to a different domain (like if we were using DigitalOcean Spaces for image storage).

// nuxt.config.js
export default {
  image: {
    provider: 'imgix',
    domains: ['your-source.domain.com'],
    imgix: {
      baseURL: 'https://your-subdomain.imgix.net',
    }
  }
}

At the moment, there is no support for Craft image transforms. I'm not entirely sure I even want to support them because it puts a heavy load on the CMS server. Thus, when working with Craft, use 3rd party image CDN, like Imgix, or the static provider.

Project Dependencies

  • .max-w* styles (included in Cloak via whitespace.styl)

Module Options

Set these properties within cloak: { visual: { ... } } in the nuxt.config.js:

  • placeholderColor - Sets the vue-visual placeholder-color. Defaults to rgba(0,0,0,.2).
  • srcsetWidths - An array of viewport widths that will be used to make srcset values from. Defaults to [1920, 1440, 1024, 768, 425, 210].
  • blockMaxWidth - A string that should match a global CSS class that adds horizontal padding and a max-width to the block component. Defaults to max-w.

Usage

Components

Generic

<cloak-visual />

Renders a vue-visual instance using Cloak defaults.

  • props:
    • provider - Use a specific @nuxt/image provider rather than the default
    • preset - Use a specific @nuxt/image preset
    • natural - Set width and height to natural size
    • no-upscale - Use image's width as a max-width
    • no-placeholder - Clear placeholder color, like for logos. The placeholder is automatically isabled
    • ... all other vue-visual props

<cloak-visual-responsive />

Conditionally render landscape or portrait Visual instances.

  • props:
    • landscape-image - Image shown on landscape orientation viewports
    • portrait-image - Image shown on landscape orientation viewports
    • ... all other cloak-visual props

<cloak-visual-block />

The block component simply renders a 100% width Visual within the max-width gutters using the default @nuxt/image provider.

  • props:
    • maxWidth - A max-w-* class to apply to the block
    • ... all other cloak-visual-responsive props

Craft

<cloak-visual-craft-block />

Renders a cloak-visual-responsive at 100vw but with max-width gutters. It's expecting data from a GQL fragment like this:

#import "@cloak-app/craft/queries/fragments/responsive-image.gql"
#import "@cloak-app/craft/queries/fragments/responsive-video.gql"

fragment mediaAssetBlock on blocks_mediaAsset_BlockType {
  image: responsiveImage { ... responsiveImage }
  video: responsiveVideo { ... responsiveVideo }
  maxWidth
}

<responsive-craft-visual />

Renders a cloak-visual-responsive instance using Craft Super Table objects that contain landscape and portrait assets.

<craft-visual />

Renders a cloak-visual instance using Craft asset objects.

Contributing

Run yarn dev to open a Nuxt dev build of the demo directory.