- Breaking change: In interests of modularity/removing globals, remove window.svgCanvas

and `svgCanvas.ready` as used by older extensions; use `svgEditor.canvas` and
    `svgEditor.ready` instead
- npm: Add `prepare` script to ensure building/testing before publish
This commit is contained in:
Brett Zamir
2018-05-31 09:53:47 +08:00
parent 77999a31ce
commit 96e089f930
9 changed files with 49 additions and 64 deletions

27
dist/index-es.js vendored
View File

@@ -5303,7 +5303,7 @@ var reorientGrads = function reorientGrads(elem, m) {
var pathMap = [0, 'z', 'M', 'm', 'L', 'l', 'C', 'c', 'Q', 'q', 'A', 'a', 'H', 'h', 'V', 'v', 'S', 's', 'T', 't'];
/**
* TODO: move to pathActions.js when migrating rest of pathActions out of svgcanvas.js
* TODO: move to pathActions.js
* Convert a path to one with only absolute or relative values
* @param {Object} path - the path to convert
* @param {boolean} toRel - true of convert to relative
@@ -6680,7 +6680,7 @@ var walkTreePost = function walkTreePost(elem, cbFn) {
*/
var getUrlFromAttr = function getUrlFromAttr(attrVal) {
if (attrVal) {
// url("#somegrad")
// url('#somegrad')
if (attrVal.startsWith('url("')) {
return attrVal.substring(5, attrVal.indexOf('"', 6));
}
@@ -15012,6 +15012,7 @@ var SvgCanvas = function SvgCanvas(container, config) {
// TODO: Correct this:
pathActions$$1.canDeleteNodes = true;
pathActions$$1.closed_subpath = closedSubpath;
call('pointsAdded', { closedSubpath: closedSubpath, grips: grips });
call('selected', grips);
},
endChanges: function endChanges(_ref2) {
@@ -21540,8 +21541,8 @@ jGraduate(options, okCallback, cancelCallback)
where options is an object literal:
{
window: { title: "Pick the start color and opacity for the gradient" },
images: { clientPath: "images/" },
window: { title: 'Pick the start color and opacity for the gradient' },
images: { clientPath: 'images/' },
paint: a Paint object,
newstop: String of value "same", "inverse", "black" or "white"
OR object with one or both values {color: #Hex color, opac: number 0-1}
@@ -21558,10 +21559,10 @@ where options is an object literal:
$.jGraduate.Paint() -> constructs a 'none' color
$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o
$.jGraduate.Paint({hex: "#rrggbb"}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({hex: '#rrggbb'}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({linearGradient: o, a: 50}) -> creates a linear gradient paint with opacity=0.5
$.jGraduate.Paint({radialGradient: o, a: 7}) -> creates a radial gradient paint with opacity=0.07
$.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception?
$.jGraduate.Paint({hex: '#rrggbb', linearGradient: o}) -> throws an exception?
- picker accepts the following object as input:
{
@@ -23898,7 +23899,7 @@ var jPicker = function jPicker($) {
return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
},
validateHex: function validateHex(hex) {
// if (typeof hex === "object") return "";
// if (typeof hex === 'object') return '';
hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
if (hex.length > 8) hex = hex.substring(0, 8);
return hex;
@@ -27442,8 +27443,8 @@ editor.init = function () {
break;
// TODO: Update values that change on move/resize, etc
// case "select":
// case "resize":
// case 'select':
// case 'resize':
// break;
}
}
@@ -30486,16 +30487,10 @@ editor.init = function () {
updateCanvas(true);
// });
// const revnums = "svg-editor.js ($Rev$) ";
// const revnums = 'svg-editor.js ($Rev$) ';
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums);
// For Compatibility with older extensions
// $(function () {
window.svgCanvas = svgCanvas;
svgCanvas.ready = editor.ready;
// });
var setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true;
$$b.pref('lang', lang);