@superset-ui/dimension
Advanced tools
Comparing version 0.12.7 to 0.12.8
@@ -1,1 +0,55 @@ | ||
function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}import getTextDimension from"./getTextDimension";function decreaseSizeUntil(a,b,c){for(var d=a,e=b(d);!c(e);)d-=1,e=b(d);return d}export default function computeMaxFontSize(a){function b(a){return getTextDimension(_extends({},h,{style:_extends({},g,{fontSize:a})}))}var c,d=a.idealFontSize,e=a.maxWidth,f=a.maxHeight,g=a.style,h=_objectWithoutPropertiesLoose(a,["idealFontSize","maxWidth","maxHeight","style"]);if(void 0!==d&&null!==d)c=d;else if(void 0===f||null===f)throw new Error("You must specify at least one of maxHeight or idealFontSize");else c=Math.floor(f);return void 0!==e&&null!==e&&(c=decreaseSizeUntil(c,b,function(a){return a.width<=e})),void 0!==f&&null!==f&&(c=decreaseSizeUntil(c,b,function(a){return a.height<=f})),c} | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import getTextDimension from './getTextDimension'; | ||
function decreaseSizeUntil(startSize, computeDimension, condition) { | ||
let size = startSize; | ||
let dimension = computeDimension(size); | ||
while (!condition(dimension)) { | ||
size -= 1; | ||
dimension = computeDimension(size); | ||
} | ||
return size; | ||
} | ||
export default function computeMaxFontSize(input) { | ||
const { | ||
idealFontSize, | ||
maxWidth, | ||
maxHeight, | ||
style | ||
} = input, | ||
rest = _objectWithoutPropertiesLoose(input, ["idealFontSize", "maxWidth", "maxHeight", "style"]); | ||
let size; | ||
if (idealFontSize !== undefined && idealFontSize !== null) { | ||
size = idealFontSize; | ||
} else if (maxHeight === undefined || maxHeight === null) { | ||
throw new Error('You must specify at least one of maxHeight or idealFontSize'); | ||
} else { | ||
size = Math.floor(maxHeight); | ||
} | ||
function computeDimension(fontSize) { | ||
return getTextDimension(_extends({}, rest, { | ||
style: _extends({}, style, { | ||
fontSize: fontSize + "px" | ||
}) | ||
})); | ||
} | ||
if (maxWidth !== undefined && maxWidth !== null) { | ||
size = decreaseSizeUntil(size, computeDimension, dim => dim.width <= maxWidth); | ||
} | ||
if (maxHeight !== undefined && maxHeight !== null) { | ||
size = decreaseSizeUntil(size, computeDimension, dim => dim.height <= maxHeight); | ||
} | ||
return size; | ||
} |
@@ -1,8 +0,64 @@ | ||
import getBBoxCeil from"./svg/getBBoxCeil";import{hiddenSvgFactory,textFactory}from"./svg/factories";import updateTextNode from"./svg/updateTextNode";/** | ||
import getBBoxCeil from './svg/getBBoxCeil'; | ||
import { hiddenSvgFactory, textFactory } from './svg/factories'; | ||
import updateTextNode from './svg/updateTextNode'; | ||
/** | ||
* get dimensions of multiple texts with same style | ||
* @param input | ||
* @param defaultDimension | ||
*/export default function getMultipleTextDimensions(a,b){var c=a.texts,d=a.className,e=a.style,f=a.container,g=new Map;g.set("",{height:0,width:0});var h,i,j=c.map(function(a){// Check if this string has been computed already | ||
if(g.has(a))return g.get(a);// Lazy creation of text and svg nodes | ||
h||(i=hiddenSvgFactory.createInContainer(f),h=textFactory.createInContainer(i)),updateTextNode(h,{className:d,style:e,text:a});var c=getBBoxCeil(h,b);// Store result to cache | ||
return g.set(a,c),c});return i&&h&&setTimeout(function(){textFactory.removeFromContainer(i),hiddenSvgFactory.removeFromContainer(f)},500),j} | ||
*/ | ||
export default function getMultipleTextDimensions(input, defaultDimension) { | ||
const { | ||
texts, | ||
className, | ||
style, | ||
container | ||
} = input; | ||
const cache = new Map(); // for empty string | ||
cache.set('', { | ||
height: 0, | ||
width: 0 | ||
}); | ||
let textNode; | ||
let svgNode; | ||
const dimensions = texts.map(text => { | ||
// Check if this string has been computed already | ||
if (cache.has(text)) { | ||
return cache.get(text); | ||
} // Lazy creation of text and svg nodes | ||
if (!textNode) { | ||
svgNode = hiddenSvgFactory.createInContainer(container); | ||
textNode = textFactory.createInContainer(svgNode); | ||
} // Update text and get dimension | ||
updateTextNode(textNode, { | ||
className, | ||
style, | ||
text | ||
}); | ||
const dimension = getBBoxCeil(textNode, defaultDimension); // Store result to cache | ||
cache.set(text, dimension); | ||
return dimension; | ||
}); // Remove svg node, if any | ||
if (svgNode && textNode) { | ||
// The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
setTimeout(() => { | ||
textFactory.removeFromContainer(svgNode); | ||
hiddenSvgFactory.removeFromContainer(container); | ||
}, 500); | ||
} | ||
return dimensions; | ||
} |
@@ -1,9 +0,39 @@ | ||
import updateTextNode from"./svg/updateTextNode";import getBBoxCeil from"./svg/getBBoxCeil";import{hiddenSvgFactory,textFactory}from"./svg/factories";export default function getTextDimension(a,b){var c=a.text,d=a.className,e=a.style,f=a.container;// Empty string | ||
if(0===c.length)return{height:0,width:0};var g=hiddenSvgFactory.createInContainer(f),h=textFactory.createInContainer(g);updateTextNode(h,{className:d,style:e,text:c});var i=getBBoxCeil(h,b);// The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
return setTimeout(function(){textFactory.removeFromContainer(g),hiddenSvgFactory.removeFromContainer(f)},500),i} | ||
import updateTextNode from './svg/updateTextNode'; | ||
import getBBoxCeil from './svg/getBBoxCeil'; | ||
import { hiddenSvgFactory, textFactory } from './svg/factories'; | ||
export default function getTextDimension(input, defaultDimension) { | ||
const { | ||
text, | ||
className, | ||
style, | ||
container | ||
} = input; // Empty string | ||
if (text.length === 0) { | ||
return { | ||
height: 0, | ||
width: 0 | ||
}; | ||
} | ||
const svgNode = hiddenSvgFactory.createInContainer(container); | ||
const textNode = textFactory.createInContainer(svgNode); | ||
updateTextNode(textNode, { | ||
className, | ||
style, | ||
text | ||
}); | ||
const dimension = getBBoxCeil(textNode, defaultDimension); // The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
setTimeout(() => { | ||
textFactory.removeFromContainer(svgNode); | ||
hiddenSvgFactory.removeFromContainer(container); | ||
}, 500); | ||
return dimension; | ||
} |
@@ -1,1 +0,6 @@ | ||
export{default as getTextDimension}from"./getTextDimension";export{default as getMultipleTextDimensions}from"./getMultipleTextDimensions";export{default as computeMaxFontSize}from"./computeMaxFontSize";export{default as mergeMargin}from"./mergeMargin";export{default as parseLength}from"./parseLength";export*from"./types"; | ||
export { default as getTextDimension } from './getTextDimension'; | ||
export { default as getMultipleTextDimensions } from './getMultipleTextDimensions'; | ||
export { default as computeMaxFontSize } from './computeMaxFontSize'; | ||
export { default as mergeMargin } from './mergeMargin'; | ||
export { default as parseLength } from './parseLength'; | ||
export * from './types'; |
@@ -1,1 +0,41 @@ | ||
function mergeOneSide(c,d,e){return(void 0===c&&(c=0),void 0===d&&(d=0),Number.isNaN(c)||null===c)?d:Number.isNaN(d)||null===d?c:e(c,d)}export default function mergeMargin(a,b,c){void 0===a&&(a={}),void 0===b&&(b={}),void 0===c&&(c="expand");var d=a,e=d.top,f=d.left,g=d.bottom,h=d.right,i="expand"===c?Math.max:Math.min;return{bottom:mergeOneSide(g,b.bottom,i),left:mergeOneSide(f,b.left,i),right:mergeOneSide(h,b.right,i),top:mergeOneSide(e,b.top,i)}} | ||
function mergeOneSide(operation, a, b) { | ||
if (a === void 0) { | ||
a = 0; | ||
} | ||
if (b === void 0) { | ||
b = 0; | ||
} | ||
if (Number.isNaN(a) || a === null) return b; | ||
if (Number.isNaN(b) || b === null) return a; | ||
return operation(a, b); | ||
} | ||
export default function mergeMargin(margin1, margin2, mode) { | ||
if (margin1 === void 0) { | ||
margin1 = {}; | ||
} | ||
if (margin2 === void 0) { | ||
margin2 = {}; | ||
} | ||
if (mode === void 0) { | ||
mode = 'expand'; | ||
} | ||
const { | ||
top, | ||
left, | ||
bottom, | ||
right | ||
} = margin1; | ||
const operation = mode === 'expand' ? Math.max : Math.min; | ||
return { | ||
bottom: mergeOneSide(operation, bottom, margin2.bottom), | ||
left: mergeOneSide(operation, left, margin2.left), | ||
right: mergeOneSide(operation, right, margin2.right), | ||
top: mergeOneSide(operation, top, margin2.top) | ||
}; | ||
} |
@@ -1,2 +0,22 @@ | ||
var HUNDRED_PERCENT={isDynamic:!0,multiplier:1};export default function parseLength(a){if("auto"===a||"100%"===a)return HUNDRED_PERCENT;if("string"==typeof a&&0<a.length&&"%"===a[a.length-1])// eslint-disable-next-line no-magic-numbers | ||
return{isDynamic:!0,multiplier:parseFloat(a)/100};var b="number"==typeof a?a:parseFloat(a);return{isDynamic:!1,value:b}} | ||
const HUNDRED_PERCENT = { | ||
isDynamic: true, | ||
multiplier: 1 | ||
}; | ||
export default function parseLength(input) { | ||
if (input === 'auto' || input === '100%') { | ||
return HUNDRED_PERCENT; | ||
} | ||
if (typeof input === 'string' && input.length > 0 && input[input.length - 1] === '%') { | ||
return { | ||
isDynamic: true, | ||
multiplier: parseFloat(input) / 100 | ||
}; | ||
} | ||
const value = typeof input === 'number' ? input : parseFloat(input); | ||
return { | ||
isDynamic: false, | ||
value | ||
}; | ||
} |
// eslint-disable-next-line import/prefer-default-export | ||
export var SVG_NS="http://www.w3.org/2000/svg"; | ||
export const SVG_NS = 'http://www.w3.org/2000/svg'; |
@@ -1,2 +0,16 @@ | ||
import{SVG_NS}from"./constants";export default function createHiddenSvgNode(){var a=document.createElementNS(SVG_NS,"svg");// won't capture mouse events | ||
return a.style.position="absolute",a.style.top="-100%",a.style.left="-100%",a.style.width="0",a.style.height="0",a.style.opacity="0",a.style.pointerEvents="none",a} | ||
import { SVG_NS } from './constants'; | ||
export default function createHiddenSvgNode() { | ||
const svgNode = document.createElementNS(SVG_NS, 'svg'); | ||
svgNode.style.position = 'absolute'; // so it won't disrupt page layout | ||
svgNode.style.top = '-100%'; | ||
svgNode.style.left = '-100%'; | ||
svgNode.style.width = '0'; // no dimensions | ||
svgNode.style.height = '0'; | ||
svgNode.style.opacity = '0'; // not visible | ||
svgNode.style.pointerEvents = 'none'; // won't capture mouse events | ||
return svgNode; | ||
} |
@@ -1,1 +0,4 @@ | ||
import{SVG_NS}from"./constants";export default function createTextNode(){return document.createElementNS(SVG_NS,"text")} | ||
import { SVG_NS } from './constants'; | ||
export default function createTextNode() { | ||
return document.createElementNS(SVG_NS, 'text'); | ||
} |
@@ -1,1 +0,5 @@ | ||
import LazyFactory from"./LazyFactory";import createHiddenSvgNode from"./createHiddenSvgNode";import createTextNode from"./createTextNode";export var hiddenSvgFactory=new LazyFactory(createHiddenSvgNode);export var textFactory=new LazyFactory(createTextNode); | ||
import LazyFactory from './LazyFactory'; | ||
import createHiddenSvgNode from './createHiddenSvgNode'; | ||
import createTextNode from './createTextNode'; | ||
export const hiddenSvgFactory = new LazyFactory(createHiddenSvgNode); | ||
export const textFactory = new LazyFactory(createTextNode); |
@@ -1,1 +0,18 @@ | ||
var DEFAULT_DIMENSION={height:20,width:100};export default function getBBoxCeil(a,b){void 0===b&&(b=DEFAULT_DIMENSION);var c=a.getBBox?a.getBBox():b,d=c.width,e=c.height;return{height:Math.ceil(e),width:Math.ceil(d)}} | ||
const DEFAULT_DIMENSION = { | ||
height: 20, | ||
width: 100 | ||
}; | ||
export default function getBBoxCeil(node, defaultDimension) { | ||
if (defaultDimension === void 0) { | ||
defaultDimension = DEFAULT_DIMENSION; | ||
} | ||
const { | ||
width, | ||
height | ||
} = node.getBBox ? node.getBBox() : defaultDimension; | ||
return { | ||
height: Math.ceil(height), | ||
width: Math.ceil(width) | ||
}; | ||
} |
@@ -1,1 +0,48 @@ | ||
function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var LazyFactory=/*#__PURE__*/function(){function a(a){_defineProperty(this,"activeNodes",new Map),_defineProperty(this,"factoryFn",void 0),this.factoryFn=a}var b=a.prototype;return b.createInContainer=function createInContainer(a){if(void 0===a&&(a=document.body),this.activeNodes.has(a)){var c=this.activeNodes.get(a);return c.counter+=1,c.node}var b=this.factoryFn();return a.appendChild(b),this.activeNodes.set(a,{counter:1,node:b}),b},b.removeFromContainer=function removeFromContainer(a){if(void 0===a&&(a=document.body),this.activeNodes.has(a)){var b=this.activeNodes.get(a);b.counter-=1,0===b.counter&&(a.removeChild(b.node),this.activeNodes.delete(a))}},a}();export{LazyFactory as default}; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
export default class LazyFactory { | ||
constructor(factoryFn) { | ||
_defineProperty(this, "activeNodes", new Map()); | ||
_defineProperty(this, "factoryFn", void 0); | ||
this.factoryFn = factoryFn; | ||
} | ||
createInContainer(container) { | ||
if (container === void 0) { | ||
container = document.body; | ||
} | ||
if (this.activeNodes.has(container)) { | ||
const entry = this.activeNodes.get(container); | ||
entry.counter += 1; | ||
return entry.node; | ||
} | ||
const node = this.factoryFn(); | ||
container.append(node); | ||
this.activeNodes.set(container, { | ||
counter: 1, | ||
node | ||
}); | ||
return node; | ||
} | ||
removeFromContainer(container) { | ||
if (container === void 0) { | ||
container = document.body; | ||
} | ||
if (this.activeNodes.has(container)) { | ||
const entry = this.activeNodes.get(container); | ||
entry.counter -= 1; | ||
if (entry.counter === 0) { | ||
container.removeChild(entry.node); | ||
this.activeNodes.delete(container); | ||
} | ||
} | ||
} | ||
} |
@@ -1,1 +0,32 @@ | ||
var STYLE_FIELDS=["font","fontWeight","fontStyle","fontSize","fontFamily","letterSpacing"];export default function updateTextNode(a,b){var c=void 0===b?{}:b,d=c.className,e=c.style,f=void 0===e?{}:e,g=c.text,h=a;return h.textContent!==g&&(h.textContent="undefined"==typeof g?null:g),h.getAttribute("class")!==d&&h.setAttribute("class",d||""),h.style.removeProperty("font"),h.style.removeProperty("font-weight"),h.style.removeProperty("font-style"),h.style.removeProperty("font-size"),h.style.removeProperty("font-family"),h.style.removeProperty("letter-spacing"),STYLE_FIELDS.filter(function(a){return"undefined"!=typeof f[a]&&null!==f[a]}).forEach(function(a){h.style[a]=""+f[a]}),h} | ||
const STYLE_FIELDS = ['font', 'fontWeight', 'fontStyle', 'fontSize', 'fontFamily', 'letterSpacing']; | ||
export default function updateTextNode(node, _temp) { | ||
let { | ||
className, | ||
style = {}, | ||
text | ||
} = _temp === void 0 ? {} : _temp; | ||
const textNode = node; | ||
if (textNode.textContent !== text) { | ||
textNode.textContent = typeof text === 'undefined' ? null : text; | ||
} | ||
if (textNode.getAttribute('class') !== className) { | ||
textNode.setAttribute('class', className != null ? className : ''); | ||
} // Clear style | ||
// Note: multi-word property names are hyphenated and not camel-cased. | ||
textNode.style.removeProperty('font'); | ||
textNode.style.removeProperty('font-weight'); | ||
textNode.style.removeProperty('font-style'); | ||
textNode.style.removeProperty('font-size'); | ||
textNode.style.removeProperty('font-family'); | ||
textNode.style.removeProperty('letter-spacing'); // Apply new style | ||
// Note: the font field will auto-populate other font fields when applicable. | ||
STYLE_FIELDS.filter(field => typeof style[field] !== 'undefined' && style[field] !== null).forEach(field => { | ||
textNode.style[field] = "" + style[field]; | ||
}); | ||
return textNode; | ||
} |
@@ -7,1 +7,2 @@ import { GetTextDimensionInput } from './getTextDimension'; | ||
}): number; | ||
//# sourceMappingURL=computeMaxFontSize.d.ts.map |
@@ -1,1 +0,62 @@ | ||
"use strict";var _getTextDimension=_interopRequireDefault(require("./getTextDimension"));exports.__esModule=!0,exports.default=computeMaxFontSize;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}function decreaseSizeUntil(a,b,c){for(var d=a,e=b(d);!c(e);)d-=1,e=b(d);return d}function computeMaxFontSize(a){function b(a){return(0,_getTextDimension.default)(_extends({},h,{style:_extends({},g,{fontSize:a})}))}var c,d=a.idealFontSize,e=a.maxWidth,f=a.maxHeight,g=a.style,h=_objectWithoutPropertiesLoose(a,["idealFontSize","maxWidth","maxHeight","style"]);if(void 0!==d&&null!==d)c=d;else if(void 0===f||null===f)throw new Error("You must specify at least one of maxHeight or idealFontSize");else c=Math.floor(f);return void 0!==e&&null!==e&&(c=decreaseSizeUntil(c,b,function(a){return a.width<=e})),void 0!==f&&null!==f&&(c=decreaseSizeUntil(c,b,function(a){return a.height<=f})),c} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = computeMaxFontSize; | ||
var _getTextDimension = _interopRequireDefault(require("./getTextDimension")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function decreaseSizeUntil(startSize, computeDimension, condition) { | ||
let size = startSize; | ||
let dimension = computeDimension(size); | ||
while (!condition(dimension)) { | ||
size -= 1; | ||
dimension = computeDimension(size); | ||
} | ||
return size; | ||
} | ||
function computeMaxFontSize(input) { | ||
const { | ||
idealFontSize, | ||
maxWidth, | ||
maxHeight, | ||
style | ||
} = input, | ||
rest = _objectWithoutPropertiesLoose(input, ["idealFontSize", "maxWidth", "maxHeight", "style"]); | ||
let size; | ||
if (idealFontSize !== undefined && idealFontSize !== null) { | ||
size = idealFontSize; | ||
} else if (maxHeight === undefined || maxHeight === null) { | ||
throw new Error('You must specify at least one of maxHeight or idealFontSize'); | ||
} else { | ||
size = Math.floor(maxHeight); | ||
} | ||
function computeDimension(fontSize) { | ||
return (0, _getTextDimension.default)(_extends({}, rest, { | ||
style: _extends({}, style, { | ||
fontSize: fontSize + "px" | ||
}) | ||
})); | ||
} | ||
if (maxWidth !== undefined && maxWidth !== null) { | ||
size = decreaseSizeUntil(size, computeDimension, dim => dim.width <= maxWidth); | ||
} | ||
if (maxHeight !== undefined && maxHeight !== null) { | ||
size = decreaseSizeUntil(size, computeDimension, dim => dim.height <= maxHeight); | ||
} | ||
return size; | ||
} |
@@ -13,1 +13,2 @@ import { TextStyle, Dimension } from './types'; | ||
}, defaultDimension?: Dimension): Dimension[]; | ||
//# sourceMappingURL=getMultipleTextDimensions.d.ts.map |
@@ -1,8 +0,74 @@ | ||
"use strict";exports.__esModule=!0,exports.default=getMultipleTextDimensions;var _getBBoxCeil=_interopRequireDefault(require("./svg/getBBoxCeil")),_factories=require("./svg/factories"),_updateTextNode=_interopRequireDefault(require("./svg/updateTextNode"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/** | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = getMultipleTextDimensions; | ||
var _getBBoxCeil = _interopRequireDefault(require("./svg/getBBoxCeil")); | ||
var _factories = require("./svg/factories"); | ||
var _updateTextNode = _interopRequireDefault(require("./svg/updateTextNode")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* get dimensions of multiple texts with same style | ||
* @param input | ||
* @param defaultDimension | ||
*/function getMultipleTextDimensions(a,b){var c=a.texts,d=a.className,e=a.style,f=a.container,g=new Map;g.set("",{height:0,width:0});var h,i,j=c.map(function(a){// Check if this string has been computed already | ||
if(g.has(a))return g.get(a);// Lazy creation of text and svg nodes | ||
h||(i=_factories.hiddenSvgFactory.createInContainer(f),h=_factories.textFactory.createInContainer(i)),(0,_updateTextNode.default)(h,{className:d,style:e,text:a});var c=(0,_getBBoxCeil.default)(h,b);// Store result to cache | ||
return g.set(a,c),c});return i&&h&&setTimeout(function(){_factories.textFactory.removeFromContainer(i),_factories.hiddenSvgFactory.removeFromContainer(f)},500),j} | ||
*/ | ||
function getMultipleTextDimensions(input, defaultDimension) { | ||
const { | ||
texts, | ||
className, | ||
style, | ||
container | ||
} = input; | ||
const cache = new Map(); // for empty string | ||
cache.set('', { | ||
height: 0, | ||
width: 0 | ||
}); | ||
let textNode; | ||
let svgNode; | ||
const dimensions = texts.map(text => { | ||
// Check if this string has been computed already | ||
if (cache.has(text)) { | ||
return cache.get(text); | ||
} // Lazy creation of text and svg nodes | ||
if (!textNode) { | ||
svgNode = _factories.hiddenSvgFactory.createInContainer(container); | ||
textNode = _factories.textFactory.createInContainer(svgNode); | ||
} // Update text and get dimension | ||
(0, _updateTextNode.default)(textNode, { | ||
className, | ||
style, | ||
text | ||
}); | ||
const dimension = (0, _getBBoxCeil.default)(textNode, defaultDimension); // Store result to cache | ||
cache.set(text, dimension); | ||
return dimension; | ||
}); // Remove svg node, if any | ||
if (svgNode && textNode) { | ||
// The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
setTimeout(() => { | ||
_factories.textFactory.removeFromContainer(svgNode); | ||
_factories.hiddenSvgFactory.removeFromContainer(container); | ||
}, 500); | ||
} | ||
return dimensions; | ||
} |
@@ -9,1 +9,2 @@ import { TextStyle, Dimension } from './types'; | ||
export default function getTextDimension(input: GetTextDimensionInput, defaultDimension?: Dimension): Dimension; | ||
//# sourceMappingURL=getTextDimension.d.ts.map |
@@ -1,9 +0,52 @@ | ||
"use strict";exports.__esModule=!0,exports.default=getTextDimension;var _updateTextNode=_interopRequireDefault(require("./svg/updateTextNode")),_getBBoxCeil=_interopRequireDefault(require("./svg/getBBoxCeil")),_factories=require("./svg/factories");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function getTextDimension(a,b){var c=a.text,d=a.className,e=a.style,f=a.container;// Empty string | ||
if(0===c.length)return{height:0,width:0};var g=_factories.hiddenSvgFactory.createInContainer(f),h=_factories.textFactory.createInContainer(g);(0,_updateTextNode.default)(h,{className:d,style:e,text:c});var i=(0,_getBBoxCeil.default)(h,b);// The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
return setTimeout(function(){_factories.textFactory.removeFromContainer(g),_factories.hiddenSvgFactory.removeFromContainer(f)},500),i} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = getTextDimension; | ||
var _updateTextNode = _interopRequireDefault(require("./svg/updateTextNode")); | ||
var _getBBoxCeil = _interopRequireDefault(require("./svg/getBBoxCeil")); | ||
var _factories = require("./svg/factories"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getTextDimension(input, defaultDimension) { | ||
const { | ||
text, | ||
className, | ||
style, | ||
container | ||
} = input; // Empty string | ||
if (text.length === 0) { | ||
return { | ||
height: 0, | ||
width: 0 | ||
}; | ||
} | ||
const svgNode = _factories.hiddenSvgFactory.createInContainer(container); | ||
const textNode = _factories.textFactory.createInContainer(svgNode); | ||
(0, _updateTextNode.default)(textNode, { | ||
className, | ||
style, | ||
text | ||
}); | ||
const dimension = (0, _getBBoxCeil.default)(textNode, defaultDimension); // The nodes are added to the DOM briefly only to make getBBox works. | ||
// (If not added to DOM getBBox will always return 0x0.) | ||
// After that the svg nodes are not needed. | ||
// We delay its removal in case there are subsequent calls to this function | ||
// that can reuse the svg nodes. | ||
// Experiments have shown that reusing existing nodes | ||
// instead of deleting and adding new ones can save lot of time. | ||
setTimeout(() => { | ||
_factories.textFactory.removeFromContainer(svgNode); | ||
_factories.hiddenSvgFactory.removeFromContainer(container); | ||
}, 500); | ||
return dimension; | ||
} |
@@ -7,1 +7,2 @@ export { default as getTextDimension } from './getTextDimension'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,41 @@ | ||
"use strict";var _exportNames={getTextDimension:!0,getMultipleTextDimensions:!0,computeMaxFontSize:!0,mergeMargin:!0,parseLength:!0};var _getTextDimension=_interopRequireDefault(require("./getTextDimension"));var _getMultipleTextDimensions=_interopRequireDefault(require("./getMultipleTextDimensions"));var _computeMaxFontSize=_interopRequireDefault(require("./computeMaxFontSize"));var _mergeMargin=_interopRequireDefault(require("./mergeMargin"));var _parseLength=_interopRequireDefault(require("./parseLength"));var _types=require("./types");exports.__esModule=!0;exports.parseLength=exports.mergeMargin=exports.computeMaxFontSize=exports.getMultipleTextDimensions=exports.getTextDimension=void 0;exports.getTextDimension=_getTextDimension.default;exports.getMultipleTextDimensions=_getMultipleTextDimensions.default;exports.computeMaxFontSize=_computeMaxFontSize.default;exports.mergeMargin=_mergeMargin.default;exports.parseLength=_parseLength.default;Object.keys(_types).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||(exports[a]=_types[a])});function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}} | ||
"use strict"; | ||
exports.__esModule = true; | ||
var _exportNames = { | ||
getTextDimension: true, | ||
getMultipleTextDimensions: true, | ||
computeMaxFontSize: true, | ||
mergeMargin: true, | ||
parseLength: true | ||
}; | ||
exports.parseLength = exports.mergeMargin = exports.computeMaxFontSize = exports.getMultipleTextDimensions = exports.getTextDimension = void 0; | ||
var _getTextDimension = _interopRequireDefault(require("./getTextDimension")); | ||
exports.getTextDimension = _getTextDimension.default; | ||
var _getMultipleTextDimensions = _interopRequireDefault(require("./getMultipleTextDimensions")); | ||
exports.getMultipleTextDimensions = _getMultipleTextDimensions.default; | ||
var _computeMaxFontSize = _interopRequireDefault(require("./computeMaxFontSize")); | ||
exports.computeMaxFontSize = _computeMaxFontSize.default; | ||
var _mergeMargin = _interopRequireDefault(require("./mergeMargin")); | ||
exports.mergeMargin = _mergeMargin.default; | ||
var _parseLength = _interopRequireDefault(require("./parseLength")); | ||
exports.parseLength = _parseLength.default; | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types[key]; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -8,1 +8,2 @@ import { Margin } from './types'; | ||
}; | ||
//# sourceMappingURL=mergeMargin.d.ts.map |
@@ -1,1 +0,46 @@ | ||
"use strict";exports.__esModule=!0,exports.default=mergeMargin;function mergeOneSide(c,d,e){return(void 0===c&&(c=0),void 0===d&&(d=0),Number.isNaN(c)||null===c)?d:Number.isNaN(d)||null===d?c:e(c,d)}function mergeMargin(a,b,c){void 0===a&&(a={}),void 0===b&&(b={}),void 0===c&&(c="expand");var d=a,e=d.top,f=d.left,g=d.bottom,h=d.right,i="expand"===c?Math.max:Math.min;return{bottom:mergeOneSide(g,b.bottom,i),left:mergeOneSide(f,b.left,i),right:mergeOneSide(h,b.right,i),top:mergeOneSide(e,b.top,i)}} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = mergeMargin; | ||
function mergeOneSide(operation, a, b) { | ||
if (a === void 0) { | ||
a = 0; | ||
} | ||
if (b === void 0) { | ||
b = 0; | ||
} | ||
if (Number.isNaN(a) || a === null) return b; | ||
if (Number.isNaN(b) || b === null) return a; | ||
return operation(a, b); | ||
} | ||
function mergeMargin(margin1, margin2, mode) { | ||
if (margin1 === void 0) { | ||
margin1 = {}; | ||
} | ||
if (margin2 === void 0) { | ||
margin2 = {}; | ||
} | ||
if (mode === void 0) { | ||
mode = 'expand'; | ||
} | ||
const { | ||
top, | ||
left, | ||
bottom, | ||
right | ||
} = margin1; | ||
const operation = mode === 'expand' ? Math.max : Math.min; | ||
return { | ||
bottom: mergeOneSide(operation, bottom, margin2.bottom), | ||
left: mergeOneSide(operation, left, margin2.left), | ||
right: mergeOneSide(operation, right, margin2.right), | ||
top: mergeOneSide(operation, top, margin2.top) | ||
}; | ||
} |
@@ -8,1 +8,2 @@ export default function parseLength(input: string | number): { | ||
}; | ||
//# sourceMappingURL=parseLength.d.ts.map |
@@ -1,2 +0,27 @@ | ||
"use strict";exports.__esModule=!0,exports.default=parseLength;var HUNDRED_PERCENT={isDynamic:!0,multiplier:1};function parseLength(a){if("auto"===a||"100%"===a)return HUNDRED_PERCENT;if("string"==typeof a&&0<a.length&&"%"===a[a.length-1])// eslint-disable-next-line no-magic-numbers | ||
return{isDynamic:!0,multiplier:parseFloat(a)/100};var b="number"==typeof a?a:parseFloat(a);return{isDynamic:!1,value:b}} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = parseLength; | ||
const HUNDRED_PERCENT = { | ||
isDynamic: true, | ||
multiplier: 1 | ||
}; | ||
function parseLength(input) { | ||
if (input === 'auto' || input === '100%') { | ||
return HUNDRED_PERCENT; | ||
} | ||
if (typeof input === 'string' && input.length > 0 && input[input.length - 1] === '%') { | ||
return { | ||
isDynamic: true, | ||
multiplier: parseFloat(input) / 100 | ||
}; | ||
} | ||
const value = typeof input === 'number' ? input : parseFloat(input); | ||
return { | ||
isDynamic: false, | ||
value | ||
}; | ||
} |
export declare const SVG_NS = "http://www.w3.org/2000/svg"; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -1,2 +0,7 @@ | ||
"use strict";exports.__esModule=!0,exports.SVG_NS=void 0;// eslint-disable-next-line import/prefer-default-export | ||
var SVG_NS="http://www.w3.org/2000/svg";exports.SVG_NS=SVG_NS; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.SVG_NS = void 0; | ||
// eslint-disable-next-line import/prefer-default-export | ||
const SVG_NS = 'http://www.w3.org/2000/svg'; | ||
exports.SVG_NS = SVG_NS; |
export default function createHiddenSvgNode(): SVGSVGElement; | ||
//# sourceMappingURL=createHiddenSvgNode.d.ts.map |
@@ -1,2 +0,22 @@ | ||
"use strict";var _constants=require("./constants");exports.__esModule=!0,exports.default=createHiddenSvgNode;function createHiddenSvgNode(){var a=document.createElementNS(_constants.SVG_NS,"svg");// won't capture mouse events | ||
return a.style.position="absolute",a.style.top="-100%",a.style.left="-100%",a.style.width="0",a.style.height="0",a.style.opacity="0",a.style.pointerEvents="none",a} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = createHiddenSvgNode; | ||
var _constants = require("./constants"); | ||
function createHiddenSvgNode() { | ||
const svgNode = document.createElementNS(_constants.SVG_NS, 'svg'); | ||
svgNode.style.position = 'absolute'; // so it won't disrupt page layout | ||
svgNode.style.top = '-100%'; | ||
svgNode.style.left = '-100%'; | ||
svgNode.style.width = '0'; // no dimensions | ||
svgNode.style.height = '0'; | ||
svgNode.style.opacity = '0'; // not visible | ||
svgNode.style.pointerEvents = 'none'; // won't capture mouse events | ||
return svgNode; | ||
} |
export default function createTextNode(): SVGTextElement; | ||
//# sourceMappingURL=createTextNode.d.ts.map |
@@ -1,1 +0,10 @@ | ||
"use strict";var _constants=require("./constants");exports.__esModule=!0,exports.default=createTextNode;function createTextNode(){return document.createElementNS(_constants.SVG_NS,"text")} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = createTextNode; | ||
var _constants = require("./constants"); | ||
function createTextNode() { | ||
return document.createElementNS(_constants.SVG_NS, 'text'); | ||
} |
import LazyFactory from './LazyFactory'; | ||
export declare const hiddenSvgFactory: LazyFactory<SVGSVGElement>; | ||
export declare const textFactory: LazyFactory<SVGTextElement>; | ||
//# sourceMappingURL=factories.d.ts.map |
@@ -1,1 +0,17 @@ | ||
"use strict";exports.__esModule=!0,exports.textFactory=exports.hiddenSvgFactory=void 0;var _LazyFactory=_interopRequireDefault(require("./LazyFactory")),_createHiddenSvgNode=_interopRequireDefault(require("./createHiddenSvgNode")),_createTextNode=_interopRequireDefault(require("./createTextNode"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var hiddenSvgFactory=new _LazyFactory.default(_createHiddenSvgNode.default);exports.hiddenSvgFactory=hiddenSvgFactory;var textFactory=new _LazyFactory.default(_createTextNode.default);exports.textFactory=textFactory; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.textFactory = exports.hiddenSvgFactory = void 0; | ||
var _LazyFactory = _interopRequireDefault(require("./LazyFactory")); | ||
var _createHiddenSvgNode = _interopRequireDefault(require("./createHiddenSvgNode")); | ||
var _createTextNode = _interopRequireDefault(require("./createTextNode")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const hiddenSvgFactory = new _LazyFactory.default(_createHiddenSvgNode.default); | ||
exports.hiddenSvgFactory = hiddenSvgFactory; | ||
const textFactory = new _LazyFactory.default(_createTextNode.default); | ||
exports.textFactory = textFactory; |
@@ -6,1 +6,2 @@ import { Dimension } from '../types'; | ||
}; | ||
//# sourceMappingURL=getBBoxCeil.d.ts.map |
@@ -1,1 +0,23 @@ | ||
"use strict";exports.__esModule=!0,exports.default=getBBoxCeil;var DEFAULT_DIMENSION={height:20,width:100};function getBBoxCeil(a,b){void 0===b&&(b=DEFAULT_DIMENSION);var c=a.getBBox?a.getBBox():b,d=c.width,e=c.height;return{height:Math.ceil(e),width:Math.ceil(d)}} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = getBBoxCeil; | ||
const DEFAULT_DIMENSION = { | ||
height: 20, | ||
width: 100 | ||
}; | ||
function getBBoxCeil(node, defaultDimension) { | ||
if (defaultDimension === void 0) { | ||
defaultDimension = DEFAULT_DIMENSION; | ||
} | ||
const { | ||
width, | ||
height | ||
} = node.getBBox ? node.getBBox() : defaultDimension; | ||
return { | ||
height: Math.ceil(height), | ||
width: Math.ceil(width) | ||
}; | ||
} |
@@ -8,1 +8,2 @@ export default class LazyFactory<T extends HTMLElement | SVGElement> { | ||
} | ||
//# sourceMappingURL=LazyFactory.d.ts.map |
@@ -1,1 +0,55 @@ | ||
"use strict";exports.__esModule=!0,exports.default=void 0;function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var LazyFactory=/*#__PURE__*/function(){function a(a){_defineProperty(this,"activeNodes",new Map),_defineProperty(this,"factoryFn",void 0),this.factoryFn=a}var b=a.prototype;return b.createInContainer=function createInContainer(a){if(void 0===a&&(a=document.body),this.activeNodes.has(a)){var c=this.activeNodes.get(a);return c.counter+=1,c.node}var b=this.factoryFn();return a.appendChild(b),this.activeNodes.set(a,{counter:1,node:b}),b},b.removeFromContainer=function removeFromContainer(a){if(void 0===a&&(a=document.body),this.activeNodes.has(a)){var b=this.activeNodes.get(a);b.counter-=1,0===b.counter&&(a.removeChild(b.node),this.activeNodes.delete(a))}},a}();exports.default=LazyFactory; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
class LazyFactory { | ||
constructor(factoryFn) { | ||
_defineProperty(this, "activeNodes", new Map()); | ||
_defineProperty(this, "factoryFn", void 0); | ||
this.factoryFn = factoryFn; | ||
} | ||
createInContainer(container) { | ||
if (container === void 0) { | ||
container = document.body; | ||
} | ||
if (this.activeNodes.has(container)) { | ||
const entry = this.activeNodes.get(container); | ||
entry.counter += 1; | ||
return entry.node; | ||
} | ||
const node = this.factoryFn(); | ||
container.append(node); | ||
this.activeNodes.set(container, { | ||
counter: 1, | ||
node | ||
}); | ||
return node; | ||
} | ||
removeFromContainer(container) { | ||
if (container === void 0) { | ||
container = document.body; | ||
} | ||
if (this.activeNodes.has(container)) { | ||
const entry = this.activeNodes.get(container); | ||
entry.counter -= 1; | ||
if (entry.counter === 0) { | ||
container.removeChild(entry.node); | ||
this.activeNodes.delete(container); | ||
} | ||
} | ||
} | ||
} | ||
exports.default = LazyFactory; |
@@ -7,1 +7,2 @@ import { TextStyle } from '../types'; | ||
}): SVGTextElement; | ||
//# sourceMappingURL=updateTextNode.d.ts.map |
@@ -1,1 +0,37 @@ | ||
"use strict";exports.__esModule=!0,exports.default=updateTextNode;var STYLE_FIELDS=["font","fontWeight","fontStyle","fontSize","fontFamily","letterSpacing"];function updateTextNode(a,b){var c=void 0===b?{}:b,d=c.className,e=c.style,f=void 0===e?{}:e,g=c.text,h=a;return h.textContent!==g&&(h.textContent="undefined"==typeof g?null:g),h.getAttribute("class")!==d&&h.setAttribute("class",d||""),h.style.removeProperty("font"),h.style.removeProperty("font-weight"),h.style.removeProperty("font-style"),h.style.removeProperty("font-size"),h.style.removeProperty("font-family"),h.style.removeProperty("letter-spacing"),STYLE_FIELDS.filter(function(a){return"undefined"!=typeof f[a]&&null!==f[a]}).forEach(function(a){h.style[a]=""+f[a]}),h} | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = updateTextNode; | ||
const STYLE_FIELDS = ['font', 'fontWeight', 'fontStyle', 'fontSize', 'fontFamily', 'letterSpacing']; | ||
function updateTextNode(node, _temp) { | ||
let { | ||
className, | ||
style = {}, | ||
text | ||
} = _temp === void 0 ? {} : _temp; | ||
const textNode = node; | ||
if (textNode.textContent !== text) { | ||
textNode.textContent = typeof text === 'undefined' ? null : text; | ||
} | ||
if (textNode.getAttribute('class') !== className) { | ||
textNode.setAttribute('class', className != null ? className : ''); | ||
} // Clear style | ||
// Note: multi-word property names are hyphenated and not camel-cased. | ||
textNode.style.removeProperty('font'); | ||
textNode.style.removeProperty('font-weight'); | ||
textNode.style.removeProperty('font-style'); | ||
textNode.style.removeProperty('font-size'); | ||
textNode.style.removeProperty('font-family'); | ||
textNode.style.removeProperty('letter-spacing'); // Apply new style | ||
// Note: the font field will auto-populate other font fields when applicable. | ||
STYLE_FIELDS.filter(field => typeof style[field] !== 'undefined' && style[field] !== null).forEach(field => { | ||
textNode.style[field] = "" + style[field]; | ||
}); | ||
return textNode; | ||
} |
@@ -19,1 +19,2 @@ export interface TextStyle { | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@superset-ui/dimension", | ||
"version": "0.12.7", | ||
"version": "0.12.8", | ||
"description": "Superset UI dimension", | ||
@@ -28,3 +28,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "0a60f5be3adfc70af8c9d9ef92f5d2c2d935a2c4" | ||
"gitHead": "9bb5c471e0e3d05da38929feb00ade7d0ecdc474" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
43780
59
731
1
1