- Refactoring: Destructuring, templates, label Unicode code point

- npm: Rename `build-doc` to `build-docs`; add `open-docs` script
This commit is contained in:
Brett Zamir
2019-04-08 10:50:50 +08:00
parent 91c0dc549b
commit 0c1ddd44fa
18 changed files with 290 additions and 243 deletions

94
dist/index-es.js vendored
View File

@@ -9377,7 +9377,7 @@ function addScriptAtts(script, atts) {
* @function module:importModule.importSetGlobalDefault
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The value to which it resolves depends on the export of the targeted module.
* @returns {Promise<*>} The value to which it resolves depends on the export of the targeted module.
*/
@@ -9390,7 +9390,7 @@ function importSetGlobalDefault(url, config) {
* @function module:importModule.importSetGlobal
* @param {string|string[]} url
* @param {module:importModule.ImportConfig} config
* @returns {Promise} The promise resolves to either an `ArbitraryModule` or
* @returns {Promise<ArbitraryModule>} The promise resolves to either an `ArbitraryModule` or
* any other value depends on the export of the targeted module.
*/
@@ -9402,7 +9402,7 @@ function importSetGlobal(_x, _x2) {
* @author Brett Zamir (other items are from `dynamic-import-polyfill`)
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @returns {Promise} Resolves to `undefined` or rejects with an `Error` upon a
* @returns {Promise<void|Error>} Resolves to `undefined` or rejects with an `Error` upon a
* script loading error
*/
@@ -9493,14 +9493,14 @@ function importScript(url) {
});
}
/**
*
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
*
* @param {string|string[]} url
* @param {PlainObject} [atts={}]
* @param {PlainObject} opts
* @param {boolean} [opts.returnDefault=false} = {}]
* @returns {Promise<*>} Resolves to value of loading module or rejects with
* `Error` upon a script loading error.
*/
function importModule(url) {
var atts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -9592,13 +9592,19 @@ function jQueryPluginDBox($) {
var box = $('#dialog_box'),
btnHolder = $('#dialog_buttons'),
dialogContent = $('#dialog_content');
/**
* @typedef {PlainObject} module:jQueryPluginDBox.PromiseResultObject
* @property {string|true} response
* @property {boolean} checked
*/
/**
* Resolves to `false` (if cancelled), for prompts and selects
* without checkboxes, it resolves to the value of the form control. For other
* types without checkboxes, it resolves to `true`. For checkboxes, it resolves
* to an object with the `response` key containing the same value as the previous
* mentioned (string or `true`) and a `checked` (boolean) property.
* @typedef {Promise} module:jQueryPluginDBox.PromiseResult
* @typedef {Promise<boolean|string|module:jQueryPluginDBox.PromiseResultObject>} module:jQueryPluginDBox.PromiseResult
*/
/**
@@ -14608,7 +14614,7 @@ function SvgCanvas(container, config) {
/**
* @function module:svgcanvas.ExtensionInitResponse#addLangData
* @param {module:svgcanvas.SvgCanvas#event:ext-addLangData} arg
* @returns {Promise} Resolves to {@link module:locale.ExtensionLocaleData}
* @returns {Promise<module:locale.ExtensionLocaleData>} Resolves to {@link module:locale.ExtensionLocaleData}
*/
/**
@@ -14634,7 +14640,7 @@ function SvgCanvas(container, config) {
* @callback module:svgcanvas.ExtensionInitCallback
* @this module:SVGEditor
* @param {module:svgcanvas.ExtensionArgumentObject} arg
* @returns {Promise} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
* @returns {Promise<module:svgcanvas.ExtensionInitResponse|void>} Resolves to [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse} or `undefined`
*/
/**
@@ -14652,7 +14658,7 @@ function SvgCanvas(container, config) {
* @fires module:svgcanvas.SvgCanvas#event:extension_added
* @throws {TypeError|Error} `TypeError` if `extInitFunc` is not a function, `Error`
* if extension of supplied name already exists
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@@ -14985,7 +14991,7 @@ function SvgCanvas(container, config) {
/**
* The promise return, if present, resolves to `undefined`
* (`extension_added`, `exported`, `saved`)
* @typedef {Promise|undefined} module:svgcanvas.EventHandlerReturn
* @typedef {Promise<void>|void} module:svgcanvas.EventHandlerReturn
*/
/**
@@ -17688,7 +17694,7 @@ function SvgCanvas(container, config) {
* Converts a given image file to a data URL when possible, then runs a given callback.
* @function module:svgcanvas.SvgCanvas#embedImage
* @param {string} src - The path/URL of the image
* @returns {Promise} Resolves to Data URL (string|false)
* @returns {Promise<string|false>} Resolves to a Data URL (string|false)
*/
@@ -17840,7 +17846,7 @@ function SvgCanvas(container, config) {
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
* @returns {Promise<module:svgcanvas.ImageExportedResults>} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport =
@@ -17987,7 +17993,7 @@ function SvgCanvas(container, config) {
* @param {string} [exportWindowName] Will also be used for the download file name here
* @param {external:jsPDF.OutputType} [outputType="dataurlstring"]
* @fires module:svgcanvas.SvgCanvas#event:exportedPDF
* @returns {Promise} Resolves to {@link module:svgcanvas.PDFExportedResults}
* @returns {Promise<module:svgcanvas.PDFExportedResults>} Resolves to {@link module:svgcanvas.PDFExportedResults}
*/
@@ -28172,7 +28178,7 @@ var init$7 = function init(editor) {
* @function module:locale.readLang
* @param {module:locale.LocaleStrings} langData See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @returns {Promise} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
* @returns {Promise<module:locale.LangAndData>} Resolves to [`LangAndData`]{@link module:locale.LangAndData}
*/
var readLang =
@@ -28425,7 +28431,7 @@ function () {
* @fires module:svgcanvas.SvgCanvas#event:ext-addLangData
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
var putLocale =
@@ -28918,7 +28924,7 @@ curConfig = {
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @throws {Error} Upon failure to load SVG
* @returns {Promise} Resolves to undefined upon success (or if `noAlert` is
* @returns {Promise<void>} Resolves to undefined upon success (or if `noAlert` is
* falsey, though only until after the `alert` is closed); rejects if SVG
* loading fails and `noAlert` is truthy.
*/
@@ -28992,7 +28998,7 @@ function getImportLocale(_ref) {
* @param {PlainObject} localeInfo
* @param {string} [localeInfo.name] Defaults to `defaultName` of {@link module:SVGEditor~getImportLocale}
* @param {string} [localeInfo.lang=defaultLang] Defaults to `defaultLang` of {@link module:SVGEditor~getImportLocale}
* @returns {Promise} Resolves to {@link module:locale.LocaleStrings}
* @returns {Promise<module:locale.LocaleStrings>} Resolves to {@link module:locale.LocaleStrings}
*/
return (
/*#__PURE__*/
@@ -29285,12 +29291,12 @@ editor.setConfig = function (opts, cfgCfg) {
* Allows one to override default SVGEdit `open`, `save`, and
* `export` editor behaviors.
* @param {module:SVGEditor.CustomHandler} opts Extension mechanisms may call `setCustomHandlers` with three functions: `opts.open`, `opts.save`, and `opts.exportImage`
* @returns {undefined}
* @returns {Promise<void>}
*/
editor.setCustomHandlers = function (opts) {
editor.ready(function () {
return editor.ready(function () {
if (opts.open) {
$$b('#tool_open > input[type="file"]').remove();
$$b('#tool_open').show();
@@ -29499,7 +29505,7 @@ editor.init = function () {
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @fires module:svgcanvas.SvgCanvas#event:extensions_added
* @returns {Promise} Resolves to result of {@link module:locale.readLang}
* @returns {Promise<module:locale.LangAndData>} Resolves to result of {@link module:locale.readLang}
*/
@@ -30704,7 +30710,7 @@ editor.init = function () {
/**
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.cancelDeletes=false}]
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@@ -31980,7 +31986,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>|undefined} Resolves to `undefined`
*/
var extAdded =
@@ -33423,7 +33429,7 @@ editor.init = function () {
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@@ -33578,7 +33584,7 @@ editor.init = function () {
};
/**
* @fires module:svgcanvas.SvgCanvas#event:ext-onNewDocument
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@@ -33671,7 +33677,7 @@ editor.init = function () {
var loadingURL;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var clickExport =
@@ -33966,7 +33972,7 @@ editor.init = function () {
};
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
@@ -34177,7 +34183,7 @@ editor.init = function () {
var resetScrollPos = $$b.noop;
/**
*
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/
var cancelOverlays =
@@ -35876,7 +35882,7 @@ editor.init = function () {
return uiStrings$1;
};
/**
* @returns {Promise} Resolves to boolean indicating `true` if there were no changes
* @returns {Promise<boolean>} Resolves to boolean indicating `true` if there were no changes
* and `false` after the user confirms.
*/
@@ -36113,7 +36119,7 @@ editor.init = function () {
* @param {module:locale.LocaleStrings} allStrings See {@tutorial LocaleDocs}
* @fires module:svgcanvas.SvgCanvas#event:ext-langReady
* @fires module:svgcanvas.SvgCanvas#event:ext-langChanged
* @returns {Promise} A Promise which resolves to `undefined`
* @returns {Promise<void>} A Promise which resolves to `undefined`
*/
var setLang = editor.setLang =
@@ -36279,7 +36285,7 @@ editor.init = function () {
};
/**
* @callback module:SVGEditor.ReadyCallback
* @returns {Promise|undefined}
* @returns {Promise<void>|undefined}
*/
/**
@@ -36287,7 +36293,7 @@ editor.init = function () {
* to be invoked immediately if it is already ready--i.e.,
* if `runCallbacks` has been run).
* @param {module:SVGEditor.ReadyCallback} cb Callback to be queued to invoke
* @returns {Promise} Resolves when all callbacks, including the supplied have resolved
* @returns {Promise<ArbitraryCallbackResult>} Resolves when all callbacks, including the supplied have resolved
*/
@@ -36306,7 +36312,7 @@ editor.ready = function (cb) {
};
/**
* Invokes the callbacks previous set by `svgEditor.ready`
* @returns {Promise} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
* @returns {Promise<void>} Resolves to `undefined` if all callbacks succeeded and rejects otherwise
*/
@@ -36363,14 +36369,14 @@ regeneratorRuntime.mark(function _callee20() {
* @param {string} str The SVG string to load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert=false] Option to avoid alert to user and instead get rejected promise
* @returns {Promise}
* @returns {Promise<void>}
*/
editor.loadFromString = function (str) {
var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref39.noAlert;
editor.ready(
return editor.ready(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
@@ -36431,7 +36437,7 @@ editor.disableUI = function (featList) {// $(function () {
* @param {PlainObject} [opts={}] May contain properties: `cache`, `callback`
* @param {boolean} [opts.cache]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` or rejects upon bad loading of
* @returns {Promise<void>} Resolves to `undefined` or rejects upon bad loading of
* the SVG (or upon failure to parse the loaded string) when `noAlert` is
* enabled
*/
@@ -36484,7 +36490,7 @@ editor.loadFromURL = function (url) {
* @param {string} str The Data URI to base64-decode (if relevant) and load
* @param {PlainObject} [opts={}]
* @param {boolean} [opts.noAlert]
* @returns {Promise} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
* @returns {Promise<void>} Resolves to `undefined` and rejects if loading SVG string fails and `noAlert` is enabled
*/
@@ -36492,7 +36498,7 @@ editor.loadFromDataURI = function (str) {
var _ref42 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
noAlert = _ref42.noAlert;
editor.ready(function () {
return editor.ready(function () {
var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/);
@@ -36517,7 +36523,7 @@ editor.loadFromDataURI = function (str) {
* @param {module:svgcanvas.ExtensionInitCallback} init Config to be invoked on this module
* @param {module:svgcanvas.ExtensionInitArgs} initArgs
* @throws {Error} If called too early
* @returns {Promise} Resolves to `undefined`
* @returns {Promise<void>} Resolves to `undefined`
*/