From d84f39cb3f39038bb735f2b4994a94785450ef47 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 16 Apr 2019 08:59:16 +0800 Subject: [PATCH] - Docs (JSDoc): Further on preferring `void` --- CHANGES.md | 3 +- editor/browser.js | 2 +- editor/canvg/canvg.js | 4 +- editor/contextmenu.js | 8 +- editor/contextmenu/jQuery.contextMenu.js | 4 +- editor/coords.js | 2 +- editor/dbox.js | 2 +- editor/draw.js | 40 +-- editor/embedapi-dom.js | 10 +- editor/embedapi.js | 8 +- editor/extensions/ext-arrows.js | 12 +- editor/extensions/ext-connector.js | 14 +- editor/extensions/ext-eyedropper.js | 2 +- editor/extensions/ext-foreignobject.js | 8 +- editor/extensions/ext-grid.js | 4 +- editor/extensions/ext-imagelib.js | 8 +- editor/extensions/ext-markers.js | 16 +- editor/extensions/ext-mathjax.js | 2 +- editor/extensions/ext-placemark.js | 16 +- editor/extensions/ext-polygon.js | 4 +- editor/extensions/ext-server_opensave.js | 4 +- editor/extensions/ext-shapes.js | 6 +- editor/extensions/ext-star.js | 4 +- editor/extensions/ext-storage.js | 12 +- editor/extensions/ext-webappfind.js | 2 +- editor/extensions/imagelib/openclipart.js | 2 +- editor/external/dom-polyfill/dom-polyfill.js | 2 +- .../dynamic-import-polyfill/importModule.js | 10 +- editor/history.js | 34 +-- editor/historyrecording.js | 2 +- editor/jgraduate/jQuery.jGraduate.js | 16 +- editor/jgraduate/jQuery.jPicker.js | 104 +++---- editor/layer.js | 12 +- editor/locale/locale.js | 4 +- editor/path.js | 112 ++++---- editor/recalculate.js | 6 +- editor/sanitize.js | 2 +- editor/select.js | 14 +- editor/spinbtn/jQuery.SpinButton.js | 2 +- editor/svg-editor.js | 260 +++++++++--------- editor/svgcanvas.js | 258 ++++++++--------- editor/svgicons/jQuery.svgIcons.js | 16 +- editor/svgtransformlist.js | 10 +- editor/touch.js | 2 +- editor/units.js | 6 +- editor/utilities.js | 18 +- firefox-extension/content/svg-edit-overlay.js | 2 +- jsdoc-check-overly-generic-types.js | 2 +- screencasts/svgopen2010/script.js | 8 +- test/contextmenu_test.js | 2 +- test/coords_test.js | 4 +- test/history_test.js | 4 +- test/qunit/qunit-assert-almostEquals.js | 2 +- test/qunit/qunit-assert-close.js | 8 +- ...qunit-assert-expectOutOfBoundsException.js | 2 +- test/recalculate_test.js | 8 +- test/select_test.js | 4 +- test/sinon/sinon-qunit.js | 2 +- test/svgtransformlist_test.js | 4 +- test/units_test.js | 2 +- test/utilities_performance_test.js | 2 +- test/utilities_test.js | 6 +- 62 files changed, 576 insertions(+), 575 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 555c0f01..40cc508e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,8 @@ - Enhancement: Return a Promise for Editor's `setCustomHandlers`, `loadFromString`, `loadFromDataURI` so known when ready and set - Refactoring: Destructuring, templates, label Unicode code point -- Linting (JSDoc): Update per newly enforced `require-returns` +- Linting (JSDoc): Update per newly enforced `require-returns`; avoid + Closure syntax - Docs (Refactoring): Formally specify `Promise` resolve type; add `typedef` for dialog result object; add an `ArbitraryCallbackResult` type; prefer `void` diff --git a/editor/browser.js b/editor/browser.js index 4b4f28d5..157d902d 100644 --- a/editor/browser.js +++ b/editor/browser.js @@ -278,7 +278,7 @@ export const supportsNativeTransformLists = () => supportsNativeSVGTransformList /** * Set `supportsNativeSVGTransformLists_` to `false` (for unit testing). * @function module:browser.disableSupportsNativeTransformLists - * @returns {undefined} + * @returns {void} */ export const disableSupportsNativeTransformLists = () => { supportsNativeSVGTransformLists_ = false; diff --git a/editor/canvg/canvg.js b/editor/canvg/canvg.js index 8c546b71..b7403d85 100644 --- a/editor/canvg/canvg.js +++ b/editor/canvg/canvg.js @@ -2599,7 +2599,7 @@ function build (opts) { * @param {Float} width * @param {Float} height * @param {Integer} rgba - * @returns {undefined} + * @returns {void} */ function imGet (img, x, y, width, height, rgba) { return img[y * width * 4 + x * 4 + rgba]; @@ -2613,7 +2613,7 @@ function build (opts) { * @param {Float} height * @param {Integer} rgba * @param {Float} val - * @returns {undefined} + * @returns {void} */ function imSet (img, x, y, width, height, rgba, val) { img[y * width * 4 + x * 4 + rgba] = val; diff --git a/editor/contextmenu.js b/editor/contextmenu.js index 9483af26..294ebbb9 100644 --- a/editor/contextmenu.js +++ b/editor/contextmenu.js @@ -37,7 +37,7 @@ const menuItemIsValid = function (menuItem) { * @function module:contextmenu.add * @param {module:contextmenu.MenuItem} menuItem * @throws {Error|TypeError} -* @returns {undefined} +* @returns {void} */ export const add = function (menuItem) { // menuItem: {id, label, shortcut, action} @@ -73,7 +73,7 @@ export const getCustomHandler = function (handlerKey) { /** * @param {module:contextmenu.MenuItem} menuItem -* @returns {undefined} +* @returns {void} */ const injectExtendedContextMenuItemIntoDom = function (menuItem) { if (!Object.keys(contextMenuExtensions).length) { @@ -89,7 +89,7 @@ const injectExtendedContextMenuItemIntoDom = function (menuItem) { /** * @function module:contextmenu.injectExtendedContextMenuItemsIntoDom -* @returns {undefined} +* @returns {void} */ export const injectExtendedContextMenuItemsIntoDom = function () { Object.values(contextMenuExtensions).forEach((menuItem) => { @@ -98,6 +98,6 @@ export const injectExtendedContextMenuItemsIntoDom = function () { }; /** * @function module:contextmenu.resetCustomMenus -* @returns {undefined} +* @returns {void} */ export const resetCustomMenus = function () { contextMenuExtensions = {}; }; diff --git a/editor/contextmenu/jQuery.contextMenu.js b/editor/contextmenu/jQuery.contextMenu.js index 3ff82d0c..93c8f60b 100755 --- a/editor/contextmenu/jQuery.contextMenu.js +++ b/editor/contextmenu/jQuery.contextMenu.js @@ -180,7 +180,7 @@ function jQueryContextMenu ($) { /** * Disable context menu items on the fly. * @memberof external:jQuery.fn - * @param {undefined|string} o Comma-separated + * @param {void|string} o Comma-separated * @returns {external:jQuery} */ disableContextMenuItems (o) { @@ -203,7 +203,7 @@ function jQueryContextMenu ($) { /** * Enable context menu items on the fly. * @memberof external:jQuery.fn - * @param {undefined|string} o Comma-separated + * @param {void|string} o Comma-separated * @returns {external:jQuery} */ enableContextMenuItems (o) { diff --git a/editor/coords.js b/editor/coords.js index 34b37ee3..0d4f02eb 100644 --- a/editor/coords.js +++ b/editor/coords.js @@ -43,7 +43,7 @@ let editorContext_ = null; /** * @function module:coords.init * @param {module:coords.EditorContext} editorContext -* @returns {undefined} +* @returns {void} */ export const init = function (editorContext) { editorContext_ = editorContext; diff --git a/editor/dbox.js b/editor/dbox.js index 113353ab..f59357a1 100644 --- a/editor/dbox.js +++ b/editor/dbox.js @@ -52,7 +52,7 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance /** * Triggered upon a change of value for the select pull-down. * @callback module:jQueryPluginDBox.SelectChangeListener - * @returns {undefined} + * @returns {void} */ /** * Creates a dialog of the specified type with a given message diff --git a/editor/draw.js b/editor/draw.js index a33e036b..dd7f347b 100644 --- a/editor/draw.js +++ b/editor/draw.js @@ -175,7 +175,7 @@ export class Drawing { /** * @param {!(string|Integer)} n The nonce to set - * @returns {undefined} + * @returns {void} */ setNonce (n) { this.svgElem_.setAttributeNS(NS.XMLNS, 'xmlns:se', NS.SE); @@ -185,7 +185,7 @@ export class Drawing { /** * Clears any previously set nonce. - * @returns {undefined} + * @returns {void} */ clearNonce () { // We deliberately leave any se:nonce attributes alone, @@ -385,7 +385,7 @@ export class Drawing { /** * @param {module:history.HistoryRecordingService} hrService - * @returns {undefined} + * @returns {void} */ mergeLayer (hrService) { const currentGroup = this.current_layer.getGroup(); @@ -425,7 +425,7 @@ export class Drawing { /** * @param {module:history.HistoryRecordingService} hrService - * @returns {undefined} + * @returns {void} */ mergeAllLayers (hrService) { // Set the current layer to the last layer. @@ -476,7 +476,7 @@ export class Drawing { /** * Updates layer system and sets the current layer to the * top-most layer (last `` child of this drawing). - * @returns {undefined} + * @returns {void} */ identifyLayers () { this.all_layers = []; @@ -650,7 +650,7 @@ export class Drawing { * action. * @param {string} layerName - Name of the layer on which to set the opacity * @param {Float} opacity - A float value in the range 0.0-1.0 - * @returns {undefined} + * @returns {void} */ setLayerOpacity (layerName, opacity) { if (typeof opacity !== 'number' || opacity < 0.0 || opacity > 1.0) { @@ -680,7 +680,7 @@ export class Drawing { * @function module:draw.randomizeIds * @param {boolean} enableRandomization - flag indicating if documents should have randomized ids * @param {draw.Drawing} currentDrawing - * @returns {undefined} + * @returns {void} */ export const randomizeIds = function (enableRandomization, currentDrawing) { randIds = enableRandomization === false @@ -718,7 +718,7 @@ export const randomizeIds = function (enableRandomization, currentDrawing) { /** * @function module:draw.DrawCanvasInit#setCurrentGroup * @param {Element} cg - * @returns {undefined} + * @returns {void} */ /** * @function module:draw.DrawCanvasInit#getSelectedElements @@ -735,7 +735,7 @@ export const randomizeIds = function (enableRandomization, currentDrawing) { /** * @function module:draw.DrawCanvasInit#clearSelection * @param {boolean} [noCall] - When `true`, does not call the "selected" handler - * @returns {undefined} + * @returns {void} */ /** * Run the callback function associated with the given event @@ -744,23 +744,23 @@ export const randomizeIds = function (enableRandomization, currentDrawing) { * @param {module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset} arg - Argument to pass through to the callback * function. If the event is "changed", a (single-item) array of `Element`s is * passed. If the event is "contextset", the arg is `null` or `Element`. - * @returns {undefined} + * @returns {void} */ /** * @function module:draw.DrawCanvasInit#addCommandToHistory * @param {Command} cmd - * @returns {undefined} + * @returns {void} */ /** * @function module:draw.DrawCanvasInit#changeSVGContent - * @returns {undefined} + * @returns {void} */ let canvas_; /** * @function module:draw.init * @param {module:draw.DrawCanvasInit} canvas -* @returns {undefined} +* @returns {void} */ export const init = function (canvas) { canvas_ = canvas; @@ -769,7 +769,7 @@ export const init = function (canvas) { /** * Updates layer system. * @function module:draw.identifyLayers -* @returns {undefined} +* @returns {void} */ export const identifyLayers = function () { leaveContext(); @@ -784,7 +784,7 @@ export const identifyLayers = function () { * @param {string} name - The given name * @param {module:history.HistoryRecordingService} hrService * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ export const createLayer = function (name, hrService) { const newLayer = canvas_.getCurrentDrawing().createLayer( @@ -803,7 +803,7 @@ export const createLayer = function (name, hrService) { * @param {string} name - The given name. If the layer name exists, a new name will be generated. * @param {module:history.HistoryRecordingService} hrService - History recording service * @fires module:svgcanvas.SvgCanvas#event:changed - * @returns {undefined} + * @returns {void} */ export const cloneLayer = function (name, hrService) { // Clone the current layer and make the cloned layer the new current layer @@ -957,7 +957,7 @@ export const moveSelectedToLayer = function (layerName) { /** * @function module:draw.mergeLayer * @param {module:history.HistoryRecordingService} hrService -* @returns {undefined} +* @returns {void} */ export const mergeLayer = function (hrService) { canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(hrService)); @@ -969,7 +969,7 @@ export const mergeLayer = function (hrService) { /** * @function module:draw.mergeAllLayers * @param {module:history.HistoryRecordingService} hrService -* @returns {undefined} +* @returns {void} */ export const mergeAllLayers = function (hrService) { canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(hrService)); @@ -983,7 +983,7 @@ export const mergeAllLayers = function (hrService) { * disabled elements enabled again. * @function module:draw.leaveContext * @fires module:svgcanvas.SvgCanvas#event:contextset -* @returns {undefined} +* @returns {void} */ export const leaveContext = function () { const len = disabledElems.length; @@ -1010,7 +1010,7 @@ export const leaveContext = function () { * @function module:draw.setContext * @param {Element} elem * @fires module:svgcanvas.SvgCanvas#event:contextset -* @returns {undefined} +* @returns {void} */ export const setContext = function (elem) { leaveContext(); diff --git a/editor/embedapi-dom.js b/editor/embedapi-dom.js index 2a09b52e..d64fb20e 100644 --- a/editor/embedapi-dom.js +++ b/editor/embedapi-dom.js @@ -13,7 +13,7 @@ let svgCanvas = null; /** * @param {string} data * @param {string} error -* @returns {undefined} +* @returns {void} */ function handleSvgData (data, error) { if (error) { @@ -27,7 +27,7 @@ function handleSvgData (data, error) { /** * Set the canvas with an example SVG string. -* @returns {undefined} +* @returns {void} */ function loadSvg () { const svgexample = 'Layer 1'; @@ -36,7 +36,7 @@ function loadSvg () { /** * -* @returns {undefined} +* @returns {void} */ function saveSvg () { svgCanvas.getSvgString()(handleSvgData); @@ -44,7 +44,7 @@ function saveSvg () { /** * Perform a PNG export. -* @returns {undefined} +* @returns {void} */ function exportPNG () { svgCanvas.getUIStrings()(function (uiStrings) { @@ -62,7 +62,7 @@ function exportPNG () { /** * Perform a PDF export. -* @returns {undefined} +* @returns {void} */ function exportPDF () { svgCanvas.getUIStrings()(function (uiStrings) { diff --git a/editor/embedapi.js b/editor/embedapi.js index cfec6270..cd331edf 100644 --- a/editor/embedapi.js +++ b/editor/embedapi.js @@ -8,7 +8,7 @@ let cbid = 0; /** * @callback module:EmbeddedSVGEdit.CallbackSetter * @param {GenericCallback} newCallback Callback to be stored (signature dependent on function) -* @returns {undefined} +* @returns {void} */ /** * @callback module:EmbeddedSVGEdit.CallbackSetGetter @@ -37,7 +37,7 @@ function getCallbackSetter (funcName) { * of same domain control. * @param {module:EmbeddedSVGEdit.EmbeddedSVGEdit} t The `this` value * @param {JSON} data -* @returns {undefined} +* @returns {void} */ function addCallback (t, {result, error, id: callbackID}) { if (typeof callbackID === 'number' && t.callbacks[callbackID]) { @@ -53,7 +53,7 @@ function addCallback (t, {result, error, id: callbackID}) { /** * @param {Event} e -* @returns {undefined} +* @returns {void} */ function messageListener (e) { // We accept and post strings as opposed to objects for the sake of IE9 support; this @@ -76,7 +76,7 @@ function messageListener (e) { /** * @callback module:EmbeddedSVGEdit.MessageListener * @param {MessageEvent} e -* @returns {undefined} +* @returns {void} */ /** * @param {module:EmbeddedSVGEdit.EmbeddedSVGEdit} t The `this` value diff --git a/editor/extensions/ext-arrows.js b/editor/extensions/ext-arrows.js index 56a816eb..0d8ae1d0 100644 --- a/editor/extensions/ext-arrows.js +++ b/editor/extensions/ext-arrows.js @@ -22,7 +22,7 @@ export default { /** * @param {Window} win * @param {!(string|Integer)} n - * @returns {undefined} + * @returns {void} */ function setArrowNonce (win, n) { randomizeIds = true; @@ -33,7 +33,7 @@ export default { /** * @param {Window} win - * @returns {undefined} + * @returns {void} */ function unsetArrowNonce (win) { randomizeIds = false; @@ -74,7 +74,7 @@ export default { /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { $('#arrow_panel').toggle(on); @@ -107,7 +107,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function resetMarker () { const el = selElems[0]; @@ -165,7 +165,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function setArrow () { resetMarker(); @@ -196,7 +196,7 @@ export default { /** * @param {Element} elem - * @returns {undefined} + * @returns {void} */ function colorChanged (elem) { const color = elem.getAttribute('stroke'); diff --git a/editor/extensions/ext-connector.js b/editor/extensions/ext-connector.js index 8be5cea6..c484d070 100644 --- a/editor/extensions/ext-connector.js +++ b/editor/extensions/ext-connector.js @@ -89,7 +89,7 @@ export default { /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { let connRules = $('#connector_rules'); @@ -106,7 +106,7 @@ export default { * @param {Float} x * @param {Float} y * @param {boolean} [setMid] - * @returns {undefined} + * @returns {void} */ function setPoint (elem, pos, x, y, setMid) { const pts = elem.points; @@ -139,7 +139,7 @@ export default { /** * @param {Float} diffX * @param {Float} diffY - * @returns {undefined} + * @returns {void} */ function updateLine (diffX, diffY) { // Update line with element @@ -178,7 +178,7 @@ export default { /** * * @param {Element[]} [elems=selElems] Array of elements - * @returns {undefined} + * @returns {void} */ function findConnectors (elems = selElems) { const connectors = $(svgcontent).find(connSel); @@ -189,7 +189,7 @@ export default { let addThis; /** * - * @returns {undefined} + * @returns {void} */ function add () { if (elems.includes(this)) { @@ -240,7 +240,7 @@ export default { /** * @param {Element[]} [elems=selElems] - * @returns {undefined} + * @returns {void} */ function updateConnectors (elems) { // Updates connector lines based on selected elements @@ -317,7 +317,7 @@ export default { /** * Do on reset. - * @returns {undefined} + * @returns {void} */ function init () { // Make sure all connectors have data set diff --git a/editor/extensions/ext-eyedropper.js b/editor/extensions/ext-eyedropper.js index 6e63f3f7..25496abc 100644 --- a/editor/extensions/ext-eyedropper.js +++ b/editor/extensions/ext-eyedropper.js @@ -28,7 +28,7 @@ export default { /** * * @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged|module:svgcanvas.SvgCanvas#event:ext-elementChanged} opts - * @returns {undefined} + * @returns {void} */ function getStyle (opts) { // if we are in eyedropper mode, we don't want to disable the eye-dropper tool diff --git a/editor/extensions/ext-foreignobject.js b/editor/extensions/ext-foreignobject.js index 5a72b25f..c89e8ef9 100644 --- a/editor/extensions/ext-foreignobject.js +++ b/editor/extensions/ext-foreignobject.js @@ -27,7 +27,7 @@ export default { /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { let fcRules = $('#fc_rules'); @@ -40,7 +40,7 @@ export default { /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function toggleSourceButtons (on) { $('#tool_source_save, #tool_source_cancel').toggle(!on); @@ -78,7 +78,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function showForeignEditor () { const elt = selElems[0]; @@ -97,7 +97,7 @@ export default { /** * @param {string} attr * @param {string|Float} val - * @returns {undefined} + * @returns {void} */ function setAttr (attr, val) { svgCanvas.changeSelectedAttribute(attr, val); diff --git a/editor/extensions/ext-grid.js b/editor/extensions/ext-grid.js index c744ddb6..d7635493 100644 --- a/editor/extensions/ext-grid.js +++ b/editor/extensions/ext-grid.js @@ -74,7 +74,7 @@ export default { /** * * @param {Float} zoom - * @returns {undefined} + * @returns {void} */ function updateGrid (zoom) { // TODO: Try this with elements, then compare performance difference @@ -127,7 +127,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function gridUpdate () { if (showGrid) { diff --git a/editor/extensions/ext-imagelib.js b/editor/extensions/ext-imagelib.js index bc867734..f327f75c 100644 --- a/editor/extensions/ext-imagelib.js +++ b/editor/extensions/ext-imagelib.js @@ -41,7 +41,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function closeBrowser () { $('#imgbrowse_holder').hide(); @@ -49,7 +49,7 @@ export default { /** * @param {string} url - * @returns {undefined} + * @returns {void} */ function importImage (url) { const newImage = svgCanvas.addSVGElementFromJson({ @@ -289,7 +289,7 @@ export default { /** * @param {boolean} show - * @returns {undefined} + * @returns {void} */ function toggleMulti (show) { $('#lib_framewrap, #imglib_opts').css({right: (show ? 200 : 10)}); @@ -333,7 +333,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function showBrowser () { let browser = $('#imgbrowse'); diff --git a/editor/extensions/ext-markers.js b/editor/extensions/ext-markers.js index dea646af..e44aeabb 100644 --- a/editor/extensions/ext-markers.js +++ b/editor/extensions/ext-markers.js @@ -97,7 +97,7 @@ export default { * * @param {"start"|"mid"|"end"} pos * @param {string} id - * @returns {undefined} + * @returns {void} */ function setIcon (pos, id) { if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; } @@ -111,7 +111,7 @@ export default { * Toggles context tool panel off/on. Sets the controls with the * selected element's settings. * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { $('#marker_panel').toggle(on); @@ -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 {undefined} + * @returns {void} */ function addMarker (id, val) { const txtBoxBg = '#ffffff'; @@ -295,7 +295,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function setMarker () { const poslist = {start_marker: 'start', mid_marker: 'mid', end_marker: 'end'}; @@ -327,7 +327,7 @@ export default { * Called when the main system modifies an object. This routine changes * the associated markers to be the same color. * @param {Element} elem - * @returns {undefined} + * @returns {void} */ function colorChanged (elem) { const color = elem.getAttribute('stroke'); @@ -349,7 +349,7 @@ export default { * Called when the main system creates or modifies an object. * Its primary purpose is to create new markers for cloned objects. * @param {Element} el - * @returns {undefined} + * @returns {void} */ function updateReferences (el) { $.each(mtypes, function (i, pos) { @@ -376,7 +376,7 @@ export default { /** * @param {"start"|"mid"|"end"} pos * @param {string} val - * @returns {undefined} + * @returns {void} */ function triggerTextEntry (pos, val) { $('#' + pos + '_marker').val(val); @@ -443,7 +443,7 @@ export default { /** * @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id - * @returns {undefined} + * @returns {void} */ function getTitle (id) { const {langList} = strings; diff --git a/editor/extensions/ext-mathjax.js b/editor/extensions/ext-mathjax.js index 408a0e90..4d086d37 100644 --- a/editor/extensions/ext-mathjax.js +++ b/editor/extensions/ext-mathjax.js @@ -67,7 +67,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function saveMath () { const code = $('#mathjax_code_textarea').val(); diff --git a/editor/extensions/ext-placemark.js b/editor/extensions/ext-placemark.js index 100cbd3f..c30f1658 100644 --- a/editor/extensions/ext-placemark.js +++ b/editor/extensions/ext-placemark.js @@ -55,7 +55,7 @@ export default { /** * * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { $('#placemark_panel').toggle(on); @@ -80,7 +80,7 @@ export default { /** * Called when text is changed. * @param {string} txt - * @returns {undefined} + * @returns {void} */ function updateText (txt) { const items = txt.split(';'); @@ -98,7 +98,7 @@ export default { /** * Called when font is changed. * @param {string} font - * @returns {undefined} + * @returns {void} */ function updateFont (font) { font = font.split(' '); @@ -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 {undefined} + * @returns {void} */ function addMarker (id, val) { let marker = svgCanvas.getElem(id); @@ -177,7 +177,7 @@ export default { /** * @param {Element} el * @param {string} val - * @returns {undefined} + * @returns {void} */ function setMarker (el, val) { const markerName = 'marker-start'; @@ -199,7 +199,7 @@ export default { * Called when the main system modifies an object. This routine changes * the associated markers to be the same color. * @param {Element} el - * @returns {undefined} + * @returns {void} */ function colorChanged (el) { const color = el.getAttribute('stroke'); @@ -219,7 +219,7 @@ export default { * Called when the main system creates or modifies an object. * Its primary purpose is to create new markers for cloned objects. * @param {Element} el - * @returns {undefined} + * @returns {void} */ function updateReferences (el) { const id = 'placemark_marker_' + el.id; @@ -251,7 +251,7 @@ export default { /** * @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id - * @returns {undefined} + * @returns {void} */ function getTitle (id) { const {langList} = strings; diff --git a/editor/extensions/ext-polygon.js b/editor/extensions/ext-polygon.js index 7557def3..88a2b327 100644 --- a/editor/extensions/ext-polygon.js +++ b/editor/extensions/ext-polygon.js @@ -38,7 +38,7 @@ export default { /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { let fcRules = $('#fc_rules'); @@ -59,7 +59,7 @@ export default { /** * @param {string} attr * @param {string|Float} val - * @returns {undefined} + * @returns {void} */ function setAttr (attr, val) { svgCanvas.changeSelectedAttribute(attr, val); diff --git a/editor/extensions/ext-server_opensave.js b/editor/extensions/ext-server_opensave.js index 983075fb..78c8f3a1 100644 --- a/editor/extensions/ext-server_opensave.js +++ b/editor/extensions/ext-server_opensave.js @@ -210,7 +210,7 @@ export default { /** * * @param {external:jQuery} form - * @returns {undefined} + * @returns {void} */ function rebuildInput (form) { form.empty(); @@ -219,7 +219,7 @@ export default { /** * Submit the form, empty its contents for reuse and show * uploading message. - * @returns {undefined} + * @returns {void} */ async function submit () { // This submits the form, which returns the file data using `svgEditor.processFile()` diff --git a/editor/extensions/ext-shapes.js b/editor/extensions/ext-shapes.js index f9405533..a2ba2665 100644 --- a/editor/extensions/ext-shapes.js +++ b/editor/extensions/ext-shapes.js @@ -63,7 +63,7 @@ export default { /** * - * @returns {undefined} + * @returns {void} */ function loadIcons () { $('#shape_buttons').empty().append(curLib.buttons); @@ -79,7 +79,7 @@ export default { /** * @param {string|"basic"} cat Category ID * @param {module:Extension.Shapes.Shapes} shapes - * @returns {undefined} + * @returns {void} */ function makeButtons (cat, shapes) { const size = curLib.size || 300; @@ -118,7 +118,7 @@ export default { /** * @param {string|"basic"} catId - * @returns {undefined} + * @returns {void} */ function loadLibrary (catId) { const lib = library[catId]; diff --git a/editor/extensions/ext-star.js b/editor/extensions/ext-star.js index a5b9aeff..1427c549 100644 --- a/editor/extensions/ext-star.js +++ b/editor/extensions/ext-star.js @@ -27,7 +27,7 @@ export default { /** * * @param {boolean} on - * @returns {undefined} + * @returns {void} */ function showPanel (on) { let fcRules = $('#fc_rules'); @@ -48,7 +48,7 @@ export default { * * @param {string} attr * @param {string|Float} val - * @returns {undefined} + * @returns {void} */ function setAttr (attr, val) { svgCanvas.changeSelectedAttribute(attr, val); diff --git a/editor/extensions/ext-storage.js b/editor/extensions/ext-storage.js index 24b7ac1b..5472e8f4 100644 --- a/editor/extensions/ext-storage.js +++ b/editor/extensions/ext-storage.js @@ -50,7 +50,7 @@ export default { /** * Replace `storagePrompt` parameter within URL. * @param {string} val - * @returns {undefined} + * @returns {void} */ function replaceStoragePrompt (val) { val = val ? 'storagePrompt=' + val : ''; @@ -68,7 +68,7 @@ export default { * Sets SVG content as a string with "svgedit-" and the current * canvas name as namespace. * @param {string} val - * @returns {undefined} + * @returns {void} */ function setSVGContentStorage (val) { if (storage) { @@ -84,7 +84,7 @@ export default { /** * Set the cookie to expire. * @param {string} cookie - * @returns {undefined} + * @returns {void} */ function expireCookie (cookie) { document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT'; @@ -92,7 +92,7 @@ export default { /** * Expire the storage cookie. - * @returns {undefined} + * @returns {void} */ function removeStoragePrefCookie () { expireCookie('svgeditstore'); @@ -100,7 +100,7 @@ export default { /** * Empties storage for each of the current preferences. - * @returns {undefined} + * @returns {void} */ function emptyStorage () { setSVGContentStorage(''); @@ -122,7 +122,7 @@ export default { * content into storage) * 2. Use localStorage to set SVG contents (potentially too large to allow in cookies) * 3. Use localStorage (where available) or cookies to set preferences. - * @returns {undefined} + * @returns {void} */ function setupBeforeUnloadListener () { window.addEventListener('beforeunload', function (e) { diff --git a/editor/extensions/ext-webappfind.js b/editor/extensions/ext-webappfind.js index 953c334e..434d6cff 100644 --- a/editor/extensions/ext-webappfind.js +++ b/editor/extensions/ext-webappfind.js @@ -22,7 +22,7 @@ export default { * @param {module:svgcanvas.SvgCanvas#event:message} data * @listens module:svgcanvas.SvgCanvas#event:message * @throws {Error} Unexpected event type - * @returns {undefined} + * @returns {void} */ (win, {data, origin}) => { // eslint-disable-line no-shadow // console.log('data, origin', data, origin); diff --git a/editor/extensions/imagelib/openclipart.js b/editor/extensions/imagelib/openclipart.js index a00cf18a..b29c7cd4 100644 --- a/editor/extensions/imagelib/openclipart.js +++ b/editor/extensions/imagelib/openclipart.js @@ -11,7 +11,7 @@ const jsVoid = 'javascript: void(0);'; // eslint-disable-line no-script-url /** * Shows results after query submission. * @param {string} url - * @returns {undefined} + * @returns {void} */ async function processResults (url) { /** diff --git a/editor/external/dom-polyfill/dom-polyfill.js b/editor/external/dom-polyfill/dom-polyfill.js index fdf25b11..8fb355ae 100644 --- a/editor/external/dom-polyfill/dom-polyfill.js +++ b/editor/external/dom-polyfill/dom-polyfill.js @@ -8,7 +8,7 @@ * * @param {Node} o * @param {module:DOMPolyfill~ParentNode|module:DOMPolyfill~ChildNode} ps - * @returns {undefined} + * @returns {void} */ function mixin (o, ps) { if (!o) return; diff --git a/editor/external/dynamic-import-polyfill/importModule.js b/editor/external/dynamic-import-polyfill/importModule.js index 328263fc..8f5ab0e9 100644 --- a/editor/external/dynamic-import-polyfill/importModule.js +++ b/editor/external/dynamic-import-polyfill/importModule.js @@ -20,7 +20,7 @@ function toAbsoluteURL (url) { * Add any of the whitelisted attributes to the script tag. * @param {HTMLScriptElement} script * @param {PlainObject.} atts - * @returns {undefined} + * @returns {void} */ function addScriptAtts (script, atts) { ['id', 'class', 'type'].forEach((prop) => { @@ -81,7 +81,7 @@ export function importScript (url, atts = {}) { const script = document.createElement('script'); /** * - * @returns {undefined} + * @returns {void} */ function scriptOnError () { reject(new Error(`Failed to import: ${url}`)); @@ -89,7 +89,7 @@ export function importScript (url, atts = {}) { } /** * - * @returns {undefined} + * @returns {void} */ function scriptOnLoad () { resolve(); @@ -131,7 +131,7 @@ export function importModule (url, atts = {}, {returnDefault = false} = {}) { const script = document.createElement('script'); /** * - * @returns {undefined} + * @returns {void} */ function scriptOnError () { reject(new Error(`Failed to import: ${url}`)); @@ -139,7 +139,7 @@ export function importModule (url, atts = {}, {returnDefault = false} = {}) { } /** * - * @returns {undefined} + * @returns {void} */ function scriptOnLoad () { resolve(window[vector]); diff --git a/editor/history.js b/editor/history.js index a135076d..cf4b72eb 100644 --- a/editor/history.js +++ b/editor/history.js @@ -46,7 +46,7 @@ class Command { * @function module:history.HistoryCommand#apply * @param {module:history.HistoryEventHandler} * @fires module:history~Command#event:history - * @returns {undefined|true} + * @returns {void|true} */ /** * @@ -54,7 +54,7 @@ class Command { * @function module:history.HistoryCommand#unapply * @param {module:history.HistoryEventHandler} * @fires module:history~Command#event:history - * @returns {undefined|true} + * @returns {void|true} */ /** * Returns the elements @@ -92,7 +92,7 @@ class Command { * @param {string} eventType One of the HistoryEvent types * @param {module:history~Command#event:history} command * @listens module:history~Command#event:history - * @returns {undefined} + * @returns {void} * */ @@ -122,7 +122,7 @@ export class MoveElementCommand extends Command { * Re-positions the element. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ apply (handler) { // TODO(codedread): Refactor this common event code into a base HistoryCommand class. @@ -141,7 +141,7 @@ export class MoveElementCommand extends Command { * Positions the element back to its original location. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ unapply (handler) { if (handler) { @@ -188,7 +188,7 @@ export class InsertElementCommand extends Command { * Re-inserts the new element. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ apply (handler) { if (handler) { @@ -206,7 +206,7 @@ export class InsertElementCommand extends Command { * Removes the element. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ unapply (handler) { if (handler) { @@ -257,7 +257,7 @@ export class RemoveElementCommand extends Command { * Re-removes the new element. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ apply (handler) { if (handler) { @@ -277,7 +277,7 @@ export class RemoveElementCommand extends Command { * Re-adds the new element. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ unapply (handler) { if (handler) { @@ -481,7 +481,7 @@ export class BatchCommand extends Command { * Runs "apply" on all subcommands. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ apply (handler) { if (handler) { @@ -502,7 +502,7 @@ export class BatchCommand extends Command { * Runs "unapply" on all subcommands. * @param {module:history.HistoryEventHandler} handler * @fires module:history~Command#event:history - * @returns {undefined} + * @returns {void} */ unapply (handler) { if (handler) { @@ -538,7 +538,7 @@ export class BatchCommand extends Command { /** * Adds a given command to the history stack. * @param {Command} cmd - The undo command object to add - * @returns {undefined} + * @returns {void} */ addSubCommand (cmd) { this.stack.push(cmd); @@ -573,7 +573,7 @@ export class UndoManager { /** * Resets the undo stack, effectively clearing the undo/redo history. - * @returns {undefined} + * @returns {void} */ resetUndoStack () { this.undoStack = []; @@ -610,7 +610,7 @@ export class UndoManager { /** * Performs an undo step. - * @returns {undefined} + * @returns {void} */ undo () { if (this.undoStackPointer > 0) { @@ -621,7 +621,7 @@ export class UndoManager { /** * Performs a redo step. - * @returns {undefined} + * @returns {void} */ redo () { if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) { @@ -633,7 +633,7 @@ export class UndoManager { /** * Adds a command object to the undo history stack. * @param {Command} cmd - The command object to add - * @returns {undefined} + * @returns {void} */ addCommandToHistory (cmd) { // FIXME: we MUST compress consecutive text changes to the same element @@ -658,7 +658,7 @@ export class UndoManager { * from the DOM and uses all of these to construct the undo-able command. * @param {string} attrName - The name of the attribute being changed * @param {Element[]} elems - Array of DOM elements being changed - * @returns {undefined} + * @returns {void} */ beginUndoableChange (attrName, elems) { const p = ++this.undoChangeStackPointer; diff --git a/editor/historyrecording.js b/editor/historyrecording.js index 49437dde..a87af5e2 100644 --- a/editor/historyrecording.js +++ b/editor/historyrecording.js @@ -141,7 +141,7 @@ class HistoryRecordingService { * Private function to add a command to the history or current batch command. * @private * @param {Command} cmd - * @returns {module:history.HistoryRecordingService|undefined} + * @returns {module:history.HistoryRecordingService|void} */ addCommand_ (cmd) { if (!this.undoManager_) { return this; } diff --git a/editor/jgraduate/jQuery.jGraduate.js b/editor/jgraduate/jQuery.jGraduate.js index 75cbcfe7..bb6ea24a 100644 --- a/editor/jgraduate/jQuery.jGraduate.js +++ b/editor/jgraduate/jQuery.jGraduate.js @@ -205,7 +205,7 @@ export default function jQueryPluginJGraduate ($) { /** * @param {SVGElement} elem * @param {module:jGraduate.Attrs} attrs - * @returns {undefined} + * @returns {void} */ function setAttrs (elem, attrs) { if (isGecko) { @@ -257,11 +257,11 @@ export default function jQueryPluginJGraduate ($) { /** * @callback external:jQuery.fn.jGraduate.OkCallback * @param {external:jQuery.jGraduate.Paint} paint - * @returns {undefined} + * @returns {void} */ /** * @callback external:jQuery.fn.jGraduate.CancelCallback - * @returns {undefined} + * @returns {void} */ /** @@ -727,7 +727,7 @@ export default function jQueryPluginJGraduate ($) { /** * - * @returns {undefined} + * @returns {void} */ function remStop () { delStop.setAttribute('display', 'none'); @@ -751,7 +751,7 @@ export default function jQueryPluginJGraduate ($) { /** * @param {Element} item - * @returns {undefined} + * @returns {void} */ function selectStop (item) { if (curStop) curStop.setAttribute('stroke', '#000'); @@ -766,7 +766,7 @@ export default function jQueryPluginJGraduate ($) { /** * - * @returns {undefined} + * @returns {void} */ function remDrags () { $win.unbind('mousemove', dragColor); @@ -782,7 +782,7 @@ export default function jQueryPluginJGraduate ($) { let cY = cy; /** * - * @returns {undefined} + * @returns {void} */ function xform () { const rot = angle ? 'rotate(' + angle + ',' + cX + ',' + cY + ') ' : ''; @@ -799,7 +799,7 @@ export default function jQueryPluginJGraduate ($) { /** * @param {Event} evt - * @returns {undefined} + * @returns {void} */ function dragColor (evt) { let x = evt.pageX - stopOffset.left; diff --git a/editor/jgraduate/jQuery.jPicker.js b/editor/jgraduate/jQuery.jPicker.js index c2864295..71afdc3b 100755 --- a/editor/jgraduate/jQuery.jPicker.js +++ b/editor/jgraduate/jQuery.jPicker.js @@ -74,7 +74,7 @@ const jPicker = function ($) { * @memberof module:jPicker * @param {external:jQuery} bar * @param {module:jPicker.SliderOptions} options - * @returns {undefined} + * @returns {void} */ class Slider { constructor (bar, options) { @@ -82,7 +82,7 @@ const jPicker = function ($) { /** * Fire events on the supplied `context` * @param {module:jPicker.JPickerInit} context - * @returns {undefined} + * @returns {void} */ function fireChangeEvents (context) { changeEvents.forEach((changeEvent) => { @@ -93,7 +93,7 @@ const jPicker = function ($) { /** * Bind the mousedown to the bar not the arrow for quick snapping to the clicked location. * @param {external:jQuery.Event} e - * @returns {undefined} + * @returns {void} */ function mouseDown (e) { const off = bar.offset(); @@ -136,7 +136,7 @@ const jPicker = function ($) { /** * Calculate mouse position and set value within the current range. * @param {Event} e - * @returns {undefined} + * @returns {void} */ function setValuesFromMousePosition (e) { const barW = bar.w, // local copies for YUI compressor @@ -155,7 +155,7 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function draw () { const @@ -192,7 +192,7 @@ const jPicker = function ($) { * @param {?("xy"|"x"|"y")} name * @param {module:math.XYObject} value * @param {module:jPicker.Slider} context - * @returns {module:math.XYObject|Float|undefined} + * @returns {module:math.XYObject|Float|void} */ function val (name, value, context) { const set = value !== undefined; @@ -263,7 +263,7 @@ const jPicker = function ($) { * * @param {"minx"|"maxx"|"rangex"|"miny"|"maxy"|"rangey"|"all"} name * @param {module:jPicker.MinMaxRangeXY} value - * @returns {module:jPicker.MinMaxRangeXY|module:jPicker.MinMaxRangeX|module:jPicker.MinMaxRangeY|undefined} + * @returns {module:jPicker.MinMaxRangeXY|module:jPicker.MinMaxRangeX|module:jPicker.MinMaxRangeY|void} */ function range (name, value) { const set = value !== undefined; @@ -336,14 +336,14 @@ const jPicker = function ($) { } /** * @param {GenericCallback} callback - * @returns {undefined} + * @returns {void} */ function bind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks if (typeof callback === 'function') changeEvents.push(callback); } /** * @param {GenericCallback} callback - * @returns {undefined} + * @returns {void} */ function unbind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks if (typeof callback !== 'function') return; @@ -352,7 +352,7 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function destroy () { // unbind all possible events and null objects @@ -416,7 +416,7 @@ const jPicker = function ($) { /** * * @param {Event} e - * @returns {Event|false|undefined} + * @returns {Event|false|void} */ function keyDown (e) { if (e.target.value === '' && e.target !== hex.get(0) && ((!isNullish(bindedHex) && e.target !== bindedHex.get(0)) || isNullish(bindedHex))) return undefined; @@ -512,7 +512,7 @@ const jPicker = function ($) { // input box key up - validate value and set color /** * @param {Event} e - * @returns {Event|undefined} + * @returns {Event|void} * @todo Why is this returning an event? */ function keyUp (e) { @@ -569,7 +569,7 @@ const jPicker = function ($) { // input box blur - reset to original if value empty /** * @param {Event} e - * @returns {undefined} + * @returns {void} */ function blur (e) { if (!isNullish(color.val())) { @@ -625,7 +625,7 @@ const jPicker = function ($) { /** * @param {external:jQuery} ui * @param {Element} context - * @returns {undefined} + * @returns {void} */ function colorChanged (ui, context) { const all = ui.val('all'); @@ -642,7 +642,7 @@ const jPicker = function ($) { } /** * Unbind all events and null objects. - * @returns {undefined} + * @returns {void} */ function destroy () { red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).unbind('keyup', keyUp).unbind('blur', blur); @@ -718,17 +718,17 @@ const jPicker = function ($) { /** * * @param {module:jPicker.Slider} context - * @returns {undefined} + * @returns {void} */ function fireChangeEvents (context) { for (let i = 0; i < changeEvents.length; i++) changeEvents[i].call(that, that, context); } /** - * @param {string|"ahex"|"hex"|"all"|""|null|undefined} name String composed of letters "r", "g", "b", "a", "h", "s", and/or "v" + * @param {string|"ahex"|"hex"|"all"|""|null|void} name String composed of letters "r", "g", "b", "a", "h", "s", and/or "v" * @param {module:jPicker.RGBA|module:jPicker.JPickerInit|string} [value] * @param {external:jQuery.jPicker.Color} context - * @returns {module:jPicker.JPickerInit|string|null|undefined} + * @returns {module:jPicker.JPickerInit|string|null|void} */ function val (name, value, context) { // Kind of ugly @@ -955,14 +955,14 @@ const jPicker = function ($) { } /** * @param {GenericCallback} callback - * @returns {undefined} + * @returns {void} */ function bind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks if (typeof callback === 'function') changeEvents.push(callback); } /** * @param {GenericCallback} callback - * @returns {undefined} + * @returns {void} */ function unbind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks if (typeof callback !== 'function') return; @@ -973,7 +973,7 @@ const jPicker = function ($) { } /** * Unset `changeEvents` - * @returns {undefined} + * @returns {void} */ function destroy () { changeEvents = null; @@ -1194,19 +1194,19 @@ const jPicker = function ($) { * @callback module:jPicker.LiveCallback * @param {external:jQuery} ui * @param {Element} context - * @returns {undefined} + * @returns {void} */ /** * @callback module:jPicker.CommitCallback * @param {external:jQuery.jPicker.Color} activeColor * @param {external:jQuery} okButton - * @returns {undefined} Return value not used. + * @returns {void} Return value not used. */ /** * @callback module:jPicker.CancelCallback * @param {external:jQuery.jPicker.Color} activeColor * @param {external:jQuery} cancelButton - * @returns {undefined} Return value not used. + * @returns {void} Return value not used. */ /** * While it would seem this should specify the name `jPicker` for JSDoc, that doesn't @@ -1251,7 +1251,7 @@ const jPicker = function ($) { * * @param {"h"|"s"|"v"|"r"|"g"|"b"|"a"} colorMode * @throws {Error} Invalid mode - * @returns {undefined} + * @returns {void} */ function setColorMode (colorMode) { const {active} = color, // local copies for YUI compressor @@ -1407,7 +1407,7 @@ const jPicker = function ($) { * Update color when user changes text values. * @param {external:jQuery} ui * @param {?module:jPicker.Slider} context - * @returns {undefined} + * @returns {void} */ function activeColorChanged (ui, context) { if (isNullish(context) || (context !== colorBar && context !== colorMap)) positionMapAndBarArrows.call(that, ui, context); @@ -1422,7 +1422,7 @@ const jPicker = function ($) { * User has dragged the ColorMap pointer. * @param {external:jQuery} ui * @param {?module:jPicker.Slider} context - * @returns {undefined} + * @returns {void} */ function mapValueChanged (ui, context) { const {active} = color; @@ -1455,7 +1455,7 @@ const jPicker = function ($) { * User has dragged the ColorBar slider. * @param {external:jQuery} ui * @param {?module:jPicker.Slider} context - * @returns {undefined} + * @returns {void} */ function colorBarValueChanged (ui, context) { const {active} = color; @@ -1489,7 +1489,7 @@ const jPicker = function ($) { * Position map and bar arrows to match current color. * @param {external:jQuery} ui * @param {?module:jPicker.Slider} context - * @returns {undefined} + * @returns {void} */ function positionMapAndBarArrows (ui, context) { if (context !== colorMap) { @@ -1555,7 +1555,7 @@ const jPicker = function ($) { } /** * @param {external:jQuery} ui - * @returns {undefined} + * @returns {void} */ function updatePreview (ui) { try { @@ -1566,7 +1566,7 @@ const jPicker = function ($) { } /** * @param {external:jQuery} ui - * @returns {undefined} + * @returns {void} */ function updateMapVisuals (ui) { switch (settings.color.mode) { @@ -1597,7 +1597,7 @@ const jPicker = function ($) { } /** * @param {external:jQuery} ui - * @returns {undefined} + * @returns {void} */ function updateBarVisuals (ui) { switch (settings.color.mode) { @@ -1651,7 +1651,7 @@ const jPicker = function ($) { /** * @param {external:jQuery} el * @param {string} [c="transparent"] - * @returns {undefined} + * @returns {void} */ function setBG (el, c) { el.css({backgroundColor: (c && c.length === 6 && '#' + c) || 'transparent'}); @@ -1660,7 +1660,7 @@ const jPicker = function ($) { /** * @param {external:jQuery} img * @param {string} src The image source - * @returns {undefined} + * @returns {void} */ function setImg (img, src) { if (isLessThanIE7 && (src.includes('AlphaBar.png') || src.includes('Bars.png') || src.includes('Maps.png'))) { @@ -1671,7 +1671,7 @@ const jPicker = function ($) { /** * @param {external:jQuery} img * @param {Float} y - * @returns {undefined} + * @returns {void} */ function setImgLoc (img, y) { img.css({top: y + 'px'}); @@ -1679,7 +1679,7 @@ const jPicker = function ($) { /** * @param {external:jQuery} obj * @param {Float} alpha - * @returns {undefined} + * @returns {void} */ function setAlpha (obj, alpha) { obj.css({visibility: alpha > 0 ? 'visible' : 'hidden'}); @@ -1712,21 +1712,21 @@ const jPicker = function ($) { /** * Revert color to original color when opened. - * @returns {undefined} + * @returns {void} */ function revertColor () { color.active.val('ahex', color.current.val('ahex')); } /** * Commit the color changes. - * @returns {undefined} + * @returns {void} */ function commitColor () { color.current.val('ahex', color.active.val('ahex')); } /** * @param {Event} e - * @returns {undefined} + * @returns {void} */ function radioClicked (e) { $(this).parents('tbody:first').find('input:radio[value!="' + e.target.value + '"]').removeAttr('checked'); @@ -1734,14 +1734,14 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function currentClicked () { revertColor.call(that); } /** * - * @returns {undefined} + * @returns {void} */ function cancelClicked () { revertColor.call(that); @@ -1750,7 +1750,7 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function okClicked () { commitColor.call(that); @@ -1759,14 +1759,14 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function iconImageClicked () { show.call(that); } /** * @param {external:jQuery} ui - * @returns {undefined} + * @returns {void} */ function currentColorChanged (ui) { const hex = ui.val('hex'); @@ -1775,7 +1775,7 @@ const jPicker = function ($) { } /** * @param {external:jQuery} ui - * @returns {undefined} + * @returns {void} */ function expandableColorChanged (ui) { const hex = ui.val('hex'); @@ -1791,7 +1791,7 @@ const jPicker = function ($) { } /** * @param {Event} e - * @returns {undefined} + * @returns {void} */ function moveBarMouseDown (e) { // const {element} = settings.window, // local copies for YUI compressor @@ -1845,13 +1845,13 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function show () { color.current.val('ahex', color.active.val('ahex')); /** * - * @returns {undefined} + * @returns {void} */ function attachIFrame () { if (!settings.window.expandable || $.support.boxModel) return; @@ -1885,12 +1885,12 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function hide () { /** * - * @returns {undefined} + * @returns {void} */ function removeIFrame () { if (settings.window.expandable) container.css({zIndex: 10}); @@ -1912,7 +1912,7 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function initialize () { const win = settings.window, @@ -2128,7 +2128,7 @@ const jPicker = function ($) { } /** * - * @returns {undefined} + * @returns {void} */ function destroy () { container.find('td.Radio input').unbind('click', radioClicked); diff --git a/editor/layer.js b/editor/layer.js index a46c0fd5..414ee8ac 100644 --- a/editor/layer.js +++ b/editor/layer.js @@ -76,7 +76,7 @@ class Layer { /** * Active this layer so it takes pointer events. - * @returns {undefined} + * @returns {void} */ activate () { this.group_.setAttribute('style', 'pointer-events:all'); @@ -84,7 +84,7 @@ class Layer { /** * Deactive this layer so it does NOT take pointer events. - * @returns {undefined} + * @returns {void} */ deactivate () { this.group_.setAttribute('style', 'pointer-events:none'); @@ -93,7 +93,7 @@ class Layer { /** * Set this layer visible or hidden based on 'visible' parameter. * @param {boolean} visible - If true, make visible; otherwise, hide it. - * @returns {undefined} + * @returns {void} */ setVisible (visible) { const expected = visible === undefined || visible ? 'inline' : 'none'; @@ -127,7 +127,7 @@ class Layer { * Sets the opacity of this layer. If opacity is not a value between 0.0 and 1.0, * nothing happens. * @param {Float} opacity - A float value in the range 0.0-1.0 - * @returns {undefined} + * @returns {void} */ setOpacity (opacity) { if (typeof opacity === 'number' && opacity >= 0.0 && opacity <= 1.0) { @@ -138,7 +138,7 @@ class Layer { /** * Append children to this layer. * @param {SVGGElement} children - The children to append to this layer. - * @returns {undefined} + * @returns {void} */ appendChildren (children) { for (let i = 0; i < children.length; ++i) { @@ -208,7 +208,7 @@ Layer.CLASS_REGEX = new RegExp('(\\s|^)' + Layer.CLASS_NAME + '(\\s|$)'); * Add class `Layer.CLASS_NAME` to the element (usually `class='layer'`). * * @param {SVGGElement} elem - The SVG element to update - * @returns {undefined} + * @returns {void} */ function addLayerClass (elem) { const classes = elem.getAttribute('class'); diff --git a/editor/locale/locale.js b/editor/locale/locale.js index 628fea69..e2efdcfe 100644 --- a/editor/locale/locale.js +++ b/editor/locale/locale.js @@ -48,7 +48,7 @@ let langParam; * @param {"content"|"title"} type * @param {module:locale.LocaleSelectorValue} obj Selectors or IDs keyed to strings * @param {boolean} ids - * @returns {undefined} + * @returns {void} */ export const setStrings = function (type, obj, ids) { // Root element to look for element from @@ -111,7 +111,7 @@ let editor_; * @function init * @memberof module:locale * @param {module:locale.LocaleEditorInit} editor - * @returns {undefined} + * @returns {void} */ export const init = (editor) => { editor_ = editor; diff --git a/editor/path.js b/editor/path.js index bdcc04da..a7d6fc3b 100644 --- a/editor/path.js +++ b/editor/path.js @@ -49,7 +49,7 @@ const uiStrings = {}; /** * @function module:path.setUiStrings * @param {module:path.uiStrings} strs -* @returns {undefined} +* @returns {void} */ export const setUiStrings = function (strs) { Object.assign(uiStrings, strs.ui); @@ -66,7 +66,7 @@ let pathData = {}; /** * @function module:path.setLinkControlPoints * @param {boolean} lcp -* @returns {undefined} +* @returns {void} */ export const setLinkControlPoints = function (lcp) { linkControlPts = lcp; @@ -103,12 +103,12 @@ let editorContext_ = null; * @function module:path.EditorContext#call * @param {"selected"|"changed"} ev - String with the event name * @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function. If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed. - * @returns {undefined} + * @returns {void} */ /** * @function module:path.EditorContext#resetD * @param {SVGPathElement} p - * @returns {undefined} + * @returns {void} */ /** * Note: This doesn't round to an integer necessarily @@ -163,7 +163,7 @@ let editorContext_ = null; /** * @function module:path.EditorContext#setStarted * @param {boolean} s - * @returns {undefined} + * @returns {void} */ /** * @function module:path.EditorContext#getRubberBox @@ -179,14 +179,14 @@ let editorContext_ = null; * @param {PlainObject} cfg * @param {boolean} cfg.closedSubpath * @param {SVGCircleElement[]} cfg.grips - * @returns {undefined} + * @returns {void} */ /** * @function module:path.EditorContext#endChanges * @param {PlainObject} cfg * @param {string} cfg.cmd * @param {Element} cfg.elem - * @returns {undefined} + * @returns {void} */ /** * @function module:path.EditorContext#getCurrentZoom @@ -234,7 +234,7 @@ let editorContext_ = null; /** * @function module:path.init * @param {module:path.EditorContext} editorContext -* @returns {undefined} +* @returns {void} */ export const init = function (editorContext) { editorContext_ = editorContext; @@ -255,7 +255,7 @@ export const init = function (editorContext) { * @param {Element} elem * @param {Segment} newseg * @param {Integer} index -* @returns {undefined} +* @returns {void} */ export const insertItemBefore = function (elem, newseg, index) { // Support insertItemBefore on paths for FF2 @@ -535,7 +535,7 @@ export const getControlPoints = function (seg) { * @param {Integer} index * @param {ArgumentsArray} pts * @param {SVGPathElement} elem -* @returns {undefined} +* @returns {void} */ export const replacePathSeg = function (type, index, pts, elem) { const pth = elem || path.elem; @@ -689,7 +689,7 @@ export class Segment { /** * @param {boolean} y - * @returns {undefined} + * @returns {void} */ showCtrlPts (y) { for (const i in this.ctrlpts) { @@ -701,7 +701,7 @@ export class Segment { /** * @param {boolean} y - * @returns {undefined} + * @returns {void} */ selectCtrls (y) { $('#ctrlpointgrip_' + this.index + 'c1, #ctrlpointgrip_' + this.index + 'c2') @@ -710,7 +710,7 @@ export class Segment { /** * @param {boolean} y - * @returns {undefined} + * @returns {void} */ show (y) { if (this.ptgrip) { @@ -723,7 +723,7 @@ export class Segment { /** * @param {boolean} y - * @returns {undefined} + * @returns {void} */ select (y) { if (this.ptgrip) { @@ -737,7 +737,7 @@ export class Segment { } /** - * @returns {undefined} + * @returns {void} */ addGrip () { this.ptgrip = getPointGrip(this, true); @@ -747,7 +747,7 @@ export class Segment { /** * @param {boolean} full - * @returns {undefined} + * @returns {void} */ update (full) { if (this.ptgrip) { @@ -773,7 +773,7 @@ export class Segment { /** * @param {Integer} dx * @param {Integer} dy - * @returns {undefined} + * @returns {void} */ move (dx, dy) { const {item} = this; @@ -816,7 +816,7 @@ export class Segment { /** * @param {Integer} num - * @returns {undefined} + * @returns {void} */ setLinked (num) { let seg, anum, pt; @@ -850,7 +850,7 @@ export class Segment { * @param {Integer} num * @param {Integer} dx * @param {Integer} dy - * @returns {undefined} + * @returns {void} */ moveCtrl (num, dx, dy) { const {item} = this; @@ -869,7 +869,7 @@ export class Segment { /** * @param {Integer} newType Possible values set during {@link module:path.init} * @param {ArgumentsArray} pts - * @returns {undefined} + * @returns {void} */ setType (newType, pts) { replacePathSeg(newType, this.index, pts); @@ -991,11 +991,11 @@ export class Path { * @callback module:path.PathEachSegCallback * @this module:path.Segment * @param {Integer} i The index of the seg being iterated - * @returns {boolean|undefined} Will stop execution of `eachSeg` if returns `false` + * @returns {boolean|void} Will stop execution of `eachSeg` if returns `false` */ /** * @param {module:path.PathEachSegCallback} fn - * @returns {undefined} + * @returns {void} */ eachSeg (fn) { const len = this.segs.length; @@ -1007,7 +1007,7 @@ export class Path { /** * @param {Integer} index - * @returns {undefined} + * @returns {void} */ addSeg (index) { // Adds a new segment @@ -1048,7 +1048,7 @@ export class Path { /** * @param {Integer} index - * @returns {undefined} + * @returns {void} */ deleteSeg (index) { const seg = this.segs[index]; @@ -1078,7 +1078,7 @@ export class Path { /** * @param {Integer} index - * @returns {undefined} + * @returns {void} */ removePtFromSelection (index) { const pos = this.selected_pts.indexOf(index); @@ -1090,7 +1090,7 @@ export class Path { } /** - * @returns {undefined} + * @returns {void} */ clearSelection () { this.eachSeg(function () { @@ -1101,7 +1101,7 @@ export class Path { } /** - * @returns {undefined} + * @returns {void} */ storeD () { this.last_d = this.elem.getAttribute('d'); @@ -1109,7 +1109,7 @@ export class Path { /** * @param {Integer} y - * @returns {undefined} + * @returns {void} */ show (y) { // Shows this path's segment grips @@ -1127,7 +1127,7 @@ export class Path { * Move selected points. * @param {Integer} dx * @param {Integer} dy - * @returns {undefined} + * @returns {void} */ movePts (dx, dy) { let i = this.selected_pts.length; @@ -1140,7 +1140,7 @@ export class Path { /** * @param {Integer} dx * @param {Integer} dy - * @returns {undefined} + * @returns {void} */ moveCtrl (dx, dy) { const seg = this.segs[this.selected_pts[0]]; @@ -1152,7 +1152,7 @@ export class Path { /** * @param {?Integer} newType See {@link https://www.w3.org/TR/SVG/single-page.html#paths-InterfaceSVGPathSeg} - * @returns {undefined} + * @returns {void} */ setSegType (newType) { this.storeD(); @@ -1222,7 +1222,7 @@ export class Path { /** * @param {Integer} pt * @param {Integer} ctrlNum - * @returns {undefined} + * @returns {void} */ selectPt (pt, ctrlNum) { this.clearSelection(); @@ -1268,7 +1268,7 @@ export class Path { /** * @param {string} text - * @returns {undefined} + * @returns {void} */ endChanges (text) { if (isWebkit()) { editorContext_.resetD(this.elem); } @@ -1278,7 +1278,7 @@ export class Path { /** * @param {Integer|Integer[]} indexes - * @returns {undefined} + * @returns {void} */ addPtsToSelection (indexes) { if (!Array.isArray(indexes)) { indexes = [indexes]; } @@ -1347,7 +1347,7 @@ export const getPath_ = function (elem) { /** * @function module:path.removePath_ * @param {string} id -* @returns {undefined} +* @returns {void} */ export const removePath_ = function (id) { if (id in pathData) { delete pathData[id]; } @@ -1388,7 +1388,7 @@ const getRotVals = function (x, y) { * @function module:path.recalcRotatedPath * @todo This is still using ye olde transform methods, can probably * be optimized or even taken care of by `recalculateDimensions` -* @returns {undefined} +* @returns {void} */ export const recalcRotatedPath = function () { const currentPath = path.elem; @@ -1446,7 +1446,7 @@ export const recalcRotatedPath = function () { /** * @function module:path.clearData -* @returns {undefined} +* @returns {void} */ export const clearData = function () { pathData = {}; @@ -1457,7 +1457,7 @@ export const clearData = function () { * @function module:path.reorientGrads * @param {Element} elem * @param {SVGMatrix} m -* @returns {undefined} +* @returns {void} */ export const reorientGrads = function (elem, m) { const bb = utilsGetBBox(elem); @@ -1792,7 +1792,7 @@ export const pathActions = (function () { * @param {Element} mouseTarget * @param {Float} startX * @param {Float} startY - * @returns {boolean|undefined} + * @returns {boolean|void} */ mouseDown (evt, mouseTarget, startX, startY) { let id; @@ -2042,7 +2042,7 @@ export const pathActions = (function () { /** * @param {Float} mouseX * @param {Float} mouseY - * @returns {undefined} + * @returns {void} */ mouseMove (mouseX, mouseY) { const currentZoom = editorContext_.getCurrentZoom(); @@ -2178,7 +2178,7 @@ export const pathActions = (function () { * @param {Element} element * @param {Float} mouseX * @param {Float} mouseY - * @returns {module:path.keepElement|undefined} + * @returns {module:path.keepElement|void} */ mouseUp (evt, element, mouseX, mouseY) { const drawnPath = editorContext_.getDrawnPath(); @@ -2230,7 +2230,7 @@ export const pathActions = (function () { }, /** * @param {Element} element - * @returns {undefined} + * @returns {void} */ toEditMode (element) { path = getPath_(element); @@ -2243,7 +2243,7 @@ export const pathActions = (function () { /** * @param {Element} elem * @fires module:svgcanvas.SvgCanvas#event:selected - * @returns {undefined} + * @returns {void} */ toSelectMode (elem) { const selPath = (elem === path.elem); @@ -2264,7 +2264,7 @@ export const pathActions = (function () { }, /** * @param {boolean} on - * @returns {undefined} + * @returns {void} */ addSubPath (on) { if (on) { @@ -2279,7 +2279,7 @@ export const pathActions = (function () { }, /** * @param {Element} target - * @returns {undefined} + * @returns {void} */ select (target) { if (currentPath === target) { @@ -2292,7 +2292,7 @@ export const pathActions = (function () { }, /** * @fires module:svgcanvas.SvgCanvas#event:changed - * @returns {undefined} + * @returns {void} */ reorient () { const elem = editorContext_.getSelectedElements()[0]; @@ -2322,7 +2322,7 @@ export const pathActions = (function () { /** * @param {boolean} remove Not in use - * @returns {undefined} + * @returns {void} */ clear (remove) { const drawnPath = editorContext_.getDrawnPath(); @@ -2342,7 +2342,7 @@ export const pathActions = (function () { }, /** * @param {?(Element|SVGPathElement)} pth - * @returns {false|undefined} + * @returns {false|void} */ resetOrientation (pth) { if (isNullish(pth) || pth.nodeName !== 'path') { return false; } @@ -2384,7 +2384,7 @@ export const pathActions = (function () { return undefined; }, /** - * @returns {undefined} + * @returns {void} */ zoomChange () { if (editorContext_.getCurrentMode() === 'pathedit') { @@ -2412,13 +2412,13 @@ export const pathActions = (function () { }, /** * @param {boolean} linkPoints - * @returns {undefined} + * @returns {void} */ linkControlPoints (linkPoints) { setLinkControlPoints(linkPoints); }, /** - * @returns {undefined} + * @returns {void} */ clonePathNode () { path.storeD(); @@ -2441,7 +2441,7 @@ export const pathActions = (function () { path.endChanges('Clone path node(s)'); }, /** - * @returns {undefined} + * @returns {void} */ opencloseSubPath () { const selPts = path.selected_pts; @@ -2553,7 +2553,7 @@ export const pathActions = (function () { path.init().selectPt(0); }, /** - * @returns {undefined} + * @returns {void} */ deletePathNode () { if (!pathActions.canDeleteNodes) { return; } @@ -2643,7 +2643,7 @@ export const pathActions = (function () { smoothPolylineIntoPath, /** * @param {?Integer} v See {@link https://www.w3.org/TR/SVG/single-page.html#paths-InterfaceSVGPathSeg} - * @returns {undefined} + * @returns {void} */ setSegType (v) { path.setSegType(v); @@ -2651,7 +2651,7 @@ export const pathActions = (function () { /** * @param {string} attr * @param {Float} newValue - * @returns {undefined} + * @returns {void} */ moveNode (attr, newValue) { const selPts = path.selected_pts; @@ -2669,7 +2669,7 @@ export const pathActions = (function () { }, /** * @param {Element} elem - * @returns {undefined} + * @returns {void} */ fixEnd (elem) { // Adds an extra segment if the last seg before a Z doesn't end diff --git a/editor/recalculate.js b/editor/recalculate.js index 52512e21..ac388d31 100644 --- a/editor/recalculate.js +++ b/editor/recalculate.js @@ -36,13 +36,13 @@ let context_; /** * @function module:recalculate.EditorContext#setStartTransform * @param {string} transform - * @returns {undefined} + * @returns {void} */ /** * @function module:recalculate.init * @param {module:recalculate.EditorContext} editorContext -* @returns {undefined} +* @returns {void} */ export const init = function (editorContext) { context_ = editorContext; @@ -54,7 +54,7 @@ export const init = function (editorContext) { * @param {string} attr - The clip-path attribute value with the clipPath's ID * @param {Float} tx - The translation's x value * @param {Float} ty - The translation's y value -* @returns {undefined} +* @returns {void} */ export const updateClipPath = function (attr, tx, ty) { const path = getRefElem(attr).firstChild; diff --git a/editor/sanitize.js b/editor/sanitize.js index fe970280..0a8e4a3d 100644 --- a/editor/sanitize.js +++ b/editor/sanitize.js @@ -108,7 +108,7 @@ Object.entries(svgWhiteList_).forEach(function ([elt, atts]) { * It only keeps what is allowed from our whitelist defined above. * @function module:sanitize.sanitizeSvg * @param {Text|Element} node - The DOM element to be checked (we'll also check its children) or text node to be cleaned up -* @returns {undefined} +* @returns {void} */ export const sanitizeSvg = function (node) { // Cleanup text nodes diff --git a/editor/select.js b/editor/select.js index c2779a3f..7e0d0e50 100644 --- a/editor/select.js +++ b/editor/select.js @@ -79,7 +79,7 @@ export class Selector { * Used to reset the id and element that the selector is attached to. * @param {Element} e - DOM element associated with this selector * @param {module:utilities.BBoxObject} bbox - Optional bbox to use for reset (prevents duplicate getBBox call). - * @returns {undefined} + * @returns {void} */ reset (e, bbox) { this.locked = true; @@ -91,7 +91,7 @@ export class Selector { /** * Show the resize grips of this selector. * @param {boolean} show - Indicates whether grips should be shown or not - * @returns {undefined} + * @returns {void} */ showGrips (show) { const bShow = show ? 'inline' : 'none'; @@ -107,7 +107,7 @@ export class Selector { /** * Updates the selector to match the element's size. * @param {module:utilities.BBoxObject} [bbox] - BBox to use for resize (prevents duplicate getBBox call). - * @returns {undefined} + * @returns {void} */ resize (bbox) { const selectedBox = this.selectorRect, @@ -240,7 +240,7 @@ export class Selector { /** * Updates cursors for corner grips on rotation so arrows point the right way. * @param {Float} angle - Current rotation angle in degrees -* @returns {undefined} +* @returns {void} */ Selector.updateGripCursors = function (angle) { const dirArr = Object.keys(selectorManager_.selectorGrips); @@ -293,7 +293,7 @@ export class SelectorManager { /** * Resets the parent selector group element. - * @returns {undefined} + * @returns {void} */ initGroup () { // remove old selector parent group if it existed @@ -439,7 +439,7 @@ export class SelectorManager { * Removes the selector of the given element (hides selection box). * * @param {Element} elem - DOM element to remove the selector for - * @returns {undefined} + * @returns {void} */ releaseSelector (elem) { if (isNullish(elem)) { return; } @@ -531,7 +531,7 @@ export class SelectorManager { * @function module:select.init * @param {module:select.Config} config - An object containing configurable parameters (imgPath) * @param {module:select.SVGFactory} svgFactory - An object implementing the SVGFactory interface. - * @returns {undefined} + * @returns {void} */ export const init = function (config, svgFactory) { config_ = config; diff --git a/editor/spinbtn/jQuery.SpinButton.js b/editor/spinbtn/jQuery.SpinButton.js index 7deb2299..cff4fd7a 100644 --- a/editor/spinbtn/jQuery.SpinButton.js +++ b/editor/spinbtn/jQuery.SpinButton.js @@ -90,7 +90,7 @@ export default function jQueryPluginSpinButton ($) { /** * @callback module:jQuerySpinButton.ValueCallback * @param {external:jQuery.fn.SpinButton} thisArg Spin Button; check its `value` to see how it was changed. - * @returns {undefined} + * @returns {void} */ /** * @typedef {PlainObject} module:jQuerySpinButton.SpinButtonConfig diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 5ffd7eb7..f4819cca 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -378,7 +378,7 @@ function getImportLocale ({defaultLang, defaultName}) { * Store and retrieve preferences. * @param {string} key The preference name to be retrieved or set * @param {string} [val] The value. If the value supplied is missing or falsey, no change to the preference will be made. -* @returns {string|undefined} If val is missing or falsey, the value of the previously stored preference will be returned. +* @returns {string|void} If val is missing or falsey, the value of the previously stored preference will be returned. * @todo Can we change setting on the jQuery namespace (onto editor) to avoid conflicts? * @todo Review whether any remaining existing direct references to * getting `curPrefs` can be changed to use `$.pref()` getting to ensure @@ -420,7 +420,7 @@ editor.setStrings = setStrings; * change URL setting so that it always uses a different namespace, * so it won't affect pre-existing user storage (but then if users saves * that, it will then be subject to tampering -* @returns {undefined} +* @returns {void} */ editor.loadContentAndPrefs = function () { if (!curConfig.forceStorage && @@ -480,7 +480,7 @@ editor.loadContentAndPrefs = function () { * explicitly permits via `allowInitialUserOverride` but extension config * can be overridden as they will run after URL settings). Should * not be needed in `svgedit-config-iife.js`. -* @returns {undefined} +* @returns {void} */ editor.setConfig = function (opts, cfgCfg) { cfgCfg = cfgCfg || {}; @@ -489,7 +489,7 @@ editor.setConfig = function (opts, cfgCfg) { * @param {module:SVGEditor.Config|module:SVGEditor.Prefs} cfgObj * @param {string} key * @param {Any} val See {@link module:SVGEditor.Config} or {@link module:SVGEditor.Prefs} - * @returns {undefined} + * @returns {void} */ function extendOrAdd (cfgObj, key, val) { if (cfgObj[key] && typeof cfgObj[key] === 'object') { @@ -569,7 +569,7 @@ editor.setConfig = function (opts, cfgCfg) { * - calls [svgCanvas.setSvgString()]{@link module:svgcanvas.SvgCanvas#setSvgString} with the string contents of that file. * Not passed any parameters. * @function module:SVGEditor.CustomHandler#open -* @returns {undefined} +* @returns {void} */ /** * Its responsibilities are: @@ -580,7 +580,7 @@ editor.setConfig = function (opts, cfgCfg) { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:saved} svgStr A string of the SVG * @listens module:svgcanvas.SvgCanvas#event:saved -* @returns {undefined} +* @returns {void} */ /** * Its responsibilities (with regard to the object it is supplied in its 2nd argument) are: @@ -593,14 +593,14 @@ editor.setConfig = function (opts, cfgCfg) { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:exported} data * @listens module:svgcanvas.SvgCanvas#event:exported -* @returns {undefined} +* @returns {void} */ /** * @function module:SVGEditor.CustomHandler#exportPDF * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:exportedPDF} data * @listens module:svgcanvas.SvgCanvas#event:exportedPDF -* @returns {undefined} +* @returns {void} */ /** @@ -633,7 +633,7 @@ editor.setCustomHandlers = function (opts) { /** * @param {boolean} arg -* @returns {undefined} +* @returns {void} */ editor.randomizeIds = function (arg) { return svgCanvas.randomizeIds(arg); @@ -641,7 +641,7 @@ editor.randomizeIds = function (arg) { /** * Auto-run after a Promise microtask. -* @returns {undefined} +* @returns {void} */ editor.init = function () { const modularVersion = !('svgEditor' in window) || @@ -682,7 +682,7 @@ editor.init = function () { /** * Sets up current preferences based on defaults. - * @returns {undefined} + * @returns {void} */ function setupCurPrefs () { curPrefs = $.extend(true, {}, defaultPrefs, curPrefs); // Now safe to merge with priority for curPrefs in the event any are already set @@ -692,7 +692,7 @@ editor.init = function () { /** * Sets up current config based on defaults. - * @returns {undefined} + * @returns {void} */ function setupCurConfig () { curConfig = $.extend(true, {}, defaultConfig, curConfig); // Now safe to merge with priority for curConfig in the event any are already set @@ -781,7 +781,7 @@ editor.init = function () { * @param {string|Element|external:jQuery} elem * @param {string|external:jQuery} iconId * @param {Float} forcedSize Not in use - * @returns {undefined} + * @returns {void} */ const setIcon = editor.setIcon = function (elem, iconId, forcedSize) { const icon = (typeof iconId === 'string') ? $.getSvgIcon(iconId, true) : iconId.clone(); @@ -850,7 +850,7 @@ editor.init = function () { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:extensions_added} data * @listens module:svgcanvas.SvgCanvas#event:extensions_added - * @returns {undefined} + * @returns {void} */ (win, data) => { extensionsAdded = true; @@ -868,7 +868,7 @@ editor.init = function () { /** * @param {module:svgcanvas.SvgCanvas#event:message} messageObj * @fires module:svgcanvas.SvgCanvas#event:message - * @returns {undefined} + * @returns {void} */ (messageObj) => { svgCanvas.call('message', messageObj); @@ -887,7 +887,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const setFlyoutPositions = function () { $('.tools_flyout').each(function () { @@ -921,7 +921,7 @@ editor.init = function () { /** * @param {external:jQuery} elems * @param {Float} scale - * @returns {undefined} + * @returns {void} */ const scaleElements = function (elems, scale) { // const prefix = '-' + uaPrefix.toLowerCase() + '-'; // Currently unused @@ -959,7 +959,7 @@ editor.init = function () { /** * Called internally. * @param {module:SVGEditor.IconSize} size - * @returns {undefined} + * @returns {void} */ const setIconSize = editor.setIconSize = function (size) { // const elems = $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open'); @@ -1509,7 +1509,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const setSelectMode = function () { const curr = $('.tool_button_current'); @@ -1546,7 +1546,7 @@ editor.init = function () { * This function highlights the layer passed in (by fading out the other layers). * If no layer is passed in, this function restores the other layers * @param {string} [layerNameToHighlight] - * @returns {undefined} + * @returns {void} */ const toggleHighlightLayer = function (layerNameToHighlight) { let i; @@ -1570,7 +1570,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const populateLayers = function () { svgCanvas.clearSelection(); @@ -1630,7 +1630,7 @@ editor.init = function () { /** * @param {Event} [e] Not used. * @param {boolean} forSaving - * @returns {undefined} + * @returns {void} */ const showSourceEditor = function (e, forSaving) { if (editingsource) { return; } @@ -1650,7 +1650,7 @@ editor.init = function () { /** * @param {boolean} editmode * @param {module:svgcanvas.SvgCanvas#event:selected} elems - * @returns {undefined} + * @returns {void} */ const togglePathEditMode = function (editmode, elems) { $('#path_node_panel').toggle(editmode); @@ -1676,7 +1676,7 @@ editor.init = function () { * @param {external:Window} wind * @param {module:svgcanvas.SvgCanvas#event:saved} svg The SVG source * @listens module:svgcanvas.SvgCanvas#event:saved - * @returns {undefined} + * @returns {void} */ const saveHandler = function (wind, svg) { editor.showSaveWarning = false; @@ -1731,7 +1731,7 @@ editor.init = function () { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:exported} data * @listens module:svgcanvas.SvgCanvas#event:exported - * @returns {undefined} + * @returns {void} */ const exportHandler = function (win, data) { const {issues, exportWindowName} = data; @@ -1763,7 +1763,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const operaRepaint = function () { // Repaints canvas in Opera. Needed for stroke-dasharray change as well as fill change @@ -1777,7 +1777,7 @@ editor.init = function () { * * @param {Element} opt * @param {boolean} changeElem - * @returns {undefined} + * @returns {void} */ function setStrokeOpt (opt, changeElem) { const {id} = opt; @@ -1821,7 +1821,7 @@ editor.init = function () { * Unless the select toolbar button is disabled, sets the button * and sets the select mode and cursor styles. * @function module:SVGEditor.clickSelect - * @returns {undefined} + * @returns {void} */ const clickSelect = editor.clickSelect = function () { if (toolButtonClick('#tool_select')) { @@ -1842,7 +1842,7 @@ editor.init = function () { * Set a selected image's URL. * @function module:SVGEditor.setImageURL * @param {string} url - * @returns {undefined} + * @returns {void} */ const setImageURL = editor.setImageURL = function (url) { if (!url) { @@ -1871,7 +1871,7 @@ editor.init = function () { * * @param {string} color * @param {string} url - * @returns {undefined} + * @returns {void} */ function setBackground (color, url) { // if (color == $.pref('bkgd_color') && url == $.pref('bkgd_url')) { return; } @@ -1900,7 +1900,7 @@ editor.init = function () { /** * @param {Element} elem - * @returns {undefined} + * @returns {void} */ const setInputWidth = function (elem) { const w = Math.min(Math.max(12 + elem.value.length * 6, 50), 300); @@ -1911,7 +1911,7 @@ editor.init = function () { * * @param {HTMLDivElement} [scanvas] * @param {Float} [zoom] - * @returns {undefined} + * @returns {void} */ function updateRulers (scanvas, zoom) { if (!zoom) { zoom = svgCanvas.getZoom(); } @@ -2068,7 +2068,7 @@ editor.init = function () { * @function module:SVGEditor.updateCanvas * @param {boolean} center * @param {module:math.XYObject} newCtr - * @returns {undefined} + * @returns {void} */ const updateCanvas = editor.updateCanvas = function (center, newCtr) { const zoom = svgCanvas.getZoom(); @@ -2146,7 +2146,7 @@ editor.init = function () { /** * @fires module:svgcanvas.SvgCanvas#event:ext-toolButtonStateUpdate - * @returns {undefined} + * @returns {void} */ const updateToolButtonState = function () { const bNoFill = (svgCanvas.getColor('fill') === 'none'); @@ -2210,7 +2210,7 @@ editor.init = function () { * Updates the toolbar (colors, opacity, etc) based on the selected element. * This function also updates the opacity and id elements that are in the * context panel. - * @returns {undefined} + * @returns {void} */ const updateToolbar = function () { let i, len; @@ -2277,7 +2277,7 @@ editor.init = function () { /** * Updates the context panel tools based on the selected element. - * @returns {undefined} + * @returns {void} */ const updateContextPanel = function () { let elem = selectedElement; @@ -2499,7 +2499,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const updateWireFrame = function () { // Test support @@ -2517,7 +2517,7 @@ editor.init = function () { /** * @param {string} [title=svgCanvas.getDocumentTitle()] - * @returns {undefined} + * @returns {void} */ const updateTitle = function (title) { title = title || svgCanvas.getDocumentTitle(); @@ -2537,7 +2537,7 @@ editor.init = function () { * @param {module:svgcanvas.SvgCanvas#event:selected} elems Array of elements that were selected * @listens module:svgcanvas.SvgCanvas#event:selected * @fires module:svgcanvas.SvgCanvas#event:ext-selectedChanged - * @returns {undefined} + * @returns {void} */ const selectedChanged = function (win, elems) { const mode = svgCanvas.getMode(); @@ -2575,7 +2575,7 @@ editor.init = function () { * @param {module:svgcanvas.SvgCanvas#event:transition} elems * @listens module:svgcanvas.SvgCanvas#event:transition * @fires module:svgcanvas.SvgCanvas#event:ext-elementTransition - * @returns {undefined} + * @returns {void} */ const elementTransition = function (win, elems) { const mode = svgCanvas.getMode(); @@ -2623,7 +2623,7 @@ editor.init = function () { * @param {module:svgcanvas.SvgCanvas#event:changed} elems * @listens module:svgcanvas.SvgCanvas#event:changed * @fires module:svgcanvas.SvgCanvas#event:ext-elementChanged - * @returns {undefined} + * @returns {void} */ const elementChanged = function (win, elems) { const mode = svgCanvas.getMode(); @@ -2670,7 +2670,7 @@ editor.init = function () { }; /** - * @returns {undefined} + * @returns {void} */ const zoomDone = function () { updateWireFrame(); @@ -2694,7 +2694,7 @@ editor.init = function () { * @param {module:svgcanvas.SvgCanvas#event:zoomed} bbox * @param {boolean} autoCenter * @listens module:svgcanvas.SvgCanvas#event:zoomed - * @returns {undefined} + * @returns {void} */ const zoomChanged = svgCanvas.zoomChanged = function (win, bbox, autoCenter) { const scrbar = 15, @@ -2764,7 +2764,7 @@ editor.init = function () { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:contextset} context * @listens module:svgcanvas.SvgCanvas#event:contextset - * @returns {undefined} + * @returns {void} */ const contextChanged = function (win, context) { let linkStr = ''; @@ -2794,7 +2794,7 @@ editor.init = function () { /** * Makes sure the current selected paint is available to work with. - * @returns {undefined} + * @returns {void} */ const prepPaints = function () { paintBox.fill.prep(); @@ -2805,7 +2805,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const setFlyoutTitles = function () { $('.tools_flyout').each(function () { @@ -2824,7 +2824,7 @@ editor.init = function () { const allHolders = {}; /** * @param {PlainObject.} holders Key is a selector - * @returns {undefined} + * @returns {void} */ const setupFlyouts = function (holders) { $.each(holders, function (holdSel, btnOpts) { @@ -2854,7 +2854,7 @@ editor.init = function () { /** * Clicking the icon in flyout should set this set's icon. * @param {Event} ev - * @returns {undefined} + * @returns {void} */ const flyoutAction = function (ev) { let options = opts; @@ -2957,7 +2957,7 @@ editor.init = function () { /** * @param {string} id * @param {external:jQuery} child - * @returns {undefined} + * @returns {void} */ const makeFlyoutHolder = function (id, child) { const div = $('
', { @@ -2977,7 +2977,7 @@ editor.init = function () { * @param {boolean} opts.seticon * @param {boolean} opts.multiclick * @todo Combine this with `addDropDown` or find other way to optimize. - * @returns {undefined} + * @returns {void} */ const addAltDropDown = function (elemSel, listSel, callback, opts) { const button = $(elemSel); @@ -3042,7 +3042,7 @@ editor.init = function () { * @param {external:Window} win * @param {module:svgcanvas.SvgCanvas#event:extension_added} ext * @listens module:svgcanvas.SvgCanvas#event:extension_added - * @returns {Promise|undefined} Resolves to `undefined` + * @returns {Promise|void} Resolves to `undefined` */ const extAdded = async function (win, ext) { if (!ext) { @@ -3068,7 +3068,7 @@ editor.init = function () { /** * Clear resize timer if present and if not previously performed, * perform an icon resize. - * @returns {undefined} + * @returns {void} */ function prepResize () { if (resizeTimer) { @@ -3085,7 +3085,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const runCallback = function () { if (ext.callback && !cbCalled) { @@ -3534,7 +3534,7 @@ editor.init = function () { * @param {false} centerInfo.center * @param {module:math.XYObject} centerInfo.newCtr * @listens module:svgcanvas.SvgCanvas#event:updateCanvas - * @returns {undefined} + * @returns {void} */ function (win, {center, newCtr}) { updateCanvas(center, newCtr); @@ -3609,7 +3609,7 @@ editor.init = function () { /** * @param {external:jQuery.fn.SpinButton} ctl Spin Button * @param {string} [val=ctl.value] - * @returns {undefined} + * @returns {void} */ const changeOpacity = function (ctl, val) { if (Utils.isNullish(val)) { val = ctl.value; } @@ -3624,7 +3624,7 @@ editor.init = function () { * @param {external:jQuery.fn.SpinButton} ctl Spin Button * @param {string} [val=ctl.value] * @param {boolean} noUndo - * @returns {undefined} + * @returns {void} */ const changeBlur = function (ctl, val, noUndo) { if (Utils.isNullish(val)) { val = ctl.value; } @@ -3661,7 +3661,7 @@ editor.init = function () { const confirmStr = uiStrings.notification.QmoveElemsToLayer.replace('%s', destLayer); /** * @param {boolean} ok - * @returns {undefined} + * @returns {void} */ const moveToLayer = function (ok) { if (!ok) { return; } @@ -3833,7 +3833,7 @@ editor.init = function () { /** * @param {boolean} active - * @returns {undefined} + * @returns {void} */ editor.setPanning = function (active) { svgCanvas.spaceKey = keypan = active; @@ -3926,13 +3926,13 @@ editor.init = function () { * @callback module:SVGEditor.DropDownCallback * @param {external:jQuery.Event} ev See {@link http://api.jquery.com/Types/#Event} * @listens external:jQuery.Event - * @returns {undefined|boolean} Calls `preventDefault()` and `stopPropagation()` + * @returns {void|boolean} Calls `preventDefault()` and `stopPropagation()` */ /** * @param {Element|string} elem DOM Element or selector * @param {module:SVGEditor.DropDownCallback} callback Mouseup callback * @param {boolean} dropUp - * @returns {undefined} + * @returns {void} */ editor.addDropDown = function (elem, callback, dropUp) { if (!$(elem).length) { return; } // Quit if called on non-existent element @@ -4065,7 +4065,7 @@ editor.init = function () { let inp; /** * - * @returns {undefined} + * @returns {void} */ const unfocus = function () { $(inp).blur(); @@ -4087,7 +4087,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickFHPath = function () { if (toolButtonClick('#tool_fhpath')) { @@ -4097,7 +4097,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickLine = function () { if (toolButtonClick('#tool_line')) { @@ -4107,7 +4107,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickSquare = function () { if (toolButtonClick('#tool_square')) { @@ -4117,7 +4117,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickRect = function () { if (toolButtonClick('#tool_rect')) { @@ -4127,7 +4127,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickFHRect = function () { if (toolButtonClick('#tool_fhrect')) { @@ -4137,7 +4137,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickCircle = function () { if (toolButtonClick('#tool_circle')) { @@ -4147,7 +4147,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickEllipse = function () { if (toolButtonClick('#tool_ellipse')) { @@ -4157,7 +4157,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickFHEllipse = function () { if (toolButtonClick('#tool_fhellipse')) { @@ -4167,7 +4167,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickImage = function () { if (toolButtonClick('#tool_image')) { @@ -4177,7 +4177,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickZoom = function () { if (toolButtonClick('#tool_zoom')) { @@ -4188,7 +4188,7 @@ editor.init = function () { /** * @param {Float} multiplier - * @returns {undefined} + * @returns {void} */ const zoomImage = function (multiplier) { const res = svgCanvas.getResolution(); @@ -4202,7 +4202,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const dblclickZoom = function () { if (toolButtonClick('#tool_zoom')) { @@ -4213,7 +4213,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickText = function () { if (toolButtonClick('#tool_text')) { @@ -4223,7 +4223,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickPath = function () { if (toolButtonClick('#tool_path')) { @@ -4234,7 +4234,7 @@ editor.init = function () { /** * Delete is a contextual tool that only appears in the ribbon if * an element has been selected. - * @returns {undefined} + * @returns {void} */ const deleteSelected = function () { if (!Utils.isNullish(selectedElement) || multiselected) { @@ -4244,7 +4244,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const cutSelected = function () { if (!Utils.isNullish(selectedElement) || multiselected) { @@ -4254,7 +4254,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const copySelected = function () { if (!Utils.isNullish(selectedElement) || multiselected) { @@ -4264,7 +4264,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const pasteInCenter = function () { const zoom = svgCanvas.getZoom(); @@ -4275,7 +4275,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const moveToTopSelected = function () { if (!Utils.isNullish(selectedElement)) { @@ -4285,7 +4285,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const moveToBottomSelected = function () { if (!Utils.isNullish(selectedElement)) { @@ -4295,7 +4295,7 @@ editor.init = function () { /** * @param {"Up"|"Down"} dir - * @returns {undefined} + * @returns {void} */ const moveUpDownSelected = function (dir) { if (!Utils.isNullish(selectedElement)) { @@ -4305,7 +4305,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const convertToPath = function () { if (!Utils.isNullish(selectedElement)) { @@ -4315,7 +4315,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const reorientPath = function () { if (!Utils.isNullish(selectedElement)) { @@ -4339,7 +4339,7 @@ editor.init = function () { /** * @param {Float} dx * @param {Float} dy - * @returns {undefined} + * @returns {void} */ const moveSelected = function (dx, dy) { if (!Utils.isNullish(selectedElement) || multiselected) { @@ -4355,7 +4355,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const linkControlPoints = function () { $('#tool_node_link').toggleClass('push_button_pressed tool_button'); @@ -4365,7 +4365,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clonePathNode = function () { if (path.getNodePoint()) { @@ -4375,7 +4375,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const deletePathNode = function () { if (path.getNodePoint()) { @@ -4385,7 +4385,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const addSubPath = function () { const button = $('#tool_add_subpath'); @@ -4396,7 +4396,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const opencloseSubPath = function () { path.opencloseSubPath(); @@ -4404,7 +4404,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const selectNext = function () { svgCanvas.cycleElement(1); @@ -4412,7 +4412,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const selectPrev = function () { svgCanvas.cycleElement(0); @@ -4421,7 +4421,7 @@ editor.init = function () { /** * @param {0|1} cw * @param {Integer} step - * @returns {undefined} + * @returns {void} */ const rotateSelected = function (cw, step) { if (Utils.isNullish(selectedElement) || multiselected) { return; } @@ -4474,7 +4474,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickSave = function () { // In the future, more options can be provided here @@ -4517,7 +4517,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ function openExportWindow () { const {loadingImage} = uiStrings.notification; @@ -4565,7 +4565,7 @@ editor.init = function () { * By default, svgCanvas.open() is a no-op. It is up to an extension * mechanism (opera widget, etc.) to call `setCustomHandlers()` which * will make it do something. - * @returns {undefined} + * @returns {void} */ const clickOpen = function () { svgCanvas.open(); @@ -4573,7 +4573,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickImport = function () { /* */ @@ -4581,7 +4581,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickUndo = function () { if (undoMgr.getUndoStackSize() > 0) { @@ -4592,7 +4592,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickRedo = function () { if (undoMgr.getRedoStackSize() > 0) { @@ -4603,7 +4603,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickGroup = function () { // group @@ -4617,7 +4617,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickClone = function () { svgCanvas.cloneSelectedElements(20, 20); @@ -4625,7 +4625,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickAlign = function () { const letter = this.id.replace('tool_align', '').charAt(0); @@ -4634,7 +4634,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const clickWireframe = function () { $('#tool_wireframe').toggleClass('push_button_pressed tool_button'); @@ -4661,7 +4661,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const showDocProperties = function () { if (docprops) { return; } @@ -4686,7 +4686,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const showPreferences = function () { if (preferences) { return; } @@ -4715,7 +4715,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const hideSourceEditor = function () { $('#svg_source_editor').hide(); @@ -4753,7 +4753,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const hideDocProperties = function () { $('#svg_docprops').hide(); @@ -4765,7 +4765,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ const hidePreferences = function () { $('#svg_prefs').hide(); @@ -4817,7 +4817,7 @@ editor.init = function () { /** * Save user preferences based on current values in the UI. * @function module:SVGEditor.savePreferences - * @returns {undefined} + * @returns {void} */ const savePreferences = editor.savePreferences = async function () { // Set background @@ -4999,7 +4999,7 @@ editor.init = function () { * @param {external:jQuery} elem * @todo Go back to the color boxes having white background-color and then setting * background-image to none.png (otherwise partially transparent gradients look weird) - * @returns {undefined} + * @returns {void} */ const colorPicker = function (elem) { const picker = elem.attr('id') === 'stroke_color' ? 'stroke' : 'fill'; @@ -5271,7 +5271,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ function deleteLayer () { if (svgCanvas.deleteCurrentLayer()) { @@ -5287,7 +5287,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ async function cloneLayer () { const name = svgCanvas.getCurrentDrawing().getCurrentLayerName() + ' copy'; @@ -5305,7 +5305,7 @@ editor.init = function () { /** * - * @returns {undefined} + * @returns {void} */ function mergeLayer () { if ($('#layerlist tr.layersel').index() === svgCanvas.getCurrentDrawing().getNumLayers() - 1) { @@ -5318,7 +5318,7 @@ editor.init = function () { /** * @param {Integer} pos - * @returns {undefined} + * @returns {void} */ function moveLayer (pos) { const total = svgCanvas.getCurrentDrawing().getNumLayers(); @@ -5362,7 +5362,7 @@ editor.init = function () { /** * @param {Float} delta * @fires module:svgcanvas.SvgCanvas#event:ext-workareaResized - * @returns {undefined} + * @returns {void} */ const changeSidePanelWidth = function (delta) { const rulerX = $('#ruler_x'); @@ -5375,7 +5375,7 @@ editor.init = function () { /** * @param {Event} evt - * @returns {undefined} + * @returns {void} */ const resizeSidePanel = function (evt) { if (!allowmove) { return; } @@ -5398,7 +5398,7 @@ editor.init = function () { /** * If width is non-zero, then fully close it; otherwise fully open it. * @param {boolean} close Forces the side panel closed - * @returns {undefined} + * @returns {void} */ const toggleSidePanel = function (close) { const dpr = window.devicePixelRatio || 1; @@ -5677,7 +5677,7 @@ editor.init = function () { return { /** @lends module:SVGEditor~Actions */ /** - * @returns {undefined} + * @returns {void} */ setAll () { const flyouts = {}; @@ -5785,7 +5785,7 @@ editor.init = function () { $('#tool_zoom').dblclick(dblclickZoom); }, /** - * @returns {undefined} + * @returns {void} */ setTitles () { $.each(keyAssocs, function (keyval, sel) { @@ -5958,7 +5958,7 @@ editor.init = function () { * @param {"dupe"|"delete"|"merge_down"|"merge_all"} action * @param {external:jQuery} el * @param {{x: Float, y: Float, docX: Float, docY: Float}} pos - * @returns {undefined} + * @returns {void} */ const lmenuFunc = function (action, el, pos) { switch (action) { @@ -6004,7 +6004,7 @@ editor.init = function () { canvMenu.enableContextMenuItems('#delete,#cut,#copy'); /** - * @returns {undefined} + * @returns {void} */ function enableOrDisableClipboard () { let svgeditClipboard; @@ -6062,7 +6062,7 @@ editor.init = function () { /** * * @param {Event} e - * @returns {undefined} + * @returns {void} */ function onDragEnter (e) { e.stopPropagation(); @@ -6073,7 +6073,7 @@ editor.init = function () { /** * * @param {Event} e - * @returns {undefined} + * @returns {void} */ function onDragOver (e) { e.stopPropagation(); @@ -6083,7 +6083,7 @@ editor.init = function () { /** * * @param {Event} e - * @returns {undefined} + * @returns {void} */ function onDragLeave (e) { e.stopPropagation(); @@ -6097,7 +6097,7 @@ editor.init = function () { if (window.FileReader) { /** * @param {Event} e - * @returns {undefined} + * @returns {void} */ const importImage = function (e) { $.process_cancel(uiStrings.notification.loadingImage); @@ -6142,7 +6142,7 @@ editor.init = function () { * Insert the new image until we know its dimensions * @param {Float} width * @param {Float} height - * @returns {undefined} + * @returns {void} */ const insertNewImage = function (width, height) { const newImage = svgCanvas.addSVGElementFromJson({ @@ -6339,7 +6339,7 @@ editor.init = function () { /** * @callback module:SVGEditor.ReadyCallback -* @returns {Promise|undefined} +* @returns {Promise|void} */ /** * Queues a callback to be invoked when the editor is ready (or @@ -6400,7 +6400,7 @@ editor.loadFromString = function (str, {noAlert} = {}) { /** * Not presently in use. * @param {PlainObject} featList -* @returns {undefined} +* @returns {void} */ editor.disableUI = function (featList) { // $(function () { @@ -6412,7 +6412,7 @@ editor.disableUI = function (featList) { /** * @callback module:SVGEditor.URLLoadCallback * @param {boolean} success - * @returns {undefined} + * @returns {void} */ /** * @param {string} url URL from which to load an SVG string via Ajax @@ -6510,7 +6510,7 @@ const messageQueue = []; * @param {Any} info.data * @param {string} info.origin * @fires module:svgcanvas.SvgCanvas#event:message - * @returns {undefined} + * @returns {void} */ const messageListener = ({data, origin}) => { // eslint-disable-line no-shadow // console.log('data, origin, extensionsAdded', data, origin, extensionsAdded); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index b2b45705..a98b3dcf 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -180,7 +180,7 @@ let svgcontent = svgdoc.createElementNS(NS.SVG, 'svg'); /** * This function resets the svgcontent element while keeping it in the DOM. * @function module:svgcanvas.SvgCanvas#clearSvgContentElement -* @returns {undefined} +* @returns {void} */ const clearSvgContentElement = canvas.clearSvgContentElement = function () { $(svgcontent).empty(); @@ -211,7 +211,7 @@ let idprefix = 'svg_'; * Changes the ID prefix to the given value. * @function module:svgcanvas.SvgCanvas#setIdPrefix * @param {string} p - String with the new prefix -* @returns {undefined} +* @returns {void} */ canvas.setIdPrefix = function (p) { idprefix = p; @@ -493,7 +493,7 @@ const undoMgr = canvas.undoMgr = new UndoManager({ * @param {string} eventType One of the HistoryEvent types * @param {module:history.HistoryCommand} cmd Fulfills the HistoryCommand interface * @fires module:svgcanvas.SvgCanvas#event:changed - * @returns {undefined} + * @returns {void} */ handleHistoryEvent (eventType, cmd) { const EventTypes = HistoryEventTypes; @@ -626,7 +626,7 @@ const getId = canvas.getId = function () { * @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call} * @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name * @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function. -* @returns {module:svgcanvas.EventHandlerReturn|undefined} +* @returns {module:svgcanvas.EventHandlerReturn|void} */ const call = function (ev, arg) { if (events[ev]) { @@ -843,7 +843,7 @@ pathModule.init( * @param {SVGCircleElement[]} ptsInfo.grips * @fires module:svgcanvas.SvgCanvas#event:pointsAdded * @fires module:svgcanvas.SvgCanvas#event:selected - * @returns {undefined} + * @returns {void} */ addPtsToSelection ({closedSubpath, grips}) { // TODO: Correct this: @@ -857,7 +857,7 @@ pathModule.init( * @param {ChangeElementCommand} changes.cmd * @param {SVGPathElement} changes.elem * @fires module:svgcanvas.SvgCanvas#event:changed - * @returns {undefined} + * @returns {void} */ endChanges ({cmd, elem}) { addCommandToHistory(cmd); @@ -1000,7 +1000,7 @@ this.runExtension = function (name, action, vars) { return this.runExtensions(action, vars, false, (n) => n === name); }; /** -* @typedef {module:svgcanvas.ExtensionMouseDownStatus|module:svgcanvas.ExtensionMouseUpStatus|module:svgcanvas.ExtensionIDsUpdatedStatus|module:locale.ExtensionLocaleData[]|undefined} module:svgcanvas.ExtensionStatus +* @typedef {module:svgcanvas.ExtensionMouseDownStatus|module:svgcanvas.ExtensionMouseUpStatus|module:svgcanvas.ExtensionIDsUpdatedStatus|module:locale.ExtensionLocaleData[]|void} module:svgcanvas.ExtensionStatus * @tutorial ExtensionDocs */ /** @@ -1067,12 +1067,12 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray, /** * @function module:svgcanvas.ExtensionInitResponse#mouseDown * @param {module:svgcanvas.SvgCanvas#event:ext-mouseDown} arg - * @returns {undefined|module:svgcanvas.ExtensionMouseDownStatus} + * @returns {void|module:svgcanvas.ExtensionMouseDownStatus} */ /** * @function module:svgcanvas.ExtensionInitResponse#mouseMove * @param {module:svgcanvas.SvgCanvas#event:ext-mouseMove} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#mouseUp @@ -1082,7 +1082,7 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray, /** * @function module:svgcanvas.ExtensionInitResponse#zoomChanged * @param {module:svgcanvas.SvgCanvas#event:ext-zoomChanged} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#IDsUpdated @@ -1092,37 +1092,37 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray, /** * @function module:svgcanvas.ExtensionInitResponse#canvasUpdated * @param {module:svgcanvas.SvgCanvas#event:ext-canvasUpdated} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#toolButtonStateUpdate * @param {module:svgcanvas.SvgCanvas#event:ext-toolButtonStateUpdate} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#selectedChanged * @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#elementTransition * @param {module:svgcanvas.SvgCanvas#event:ext-elementTransition} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#elementChanged * @param {module:svgcanvas.SvgCanvas#event:ext-elementChanged} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#langReady * @param {module:svgcanvas.SvgCanvas#event:ext-langReady} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#langChanged * @param {module:svgcanvas.SvgCanvas#event:ext-langChanged} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#addLangData @@ -1132,18 +1132,18 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray, /** * @function module:svgcanvas.ExtensionInitResponse#onNewDocument * @param {module:svgcanvas.SvgCanvas#event:ext-onNewDocument} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#workareaResized * @param {module:svgcanvas.SvgCanvas#event:ext-workareaResized} arg - * @returns {undefined} + * @returns {void} */ /** * @function module:svgcanvas.ExtensionInitResponse#callback * @this module:SVGEditor * @param {module:svgcanvas.SvgCanvas#event:ext-callback} arg - * @returns {undefined} + * @returns {void} */ /** @@ -1307,7 +1307,7 @@ const getVisibleElementsAndBBoxes = this.getVisibleElementsAndBBoxes = function * Wrap an SVG element into a group element, mark the group as 'gsvg'. * @function module:svgcanvas.SvgCanvas#groupSvgElem * @param {Element} elem - SVG element to wrap -* @returns {undefined} +* @returns {void} */ const groupSvgElem = this.groupSvgElem = function (elem) { const g = document.createElementNS(NS.SVG, 'g'); @@ -1375,11 +1375,11 @@ canvas.call = call; * [`init()`]{@link module:svgcanvas.ExtensionInitCallback} * along with the name of the extension. * @event module:svgcanvas.SvgCanvas#event:extension_added - * @type {module:svgcanvas.ExtensionInitResponsePlusName|undefined} + * @type {module:svgcanvas.ExtensionInitResponsePlusName|void} */ /** * @event module:svgcanvas.SvgCanvas#event:extensions_added - * @type {undefined} + * @type {void} */ /** * @typedef {PlainObject} module:svgcanvas.Message @@ -1401,15 +1401,15 @@ canvas.call = call; */ /** * @event module:svgcanvas.SvgCanvas#event:unsetnonce - * @type {undefined} + * @type {void} */ /** * @event module:svgcanvas.SvgCanvas#event:zoomDone - * @type {undefined} + * @type {void} */ /** * @event module:svgcanvas.SvgCanvas#event:cleared - * @type {undefined} + * @type {void} */ /** @@ -1424,7 +1424,7 @@ canvas.call = call; * Creating a cover-all class until {@link https://github.com/jsdoc3/jsdoc/issues/1545} may be supported. * `undefined` may be returned by {@link module:svgcanvas.SvgCanvas#event:extension_added} if the extension's `init` returns `undefined` It is also the type for the following events "zoomDone", "unsetnonce", "cleared", and "extensions_added". * @event module:svgcanvas.SvgCanvas#event:GenericCanvasEvent - * @type {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset|module:svgcanvas.SvgCanvas#event:pointsAdded|module:svgcanvas.SvgCanvas#event:extension_added|module:svgcanvas.SvgCanvas#event:extensions_added|module:svgcanvas.SvgCanvas#event:message|module:svgcanvas.SvgCanvas#event:transition|module:svgcanvas.SvgCanvas#event:zoomed|module:svgcanvas.SvgCanvas#event:updateCanvas|module:svgcanvas.SvgCanvas#event:saved|module:svgcanvas.SvgCanvas#event:exported|module:svgcanvas.SvgCanvas#event:exportedPDF|module:svgcanvas.SvgCanvas#event:setnonce|module:svgcanvas.SvgCanvas#event:unsetnonce|undefined} + * @type {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset|module:svgcanvas.SvgCanvas#event:pointsAdded|module:svgcanvas.SvgCanvas#event:extension_added|module:svgcanvas.SvgCanvas#event:extensions_added|module:svgcanvas.SvgCanvas#event:message|module:svgcanvas.SvgCanvas#event:transition|module:svgcanvas.SvgCanvas#event:zoomed|module:svgcanvas.SvgCanvas#event:updateCanvas|module:svgcanvas.SvgCanvas#event:saved|module:svgcanvas.SvgCanvas#event:exported|module:svgcanvas.SvgCanvas#event:exportedPDF|module:svgcanvas.SvgCanvas#event:setnonce|module:svgcanvas.SvgCanvas#event:unsetnonce|void} */ /** @@ -1458,7 +1458,7 @@ canvas.bind = function (ev, f) { * Runs the SVG Document through the sanitizer and then updates its paths. * @function module:svgcanvas.SvgCanvas#prepareSvg * @param {XMLDocument} newDoc - The SVG DOM document -* @returns {undefined} +* @returns {void} */ this.prepareSvg = function (newDoc) { this.sanitizeSvg(newDoc.documentElement); @@ -1506,7 +1506,7 @@ const ffClone = function (elem) { * @param {string|Float} val - The new rotation angle in degrees * @param {boolean} preventUndo - Indicates whether the action should be undoable or not * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setRotationAngle = function (val, preventUndo) { // ensure val is the proper type @@ -1560,7 +1560,7 @@ this.setRotationAngle = function (val, preventUndo) { * adding the changes to a single batch command. * @function module:svgcanvas.SvgCanvas#recalculateAllSelectedDimensions * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ const recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function () { const text = (currentResizeMode === 'none' ? 'position' : 'size'); @@ -1586,7 +1586,7 @@ const recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = * Debug tool to easily see the current matrix in the browser's console. * @function module:svgcanvas~logMatrix * @param {SVGMatrix} m The matrix - * @returns {undefined} + * @returns {void} */ const logMatrix = function (m) { console.log([m.a, m.b, m.c, m.d, m.e, m.f]); // eslint-disable-line no-console @@ -1606,7 +1606,7 @@ let rootSctm = null; * @function module:svgcanvas.SvgCanvas#selectOnly * @param {Element[]} elems - an array of DOM elements to be selected * @param {boolean} showGrips - Indicates whether the resize grips should be shown -* @returns {undefined} +* @returns {void} */ const selectOnly = this.selectOnly = function (elems, showGrips) { clearSelection(true); @@ -1620,7 +1620,7 @@ const selectOnly = this.selectOnly = function (elems, showGrips) { * Removes elements from the selection. * @function module:svgcanvas.SvgCanvas#removeFromSelection * @param {Element[]} elemsToRemove - An array of elements to remove from selection -* @returns {undefined} +* @returns {void} */ /* const removeFromSelection = */ this.removeFromSelection = function (elemsToRemove) { if (isNullish(selectedElements[0])) { return; } @@ -1647,7 +1647,7 @@ const selectOnly = this.selectOnly = function (elems, showGrips) { /** * Clears the selection, then adds all elements in the current layer to the selection. * @function module:svgcanvas.SvgCanvas#selectAllInCurrentLayer -* @returns {undefined} +* @returns {void} */ this.selectAllInCurrentLayer = function () { const currentLayer = getCurrentDrawing().getCurrentLayer(); @@ -1728,7 +1728,7 @@ const getBsplinePoint = function (t) { * and do nothing else. * @param {MouseEvent} evt * @fires module:svgcanvas.SvgCanvas#event:ext-mouseDown - * @returns {undefined} + * @returns {void} */ const mouseDown = function (evt) { if (canvas.spaceKey || evt.button === 1) { return; } @@ -2116,7 +2116,7 @@ const mouseDown = function (evt) { * @param {MouseEvent} evt * @fires module:svgcanvas.SvgCanvas#event:transition * @fires module:svgcanvas.SvgCanvas#event:ext-mouseMove - * @returns {undefined} + * @returns {void} */ const mouseMove = function (evt) { if (!started) { return; } @@ -2566,7 +2566,7 @@ const mouseMove = function (evt) { * @fires module:svgcanvas.SvgCanvas#event:zoomed * @fires module:svgcanvas.SvgCanvas#event:changed * @fires module:svgcanvas.SvgCanvas#event:ext-mouseUp - * @returns {undefined} + * @returns {void} */ const mouseUp = function (evt) { if (evt.button === 2) { return; } @@ -2953,7 +2953,7 @@ $(container).bind( * @param {Event} e * @fires module:svgcanvas.SvgCanvas#event:updateCanvas * @fires module:svgcanvas.SvgCanvas#event:zoomDone - * @returns {undefined} + * @returns {void} */ function (e) { if (!e.shiftKey) { return; } @@ -3058,7 +3058,7 @@ let allowDbl; /** * * @param {Integer} index - * @returns {undefined} + * @returns {void} */ function setCursor (index) { const empty = (textinput.value === ''); @@ -3115,7 +3115,7 @@ function setCursor (index) { * @param {Integer} start * @param {Integer} end * @param {boolean} skipInput - * @returns {undefined} + * @returns {void} */ function setSelection (start, end, skipInput) { if (start === end) { @@ -3197,7 +3197,7 @@ function getIndexFromPoint (mouseX, mouseY) { * * @param {Float} mouseX * @param {Float} mouseY - * @returns {undefined} + * @returns {void} */ function setCursorFromPoint (mouseX, mouseY) { setCursor(getIndexFromPoint(mouseX, mouseY)); @@ -3208,7 +3208,7 @@ function setCursorFromPoint (mouseX, mouseY) { * @param {Float} x * @param {Float} y * @param {boolean} apply - * @returns {undefined} + * @returns {void} */ function setEndSelectionFromPoint (x, y, apply) { const i1 = textinput.selectionStart; @@ -3279,7 +3279,7 @@ function hideCursor () { /** * * @param {Event} evt - * @returns {undefined} + * @returns {void} */ function selectAll (evt) { setSelection(0, curtext.textContent.length); @@ -3289,7 +3289,7 @@ function selectAll (evt) { /** * * @param {Event} evt - * @returns {undefined} + * @returns {void} */ function selectWord (evt) { if (!allowDbl || !curtext) { return; } @@ -3318,7 +3318,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { * @param {Element} target * @param {Float} x * @param {Float} y - * @returns {undefined} + * @returns {void} */ select (target, x, y) { curtext = target; @@ -3326,7 +3326,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { }, /** * @param {Element} elem - * @returns {undefined} + * @returns {void} */ start (elem) { curtext = elem; @@ -3337,7 +3337,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { * @param {Element} mouseTarget * @param {Float} startX * @param {Float} startY - * @returns {undefined} + * @returns {void} */ mouseDown (evt, mouseTarget, startX, startY) { const pt = screenToPt(startX, startY); @@ -3352,7 +3352,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { /** * @param {Float} mouseX * @param {Float} mouseY - * @returns {undefined} + * @returns {void} */ mouseMove (mouseX, mouseY) { const pt = screenToPt(mouseX, mouseY); @@ -3362,7 +3362,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { * @param {external:MouseEvent} evt * @param {Float} mouseX * @param {Float} mouseY - * @returns {undefined} + * @returns {void} */ mouseUp (evt, mouseX, mouseY) { const pt = screenToPt(mouseX, mouseY); @@ -3388,13 +3388,13 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { /** * @function * @param {Integer} index - * @returns {undefined} + * @returns {void} */ setCursor, /** * @param {Float} x * @param {Float} y - * @returns {undefined} + * @returns {void} */ toEditMode (x, y) { allowDbl = false; @@ -3427,7 +3427,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { /** * @param {boolean|Element} selectElem * @fires module:svgcanvas.SvgCanvas#event:selected - * @returns {undefined} + * @returns {void} */ toSelectMode (selectElem) { currentMode = 'select'; @@ -3459,14 +3459,14 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { }, /** * @param {Element} elem - * @returns {undefined} + * @returns {void} */ setInputElem (elem) { textinput = elem; // $(textinput).blur(hideCursor); }, /** - * @returns {undefined} + * @returns {void} */ clear () { if (currentMode === 'textedit') { @@ -3475,7 +3475,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ { }, /** * @param {Element} inputElem Not in use - * @returns {undefined} + * @returns {void} */ init (inputElem) { if (!curtext) { return; } @@ -3835,7 +3835,7 @@ this.svgToString = function (elem, indent) { * Function to run when image data is found * @callback module:svgcanvas.ImageEmbeddedCallback * @param {string|false} result Data URL - * @returns {undefined} + * @returns {void} */ /** * Converts a given image file to a data URL when possible, then runs a given callback. @@ -3876,7 +3876,7 @@ this.embedImage = function (src) { * Sets a given URL to be a "last good image" URL. * @function module:svgcanvas.SvgCanvas#setGoodImage * @param {string} val -* @returns {undefined} +* @returns {void} */ this.setGoodImage = function (val) { lastGoodImgUrl = val; @@ -3885,7 +3885,7 @@ this.setGoodImage = function (val) { /** * Does nothing by default, handled by optional widget/extension. * @function module:svgcanvas.SvgCanvas#open -* @returns {undefined} +* @returns {void} */ this.open = function () { /* */ @@ -3898,7 +3898,7 @@ this.open = function () { * @function module:svgcanvas.SvgCanvas#save * @param {module:svgcanvas.SaveOptions} opts * @fires module:svgcanvas.SvgCanvas#event:saved -* @returns {undefined} +* @returns {void} */ this.save = function (opts) { // remove the selected outline before serializing @@ -4011,7 +4011,7 @@ this.rasterExport = async function (imgType, quality, exportWindowName, opts = { let bloburl; /** * Called when `bloburl` is available for export. - * @returns {undefined} + * @returns {void} */ function done () { const obj = { @@ -4038,7 +4038,7 @@ this.rasterExport = async function (imgType, quality, exportWindowName, opts = { * @external jsPDF */ /** - * @typedef {undefined|"save"|"arraybuffer"|"blob"|"datauristring"|"dataurlstring"|"dataurlnewwindow"|"datauri"|"dataurl"} external:jsPDF.OutputType + * @typedef {void|"save"|"arraybuffer"|"blob"|"datauristring"|"dataurlstring"|"dataurlnewwindow"|"datauri"|"dataurl"} external:jsPDF.OutputType * @todo Newer version to add also allows these `outputType` values "bloburi"|"bloburl" which return strings, so document here and for `outputType` of `module:svgcanvas.PDFExportedResults` below if added */ /** @@ -4146,7 +4146,7 @@ this.getSvgString = function () { * @function module:svgcanvas.SvgCanvas#randomizeIds * @param {boolean} [enableRandomization] If true, adds a nonce to the prefix. Thus * `svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true)` -* @returns {undefined} +* @returns {void} */ this.randomizeIds = function (enableRandomization) { if (arguments.length > 0 && enableRandomization === false) { @@ -4160,7 +4160,7 @@ this.randomizeIds = function (enableRandomization) { * Ensure each element has a unique ID. * @function module:svgcanvas.SvgCanvas#uniquifyElems * @param {Element} g - The parent element of the tree to give unique IDs -* @returns {undefined} +* @returns {void} */ const uniquifyElems = this.uniquifyElems = function (g) { const ids = {}; @@ -4254,7 +4254,7 @@ const uniquifyElems = this.uniquifyElems = function (g) { * Assigns reference data for each use element. * @function module:svgcanvas.SvgCanvas#setUseData * @param {Element} parent -* @returns {undefined} +* @returns {void} */ const setUseData = this.setUseData = function (parent) { let elems = $(parent); @@ -4278,7 +4278,7 @@ const setUseData = this.setUseData = function (parent) { * Converts gradients from userSpaceOnUse to objectBoundingBox. * @function module:svgcanvas.SvgCanvas#convertGradients * @param {Element} elem -* @returns {undefined} +* @returns {void} */ const convertGradients = this.convertGradients = function (elem) { let elems = $(elem).find('linearGradient, radialGradient'); @@ -4357,7 +4357,7 @@ const convertGradients = this.convertGradients = function (elem) { * @function module:svgcanvas.SvgCanvas#convertToGroup * @param {Element} elem * @fires module:svgcanvas.SvgCanvas#event:selected -* @returns {undefined} +* @returns {void} */ const convertToGroup = this.convertToGroup = function (elem) { if (!elem) { @@ -4826,7 +4826,7 @@ draw.init( addCommandToHistory, /** * @fires module:svgcanvas.SvgCanvas#event:changed - * @returns {undefined} + * @returns {void} */ changeSVGContent () { call('changed', [svgcontent]); @@ -4842,7 +4842,7 @@ draw.init( * Clears the current document. This is not an undoable action. * @function module:svgcanvas.SvgCanvas#clear * @fires module:svgcanvas.SvgCanvas#event:cleared -* @returns {undefined} +* @returns {void} */ this.clear = function () { pathActions.clear(); @@ -4928,7 +4928,7 @@ this.getVersion = function () { * Update interface strings with given values. * @function module:svgcanvas.SvgCanvas#setUiStrings * @param {module:path.uiStrings} strs - Object with strings (see the [locales API]{@link module:locale.LocaleStrings} and the [tutorial]{@tutorial LocaleDocs}) -* @returns {undefined} +* @returns {void} */ this.setUiStrings = function (strs) { Object.assign(uiStrings, strs.notification); @@ -4940,7 +4940,7 @@ this.setUiStrings = function (strs) { * Update configuration options with given values. * @function module:svgcanvas.SvgCanvas#setConfig * @param {module:SVGEditor.Config} opts - Object with options -* @returns {undefined} +* @returns {void} */ this.setConfig = function (opts) { Object.assign(curConfig, opts); @@ -4949,7 +4949,7 @@ this.setConfig = function (opts) { /** * @function module:svgcanvas.SvgCanvas#getTitle * @param {Element} [elem] -* @returns {string|undefined} the current group/SVG's title contents or +* @returns {string|void} the current group/SVG's title contents or * `undefined` if no element is passed nd there are no selected elements. */ this.getTitle = function (elem) { @@ -4970,7 +4970,7 @@ this.getTitle = function (elem) { * @function module:svgcanvas.SvgCanvas#setGroupTitle * @param {string} val * @todo Combine this with `setDocumentTitle` -* @returns {undefined} +* @returns {void} */ this.setGroupTitle = function (val) { let elem = selectedElements[0]; @@ -5004,7 +5004,7 @@ this.setGroupTitle = function (val) { /** * @function module:svgcanvas.SvgCanvas#getDocumentTitle -* @returns {string|undefined} The current document title or an empty string if not found +* @returns {string|void} The current document title or an empty string if not found */ const getDocumentTitle = this.getDocumentTitle = function () { return canvas.getTitle(svgcontent); @@ -5015,7 +5015,7 @@ const getDocumentTitle = this.getDocumentTitle = function () { * This is an undoable action. * @function module:svgcanvas.SvgCanvas#setDocumentTitle * @param {string} newTitle - String with the new title -* @returns {undefined} +* @returns {void} */ this.setDocumentTitle = function (newTitle) { const childs = svgcontent.childNodes; @@ -5148,7 +5148,7 @@ this.getOffset = function () { * @param {"selection"|"canvas"|"content"|"layer"|module:SVGEditor.BBoxObjectWithFactor} val - Bounding box object to zoom to or string indicating zoom option. Note: the object value type is defined in `svg-editor.js` * @param {Integer} editorW - The editor's workarea box's width * @param {Integer} editorH - The editor's workarea box's height -* @returns {module:svgcanvas.ZoomAndBBox|undefined} +* @returns {module:svgcanvas.ZoomAndBBox|void} */ this.setBBoxZoom = function (val, editorW, editorH) { let spacer = 0.85; @@ -5256,18 +5256,18 @@ this.setBBoxZoom = function (val, editorW, editorH) { /** * Called when new image is created * @event module:svgcanvas.SvgCanvas#event:ext-onNewDocument - * @type {undefined} + * @type {void} */ /** * Called when sidepanel is resized or toggled * @event module:svgcanvas.SvgCanvas#event:ext-workareaResized - * @type {undefined} + * @type {void} */ /** * Called upon addition of the extension, or, if svgicons are set, * after the icons are ready when extension SVG icons have loaded. * @event module:svgcanvas.SvgCanvas#event:ext-callback - * @type {undefined} + * @type {void} */ /** @@ -5275,7 +5275,7 @@ this.setBBoxZoom = function (val, editorW, editorH) { * @function module:svgcanvas.SvgCanvas#setZoom * @param {Float} zoomLevel - Float indicating the zoom level to change to * @fires module:svgcanvas.SvgCanvas#event:ext-zoomChanged -* @returns {undefined} +* @returns {void} */ this.setZoom = function (zoomLevel) { const res = getResolution(); @@ -5301,7 +5301,7 @@ this.getMode = function () { * Sets the editor's mode to the given string. * @function module:svgcanvas.SvgCanvas#setMode * @param {string} name - String with the new mode to change to -* @returns {undefined} +* @returns {void} */ this.setMode = function (name) { pathActions.clear(true); @@ -5335,7 +5335,7 @@ this.getColor = function (type) { * @param {string} val - The value to set the stroke attribute to * @param {boolean} preventUndo - Boolean indicating whether or not this should be an undoable option * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setColor = function (type, val, preventUndo) { curShape[type] = val; @@ -5344,7 +5344,7 @@ this.setColor = function (type, val, preventUndo) { /** * * @param {Element} e - * @returns {undefined} + * @returns {void} */ function addNonG (e) { if (e.nodeName !== 'g') { @@ -5380,7 +5380,7 @@ this.setColor = function (type, val, preventUndo) { * Apply the current gradient to selected element's fill or stroke. * @function module:svgcanvas.SvgCanvas#setGradient * @param {"fill"|"stroke"} type - String indicating "fill" or "stroke" to apply to an element -* @returns {undefined} +* @returns {void} */ const setGradient = this.setGradient = function (type) { if (!curProperties[type + '_paint'] || curProperties[type + '_paint'].type === 'solidColor') { return; } @@ -5466,7 +5466,7 @@ const findDuplicateGradient = function (grad) { * @function module:svgcanvas.SvgCanvas#setPaint * @param {"fill"|"stroke"} type - String with "fill" or "stroke" * @param {module:jGraduate.jGraduatePaintOptions} paint - The jGraduate paint object to apply -* @returns {undefined} +* @returns {void} */ this.setPaint = function (type, paint) { // make a copy @@ -5490,7 +5490,7 @@ this.setPaint = function (type, paint) { /** * @function module:svgcanvas.SvgCanvas#setStrokePaint * @param {module:jGraduate~Paint} paint -* @returns {undefined} +* @returns {void} */ this.setStrokePaint = function (paint) { this.setPaint('stroke', paint); @@ -5499,7 +5499,7 @@ this.setStrokePaint = function (paint) { /** * @function module:svgcanvas.SvgCanvas#setFillPaint * @param {module:jGraduate~Paint} paint -* @returns {undefined} +* @returns {void} */ this.setFillPaint = function (paint) { this.setPaint('fill', paint); @@ -5519,7 +5519,7 @@ this.getStrokeWidth = function () { * @function module:svgcanvas.SvgCanvas#setStrokeWidth * @param {Float} val - A Float indicating the new stroke width value * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setStrokeWidth = function (val) { if (val === 0 && ['line', 'path'].includes(currentMode)) { @@ -5532,7 +5532,7 @@ this.setStrokeWidth = function (val) { /** * * @param {Element} e - * @returns {undefined} + * @returns {void} */ function addNonG (e) { if (e.nodeName !== 'g') { @@ -5562,7 +5562,7 @@ this.setStrokeWidth = function (val) { * @param {string} attr - String with the attribute name * @param {string|Float} val - String or number with the attribute value * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setStrokeAttr = function (attr, val) { curShape[attr.replace('-', '_')] = val; @@ -5616,7 +5616,7 @@ this.getOpacity = getOpacity; * Sets the given opacity on the current selected elements. * @function module:svgcanvas.SvgCanvas#setOpacity * @param {string} val -* @returns {undefined} +* @returns {void} */ this.setOpacity = function (val) { curShape.opacity = val; @@ -5645,7 +5645,7 @@ this.getStrokeOpacity = function () { * @param {string} type - String with "fill" or "stroke" * @param {Float} val - Float with the new opacity value * @param {boolean} preventUndo - Indicates whether or not this should be an undoable action -* @returns {undefined} +* @returns {void} */ this.setPaintOpacity = function (type, val, preventUndo) { curShape[type + '_opacity'] = val; @@ -5697,7 +5697,7 @@ let filterHidden = false; * Sets the `stdDeviation` blur value on the selected element without being undoable. * @function module:svgcanvas.SvgCanvas#setBlurNoUndo * @param {Float} val - The new `stdDeviation` value -* @returns {undefined} +* @returns {void} */ canvas.setBlurNoUndo = function (val) { if (!filter) { @@ -5726,7 +5726,7 @@ canvas.setBlurNoUndo = function (val) { /** * - * @returns {undefined} + * @returns {void} */ function finishChange () { const bCmd = canvas.undoMgr.finishUndoableChange(); @@ -5742,7 +5742,7 @@ function finishChange () { * @function module:svgcanvas.SvgCanvas#setBlurOffsets * @param {Element} filterElem - The filter DOM element to update * @param {Float} stdDev - The standard deviation value on which to base the offset size -* @returns {undefined} +* @returns {void} */ canvas.setBlurOffsets = function (filterElem, stdDev) { if (stdDev > 3) { @@ -5767,7 +5767,7 @@ canvas.setBlurOffsets = function (filterElem, stdDev) { * @function module:svgcanvas.SvgCanvas#setBlur * @param {Float} val - Float with the new `stdDeviation` blur value * @param {boolean} complete - Whether or not the action should be completed (to add to the undo manager) -* @returns {undefined} +* @returns {void} */ canvas.setBlur = function (val, complete) { if (curCommand) { @@ -5850,7 +5850,7 @@ this.getBold = function () { * Make the selected element bold or normal. * @function module:svgcanvas.SvgCanvas#setBold * @param {boolean} b - Indicates bold (`true`) or normal (`false`) -* @returns {undefined} +* @returns {void} */ this.setBold = function (b) { const selected = selectedElements[0]; @@ -5881,7 +5881,7 @@ this.getItalic = function () { * Make the selected element italic or normal. * @function module:svgcanvas.SvgCanvas#setItalic * @param {boolean} i - Indicates italic (`true`) or normal (`false`) -* @returns {undefined} +* @returns {void} */ this.setItalic = function (i) { const selected = selectedElements[0]; @@ -5906,7 +5906,7 @@ this.getFontFamily = function () { * Set the new font family. * @function module:svgcanvas.SvgCanvas#setFontFamily * @param {string} val - String with the new font family -* @returns {undefined} +* @returns {void} */ this.setFontFamily = function (val) { curText.font_family = val; @@ -5920,7 +5920,7 @@ this.setFontFamily = function (val) { * Set the new font color. * @function module:svgcanvas.SvgCanvas#setFontColor * @param {string} val - String with the new font color -* @returns {undefined} +* @returns {void} */ this.setFontColor = function (val) { curText.fill = val; @@ -5947,7 +5947,7 @@ this.getFontSize = function () { * Applies the given font size to the selected element. * @function module:svgcanvas.SvgCanvas#setFontSize * @param {Float} val - Float with the new font size -* @returns {undefined} +* @returns {void} */ this.setFontSize = function (val) { curText.font_size = val; @@ -5971,7 +5971,7 @@ this.getText = function () { * Updates the text element with the given string. * @function module:svgcanvas.SvgCanvas#setTextContent * @param {string} val - String with the new text -* @returns {undefined} +* @returns {void} */ this.setTextContent = function (val) { changeSelectedAttribute('#text', val); @@ -5985,7 +5985,7 @@ this.setTextContent = function (val) { * @function module:svgcanvas.SvgCanvas#setImageURL * @param {string} val - String with the image URL/path * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setImageURL = function (val) { const elem = selectedElements[0]; @@ -6028,7 +6028,7 @@ this.setImageURL = function (val) { * Sets the new link URL for the selected anchor element. * @function module:svgcanvas.SvgCanvas#setLinkURL * @param {string} val - String with the link URL/path -* @returns {undefined} +* @returns {void} */ this.setLinkURL = function (val) { let elem = selectedElements[0]; @@ -6063,7 +6063,7 @@ this.setLinkURL = function (val) { * @function module:svgcanvas.SvgCanvas#setRectRadius * @param {string|Float} val - The new radius * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.setRectRadius = function (val) { const selected = selectedElements[0]; @@ -6082,7 +6082,7 @@ this.setRectRadius = function (val) { * Wraps the selected element(s) in an anchor element or converts group to one. * @function module:svgcanvas.SvgCanvas#makeHyperlink * @param {string} url -* @returns {undefined} +* @returns {void} */ this.makeHyperlink = function (url) { canvas.groupSelectedElements('a', url); @@ -6093,7 +6093,7 @@ this.makeHyperlink = function (url) { /** * @function module:svgcanvas.SvgCanvas#removeHyperlink -* @returns {undefined} +* @returns {void} */ this.removeHyperlink = function () { canvas.ungroupSelectedElement(); @@ -6107,7 +6107,7 @@ this.removeHyperlink = function () { * Sets the new segment type to the selected segment(s). * @function module:svgcanvas.SvgCanvas#setSegType * @param {Integer} newType - New segment type. See {@link https://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathSeg} for list -* @returns {undefined} +* @returns {void} */ this.setSegType = function (newType) { pathActions.setSegType(newType); @@ -6119,7 +6119,7 @@ this.setSegType = function (newType) { * @todo (codedread): Remove the getBBox argument and split this function into two. * @param {Element} elem - The DOM element to be converted * @param {boolean} getBBox - Boolean on whether or not to only return the path's BBox -* @returns {undefined|DOMRect|false|SVGPathElement|null} If the getBBox flag is true, the resulting path's bounding box object. +* @returns {void|DOMRect|false|SVGPathElement|null} If the getBBox flag is true, the resulting path's bounding box object. * Otherwise the resulting path element is returned. */ this.convertToPath = function (elem, getBBox) { @@ -6156,7 +6156,7 @@ this.convertToPath = function (elem, getBBox) { * @param {string} attr - Attribute name * @param {string|Float} newValue - String or number with the new attribute value * @param {Element[]} elems - The DOM elements to apply the change to -* @returns {undefined} +* @returns {void} */ const changeSelectedAttributeNoUndo = function (attr, newValue, elems) { if (currentMode === 'pathedit') { @@ -6280,7 +6280,7 @@ const changeSelectedAttributeNoUndo = function (attr, newValue, elems) { * @param {string} attr - String with the attribute name * @param {string|Float} val - String or number with the new attribute value * @param {Element[]} elems - The DOM elements to apply the change to -* @returns {undefined} +* @returns {void} */ const changeSelectedAttribute = this.changeSelectedAttribute = function (attr, val, elems) { elems = elems || selectedElements; @@ -6300,7 +6300,7 @@ const changeSelectedAttribute = this.changeSelectedAttribute = function (attr, v * history stack. * @function module:svgcanvas.SvgCanvas#deleteSelectedElements * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.deleteSelectedElements = function () { const batchCmd = new BatchCommand('Delete Elements'); @@ -6342,7 +6342,7 @@ this.deleteSelectedElements = function () { * Removes all selected elements from the DOM and adds the change to the * history stack. Remembers removed elements on the clipboard. * @function module:svgcanvas.SvgCanvas#cutSelectedElements -* @returns {undefined} +* @returns {void} */ this.cutSelectedElements = function () { canvas.copySelectedElements(); @@ -6352,7 +6352,7 @@ this.cutSelectedElements = function () { /** * Remembers the current selected elements on the clipboard. * @function module:svgcanvas.SvgCanvas#copySelectedElements -* @returns {undefined} +* @returns {void} */ this.copySelectedElements = function () { localStorage.setItem('svgedit_clipboard', JSON.stringify( @@ -6364,12 +6364,12 @@ this.copySelectedElements = function () { /** * @function module:svgcanvas.SvgCanvas#pasteElements -* @param {"in_place"|"point"|undefined} type -* @param {Integer|undefined} x Expected if type is "point" -* @param {Integer|undefined} y Expected if type is "point" +* @param {"in_place"|"point"|void} type +* @param {Integer|void} x Expected if type is "point" +* @param {Integer|void} y Expected if type is "point" * @fires module:svgcanvas.SvgCanvas#event:changed * @fires module:svgcanvas.SvgCanvas#event:ext-IDsUpdated -* @returns {undefined} +* @returns {void} */ this.pasteElements = function (type, x, y) { let clipb = JSON.parse(localStorage.getItem('svgedit_clipboard')); @@ -6391,7 +6391,7 @@ this.pasteElements = function (type, x, y) { /** * * @param {module:svgcanvas.SVGAsJSON} elem - * @returns {undefined} + * @returns {void} */ function checkIDs (elem) { if (elem.attr && elem.attr.id) { @@ -6474,7 +6474,7 @@ this.pasteElements = function (type, x, y) { * @function module:svgcanvas.SvgCanvas#groupSelectedElements * @param {"a"|"g"} [type="g"] - type of element to group into, defaults to `` * @param {string} [urlArg] -* @returns {undefined} +* @returns {void} */ this.groupSelectedElements = function (type, urlArg) { if (!type) { type = 'g'; } @@ -6534,7 +6534,7 @@ this.groupSelectedElements = function (type, urlArg) { * @function module:svgcanvas.SvgCanvas#pushGroupProperties * @param {SVGAElement|SVGGElement} g * @param {boolean} undoable -* @returns {BatchCommand|undefined} +* @returns {BatchCommand|void} */ const pushGroupProperties = this.pushGroupProperties = function (g, undoable) { const children = g.childNodes; @@ -6720,7 +6720,7 @@ const pushGroupProperties = this.pushGroupProperties = function (g, undoable) { * Unwraps all the elements in a selected group (`g`) element. This requires * significant recalculations to apply group's transforms, etc. to its children. * @function module:svgcanvas.SvgCanvas#ungroupSelectedElement -* @returns {undefined} +* @returns {void} */ this.ungroupSelectedElement = function () { let g = selectedElements[0]; @@ -6792,7 +6792,7 @@ this.ungroupSelectedElement = function () { * other elements. * @function module:svgcanvas.SvgCanvas#moveToTopSelectedElement * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.moveToTopSelectedElement = function () { const [selected] = selectedElements; @@ -6815,7 +6815,7 @@ this.moveToTopSelectedElement = function () { * other elements. * @function module:svgcanvas.SvgCanvas#moveToBottomSelectedElement * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.moveToBottomSelectedElement = function () { const [selected] = selectedElements; @@ -6848,7 +6848,7 @@ this.moveToBottomSelectedElement = function () { * @function module:svgcanvas.SvgCanvas#moveUpDownSelected * @param {"Up"|"Down"} dir - String that's either 'Up' or 'Down' * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {undefined} +* @returns {void} */ this.moveUpDownSelected = function (dir) { const selected = selectedElements[0]; @@ -6891,7 +6891,7 @@ this.moveUpDownSelected = function (dir) { * @param {Float} dy - Float with the distance to move on the y-axis * @param {boolean} undoable - Boolean indicating whether or not the action should be undoable * @fires module:svgcanvas.SvgCanvas#event:changed -* @returns {BatchCommand|undefined} Batch command for the move +* @returns {BatchCommand|void} Batch command for the move */ this.moveSelectedElements = function (dx, dy, undoable) { // if undoable is not sent, default to true @@ -6961,7 +6961,7 @@ this.moveSelectedElements = function (dx, dy, undoable) { * @function module:svgcanvas.SvgCanvas#cloneSelectedElements * @param {Float} x Float with the distance to move on the x-axis * @param {Float} y Float with the distance to move on the y-axis -* @returns {undefined} +* @returns {void} */ this.cloneSelectedElements = function (x, y) { let i, elem; @@ -7008,7 +7008,7 @@ this.cloneSelectedElements = function (x, y) { * @function module:svgcanvas.SvgCanvas#alignSelectedElements * @param {string} type - String with single character indicating the alignment type * @param {"selected"|"largest"|"smallest"|"page"} relativeTo -* @returns {undefined} +* @returns {void} */ this.alignSelectedElements = function (type, relativeTo) { const bboxes = []; // angles = []; @@ -7193,7 +7193,7 @@ this.updateCanvas = function (w, h) { * @function module:svgcanvas.SvgCanvas#setBackground * @param {string} color - String with fill color to apply * @param {string} url - URL or path to image to use -* @returns {undefined} +* @returns {void} */ this.setBackground = function (color, url) { const bg = getElem('canvasBackground'); @@ -7223,7 +7223,7 @@ this.setBackground = function (color, url) { * @function module:svgcanvas.SvgCanvas#cycleElement * @param {boolean} next - true = next and false = previous element * @fires module:svgcanvas.SvgCanvas#event:selected -* @returns {undefined} +* @returns {void} */ this.cycleElement = function (next) { let num; diff --git a/editor/svgicons/jQuery.svgIcons.js b/editor/svgicons/jQuery.svgIcons.js index 968c4eea..e6f4901c 100644 --- a/editor/svgicons/jQuery.svgIcons.js +++ b/editor/svgicons/jQuery.svgIcons.js @@ -143,7 +143,7 @@ export default function jQueryPluginSVGIcons ($) { * the `alt` text * @param {string} [opts.testIconAlt="icon"] Alt text for the injected test image. * In case wish to ensure have one for accessibility - * @returns {undefined} + * @returns {void} */ $.svgIcons = function (file, opts = {}) { const svgns = 'http://www.w3.org/2000/svg', @@ -208,9 +208,9 @@ export default function jQueryPluginSVGIcons ($) { /** * - * @param {"ajax"|0|undefined} evt + * @param {"ajax"|0|void} evt * @param {boolean} [noWait] - * @returns {undefined} + * @returns {void} */ function getIcons (evt, noWait) { if (evt !== 'ajax') { @@ -263,7 +263,7 @@ export default function jQueryPluginSVGIcons ($) { * @param {external:jQuery} icon A wrapped `defs` or Image * @param {string} id SVG icon ID * @param {boolean} setID Whether to set the ID attribute (with `id`) - * @returns {undefined} + * @returns {void} */ function setIcon (target, icon, id, setID) { if (isOpera) icon.css('visibility', 'hidden'); @@ -293,7 +293,7 @@ export default function jQueryPluginSVGIcons ($) { /** * @param {external:jQuery} icon A wrapped `defs` or Image * @param {string} id SVG icon ID - * @returns {undefined} + * @returns {void} */ function addIcon (icon, id) { if (opts.id_match === undefined || opts.id_match !== false) { @@ -306,7 +306,7 @@ export default function jQueryPluginSVGIcons ($) { * * @param {boolean} [toImage] * @param {external:jQuery.svgIcons.Fallback} [fallback] - * @returns {undefined} + * @returns {void} */ function makeIcons (toImage = false, fallback) { if (iconsMade) return; @@ -473,7 +473,7 @@ export default function jQueryPluginSVGIcons ($) { }; /** - * @returns {undefined} + * @returns {void} */ function useFallback () { if (file.includes('.svgz')) { @@ -519,7 +519,7 @@ export default function jQueryPluginSVGIcons ($) { * @function external:jQuery.resizeSvgIcons * @param {PlainObject.} obj Object with * selectors as keys. The values are sizes. - * @returns {undefined} + * @returns {void} */ $.resizeSvgIcons = function (obj) { // FF2 and older don't detect .svg_icon, so we change it detect svg elems instead diff --git a/editor/svgtransformlist.js b/editor/svgtransformlist.js index 1b99d0d3..7bce15f8 100644 --- a/editor/svgtransformlist.js +++ b/editor/svgtransformlist.js @@ -61,7 +61,7 @@ let listMap_ = {}; */ /** * @function module:SVGTransformList.SVGEditTransformList#clear -* @returns {undefined} +* @returns {void} */ /** * @function module:SVGTransformList.SVGEditTransformList#initialize @@ -199,7 +199,7 @@ export class SVGTransformList {// eslint-disable-line no-shadow this.numberOfItems = 0; } /** - * @returns {undefined} + * @returns {void} */ clear () { this.numberOfItems = 0; @@ -318,7 +318,7 @@ export class SVGTransformList {// eslint-disable-line no-shadow /** * @function module:SVGTransformList.resetListMap -* @returns {undefined} +* @returns {void} */ export const resetListMap = function () { listMap_ = {}; @@ -328,7 +328,7 @@ export const resetListMap = function () { * Removes transforms of the given element from the map. * @function module:SVGTransformList.removeElementFromListMap * @param {Element} elem - a DOM Element - * @returns {undefined} + * @returns {void} */ export let removeElementFromListMap = function (elem) { // eslint-disable-line import/no-mutable-exports if (elem.id && listMap_[elem.id]) { @@ -375,7 +375,7 @@ export const getTransformList = function (elem) { * Replace `removeElementFromListMap` for unit-testing. * @function module:SVGTransformList.changeRemoveElementFromListMap * @param {module:SVGTransformList.removeElementFromListMap} cb Passed a single argument `elem` -* @returns {undefined} +* @returns {void} */ export const changeRemoveElementFromListMap = function (cb) { // eslint-disable-line promise/prefer-await-to-callbacks diff --git a/editor/touch.js b/editor/touch.js index 256e665d..265b8c38 100644 --- a/editor/touch.js +++ b/editor/touch.js @@ -2,7 +2,7 @@ /** * * @param {Event} ev - * @returns {undefined} + * @returns {void} */ function touchHandler (ev) { const {changedTouches} = ev, diff --git a/editor/units.js b/editor/units.js index d5f83416..1eda9250 100644 --- a/editor/units.js +++ b/editor/units.js @@ -74,7 +74,7 @@ let typeMap_ = {}; * * @function module:units.init * @param {module:units.ElementContainer} elementContainer - An object implementing the ElementContainer interface. - * @returns {undefined} + * @returns {void} */ export const init = function (elementContainer) { elementContainer_ = elementContainer; @@ -165,7 +165,7 @@ export const convertUnit = function (val, unit) { * @param {Element} elem - DOM element to be changed * @param {string} attr - Name of the attribute associated with the value * @param {string} val - Attribute value to convert -* @returns {undefined} +* @returns {void} */ export const setUnitAttr = function (elem, attr, val) { // if (!isNaN(val)) { @@ -217,7 +217,7 @@ const attrsToConvert = { * Converts all applicable attributes to the configured baseUnit. * @function module:units.convertAttrs * @param {Element} element - A DOM element whose attributes should be converted -* @returns {undefined} +* @returns {void} */ export const convertAttrs = function (element) { const elName = element.tagName; diff --git a/editor/utilities.js b/editor/utilities.js index b60273bb..e4e64176 100644 --- a/editor/utilities.js +++ b/editor/utilities.js @@ -93,7 +93,7 @@ let svgroot_ = null; /** * @function module:utilities.init * @param {module:utilities.EditorContext} editorContext -* @returns {undefined} +* @returns {void} */ export const init = function (editorContext) { editorContext_ = editorContext; @@ -371,7 +371,7 @@ export const bboxToObj = function ({x, y, width, height}) { /** * @callback module:utilities.TreeWalker * @param {Element} elem - DOM element being traversed -* @returns {undefined} +* @returns {void} */ /** @@ -379,7 +379,7 @@ export const bboxToObj = function ({x, y, width, height}) { * @function module:utilities.walkTree * @param {Element} elem - DOM element to traverse * @param {module:utilities.TreeWalker} cbFn - Callback function to run on each element -* @returns {undefined} +* @returns {void} */ export const walkTree = function (elem, cbFn) { if (elem && elem.nodeType === 1) { @@ -397,7 +397,7 @@ export const walkTree = function (elem, cbFn) { * @todo FIXME: Shouldn't this be calling walkTreePost? * @param {Element} elem - DOM element to traverse * @param {module:utilities.TreeWalker} cbFn - Callback function to run on each element -* @returns {undefined} +* @returns {void} */ export const walkTreePost = function (elem, cbFn) { if (elem && elem.nodeType === 1) { @@ -450,7 +450,7 @@ export let getHref = function (elem) { // eslint-disable-line import/no-mutable- * @function module:utilities.setHref * @param {Element} elem * @param {string} val -* @returns {undefined} +* @returns {void} */ export let setHref = function (elem, val) { // eslint-disable-line import/no-mutable-exports elem.setAttributeNS(NS.XLINK, 'xlink:href', val); @@ -1222,7 +1222,7 @@ export const getElem = (supportsSelectors()) * @param {PlainObject.} attrs - Object with attribute keys/values * @param {Integer} [suspendLength] - Milliseconds to suspend redraw * @param {boolean} [unitCheck=false] - Boolean to indicate the need to use units.setUnitAttr -* @returns {undefined} +* @returns {void} */ export const assignAttributes = function (elem, attrs, suspendLength, unitCheck) { for (const [key, value] of Object.entries(attrs)) { @@ -1244,7 +1244,7 @@ export const assignAttributes = function (elem, attrs, suspendLength, unitCheck) * Remove unneeded (default) attributes, making resulting SVG smaller. * @function module:utilities.cleanupElement * @param {Element} element - DOM element to clean up -* @returns {undefined} +* @returns {void} */ export const cleanupElement = function (element) { const defaults = { @@ -1305,7 +1305,7 @@ export const regexEscape = function (str) { * Prevents default browser click behaviour on the given element. * @function module:utilities.preventClickDefault * @param {Element} img - The DOM element to prevent the click on - * @returns {undefined} + * @returns {void} */ export const preventClickDefault = function (img) { $(img).click(function (e) { e.preventDefault(); }); @@ -1380,7 +1380,7 @@ export const isNullish = (val) => { * Overwrite methods for unit testing. * @function module:utilities.mock * @param {PlainObject} mockMethods -* @returns {undefined} +* @returns {void} */ export const mock = ({ getHref: getHrefUser, setHref: setHrefUser, getRotationAngle: getRotationAngleUser diff --git a/firefox-extension/content/svg-edit-overlay.js b/firefox-extension/content/svg-edit-overlay.js index ccc7523a..0c05a594 100644 --- a/firefox-extension/content/svg-edit-overlay.js +++ b/firefox-extension/content/svg-edit-overlay.js @@ -1,6 +1,6 @@ /** * Opens the dialog with the SVG Editor. - * @returns {undefined} + * @returns {void} */ function startSvgEdit () { // eslint-disable-line no-unused-vars const url = 'chrome://svg-edit/content/editor/svg-editor.html'; diff --git a/jsdoc-check-overly-generic-types.js b/jsdoc-check-overly-generic-types.js index 27b4aa8b..af21063f 100644 --- a/jsdoc-check-overly-generic-types.js +++ b/jsdoc-check-overly-generic-types.js @@ -61,7 +61,7 @@ console.log(`${output}\nTotal failures found: ${total}.\n`); // eslint-disable-l * Eliminates known false matches against overly generic types. * @param {string} file * @param {external:FindInFilesResult} res - * @returns {undefined} + * @returns {void} */ function reduceFalseMatches (file, res) { switch (file) { diff --git a/screencasts/svgopen2010/script.js b/screencasts/svgopen2010/script.js index 19837067..5f8ef951 100644 --- a/screencasts/svgopen2010/script.js +++ b/screencasts/svgopen2010/script.js @@ -286,7 +286,7 @@ const slides = document.querySelectorAll('.slide'); /** * Show or hide the counters. - * @returns {undefined} + * @returns {void} */ function toggleCounter () { [...counters].forEach(function (el) { @@ -296,7 +296,7 @@ function toggleCounter () { /** * Add or remove `reduced` (size) class. - * @returns {undefined} + * @returns {void} */ function toggleSize () { [...slides].forEach(function (el) { @@ -310,7 +310,7 @@ function toggleSize () { /** * Add or remove `no-transitions` class. - * @returns {undefined} + * @returns {void} */ function toggleTransitions () { [...slides].forEach(function (el) { @@ -324,7 +324,7 @@ function toggleTransitions () { /** * Add or remove `no-gradients` class. - * @returns {undefined} + * @returns {void} */ function toggleGradients () { [...slides].forEach(function (el) { diff --git a/test/contextmenu_test.js b/test/contextmenu_test.js index 2aa6931a..d745dd3c 100644 --- a/test/contextmenu_test.js +++ b/test/contextmenu_test.js @@ -10,7 +10,7 @@ QUnit.log((details) => { /** * Tear down tests, resetting custom menus. - * @returns {undefined} + * @returns {void} */ function tearDown () { contextmenu.resetCustomMenus(); diff --git a/test/coords_test.js b/test/coords_test.js index 594a2dd3..e7d9de04 100644 --- a/test/coords_test.js +++ b/test/coords_test.js @@ -21,7 +21,7 @@ let elemId = 1; /** * Set up tests with mock data. - * @returns {undefined} + * @returns {void} */ function setUp () { // Mock out editor context. @@ -52,7 +52,7 @@ function setUp () { /** * Tear down tests, removing elements. - * @returns {undefined} + * @returns {void} */ function tearDown () { while (svg.hasChildNodes()) { diff --git a/test/history_test.js b/test/history_test.js index 6f4edebe..e4ceec1f 100644 --- a/test/history_test.js +++ b/test/history_test.js @@ -50,14 +50,14 @@ class MockHistoryEventHandler { /** * Set up tests (with undo manager). - * @returns {undefined} + * @returns {void} */ function setUp () { undoMgr = new hstory.UndoManager(); } /** * Tear down tests, destroying undo manager. - * @returns {undefined} + * @returns {void} */ function tearDown () { undoMgr = null; diff --git a/test/qunit/qunit-assert-almostEquals.js b/test/qunit/qunit-assert-almostEquals.js index e33265ce..41520cdd 100644 --- a/test/qunit/qunit-assert-almostEquals.js +++ b/test/qunit/qunit-assert-almostEquals.js @@ -5,7 +5,7 @@ const NEAR_ZERO = 5e-6; // 0.000005, Firefox fails at higher levels of precision * @param {Float} actual * @param {Float} expected * @param {string} message - * @returns {undefined} + * @returns {void} */ function almostEquals (actual, expected, message) { message = message || (actual + ' did not equal ' + expected); diff --git a/test/qunit/qunit-assert-close.js b/test/qunit/qunit-assert-close.js index 3f9ccfab..e737b3e6 100644 --- a/test/qunit/qunit-assert-close.js +++ b/test/qunit/qunit-assert-close.js @@ -8,7 +8,7 @@ * @param {Float} expected * @param {Float} maxDifference (the maximum inclusive difference allowed between the actual and expected numbers) * @param {string} [message] Defaults to structured message - * @returns {undefined} + * @returns {void} */ function close (actual, expected, maxDifference, message) { const actualDiff = (actual === expected) ? 0 : Math.abs(actual - expected), @@ -27,7 +27,7 @@ function close (actual, expected, maxDifference, message) { * @param {Float} expected * @param {Float} maxPercentDifference (the maximum inclusive difference percentage allowed between the actual and expected numbers) * @param {string} [message] Defaults to a structured message - * @returns {undefined} + * @returns {void} */ function closePercent (actual, expected, maxPercentDifference, message) { let actualDiff, result; @@ -57,7 +57,7 @@ function closePercent (actual, expected, maxPercentDifference, message) { * @param {Float} expected * @param {Float} minDifference (the minimum exclusive difference allowed between the actual and expected numbers) * @param {string} [message] Defaults to structured message - * @returns {undefined} + * @returns {void} */ function notClose (actual, expected, minDifference, message) { const actualDiff = Math.abs(actual - expected), @@ -76,7 +76,7 @@ function notClose (actual, expected, minDifference, message) { * @param {Float} expected * @param {Float} minPercentDifference (the minimum exclusive difference percentage allowed between the actual and expected numbers) * @param {string} [message] Defaults to a structured message - * @returns {undefined} + * @returns {void} */ function notClosePercent (actual, expected, minPercentDifference, message) { let actualDiff, result; diff --git a/test/qunit/qunit-assert-expectOutOfBoundsException.js b/test/qunit/qunit-assert-expectOutOfBoundsException.js index 895eec2a..b9a55d2a 100644 --- a/test/qunit/qunit-assert-expectOutOfBoundsException.js +++ b/test/qunit/qunit-assert-expectOutOfBoundsException.js @@ -3,7 +3,7 @@ * @param {GenericObject} obj * @param {GenericCallback} fn * @param {Any} arg1 - * @returns {undefined} + * @returns {void} */ function expectOutOfBoundsException (obj, fn, arg1) { const expected = true; diff --git a/test/recalculate_test.js b/test/recalculate_test.js index 8b069d9d..934cf1a9 100644 --- a/test/recalculate_test.js +++ b/test/recalculate_test.js @@ -23,7 +23,7 @@ let elemId = 1; /** * Initilize modules to set up the tests. - * @returns {undefined} + * @returns {void} */ function setUp () { utilities.init( @@ -65,7 +65,7 @@ let elem; /** * Initialize for tests and set up `rect` element. - * @returns {undefined} + * @returns {void} */ function setUpRect () { setUp(); @@ -79,7 +79,7 @@ function setUpRect () { /** * Initialize for tests and set up `text` element with `tspan` child. - * @returns {undefined} + * @returns {void} */ function setUpTextWithTspan () { setUp(); @@ -99,7 +99,7 @@ function setUpTextWithTspan () { /** * Tear down the tests (empty the svg element). - * @returns {undefined} + * @returns {void} */ function tearDown () { while (svg.hasChildNodes()) { diff --git a/test/select_test.js b/test/select_test.js index 9b7570dd..a3dcd54a 100644 --- a/test/select_test.js +++ b/test/select_test.js @@ -35,7 +35,7 @@ const mockFactory = { /** * Potentially reusable test set-up. - * @returns {undefined} + * @returns {void} */ function setUp () { svgroot = mockFactory.createSVGElement({ @@ -72,7 +72,7 @@ function setUpWithInit () { /** * Tear down the test by emptying our sandbox area. - * @returns {undefined} + * @returns {void} */ function tearDown () { while (sandbox.hasChildNodes()) { diff --git a/test/sinon/sinon-qunit.js b/test/sinon/sinon-qunit.js index bf7637de..b8d4dbbd 100644 --- a/test/sinon/sinon-qunit.js +++ b/test/sinon/sinon-qunit.js @@ -12,7 +12,7 @@ * @param {PlainObject} implementations * @param {external:sinon} implementations.sinon * @param {external:QUnit} implementations.QUnit - * @returns {undefined} + * @returns {void} */ export default function sinonQunit ({sinon, QUnit}) { sinon.assert.fail = function (msg) { diff --git a/test/svgtransformlist_test.js b/test/svgtransformlist_test.js index f2ce5691..77898d11 100644 --- a/test/svgtransformlist_test.js +++ b/test/svgtransformlist_test.js @@ -23,7 +23,7 @@ let svgcontent, rect, circle; /** * Set up tests, adding elements. - * @returns {undefined} + * @returns {void} */ function setUp () { svgcontent = svgroot.appendChild(document.createElementNS(NS.SVG, 'svg')); @@ -35,7 +35,7 @@ function setUp () { /** * Tear down tests, emptying SVG root, and resetting list map. - * @returns {undefined} + * @returns {void} */ function tearDown () { transformlist.resetListMap(); diff --git a/test/units_test.js b/test/units_test.js index 09248998..9d990b66 100644 --- a/test/units_test.js +++ b/test/units_test.js @@ -10,7 +10,7 @@ QUnit.log((details) => { /** * Set up tests, supplying mock data. - * @returns {undefined} + * @returns {void} */ function setUp () { units.init( diff --git a/test/utilities_performance_test.js b/test/utilities_performance_test.js index aa65a7a8..8778adc6 100644 --- a/test/utilities_performance_test.js +++ b/test/utilities_performance_test.js @@ -46,7 +46,7 @@ const textWithMatrixTransform = document.getElementById('svg_text_with_matrix_tr * Toward performance testing, fill document with clones of element. * @param {SVGElement} elem * @param {Integer} count - * @returns {undefined} + * @returns {void} */ function fillDocumentByCloningElement (elem, count) { const elemId = elem.getAttribute('id') + '-'; diff --git a/test/utilities_test.js b/test/utilities_test.js index 9c99e5b2..a8a27ee5 100644 --- a/test/utilities_test.js +++ b/test/utilities_test.js @@ -65,21 +65,21 @@ const mockCount = { /** * Increments clear seleciton count for mock test. - * @returns {undefined} + * @returns {void} */ function mockClearSelection () { mockCount.clearSelection++; } /** * Increments add selection count for mock test. - * @returns {undefined} + * @returns {void} */ function mockAddToSelection () { mockCount.addToSelection++; } /** * Increments add command to history count for mock test. - * @returns {undefined} + * @returns {void} */ function mockAddCommandToHistory () { mockCount.addCommandToHistory++;