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

svg-paper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-paper - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

4

js/src/adjust-text.js
'use strict'
export default (selector, config) => {
export default (selector, config, paperPixelRatio = 1) => {
const $this = document.querySelector(selector)

@@ -16,3 +16,3 @@

if ($this.clientWidth > config.textLength) {
if ($this.getBoundingClientRect().width * paperPixelRatio > config.textLength) {
$this.querySelector('tspan').setAttribute('textLength', config.textLength)

@@ -19,0 +19,0 @@ $this.querySelector('tspan').setAttribute('lengthAdjust', 'spacingAndGlyphs')

@@ -69,6 +69,15 @@ 'use strict'

this.adjustTextQueries.forEach(query => {
// if viewBox is specified, Element.clientWidth and Element.getBoundingClientRect() return different values
// clientWidth: ???
// getBoundingClientRect(): pure pixel value
// so this library uses getBoundingClientRect() and pre-calculated ratio to specify the width of some elements
// @see https://stackoverflow.com/questions/15335926/how-to-use-the-svg-viewbox-attribute
const $svg = document.querySelector(this.selector)
const viewBoxWidth = $svg.getAttribute('viewBox')?.split(/ +/)[2] ?? null
const paperPixelRatio = viewBoxWidth ? parseFloat(viewBoxWidth) / $svg.getBoundingClientRect().width : 1
adjustText(query.selector, {
textLength: query.textLength,
'text-anchor': query.textAnchor,
})
}, paperPixelRatio)
})

@@ -75,0 +84,0 @@

{
"name": "svg-paper",
"version": "0.0.10",
"version": "0.0.11",
"description": "The world's most maintainable way to create paper-printable documents 🖨💘",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/ttskch/svg-paper",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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