- Docs: Add to CHANGES

- npm: Update sinon dep
- npm: Separate test-prep out of test (to avoid blocking script before publish) and avoid `prepare` (which includes local installs) in favor of `prepublishOnly`
- Build: Update dist files
This commit is contained in:
Brett Zamir
2018-06-25 14:03:53 +08:00
parent 1c98eb3273
commit 228017631e
9 changed files with 195 additions and 140 deletions

41
dist/index-es.js vendored
View File

@@ -2845,25 +2845,19 @@ var convertToNum = function convertToNum(attr, val) {
* @param val - String with the attribute value to check
*/
var isValidUnit = function isValidUnit(attr, val, selectedElement) {
var valid = false;
if (unitAttrs.includes(attr)) {
// True if it's just a number
if (!isNaN(val)) {
valid = true;
} else {
// Not a number, check if it has a valid unit
val = val.toLowerCase();
Object.keys(typeMap_).forEach(function (unit) {
if (valid) {
return;
}
var re = new RegExp('^-?[\\d\\.]+' + unit + '$');
if (re.test(val)) {
valid = true;
}
});
return true;
}
} else if (attr === 'id') {
// Not a number, check if it has a valid unit
val = val.toLowerCase();
return Object.keys(typeMap_).some(function (unit) {
var re = new RegExp('^-?[\\d\\.]+' + unit + '$');
return re.test(val);
});
}
if (attr === 'id') {
// if we're trying to change the id, make sure it's not already present in the doc
// and the id value is valid.
@@ -2878,9 +2872,7 @@ var isValidUnit = function isValidUnit(attr, val, selectedElement) {
} catch (e) {}
return result;
}
valid = true;
return valid;
return true;
};
/**
@@ -11979,17 +11971,14 @@ var SvgCanvas = function SvgCanvas(container, config) {
}
// find every element and remove it from our array copy
var j = 0;
var newSelectedItems = [],
len = selectedElements.length;
newSelectedItems.length = len;
for (var i = 0; i < len; ++i) {
var elem = selectedElements[i];
if (elem) {
// keep the item
if (!elemsToRemove.includes(elem)) {
newSelectedItems[j] = elem;
j++;
newSelectedItems.push(elem);
} else {
// remove the item and its selector
selectorManager.releaseSelector(elem);
@@ -12259,6 +12248,10 @@ var SvgCanvas = function SvgCanvas(container, config) {
var all = mouseTarget.getElementsByTagName('*'),
len = all.length;
for (i = 0; i < len; i++) {
if (!all[i].style) {
// mathML
continue;
}
all[i].style.vectorEffect = 'non-scaling-stroke';
if (iswebkit) {
delayedStroke(all[i]);
@@ -13067,14 +13060,14 @@ var SvgCanvas = function SvgCanvas(container, config) {
case 'image':
attrs = $$9(element).attr(['width', 'height']);
// Image should be kept regardless of size (use inherit dimensions later)
keep = attrs.width !== '0' || attrs.height !== '0' || currentMode === 'image';
keep = attrs.width || attrs.height || currentMode === 'image';
break;
case 'circle':
keep = element.getAttribute('r') !== '0';
break;
case 'ellipse':
attrs = $$9(element).attr(['rx', 'ry']);
keep = attrs.rx != null || attrs.ry != null;
keep = attrs.rx || attrs.ry;
break;
case 'fhellipse':
if (freehand.maxx - freehand.minx > 0 && freehand.maxy - freehand.miny > 0) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

41
dist/index-umd.js vendored
View File

@@ -2851,25 +2851,19 @@
* @param val - String with the attribute value to check
*/
var isValidUnit = function isValidUnit(attr, val, selectedElement) {
var valid = false;
if (unitAttrs.includes(attr)) {
// True if it's just a number
if (!isNaN(val)) {
valid = true;
} else {
// Not a number, check if it has a valid unit
val = val.toLowerCase();
Object.keys(typeMap_).forEach(function (unit) {
if (valid) {
return;
}
var re = new RegExp('^-?[\\d\\.]+' + unit + '$');
if (re.test(val)) {
valid = true;
}
});
return true;
}
} else if (attr === 'id') {
// Not a number, check if it has a valid unit
val = val.toLowerCase();
return Object.keys(typeMap_).some(function (unit) {
var re = new RegExp('^-?[\\d\\.]+' + unit + '$');
return re.test(val);
});
}
if (attr === 'id') {
// if we're trying to change the id, make sure it's not already present in the doc
// and the id value is valid.
@@ -2884,9 +2878,7 @@
} catch (e) {}
return result;
}
valid = true;
return valid;
return true;
};
/**
@@ -11985,17 +11977,14 @@
}
// find every element and remove it from our array copy
var j = 0;
var newSelectedItems = [],
len = selectedElements.length;
newSelectedItems.length = len;
for (var i = 0; i < len; ++i) {
var elem = selectedElements[i];
if (elem) {
// keep the item
if (!elemsToRemove.includes(elem)) {
newSelectedItems[j] = elem;
j++;
newSelectedItems.push(elem);
} else {
// remove the item and its selector
selectorManager.releaseSelector(elem);
@@ -12265,6 +12254,10 @@
var all = mouseTarget.getElementsByTagName('*'),
len = all.length;
for (i = 0; i < len; i++) {
if (!all[i].style) {
// mathML
continue;
}
all[i].style.vectorEffect = 'non-scaling-stroke';
if (iswebkit) {
delayedStroke(all[i]);
@@ -13073,14 +13066,14 @@
case 'image':
attrs = $$9(element).attr(['width', 'height']);
// Image should be kept regardless of size (use inherit dimensions later)
keep = attrs.width !== '0' || attrs.height !== '0' || currentMode === 'image';
keep = attrs.width || attrs.height || currentMode === 'image';
break;
case 'circle':
keep = element.getAttribute('r') !== '0';
break;
case 'ellipse':
attrs = $$9(element).attr(['rx', 'ry']);
keep = attrs.rx != null || attrs.ry != null;
keep = attrs.rx || attrs.ry;
break;
case 'fhellipse':
if (freehand.maxx - freehand.minx > 0 && freehand.maxy - freehand.miny > 0) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long