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

@vx/text

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/text - npm Package Compare versions

Comparing version 0.0.62 to 0.0.63

build/fragments/textOutlineProps.js

7

build/index.js

@@ -11,6 +11,11 @@ 'use strict';

var _TextOutline = require('./text/TextOutline');
var _TextOutline2 = _interopRequireDefault(_TextOutline);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
TextWrap: _TextWrap2.default
TextWrap: _TextWrap2.default,
TextOutline: _TextOutline2.default
};

60

build/text/TextWrap.js

@@ -27,2 +27,6 @@ 'use strict';

/**
* TODO: this is horrible. figure this out.
*/
var TextWrap = function (_React$Component) {

@@ -43,4 +47,8 @@ _inherits(TextWrap, _React$Component);

width = _props.width,
y = _props.y,
dy = _props.dy,
_props$y = _props.y,
y = _props$y === undefined ? 1 : _props$y,
_props$x = _props.x,
x = _props$x === undefined ? 1 : _props$x,
_props$dy = _props.dy,
dy = _props$dy === undefined ? 0 : _props$dy,
lineHeight = _props.lineHeight;

@@ -52,2 +60,3 @@

var word = void 0;
var tspan = this.tspan;

@@ -58,15 +67,20 @@ var words = text.split(/\s+/).reverse();

line.push(word);
this.tspan.textContent(line.join(" "));
if (this.getComputedTextLength() > width) {
var newText = line.join(" ");
tspan.textContent = newText;
if (tspan.getComputedTextLength() > width) {
line.pop();
this.tspan.textContent(line.join(" "));
newText = line.join(" ");
tspan.textContent = newText;
line = [word];
var newLine = document.createElementNS(svgNS, 'tspan');
newLine.setAttribueNS(svgNS, 'x', 0);
newLine.setAttributeNS(svgNS, 'x', x);
newLine.setAttributeNS(svgNS, 'y', y);
newLine.setAttributeNS(svgNS, 'dy', ++lineNumber + lineHeight + dy + 'em');
newLine.textContent(word);
newLine.setAttributeNS(svgNS, 'dy', ++lineNumber * lineHeight + 'em');
newLine.textContent = ' ' + word;
this.tspan.append(newLine);
this.tspan.parentNode.append(newLine);
tspan = newLine;
}

@@ -76,8 +90,2 @@ }

}, {
key: 'getComputedTextLength',
value: function getComputedTextLength() {
if (!this.tspan) return 0;
return this.tspan.getComputedTextLength();
}
}, {
key: 'render',

@@ -91,3 +99,5 @@ value: function render() {

y = _props2.y,
dy = _props2.dy;
dy = _props2.dy,
lineHeight = _props2.lineHeight,
width = _props2.width;

@@ -97,14 +107,10 @@ return _react2.default.createElement(

null,
_react2.default.createElement(
'tspan',
{
ref: function ref(c) {
_this2.tspan = c;
},
x: x,
y: y,
dy: dy
_react2.default.createElement('tspan', {
ref: function ref(c) {
_this2.tspan = c;
},
text
)
x: x,
y: y,
dy: dy
})
);

@@ -111,0 +117,0 @@ }

{
"name": "@vx/text",
"version": "0.0.62",
"version": "0.0.63",
"description": "vx text",

@@ -5,0 +5,0 @@ "main": "build/index.js",

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