New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

auto-scale-worklet

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-scale-worklet

A CSS Paint API worklet that explores the automatic scaling of fixed dimension content - similar to that of SVG's `viewBox`, or `background-size: contain` / `background-size: cover`.

  • 1.0.1
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Auto Scale Worklet

A CSS Paint API worklet that explores the automatic scaling of fixed dimension content - similar to that of SVG's viewBox, or background-size: contain / background-size: cover.

Why?

Paint API worklets, by nature, are responsive - they will always re-paint when the element they are applied to changes dimensions. Nine times out of ten, this is great, and exactly what we want! Sometimes, however, this introduces quite a bit of complexity, especially when working with random numbers, complex patterns, etc.

This worklet is a simple class that allows us to define a fixed --worklet-width and --worklet-height property, alongside a --worklet-scale-mode option. --worklet-scale-mode works just like background-size in CSS, and accepts either a contain or cover value.

When using this worklet, we can create our images in a similar way to SVG, working to a fixed "viewBox" or space. The content rendered in this space will then be automatically scaled to either cover, or fit within the element it is applied to.

I think this could be handy for beginners, or when implementing a custom PRNG solution is not viable.

Just an idea, anywho!

FAQs

Package last updated on 04 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

  • 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