- Linting: Use new preference for "object"; fix @example code; bad @returns
- npm: Update devDeps
This commit is contained in:
@@ -92,7 +92,7 @@ export const canvg = function (target, s, opts) {
|
||||
|
||||
/**
|
||||
* @param {module:canvg.CanvgOptions} opts
|
||||
* @returns {Object}
|
||||
* @returns {object}
|
||||
* @todo Flesh out exactly what object is returned here (after updating to latest and reincluding our changes here and those of StackBlur)
|
||||
*/
|
||||
function build (opts) {
|
||||
@@ -2599,7 +2599,7 @@ function build (opts) {
|
||||
* @param {Float} width
|
||||
* @param {Float} height
|
||||
* @param {Integer} rgba
|
||||
* @returns {void}
|
||||
* @returns {Integer}
|
||||
*/
|
||||
function imGet (img, x, y, width, height, rgba) {
|
||||
return img[y * width * 4 + x * 4 + rgba];
|
||||
|
||||
@@ -93,7 +93,6 @@ function getMessageListener (t) {
|
||||
* General usage:
|
||||
* - Have an iframe somewhere pointing to a version of svg-edit > r1000.
|
||||
* @example
|
||||
|
||||
// Initialize the magic with:
|
||||
const svgCanvas = new EmbeddedSVGEdit(window.frames.svgedit);
|
||||
|
||||
@@ -101,11 +100,11 @@ const svgCanvas = new EmbeddedSVGEdit(window.frames.svgedit);
|
||||
svgCanvas.setSvgString('string');
|
||||
|
||||
// Or if a callback is needed:
|
||||
svgCanvas.setSvgString('string')(function(data, error){
|
||||
if (error){
|
||||
// There was an error
|
||||
} else{
|
||||
// Handle data
|
||||
svgCanvas.setSvgString('string')(function (data, error) {
|
||||
if (error) {
|
||||
// There was an error
|
||||
} else {
|
||||
// Handle data
|
||||
}
|
||||
});
|
||||
|
||||
@@ -121,10 +120,12 @@ svgCanvas.setSvgString('string')(function(data, error){
|
||||
// the SVG editor on the same domain and reference the
|
||||
// JavaScript methods on the frame itself.
|
||||
|
||||
// The only other difference is
|
||||
// when handling returns: the callback notation is used instead.
|
||||
// The only other difference is when handling returns:
|
||||
// the callback notation is used instead.
|
||||
const blah = new EmbeddedSVGEdit(window.frames.svgedit);
|
||||
blah.clearSelection('woot', 'blah', 1337, [1, 2, 3, 4, 5, 'moo'], -42, {a: 'tree',b:6, c: 9})(function(){console.log('GET DATA',arguments)})
|
||||
blah.clearSelection('woot', 'blah', 1337, [1, 2, 3, 4, 5, 'moo'], -42, {
|
||||
a: 'tree', b: 6, c: 9
|
||||
})(function () { console.log('GET DATA', args); });
|
||||
*
|
||||
* @memberof module:EmbeddedSVGEdit
|
||||
*/
|
||||
|
||||
@@ -147,7 +147,7 @@ export default {
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
|
||||
* @returns {void}
|
||||
* @returns {SVGMarkerElement}
|
||||
*/
|
||||
function addMarker (id, val) {
|
||||
const txtBoxBg = '#ffffff';
|
||||
@@ -443,7 +443,7 @@ export default {
|
||||
|
||||
/**
|
||||
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
|
||||
* @returns {void}
|
||||
* @returns {string}
|
||||
*/
|
||||
function getTitle (id) {
|
||||
const {langList} = strings;
|
||||
|
||||
@@ -118,7 +118,7 @@ export default {
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"textmarker_top"|"textmarker_bottom"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
|
||||
* @returns {void}
|
||||
* @returns {SVGMarkerElement}
|
||||
*/
|
||||
function addMarker (id, val) {
|
||||
let marker = svgCanvas.getElem(id);
|
||||
@@ -251,7 +251,7 @@ export default {
|
||||
|
||||
/**
|
||||
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
|
||||
* @returns {void}
|
||||
* @returns {string}
|
||||
*/
|
||||
function getTitle (id) {
|
||||
const {langList} = strings;
|
||||
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
/**
|
||||
* Submit the form, empty its contents for reuse and show
|
||||
* uploading message.
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function submit () {
|
||||
// This submits the form, which returns the file data using `svgEditor.processFile()`
|
||||
|
||||
@@ -11,7 +11,7 @@ const jsVoid = 'javascript: void(0);'; // eslint-disable-line no-script-url
|
||||
/**
|
||||
* Shows results after query submission.
|
||||
* @param {string} url
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function processResults (url) {
|
||||
/**
|
||||
|
||||
@@ -17,9 +17,9 @@ const $ = jQuery;
|
||||
* an existing group element or, with three parameters, will create a new layer group element.
|
||||
*
|
||||
* @example
|
||||
* new Layer('name', group); // Use the existing group for this layer.
|
||||
* new Layer('name', group, svgElem); // Create a new group and add it to the DOM after group.
|
||||
* new Layer('name', null, svgElem); // Create a new group and add it to the DOM as the last layer.
|
||||
* const l1 = new Layer('name', group); // Use the existing group for this layer.
|
||||
* const l2 = new Layer('name', group, svgElem); // Create a new group and add it to the DOM after group.
|
||||
* const l3 = new Layer('name', null, svgElem); // Create a new group and add it to the DOM as the last layer.
|
||||
* @memberof module:layer
|
||||
*/
|
||||
class Layer {
|
||||
|
||||
@@ -1109,7 +1109,7 @@ export class Path {
|
||||
|
||||
/**
|
||||
* @param {Integer} y
|
||||
* @returns {void}
|
||||
* @returns {Path}
|
||||
*/
|
||||
show (y) {
|
||||
// Shows this path's segment grips
|
||||
|
||||
@@ -644,7 +644,7 @@ editor.setCustomHandlers = function (opts) {
|
||||
* @returns {void}
|
||||
*/
|
||||
editor.randomizeIds = function (arg) {
|
||||
return svgCanvas.randomizeIds(arg);
|
||||
svgCanvas.randomizeIds(arg);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2861,7 +2861,7 @@ editor.init = function () {
|
||||
/**
|
||||
* Clicking the icon in flyout should set this set's icon.
|
||||
* @param {Event} ev
|
||||
* @returns {void}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const flyoutAction = function (ev) {
|
||||
let options = opts;
|
||||
@@ -2964,7 +2964,7 @@ editor.init = function () {
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {external:jQuery} child
|
||||
* @returns {void}
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
const makeFlyoutHolder = function (id, child) {
|
||||
const div = $('<div>', {
|
||||
@@ -4824,7 +4824,7 @@ editor.init = function () {
|
||||
/**
|
||||
* Save user preferences based on current values in the UI.
|
||||
* @function module:SVGEditor.savePreferences
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
const savePreferences = editor.savePreferences = async function () {
|
||||
// Set background
|
||||
@@ -5294,7 +5294,7 @@ editor.init = function () {
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function cloneLayer () {
|
||||
const name = svgCanvas.getCurrentDrawing().getCurrentLayerName() + ' copy';
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
* This should only be used for objects known to be potentially arbitrary in form.
|
||||
* For those whose determination has not yet been made, simply use type `object`
|
||||
* (or type `?` if it may also be a primitive).
|
||||
* @typedef {Object} ArbitraryObject
|
||||
* @typedef {object} ArbitraryObject
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} ArbitraryModule
|
||||
* @typedef {object} ArbitraryModule
|
||||
*/
|
||||
/**
|
||||
* This should only be used for objects known to be potentially arbitrary in form,
|
||||
|
||||
@@ -6076,7 +6076,7 @@
|
||||
}
|
||||
/**
|
||||
* @param {Integer} y
|
||||
* @returns {void}
|
||||
* @returns {Path}
|
||||
*/
|
||||
|
||||
}, {
|
||||
@@ -9782,9 +9782,9 @@
|
||||
* an existing group element or, with three parameters, will create a new layer group element.
|
||||
*
|
||||
* @example
|
||||
* new Layer('name', group); // Use the existing group for this layer.
|
||||
* new Layer('name', group, svgElem); // Create a new group and add it to the DOM after group.
|
||||
* new Layer('name', null, svgElem); // Create a new group and add it to the DOM as the last layer.
|
||||
* const l1 = new Layer('name', group); // Use the existing group for this layer.
|
||||
* const l2 = new Layer('name', group, svgElem); // Create a new group and add it to the DOM after group.
|
||||
* const l3 = new Layer('name', null, svgElem); // Create a new group and add it to the DOM as the last layer.
|
||||
* @memberof module:layer
|
||||
*/
|
||||
|
||||
@@ -29152,8 +29152,9 @@
|
||||
|
||||
if (editor.storage && ( // Cookies do not have enough available memory to hold large documents
|
||||
curConfig.forceStorage || !curConfig.noStorageOnLoad && document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))) {
|
||||
var name = 'svgedit-' + curConfig.canvasName;
|
||||
var cached = editor.storage.getItem(name);
|
||||
var _name = 'svgedit-' + curConfig.canvasName;
|
||||
|
||||
var cached = editor.storage.getItem(_name);
|
||||
|
||||
if (cached) {
|
||||
editor.loadFromString(cached);
|
||||
@@ -29360,7 +29361,7 @@
|
||||
|
||||
|
||||
editor.randomizeIds = function (arg) {
|
||||
return svgCanvas.randomizeIds(arg);
|
||||
svgCanvas.randomizeIds(arg);
|
||||
};
|
||||
/**
|
||||
* Auto-run after a Promise microtask.
|
||||
@@ -29581,7 +29582,7 @@
|
||||
var _ref6 = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(extname) {
|
||||
var extName, url, imported, _imported$name, name, init, importLocale;
|
||||
var extName, url, imported, _imported$name, _name2, init, importLocale;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@@ -29615,12 +29616,12 @@
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, name = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
_imported$name = imported.name, _name2 = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: name
|
||||
defaultName: _name2
|
||||
});
|
||||
return _context2.abrupt("return", editor.addExtension(name, init && init.bind(editor), {
|
||||
return _context2.abrupt("return", editor.addExtension(_name2, init && init.bind(editor), {
|
||||
$: $$b,
|
||||
importLocale: importLocale
|
||||
}));
|
||||
@@ -30426,12 +30427,13 @@
|
||||
var layer = svgCanvas.getCurrentDrawing().getNumLayers(); // we get the layers in the reverse z-order (the layer rendered on top is listed first)
|
||||
|
||||
while (layer--) {
|
||||
var name = drawing.getLayerName(layer);
|
||||
var layerTr = $$b('<tr class="layer">').toggleClass('layersel', name === currentLayerName);
|
||||
var layerVis = $$b('<td class="layervis">').toggleClass('layerinvis', !drawing.getLayerVisibility(name));
|
||||
var layerName = $$b('<td class="layername">' + name + '</td>');
|
||||
var _name3 = drawing.getLayerName(layer);
|
||||
|
||||
var layerTr = $$b('<tr class="layer">').toggleClass('layersel', _name3 === currentLayerName);
|
||||
var layerVis = $$b('<td class="layervis">').toggleClass('layerinvis', !drawing.getLayerVisibility(_name3));
|
||||
var layerName = $$b('<td class="layername">' + _name3 + '</td>');
|
||||
layerlist.append(layerTr.append(layerVis, layerName));
|
||||
selLayerNames.append('<option value="' + name + '">' + name + '</option>');
|
||||
selLayerNames.append('<option value="' + _name3 + '">' + _name3 + '</option>');
|
||||
}
|
||||
|
||||
if (icon !== undefined) {
|
||||
@@ -31801,7 +31803,7 @@
|
||||
/**
|
||||
* Clicking the icon in flyout should set this set's icon.
|
||||
* @param {Event} ev
|
||||
* @returns {void}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
||||
@@ -31919,7 +31921,7 @@
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {external:jQuery} child
|
||||
* @returns {void}
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
|
||||
|
||||
@@ -34152,7 +34154,7 @@
|
||||
/**
|
||||
* Save user preferences based on current values in the UI.
|
||||
* @function module:SVGEditor.savePreferences
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
||||
|
||||
@@ -34733,7 +34735,7 @@
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @returns {void}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user