From 5ee7448d3c7f9882d3b717db78babcf560078915 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 12 Jul 2022 18:58:11 -0700 Subject: [PATCH] Format JS files. --- libraries/bootstrap/js/bootstrap.js | 553 +- libraries/bootstrap/js/bootstrap.min.js | 1213 +++- libraries/jquery.hotkeys.js | 243 +- packages/core-js/__tests__/core.test.js | 2 +- packages/core-js/src/index.js | 90 +- packages/core-js/webpack.common.js | 58 +- packages/core-js/webpack.dev.js | 6 +- packages/core-js/webpack.prod.js | 12 +- .../cypress/integration/playground.test.js | 17 +- .../cypress/integration/relationship.test.js | 24 +- packages/editor/cypress/support/commands.js | 7 +- .../src/classes/bootstrap/BootstrapDialog.js | 4 +- .../bootstrap/BootstrapDialogRequest.js | 5 +- .../src/classes/menu/ColorPaletteHtml.js | 105 +- .../src/classes/menu/ColorPalettePanel.js | 15 +- .../src/classes/menu/FontFamilyPanel.js | 15 +- .../editor/src/classes/menu/FontSizePanel.js | 11 +- packages/editor/src/classes/menu/IconPanel.js | 13 +- .../classes/menu/KeyboardShortcutDialog.js | 17 +- .../classes/menu/KeyboardShortcutTooltip.js | 3 +- .../src/classes/menu/ListToolbarPanel.js | 4 +- packages/editor/webpack.common.js | 15 +- packages/editor/webpack.playground.js | 20 +- packages/editor/webpack.prod.js | 8 +- packages/mindplot/cypress/support/commands.js | 7 +- .../src/components/IconGroupRemoveTip.js | 26 +- packages/mindplot/src/components/ImageIcon.js | 329 +- packages/mindplot/src/components/Options.js | 2 +- .../mindplot/src/components/TopicFeature.js | 11 +- .../mindplot/src/components/TopicStyle.js | 17 +- .../src/components/layout/ChangeEvent.js | 14 +- .../src/components/layout/GridSorter.js | 8 +- .../src/components/layout/SymmetricSorter.js | 141 +- .../mindplot/src/components/util/Shape.js | 5 +- .../playground/layout/BalancedTestSuite.js | 107 +- .../playground/layout/SymmetricTestSuite.js | 96 +- .../test/playground/layout/TestSuite.js | 38 +- .../test/playground/layout/lib/raphael-min.js | 5518 ++++++++++++++++- .../mindplot/test/playground/layout/utils.js | 3 +- .../unit/layout/BalancedTestSuite.test.js | 6 +- .../unit/layout/SymmetricTestSuite.test.js | 15 +- packages/web2d/src/components/Group.js | 26 +- packages/web2d/src/components/Line.js | 6 +- packages/web2d/src/components/Point.js | 14 +- packages/web2d/src/components/Toolkit.js | 30 +- packages/web2d/src/components/Workspace.js | 56 +- .../src/components/peer/svg/ElementPeer.js | 19 +- .../src/components/peer/svg/ElipsePeer.js | 4 +- .../web2d/src/components/peer/svg/LinePeer.js | 4 +- .../src/components/peer/svg/PolyLinePeer.js | 21 +- .../src/components/peer/svg/WorkspacePeer.js | 36 +- .../components/peer/utils/PolyLineUtils.js | 7 +- packages/web2d/test/playground/Grid.js | 5 +- packages/web2d/test/playground/arrow.js | 4 +- packages/web2d/test/playground/curvedLine.js | 4 +- packages/web2d/test/playground/events.js | 5 +- packages/web2d/test/playground/font.js | 10 +- packages/web2d/test/playground/group.js | 17 +- packages/web2d/test/playground/image.js | 4 +- packages/web2d/test/playground/line.js | 36 +- packages/web2d/test/playground/polyLine.js | 4 +- packages/web2d/test/playground/prototype.js | 6 +- packages/web2d/test/playground/rect.js | 7 +- packages/web2d/test/playground/shapes.js | 32 +- packages/web2d/test/playground/text.js | 21 +- packages/web2d/test/playground/workspace.js | 9 +- packages/web2d/webpack.common.js | 4 +- packages/webapp/webpack.common.js | 112 +- packages/webapp/webpack.dev.js | 14 +- packages/webapp/webpack.prod.js | 30 +- 70 files changed, 7930 insertions(+), 1420 deletions(-) diff --git a/libraries/bootstrap/js/bootstrap.js b/libraries/bootstrap/js/bootstrap.js index bf5287cc..4bfa9d29 100644 --- a/libraries/bootstrap/js/bootstrap.js +++ b/libraries/bootstrap/js/bootstrap.js @@ -4,7 +4,9 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ -if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery'); } +if (typeof jQuery === 'undefined') { + throw new Error("Bootstrap's JavaScript requires jQuery"); +} /* ======================================================================== * Bootstrap: transition.js v3.1.1 @@ -39,10 +41,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { - let called = false; const - $el = this; - $(this).one($.support.transition.end, () => { called = true; }); - const callback = function () { if (!called) $($el).trigger($.support.transition.end); }; + let called = false; + const $el = this; + $(this).one($.support.transition.end, () => { + called = true; + }); + const callback = function () { + if (!called) $($el).trigger($.support.transition.end); + }; setTimeout(callback, duration); return this; }; @@ -50,7 +56,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $(() => { $.support.transition = transitionEnd(); }); -}(jQuery)); +})(jQuery); /* ======================================================================== * Bootstrap: alert.js v3.1.1 @@ -86,7 +92,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $parent = $this.hasClass('alert') ? $this : $this.parent(); } - $parent.trigger(e = $.Event('close.bs.alert')); + $parent.trigger((e = $.Event('close.bs.alert'))); if (e.isDefaultPrevented()) return; @@ -97,9 +103,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } $.support.transition && $parent.hasClass('fade') - ? $parent - .one($.support.transition.end, removeElement) - .emulateTransitionEnd(150) + ? $parent.one($.support.transition.end, removeElement).emulateTransitionEnd(150) : removeElement(); }; @@ -132,7 +136,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close); -}(jQuery)); +})(jQuery); /* ======================================================================== * Bootstrap: button.js v3.1.1 @@ -169,15 +173,18 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $el[val](data[state] || this.options[state]); // push to event loop to allow forms to submit - setTimeout($.proxy(function () { - if (state == 'loadingText') { - this.isLoading = true; - $el.addClass(d).attr(d, d); - } else if (this.isLoading) { - this.isLoading = false; - $el.removeClass(d).removeAttr(d); - } - }, this), 0); + setTimeout( + $.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true; + $el.addClass(d).attr(d, d); + } else if (this.isLoading) { + this.isLoading = false; + $el.removeClass(d).removeAttr(d); + } + }, this), + 0, + ); }; Button.prototype.toggle = function () { @@ -233,7 +240,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $btn.button('toggle'); e.preventDefault(); }); -}(jQuery)); +})(jQuery); /* ======================================================================== * Bootstrap: carousel.js v3.1.1 @@ -253,9 +260,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.options = options; this.paused = this.sliding = this.interval = this.$active = this.$items = null; - this.options.pause == 'hover' && this.$element - .on('mouseenter', $.proxy(this.pause, this)) - .on('mouseleave', $.proxy(this.cycle, this)); + this.options.pause == 'hover' && + this.$element + .on('mouseenter', $.proxy(this.pause, this)) + .on('mouseleave', $.proxy(this.cycle, this)); }; Carousel.DEFAULTS = { @@ -269,9 +277,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.interval && clearInterval(this.interval); - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)); + this.options.interval && + !this.paused && + (this.interval = setInterval($.proxy(this.next, this), this.options.interval)); return this; }; @@ -287,9 +295,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re const that = this; const activeIndex = this.getActiveIndex(); - if (pos > (this.$items.length - 1) || pos < 0) return; + if (pos > this.$items.length - 1 || pos < 0) return; - if (this.sliding) return this.$element.one('slid.bs.carousel', () => { that.to(pos); }); + if (this.sliding) + return this.$element.one('slid.bs.carousel', () => { + that.to(pos); + }); if (activeIndex == pos) return this.pause().cycle(); return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])); @@ -331,7 +342,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $next = this.$element.find('.item')[fallback](); } - if ($next.hasClass('active')) return this.sliding = false; + if ($next.hasClass('active')) return (this.sliding = false); const e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction }); this.$element.trigger(e); @@ -359,7 +370,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $next.removeClass([type, direction].join(' ')).addClass('active'); $active.removeClass(['active', direction].join(' ')); that.sliding = false; - setTimeout(() => { that.$element.trigger('slid.bs.carousel'); }, 0); + setTimeout(() => { + that.$element.trigger('slid.bs.carousel'); + }, 0); }) .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000); } else { @@ -383,7 +396,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re return this.each(function () { const $this = $(this); let data = $this.data('bs.carousel'); - const options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option === 'object' && option); + const options = $.extend( + {}, + Carousel.DEFAULTS, + $this.data(), + typeof option === 'object' && option, + ); const action = typeof option === 'string' ? option : options.slide; if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))); @@ -407,16 +425,19 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re // ================= $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { - const $this = $(this); let - href; - const $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')); // strip for ie7 + const $this = $(this); + let href; + const $target = $( + $this.attr('data-target') || + ((href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')), + ); // strip for ie7 const options = $.extend({}, $target.data(), $this.data()); let slideIndex = $this.attr('data-slide-to'); if (slideIndex) options.interval = false; $target.carousel(options); - if (slideIndex = $this.attr('data-slide-to')) { + if ((slideIndex = $this.attr('data-slide-to'))) { $target.data('bs.carousel').to(slideIndex); } @@ -429,7 +450,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $carousel.carousel($carousel.data()); }); }); -}(jQuery)); +})(jQuery); /* ======================================================================== * Bootstrap: collapse.js v3.1.1 @@ -479,18 +500,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re const dimension = this.dimension(); - this.$element - .removeClass('collapse') - .addClass('collapsing') - [dimension](0); + this.$element.removeClass('collapse').addClass('collapsing')[dimension](0); this.transitioning = 1; const complete = function () { - this.$element - .removeClass('collapsing') - .addClass('collapse in') - [dimension]('auto'); + this.$element.removeClass('collapsing').addClass('collapse in')[dimension]('auto'); this.transitioning = 0; this.$element.trigger('shown.bs.collapse'); }; @@ -514,29 +529,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re const dimension = this.dimension(); - this.$element - [dimension](this.$element[dimension]()) - [0].offsetHeight; + this.$element[dimension](this.$element[dimension]())[0].offsetHeight; - this.$element - .addClass('collapsing') - .removeClass('collapse') - .removeClass('in'); + this.$element.addClass('collapsing').removeClass('collapse').removeClass('in'); this.transitioning = 1; const complete = function () { this.transitioning = 0; - this.$element - .trigger('hidden.bs.collapse') - .removeClass('collapsing') - .addClass('collapse'); + this.$element.trigger('hidden.bs.collapse').removeClass('collapsing').addClass('collapse'); }; if (!$.support.transition) return complete.call(this); - this.$element - [dimension](0) + this.$element[dimension](0) .one($.support.transition.end, $.proxy(complete, this)) .emulateTransitionEnd(350); }; @@ -554,7 +560,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re return this.each(function () { const $this = $(this); let data = $this.data('bs.collapse'); - const options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option === 'object' && option); + const options = $.extend( + {}, + Collapse.DEFAULTS, + $this.data(), + typeof option === 'object' && option, + ); if (!data && options.toggle && option == 'show') option = !option; if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))); @@ -576,11 +587,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { - const $this = $(this); let - href; - const target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''); // strip for ie7 + const $this = $(this); + let href; + const target = + $this.attr('data-target') || + e.preventDefault() || + ((href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')); // strip for ie7 const $target = $(target); const data = $target.data('bs.collapse'); const option = data ? 'toggle' : $this.data(); @@ -588,13 +600,17 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re const $parent = parent && $(parent); if (!data || !data.transitioning) { - if ($parent) $parent.find(`[data-toggle=collapse][data-parent="${parent}"]`).not($this).addClass('collapsed'); + if ($parent) + $parent + .find(`[data-toggle=collapse][data-parent="${parent}"]`) + .not($this) + .addClass('collapsed'); $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed'); } $target.collapse(option); }); -}(jQuery)); +})(jQuery); /* ======================================================================== * Bootstrap: dropdown.js v3.1.1 @@ -631,13 +647,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } const relatedTarget = { relatedTarget: this }; - $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)); + $parent.trigger((e = $.Event('show.bs.dropdown', relatedTarget))); if (e.isDefaultPrevented()) return; - $parent - .toggleClass('open') - .trigger('shown.bs.dropdown', relatedTarget); + $parent.toggleClass('open').trigger('shown.bs.dropdown', relatedTarget); $this.focus(); } @@ -683,7 +697,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re const $parent = getParent($(this)); const relatedTarget = { relatedTarget: this }; if (!$parent.hasClass('open')) return; - $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)); + $parent.trigger((e = $.Event('hide.bs.dropdown', relatedTarget))); if (e.isDefaultPrevented()) return; $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget); }); @@ -732,10 +746,16 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $(document) .on('click.bs.dropdown.data-api', clearMenus) - .on('click.bs.dropdown.data-api', '.dropdown form', (e) => { e.stopPropagation(); }) + .on('click.bs.dropdown.data-api', '.dropdown form', (e) => { + e.stopPropagation(); + }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) - .on('keydown.bs.dropdown.data-api', `${toggle}, [role=menu], [role=listbox]`, Dropdown.prototype.keydown); -}(jQuery)); + .on( + 'keydown.bs.dropdown.data-api', + `${toggle}, [role=menu], [role=listbox]`, + Dropdown.prototype.keydown, + ); +})(jQuery); /* ======================================================================== * Bootstrap: modal.js v3.1.1 @@ -755,11 +775,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.$backdrop = this.isShown = null; if (this.options.remote) { - this.$element - .find('.modal-content') - .load(this.options.remote, $.proxy(function () { + this.$element.find('.modal-content').load( + this.options.remote, + $.proxy(function () { this.$element.trigger('loaded.bs.modal'); - }, this)); + }, this), + ); } }; @@ -794,28 +815,25 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re that.$element.appendTo(document.body); // don't move modals dom position } - that.$element - .show() - .scrollTop(0); + that.$element.show().scrollTop(0); if (transition) { that.$element[0].offsetWidth; // force reflow } - that.$element - .addClass('in') - .attr('aria-hidden', false); + that.$element.addClass('in').attr('aria-hidden', false); that.enforceFocus(); const e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }); transition - ? that.$element.find('.modal-dialog') // wait for modal to slide in - .one($.support.transition.end, () => { - that.$element.focus().trigger(e); - }) - .emulateTransitionEnd(300) + ? that.$element + .find('.modal-dialog') // wait for modal to slide in + .one($.support.transition.end, () => { + that.$element.focus().trigger(e); + }) + .emulateTransitionEnd(300) : that.$element.focus().trigger(e); }); }; @@ -835,33 +853,36 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $(document).off('focusin.bs.modal'); - this.$element - .removeClass('in') - .attr('aria-hidden', true) - .off('click.dismiss.bs.modal'); + this.$element.removeClass('in').attr('aria-hidden', true).off('click.dismiss.bs.modal'); $.support.transition && this.$element.hasClass('fade') ? this.$element - .one($.support.transition.end, $.proxy(this.hideModal, this)) - .emulateTransitionEnd(300) + .one($.support.transition.end, $.proxy(this.hideModal, this)) + .emulateTransitionEnd(300) : this.hideModal(); }; Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop - .on('focusin.bs.modal', $.proxy(function (e) { - if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { - this.$element.focus(); - } - }, this)); + .on( + 'focusin.bs.modal', + $.proxy(function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.focus(); + } + }, this), + ); }; Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { - this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) { - e.which == 27 && this.hide(); - }, this)); + this.$element.on( + 'keyup.dismiss.bs.modal', + $.proxy(function (e) { + e.which == 27 && this.hide(); + }, this), + ); } else if (!this.isShown) { this.$element.off('keyup.dismiss.bs.modal'); } @@ -887,15 +908,17 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re if (this.isShown && this.options.backdrop) { const doAnimate = $.support.transition && animate; - this.$backdrop = $(`