From e62473d4e9811ba1120688781f145277a85bd3c5 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 22 Mar 2024 15:53:21 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B07355=20-=20Update=20clipboard=20to=202.0?= =?UTF-8?q?.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node_modules/.package-lock.json | 6 +- node_modules/clipboard/.babelrc | 3 - node_modules/clipboard/.babelrc.json | 11 + node_modules/clipboard/.editorconfig | 2 +- node_modules/clipboard/.eslintignore | 12 + node_modules/clipboard/.eslintrc.json | 24 + .../clipboard/.github/issue_template.md | 15 - node_modules/clipboard/.husky/pre-commit | 4 + node_modules/clipboard/.nvmrc | 1 + node_modules/clipboard/.prettierignore | 9 + node_modules/clipboard/.prettierrc.json | 9 + node_modules/clipboard/.travis.yml | 4 - node_modules/clipboard/LICENSE | 21 + node_modules/clipboard/bower.json | 8 +- node_modules/clipboard/composer.json | 4 +- node_modules/clipboard/contributing.md | 1 + node_modules/clipboard/dist/clipboard.js | 1470 ++++++++--------- node_modules/clipboard/dist/clipboard.min.js | 8 +- node_modules/clipboard/karma.conf.js | 47 +- node_modules/clipboard/package.js | 12 +- node_modules/clipboard/package.json | 55 +- node_modules/clipboard/readme.md | 59 +- node_modules/clipboard/webpack.config.js | 65 +- package-lock.json | 14 +- package.json | 2 +- sources/Dependencies/NPM/iTopNPM.php | 3 +- 26 files changed, 935 insertions(+), 934 deletions(-) delete mode 100644 node_modules/clipboard/.babelrc create mode 100644 node_modules/clipboard/.babelrc.json create mode 100644 node_modules/clipboard/.eslintignore create mode 100644 node_modules/clipboard/.eslintrc.json delete mode 100644 node_modules/clipboard/.github/issue_template.md create mode 100644 node_modules/clipboard/.husky/pre-commit create mode 100644 node_modules/clipboard/.nvmrc create mode 100644 node_modules/clipboard/.prettierignore create mode 100644 node_modules/clipboard/.prettierrc.json delete mode 100644 node_modules/clipboard/.travis.yml create mode 100644 node_modules/clipboard/LICENSE diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 6ef712b5e..f5cce1a87 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -92,9 +92,9 @@ } }, "node_modules/clipboard": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", - "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "dependencies": { "good-listener": "^1.2.2", "select": "^1.1.2", diff --git a/node_modules/clipboard/.babelrc b/node_modules/clipboard/.babelrc deleted file mode 100644 index 002b4aa0d..000000000 --- a/node_modules/clipboard/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env"] -} diff --git a/node_modules/clipboard/.babelrc.json b/node_modules/clipboard/.babelrc.json new file mode 100644 index 000000000..b4421995d --- /dev/null +++ b/node_modules/clipboard/.babelrc.json @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "@babel/env", + { + "forceAllTransforms": true, + "modules": false + } + ] + ] +} diff --git a/node_modules/clipboard/.editorconfig b/node_modules/clipboard/.editorconfig index 0f1d01bd1..202ee2182 100644 --- a/node_modules/clipboard/.editorconfig +++ b/node_modules/clipboard/.editorconfig @@ -7,7 +7,7 @@ root = true [*] # Change these settings to your own preference indent_style = space -indent_size = 4 +indent_size = 2 # We recommend you to keep these unchanged end_of_line = lf diff --git a/node_modules/clipboard/.eslintignore b/node_modules/clipboard/.eslintignore new file mode 100644 index 000000000..873054777 --- /dev/null +++ b/node_modules/clipboard/.eslintignore @@ -0,0 +1,12 @@ +# Ignore artifacts: +dist + +lib +npm-debug.log +bower_components +node_modules +yarn-error.log +yarn.lock + +src/*.ts +/*.js diff --git a/node_modules/clipboard/.eslintrc.json b/node_modules/clipboard/.eslintrc.json new file mode 100644 index 000000000..a6890ef2d --- /dev/null +++ b/node_modules/clipboard/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "env": { + "browser": true, + "es2021": true, + "mocha": true + }, + "extends": ["airbnb-base", "plugin:prettier/recommended"], + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error", + "prefer-const": "off", + "camelcase": "off", + "no-underscore-dangle": "off", + "consistent-return": "off", + /* Remove the necessity to use this on classes */ + "class-methods-use-this": "off", + /* Enable variables declarations from shadowing variables declared in the outer scope */ + "no-shadow": "off" + } +} diff --git a/node_modules/clipboard/.github/issue_template.md b/node_modules/clipboard/.github/issue_template.md deleted file mode 100644 index 49389c364..000000000 --- a/node_modules/clipboard/.github/issue_template.md +++ /dev/null @@ -1,15 +0,0 @@ -### Minimal example - -> Fork this [JSFiddle](https://jsfiddle.net/zenorocha/5kk0eysw/) and reproduce your issue. - -### Expected behaviour - -I thought that by going to the page '...' and pressing the button '...' then '...' would happen. - -### Actual behaviour - -Instead of '...', what I saw was that '...' happened instead. - -### Browsers affected - -I tested on all major browsers and only IE 11 does not work. diff --git a/node_modules/clipboard/.husky/pre-commit b/node_modules/clipboard/.husky/pre-commit new file mode 100644 index 000000000..d37daa075 --- /dev/null +++ b/node_modules/clipboard/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/node_modules/clipboard/.nvmrc b/node_modules/clipboard/.nvmrc new file mode 100644 index 000000000..8351c1939 --- /dev/null +++ b/node_modules/clipboard/.nvmrc @@ -0,0 +1 @@ +14 diff --git a/node_modules/clipboard/.prettierignore b/node_modules/clipboard/.prettierignore new file mode 100644 index 000000000..0069bdb3b --- /dev/null +++ b/node_modules/clipboard/.prettierignore @@ -0,0 +1,9 @@ +# Ignore artifacts: +dist + +lib +npm-debug.log +bower_components +node_modules +yarn-error.log +yarn.lock diff --git a/node_modules/clipboard/.prettierrc.json b/node_modules/clipboard/.prettierrc.json new file mode 100644 index 000000000..471698f65 --- /dev/null +++ b/node_modules/clipboard/.prettierrc.json @@ -0,0 +1,9 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": true, + "arrowParens": "always" +} diff --git a/node_modules/clipboard/.travis.yml b/node_modules/clipboard/.travis.yml deleted file mode 100644 index a4bb7b945..000000000 --- a/node_modules/clipboard/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -sudo: false -language: node_js -node_js: - - stable diff --git a/node_modules/clipboard/LICENSE b/node_modules/clipboard/LICENSE new file mode 100644 index 000000000..01cdf0799 --- /dev/null +++ b/node_modules/clipboard/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Zeno Rocha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/clipboard/bower.json b/node_modules/clipboard/bower.json index f7da89c9e..c0b31e4c8 100644 --- a/node_modules/clipboard/bower.json +++ b/node_modules/clipboard/bower.json @@ -1,6 +1,6 @@ { "name": "clipboard", - "version": "2.0.4", + "version": "2.0.11", "description": "Modern copy to clipboard. No Flash. Just 3kb", "license": "MIT", "main": "dist/clipboard.js", @@ -14,9 +14,5 @@ "/src", "/lib" ], - "keywords": [ - "clipboard", - "copy", - "cut" - ] + "keywords": ["clipboard", "copy", "cut"] } diff --git a/node_modules/clipboard/composer.json b/node_modules/clipboard/composer.json index a712d5a23..50a940565 100644 --- a/node_modules/clipboard/composer.json +++ b/node_modules/clipboard/composer.json @@ -6,11 +6,11 @@ "authors": [ { "name": "Zeno Rocha", - "url": "http://zenorocha.com/" + "homepage": "http://zenorocha.com/" } ], "require": { - "robloach/component-installer": "*" + "oomphinc/composer-installers-extender": "*" }, "extra": { "component": { diff --git a/node_modules/clipboard/contributing.md b/node_modules/clipboard/contributing.md index 9ab2c8f74..9146adca8 100644 --- a/node_modules/clipboard/contributing.md +++ b/node_modules/clipboard/contributing.md @@ -24,5 +24,6 @@ Implement your bug fix or feature, write tests to cover it and make sure all tes Documentation is extremely important and takes a fair deal of time and effort to write and keep updated. Please submit any and all improvements you can make to the repository's docs. ## Known issues + If you're using npm@3 you'll probably face some issues related to peerDependencies. https://github.com/npm/npm/issues/9204 diff --git a/node_modules/clipboard/dist/clipboard.js b/node_modules/clipboard/dist/clipboard.js index 14cb08654..aeb826f0f 100644 --- a/node_modules/clipboard/dist/clipboard.js +++ b/node_modules/clipboard/dist/clipboard.js @@ -1,7 +1,7 @@ /*! - * clipboard.js v2.0.4 - * https://zenorocha.github.io/clipboard.js - * + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * * Licensed MIT © Zeno Rocha */ (function webpackUniversalModuleDefinition(root, factory) { @@ -14,277 +14,211 @@ else root["ClipboardJS"] = factory(); })(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { +return /******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 686: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": function() { return /* binding */ clipboard; } +}); -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js +var tiny_emitter = __webpack_require__(279); +var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); +// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js +var listen = __webpack_require__(370); +var listen_default = /*#__PURE__*/__webpack_require__.n(listen); +// EXTERNAL MODULE: ./node_modules/select/src/select.js +var src_select = __webpack_require__(817); +var select_default = /*#__PURE__*/__webpack_require__.n(src_select); +;// CONCATENATED MODULE: ./src/common/command.js +/** + * Executes a given operation type. + * @param {String} type + * @return {Boolean} + */ +function command(type) { + try { + return document.execCommand(type); + } catch (err) { + return false; + } +} +;// CONCATENATED MODULE: ./src/actions/cut.js -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _clipboardAction = __webpack_require__(1); +/** + * Cut action wrapper. + * @param {String|HTMLElement} target + * @return {String} + */ -var _clipboardAction2 = _interopRequireDefault(_clipboardAction); +var ClipboardActionCut = function ClipboardActionCut(target) { + var selectedText = select_default()(target); + command('cut'); + return selectedText; +}; -var _tinyEmitter = __webpack_require__(3); +/* harmony default export */ var actions_cut = (ClipboardActionCut); +;// CONCATENATED MODULE: ./src/common/create-fake-element.js +/** + * Creates a fake textarea element with a value. + * @param {String} value + * @return {HTMLElement} + */ +function createFakeElement(value) { + var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; + var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS -var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); + fakeElement.style.fontSize = '12pt'; // Reset box model -var _goodListener = __webpack_require__(4); + fakeElement.style.border = '0'; + fakeElement.style.padding = '0'; + fakeElement.style.margin = '0'; // Move element out of screen horizontally -var _goodListener2 = _interopRequireDefault(_goodListener); + fakeElement.style.position = 'absolute'; + fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var yPosition = window.pageYOffset || document.documentElement.scrollTop; + fakeElement.style.top = "".concat(yPosition, "px"); + fakeElement.setAttribute('readonly', ''); + fakeElement.value = value; + return fakeElement; +} +;// CONCATENATED MODULE: ./src/actions/copy.js + + + +/** + * Create fake copy action wrapper using a fake element. + * @param {String} target + * @param {Object} options + * @return {String} + */ + +var fakeCopyAction = function fakeCopyAction(value, options) { + var fakeElement = createFakeElement(value); + options.container.appendChild(fakeElement); + var selectedText = select_default()(fakeElement); + command('copy'); + fakeElement.remove(); + return selectedText; +}; +/** + * Copy action wrapper. + * @param {String|HTMLElement} target + * @param {Object} options + * @return {String} + */ + + +var ClipboardActionCopy = function ClipboardActionCopy(target) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + container: document.body + }; + var selectedText = ''; + + if (typeof target === 'string') { + selectedText = fakeCopyAction(target, options); + } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { + // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange + selectedText = fakeCopyAction(target.value, options); + } else { + selectedText = select_default()(target); + command('copy'); + } + + return selectedText; +}; + +/* harmony default export */ var actions_copy = (ClipboardActionCopy); +;// CONCATENATED MODULE: ./src/actions/default.js +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + + +/** + * Inner function which performs selection from either `text` or `target` + * properties and then executes copy or cut operations. + * @param {Object} options + */ + +var ClipboardActionDefault = function ClipboardActionDefault() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + // Defines base properties passed from constructor. + var _options$action = options.action, + action = _options$action === void 0 ? 'copy' : _options$action, + container = options.container, + target = options.target, + text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. + + if (action !== 'copy' && action !== 'cut') { + throw new Error('Invalid "action" value, use either "copy" or "cut"'); + } // Sets the `target` property using an element that will be have its content copied. + + + if (target !== undefined) { + if (target && _typeof(target) === 'object' && target.nodeType === 1) { + if (action === 'copy' && target.hasAttribute('disabled')) { + throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); + } + + if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { + throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); + } + } else { + throw new Error('Invalid "target" value, use a valid Element'); + } + } // Define selection strategy based on `text` property. + + + if (text) { + return actions_copy(text, { + container: container + }); + } // Defines which selection strategy based on `target` property. + + + if (target) { + return action === 'cut' ? actions_cut(target) : actions_copy(target, { + container: container + }); + } +}; + +/* harmony default export */ var actions_default = (ClipboardActionDefault); +;// CONCATENATED MODULE: ./src/clipboard.js +function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -/** - * Base class which takes one or more elements, adds event listeners to them, - * and instantiates a new `ClipboardAction` on each click. - */ -var Clipboard = function (_Emitter) { - _inherits(Clipboard, _Emitter); +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - /** - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - * @param {Object} options - */ - function Clipboard(trigger, options) { - _classCallCheck(this, Clipboard); +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - _this.resolveOptions(options); - _this.listenClick(trigger); - return _this; - } +function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - /** - * Defines if attributes would be resolved using internal setter functions - * or custom functions that were passed in the constructor. - * @param {Object} options - */ +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - _createClass(Clipboard, [{ - key: 'resolveOptions', - value: function resolveOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - this.action = typeof options.action === 'function' ? options.action : this.defaultAction; - this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; - this.text = typeof options.text === 'function' ? options.text : this.defaultText; - this.container = _typeof(options.container) === 'object' ? options.container : document.body; - } - - /** - * Adds a click event listener to the passed trigger. - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - */ - - }, { - key: 'listenClick', - value: function listenClick(trigger) { - var _this2 = this; - - this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) { - return _this2.onClick(e); - }); - } - - /** - * Defines a new `ClipboardAction` on each click event. - * @param {Event} e - */ - - }, { - key: 'onClick', - value: function onClick(e) { - var trigger = e.delegateTarget || e.currentTarget; - - if (this.clipboardAction) { - this.clipboardAction = null; - } - - this.clipboardAction = new _clipboardAction2.default({ - action: this.action(trigger), - target: this.target(trigger), - text: this.text(trigger), - container: this.container, - trigger: trigger, - emitter: this - }); - } - - /** - * Default `action` lookup function. - * @param {Element} trigger - */ - - }, { - key: 'defaultAction', - value: function defaultAction(trigger) { - return getAttributeValue('action', trigger); - } - - /** - * Default `target` lookup function. - * @param {Element} trigger - */ - - }, { - key: 'defaultTarget', - value: function defaultTarget(trigger) { - var selector = getAttributeValue('target', trigger); - - if (selector) { - return document.querySelector(selector); - } - } - - /** - * Returns the support of the given action, or all actions if no action is - * given. - * @param {String} [action] - */ - - }, { - key: 'defaultText', - /** - * Default `text` lookup function. - * @param {Element} trigger - */ - value: function defaultText(trigger) { - return getAttributeValue('text', trigger); - } - /** - * Destroy lifecycle. - */ - - }, { - key: 'destroy', - value: function destroy() { - this.listener.destroy(); - - if (this.clipboardAction) { - this.clipboardAction.destroy(); - this.clipboardAction = null; - } - } - }], [{ - key: 'isSupported', - value: function isSupported() { - var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; - - var actions = typeof action === 'string' ? [action] : action; - var support = !!document.queryCommandSupported; - - actions.forEach(function (action) { - support = support && !!document.queryCommandSupported(action); - }); - - return support; - } - }]); - - return Clipboard; -}(_tinyEmitter2.default); /** * Helper function to retrieve attribute value. @@ -292,414 +226,384 @@ var Clipboard = function (_Emitter) { * @param {Element} element */ - function getAttributeValue(suffix, element) { - var attribute = 'data-clipboard-' + suffix; + var attribute = "data-clipboard-".concat(suffix); - if (!element.hasAttribute(attribute)) { - return; - } + if (!element.hasAttribute(attribute)) { + return; + } - return element.getAttribute(attribute); + return element.getAttribute(attribute); } - -module.exports = Clipboard; - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _select = __webpack_require__(2); - -var _select2 = _interopRequireDefault(_select); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** - * Inner class which performs selection from either `text` or `target` - * properties and then executes copy or cut operations. + * Base class which takes one or more elements, adds event listeners to them, + * and instantiates a new `ClipboardAction` on each click. */ -var ClipboardAction = function () { - /** - * @param {Object} options - */ - function ClipboardAction(options) { - _classCallCheck(this, ClipboardAction); - this.resolveOptions(options); - this.initSelection(); + +var Clipboard = /*#__PURE__*/function (_Emitter) { + _inherits(Clipboard, _Emitter); + + var _super = _createSuper(Clipboard); + + /** + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + * @param {Object} options + */ + function Clipboard(trigger, options) { + var _this; + + _classCallCheck(this, Clipboard); + + _this = _super.call(this); + + _this.resolveOptions(options); + + _this.listenClick(trigger); + + return _this; + } + /** + * Defines if attributes would be resolved using internal setter functions + * or custom functions that were passed in the constructor. + * @param {Object} options + */ + + + _createClass(Clipboard, [{ + key: "resolveOptions", + value: function resolveOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + this.action = typeof options.action === 'function' ? options.action : this.defaultAction; + this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; + this.text = typeof options.text === 'function' ? options.text : this.defaultText; + this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; } - /** - * Defines base properties passed from constructor. - * @param {Object} options + * Adds a click event listener to the passed trigger. + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger */ + }, { + key: "listenClick", + value: function listenClick(trigger) { + var _this2 = this; - _createClass(ClipboardAction, [{ - key: 'resolveOptions', - value: function resolveOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - this.action = options.action; - this.container = options.container; - this.emitter = options.emitter; - this.target = options.target; - this.text = options.text; - this.trigger = options.trigger; - - this.selectedText = ''; - } - - /** - * Decides which selection strategy is going to be applied based - * on the existence of `text` and `target` properties. - */ - - }, { - key: 'initSelection', - value: function initSelection() { - if (this.text) { - this.selectFake(); - } else if (this.target) { - this.selectTarget(); - } - } - - /** - * Creates a fake textarea element, sets its value from `text` property, - * and makes a selection on it. - */ - - }, { - key: 'selectFake', - value: function selectFake() { - var _this = this; - - var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; - - this.removeFake(); - - this.fakeHandlerCallback = function () { - return _this.removeFake(); - }; - this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true; - - this.fakeElem = document.createElement('textarea'); - // Prevent zooming on iOS - this.fakeElem.style.fontSize = '12pt'; - // Reset box model - this.fakeElem.style.border = '0'; - this.fakeElem.style.padding = '0'; - this.fakeElem.style.margin = '0'; - // Move element out of screen horizontally - this.fakeElem.style.position = 'absolute'; - this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; - // Move element to the same position vertically - var yPosition = window.pageYOffset || document.documentElement.scrollTop; - this.fakeElem.style.top = yPosition + 'px'; - - this.fakeElem.setAttribute('readonly', ''); - this.fakeElem.value = this.text; - - this.container.appendChild(this.fakeElem); - - this.selectedText = (0, _select2.default)(this.fakeElem); - this.copyText(); - } - - /** - * Only removes the fake element after another click event, that way - * a user can hit `Ctrl+C` to copy because selection still exists. - */ - - }, { - key: 'removeFake', - value: function removeFake() { - if (this.fakeHandler) { - this.container.removeEventListener('click', this.fakeHandlerCallback); - this.fakeHandler = null; - this.fakeHandlerCallback = null; - } - - if (this.fakeElem) { - this.container.removeChild(this.fakeElem); - this.fakeElem = null; - } - } - - /** - * Selects the content from element passed on `target` property. - */ - - }, { - key: 'selectTarget', - value: function selectTarget() { - this.selectedText = (0, _select2.default)(this.target); - this.copyText(); - } - - /** - * Executes the copy operation based on the current selection. - */ - - }, { - key: 'copyText', - value: function copyText() { - var succeeded = void 0; - - try { - succeeded = document.execCommand(this.action); - } catch (err) { - succeeded = false; - } - - this.handleResult(succeeded); - } - - /** - * Fires an event based on the copy operation result. - * @param {Boolean} succeeded - */ - - }, { - key: 'handleResult', - value: function handleResult(succeeded) { - this.emitter.emit(succeeded ? 'success' : 'error', { - action: this.action, - text: this.selectedText, - trigger: this.trigger, - clearSelection: this.clearSelection.bind(this) - }); - } - - /** - * Moves focus away from `target` and back to the trigger, removes current selection. - */ - - }, { - key: 'clearSelection', - value: function clearSelection() { - if (this.trigger) { - this.trigger.focus(); - } - - window.getSelection().removeAllRanges(); - } - - /** - * Sets the `action` to be performed which can be either 'copy' or 'cut'. - * @param {String} action - */ - - }, { - key: 'destroy', - - - /** - * Destroy lifecycle. - */ - value: function destroy() { - this.removeFake(); - } - }, { - key: 'action', - set: function set() { - var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; - - this._action = action; - - if (this._action !== 'copy' && this._action !== 'cut') { - throw new Error('Invalid "action" value, use either "copy" or "cut"'); - } - } - - /** - * Gets the `action` property. - * @return {String} - */ - , - get: function get() { - return this._action; - } - - /** - * Sets the `target` property using an element - * that will be have its content copied. - * @param {Element} target - */ - - }, { - key: 'target', - set: function set(target) { - if (target !== undefined) { - if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { - if (this.action === 'copy' && target.hasAttribute('disabled')) { - throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); - } - - if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { - throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); - } - - this._target = target; - } else { - throw new Error('Invalid "target" value, use a valid Element'); - } - } - } - - /** - * Gets the `target` property. - * @return {String|HTMLElement} - */ - , - get: function get() { - return this._target; - } - }]); - - return ClipboardAction; -}(); - -module.exports = ClipboardAction; - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -function select(element) { - var selectedText; - - if (element.nodeName === 'SELECT') { - element.focus(); - - selectedText = element.value; + this.listener = listen_default()(trigger, 'click', function (e) { + return _this2.onClick(e); + }); } - else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { - var isReadOnly = element.hasAttribute('readonly'); + /** + * Defines a new `ClipboardAction` on each click event. + * @param {Event} e + */ - if (!isReadOnly) { - element.setAttribute('readonly', ''); + }, { + key: "onClick", + value: function onClick(e) { + var trigger = e.delegateTarget || e.currentTarget; + var action = this.action(trigger) || 'copy'; + var text = actions_default({ + action: action, + container: this.container, + target: this.target(trigger), + text: this.text(trigger) + }); // Fires an event based on the copy operation result. + + this.emit(text ? 'success' : 'error', { + action: action, + text: text, + trigger: trigger, + clearSelection: function clearSelection() { + if (trigger) { + trigger.focus(); + } + + window.getSelection().removeAllRanges(); } - - element.select(); - element.setSelectionRange(0, element.value.length); - - if (!isReadOnly) { - element.removeAttribute('readonly'); - } - - selectedText = element.value; + }); } - else { - if (element.hasAttribute('contenteditable')) { - element.focus(); - } + /** + * Default `action` lookup function. + * @param {Element} trigger + */ - var selection = window.getSelection(); - var range = document.createRange(); - - range.selectNodeContents(element); - selection.removeAllRanges(); - selection.addRange(range); - - selectedText = selection.toString(); + }, { + key: "defaultAction", + value: function defaultAction(trigger) { + return getAttributeValue('action', trigger); } + /** + * Default `target` lookup function. + * @param {Element} trigger + */ - return selectedText; -} + }, { + key: "defaultTarget", + value: function defaultTarget(trigger) { + var selector = getAttributeValue('target', trigger); -module.exports = select; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - -function E () { - // Keep this empty so it's easier to inherit from - // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) -} - -E.prototype = { - on: function (name, callback, ctx) { - var e = this.e || (this.e = {}); - - (e[name] || (e[name] = [])).push({ - fn: callback, - ctx: ctx - }); - - return this; - }, - - once: function (name, callback, ctx) { - var self = this; - function listener () { - self.off(name, listener); - callback.apply(ctx, arguments); - }; - - listener._ = callback - return this.on(name, listener, ctx); - }, - - emit: function (name) { - var data = [].slice.call(arguments, 1); - var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); - var i = 0; - var len = evtArr.length; - - for (i; i < len; i++) { - evtArr[i].fn.apply(evtArr[i].ctx, data); - } - - return this; - }, - - off: function (name, callback) { - var e = this.e || (this.e = {}); - var evts = e[name]; - var liveEvents = []; - - if (evts && callback) { - for (var i = 0, len = evts.length; i < len; i++) { - if (evts[i].fn !== callback && evts[i].fn._ !== callback) - liveEvents.push(evts[i]); + if (selector) { + return document.querySelector(selector); } } + /** + * Allow fire programmatically a copy action + * @param {String|HTMLElement} target + * @param {Object} options + * @returns Text copied. + */ - // Remove event from queue to prevent memory leak - // Suggested by https://github.com/lazd - // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 + }, { + key: "defaultText", - (liveEvents.length) - ? e[name] = liveEvents - : delete e[name]; + /** + * Default `text` lookup function. + * @param {Element} trigger + */ + value: function defaultText(trigger) { + return getAttributeValue('text', trigger); + } + /** + * Destroy lifecycle. + */ - return this; - } -}; + }, { + key: "destroy", + value: function destroy() { + this.listener.destroy(); + } + }], [{ + key: "copy", + value: function copy(target) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + container: document.body + }; + return actions_copy(target, options); + } + /** + * Allow fire programmatically a cut action + * @param {String|HTMLElement} target + * @returns Text cutted. + */ -module.exports = E; + }, { + key: "cut", + value: function cut(target) { + return actions_cut(target); + } + /** + * Returns the support of the given action, or all actions if no action is + * given. + * @param {String} [action] + */ + + }, { + key: "isSupported", + value: function isSupported() { + var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; + var actions = typeof action === 'string' ? [action] : action; + var support = !!document.queryCommandSupported; + actions.forEach(function (action) { + support = support && !!document.queryCommandSupported(action); + }); + return support; + } + }]); + + return Clipboard; +}((tiny_emitter_default())); + +/* harmony default export */ var clipboard = (Clipboard); + +/***/ }), + +/***/ 828: +/***/ (function(module) { + +var DOCUMENT_NODE_TYPE = 9; + +/** + * A polyfill for Element.matches() + */ +if (typeof Element !== 'undefined' && !Element.prototype.matches) { + var proto = Element.prototype; + + proto.matches = proto.matchesSelector || + proto.mozMatchesSelector || + proto.msMatchesSelector || + proto.oMatchesSelector || + proto.webkitMatchesSelector; +} + +/** + * Finds the closest parent that matches a selector. + * + * @param {Element} element + * @param {String} selector + * @return {Function} + */ +function closest (element, selector) { + while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { + if (typeof element.matches === 'function' && + element.matches(selector)) { + return element; + } + element = element.parentNode; + } +} + +module.exports = closest; /***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { -var is = __webpack_require__(5); -var delegate = __webpack_require__(6); +/***/ 438: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var closest = __webpack_require__(828); + +/** + * Delegates event to a selector. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */ +function _delegate(element, selector, type, callback, useCapture) { + var listenerFn = listener.apply(this, arguments); + + element.addEventListener(type, listenerFn, useCapture); + + return { + destroy: function() { + element.removeEventListener(type, listenerFn, useCapture); + } + } +} + +/** + * Delegates event to a selector. + * + * @param {Element|String|Array} [elements] + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */ +function delegate(elements, selector, type, callback, useCapture) { + // Handle the regular Element usage + if (typeof elements.addEventListener === 'function') { + return _delegate.apply(null, arguments); + } + + // Handle Element-less usage, it defaults to global delegation + if (typeof type === 'function') { + // Use `document` as the first parameter, then apply arguments + // This is a short way to .unshift `arguments` without running into deoptimizations + return _delegate.bind(null, document).apply(null, arguments); + } + + // Handle Selector-based usage + if (typeof elements === 'string') { + elements = document.querySelectorAll(elements); + } + + // Handle Array-like based usage + return Array.prototype.map.call(elements, function (element) { + return _delegate(element, selector, type, callback, useCapture); + }); +} + +/** + * Finds closest match and invokes callback. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Function} + */ +function listener(element, selector, type, callback) { + return function(e) { + e.delegateTarget = closest(e.target, selector); + + if (e.delegateTarget) { + callback.call(element, e); + } + } +} + +module.exports = delegate; + + +/***/ }), + +/***/ 879: +/***/ (function(__unused_webpack_module, exports) { + +/** + * Check if argument is a HTML element. + * + * @param {Object} value + * @return {Boolean} + */ +exports.node = function(value) { + return value !== undefined + && value instanceof HTMLElement + && value.nodeType === 1; +}; + +/** + * Check if argument is a list of HTML elements. + * + * @param {Object} value + * @return {Boolean} + */ +exports.nodeList = function(value) { + var type = Object.prototype.toString.call(value); + + return value !== undefined + && (type === '[object NodeList]' || type === '[object HTMLCollection]') + && ('length' in value) + && (value.length === 0 || exports.node(value[0])); +}; + +/** + * Check if argument is a string. + * + * @param {Object} value + * @return {Boolean} + */ +exports.string = function(value) { + return typeof value === 'string' + || value instanceof String; +}; + +/** + * Check if argument is a function. + * + * @param {Object} value + * @return {Boolean} + */ +exports.fn = function(value) { + var type = Object.prototype.toString.call(value); + + return type === '[object Function]'; +}; + + +/***/ }), + +/***/ 370: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var is = __webpack_require__(879); +var delegate = __webpack_require__(438); /** * Validates all params and calls the right @@ -796,183 +700,191 @@ module.exports = listen; /***/ }), -/* 5 */ -/***/ (function(module, exports) { -/** - * Check if argument is a HTML element. - * - * @param {Object} value - * @return {Boolean} - */ -exports.node = function(value) { - return value !== undefined - && value instanceof HTMLElement - && value.nodeType === 1; -}; +/***/ 817: +/***/ (function(module) { -/** - * Check if argument is a list of HTML elements. - * - * @param {Object} value - * @return {Boolean} - */ -exports.nodeList = function(value) { - var type = Object.prototype.toString.call(value); +function select(element) { + var selectedText; - return value !== undefined - && (type === '[object NodeList]' || type === '[object HTMLCollection]') - && ('length' in value) - && (value.length === 0 || exports.node(value[0])); -}; + if (element.nodeName === 'SELECT') { + element.focus(); -/** - * Check if argument is a string. - * - * @param {Object} value - * @return {Boolean} - */ -exports.string = function(value) { - return typeof value === 'string' - || value instanceof String; -}; + selectedText = element.value; + } + else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { + var isReadOnly = element.hasAttribute('readonly'); -/** - * Check if argument is a function. - * - * @param {Object} value - * @return {Boolean} - */ -exports.fn = function(value) { - var type = Object.prototype.toString.call(value); + if (!isReadOnly) { + element.setAttribute('readonly', ''); + } - return type === '[object Function]'; -}; + element.select(); + element.setSelectionRange(0, element.value.length); + + if (!isReadOnly) { + element.removeAttribute('readonly'); + } + + selectedText = element.value; + } + else { + if (element.hasAttribute('contenteditable')) { + element.focus(); + } + + var selection = window.getSelection(); + var range = document.createRange(); + + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + + selectedText = selection.toString(); + } + + return selectedText; +} + +module.exports = select; /***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { -var closest = __webpack_require__(7); +/***/ 279: +/***/ (function(module) { -/** - * Delegates event to a selector. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} - */ -function _delegate(element, selector, type, callback, useCapture) { - var listenerFn = listener.apply(this, arguments); - - element.addEventListener(type, listenerFn, useCapture); - - return { - destroy: function() { - element.removeEventListener(type, listenerFn, useCapture); - } - } +function E () { + // Keep this empty so it's easier to inherit from + // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) } -/** - * Delegates event to a selector. - * - * @param {Element|String|Array} [elements] - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} - */ -function delegate(elements, selector, type, callback, useCapture) { - // Handle the regular Element usage - if (typeof elements.addEventListener === 'function') { - return _delegate.apply(null, arguments); - } +E.prototype = { + on: function (name, callback, ctx) { + var e = this.e || (this.e = {}); - // Handle Element-less usage, it defaults to global delegation - if (typeof type === 'function') { - // Use `document` as the first parameter, then apply arguments - // This is a short way to .unshift `arguments` without running into deoptimizations - return _delegate.bind(null, document).apply(null, arguments); - } - - // Handle Selector-based usage - if (typeof elements === 'string') { - elements = document.querySelectorAll(elements); - } - - // Handle Array-like based usage - return Array.prototype.map.call(elements, function (element) { - return _delegate(element, selector, type, callback, useCapture); + (e[name] || (e[name] = [])).push({ + fn: callback, + ctx: ctx }); -} -/** - * Finds closest match and invokes callback. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Function} - */ -function listener(element, selector, type, callback) { - return function(e) { - e.delegateTarget = closest(e.target, selector); + return this; + }, - if (e.delegateTarget) { - callback.call(element, e); - } + once: function (name, callback, ctx) { + var self = this; + function listener () { + self.off(name, listener); + callback.apply(ctx, arguments); + }; + + listener._ = callback + return this.on(name, listener, ctx); + }, + + emit: function (name) { + var data = [].slice.call(arguments, 1); + var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); + var i = 0; + var len = evtArr.length; + + for (i; i < len; i++) { + evtArr[i].fn.apply(evtArr[i].ctx, data); } -} -module.exports = delegate; + return this; + }, + off: function (name, callback) { + var e = this.e || (this.e = {}); + var evts = e[name]; + var liveEvents = []; -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - -var DOCUMENT_NODE_TYPE = 9; - -/** - * A polyfill for Element.matches() - */ -if (typeof Element !== 'undefined' && !Element.prototype.matches) { - var proto = Element.prototype; - - proto.matches = proto.matchesSelector || - proto.mozMatchesSelector || - proto.msMatchesSelector || - proto.oMatchesSelector || - proto.webkitMatchesSelector; -} - -/** - * Finds the closest parent that matches a selector. - * - * @param {Element} element - * @param {String} selector - * @return {Function} - */ -function closest (element, selector) { - while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { - if (typeof element.matches === 'function' && - element.matches(selector)) { - return element; - } - element = element.parentNode; + if (evts && callback) { + for (var i = 0, len = evts.length; i < len; i++) { + if (evts[i].fn !== callback && evts[i].fn._ !== callback) + liveEvents.push(evts[i]); + } } -} -module.exports = closest; + // Remove event from queue to prevent memory leak + // Suggested by https://github.com/lazd + // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 + + (liveEvents.length) + ? e[name] = liveEvents + : delete e[name]; + + return this; + } +}; + +module.exports = E; +module.exports.TinyEmitter = E; /***/ }) -/******/ ]); + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ // startup +/******/ // Load entry module and return exports +/******/ return __webpack_require__(686); +/******/ })() +.default; }); \ No newline at end of file diff --git a/node_modules/clipboard/dist/clipboard.min.js b/node_modules/clipboard/dist/clipboard.min.js index 02c549e35..1103f811e 100644 --- a/node_modules/clipboard/dist/clipboard.min.js +++ b/node_modules/clipboard/dist/clipboard.min.js @@ -1,7 +1,7 @@ /*! - * clipboard.js v2.0.4 - * https://zenorocha.github.io/clipboard.js - * + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * * Licensed MIT © Zeno Rocha */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n 1%", - "last 2 versions" - ] + "lint-staged": { + "*.{js,css,md}": [ + "prettier --write", + "eslint --fix" + ] + } } diff --git a/node_modules/clipboard/readme.md b/node_modules/clipboard/readme.md index 76692ff9e..6506470ae 100644 --- a/node_modules/clipboard/readme.md +++ b/node_modules/clipboard/readme.md @@ -1,6 +1,6 @@ # clipboard.js -[![Build Status](http://img.shields.io/travis/zenorocha/clipboard.js/master.svg?style=flat)](https://travis-ci.org/zenorocha/clipboard.js) +![Build Status](https://github.com/zenorocha/clipboard.js/workflows/build/badge.svg) ![Killing Flash](https://img.shields.io/badge/killing-flash-brightgreen.svg?style=flat) > Modern copy to clipboard. No Flash. Just 3kb gzipped. @@ -39,7 +39,7 @@ new ClipboardJS('.btn'); Internally, we need to fetch all elements that matches with your selector and attach event listeners for each one. But guess what? If you have hundreds of matches, this operation can consume a lot of memory. -For this reason we use [event delegation](http://stackoverflow.com/questions/1687296/what-is-dom-event-delegation) which replaces multiple event listeners with just a single listener. After all, [#perfmatters](https://twitter.com/hashtag/perfmatters). +For this reason we use [event delegation](https://stackoverflow.com/questions/1687296/what-is-dom-event-delegation) which replaces multiple event listeners with just a single listener. After all, [#perfmatters](https://twitter.com/hashtag/perfmatters). # Usage @@ -55,11 +55,11 @@ The value you include on this attribute needs to match another's element selecto ```html - + ``` @@ -77,7 +77,7 @@ If you omit this attribute, `copy` will be used by default. ``` @@ -91,8 +91,11 @@ Truth is, you don't even need another element to copy its content from. You can ```html - ``` @@ -105,17 +108,17 @@ That's why we fire custom events such as `success` and `error` for you to listen ```js var clipboard = new ClipboardJS('.btn'); -clipboard.on('success', function(e) { - console.info('Action:', e.action); - console.info('Text:', e.text); - console.info('Trigger:', e.trigger); +clipboard.on('success', function (e) { + console.info('Action:', e.action); + console.info('Text:', e.text); + console.info('Trigger:', e.trigger); - e.clearSelection(); + e.clearSelection(); }); -clipboard.on('error', function(e) { - console.error('Action:', e.action); - console.error('Trigger:', e.trigger); +clipboard.on('error', function (e) { + console.error('Action:', e.action); + console.error('Trigger:', e.trigger); }); ``` @@ -125,7 +128,7 @@ For a live demonstration, go to this [site](https://clipboardjs.com/) and open y Each application has different design needs, that's why clipboard.js does not include any CSS or built-in tooltip solution. -The tooltips you see on the [demo site](https://clipboardjs.com/) were built using [GitHub's Primer](https://github.com/primer/primer-css/tree/master/modules/primer-tooltips). You may want to check that out if you're looking for a similar look and feel. +The tooltips you see on the [demo site](https://clipboardjs.com/) were built using [GitHub's Primer](https://primer.style/css/components/tooltips). You may want to check that out if you're looking for a similar look and feel. ## Advanced Options @@ -135,9 +138,9 @@ For instance, if you want to dynamically set a `target`, you'll need to return a ```js new ClipboardJS('.btn', { - target: function(trigger) { - return trigger.nextElementSibling; - } + target: function (trigger) { + return trigger.nextElementSibling; + }, }); ``` @@ -145,9 +148,9 @@ If you want to dynamically set a `text`, you'll return a String. ```js new ClipboardJS('.btn', { - text: function(trigger) { - return trigger.getAttribute('aria-label'); - } + text: function (trigger) { + return trigger.getAttribute('aria-label'); + }, }); ``` @@ -155,7 +158,7 @@ For use in Bootstrap Modals or with any other library that changes the focus you ```js new ClipboardJS('.btn', { - container: document.getElementById('modal') + container: document.getElementById('modal'), }); ``` @@ -168,11 +171,11 @@ clipboard.destroy(); ## Browser Support -This library relies on both [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) and [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) APIs. The first one is [supported by all browsers](http://caniuse.com/#search=selection) while the second one is supported in the following browsers. +This library relies on both [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) and [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) APIs. The first one is [supported by all browsers](https://caniuse.com/#search=selection) while the second one is supported in the following browsers. | Chrome logo | Edge logo | Firefox logo | Internet Explorer logo | Opera logo | Safari logo | -|:---:|:---:|:---:|:---:|:---:|:---:| -| 42+ ✔ | 12+ ✔ | 41+ ✔ | 9+ ✔ | 29+ ✔ | 10+ ✔ | +| :-------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | +| 42+ ✔ | 12+ ✔ | 41+ ✔ | 9+ ✔ | 29+ ✔ | 10+ ✔ | The good news is that clipboard.js gracefully degrades if you need to support older browsers. All you have to do is show a tooltip saying `Copied!` when `success` event is called and `Press Ctrl+C to copy` when `error` event is called because the text is already selected. @@ -180,10 +183,10 @@ You can also check if clipboard.js is supported or not by running `ClipboardJS.i ## Bonus -A browser extension that adds a "copy to clipboard" button to every code block on *GitHub, MDN, Gist, StackOverflow, StackExchange, npm, and even Medium.* +A browser extension that adds a "copy to clipboard" button to every code block on _GitHub, MDN, Gist, StackOverflow, StackExchange, npm, and even Medium._ Install for [Chrome](https://chrome.google.com/webstore/detail/codecopy/fkbfebkcoelajmhanocgppanfoojcdmg) and [Firefox](https://addons.mozilla.org/en-US/firefox/addon/codecopy/). ## License -[MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha +[MIT License](https://zenorocha.mit-license.org/) © Zeno Rocha diff --git a/node_modules/clipboard/webpack.config.js b/node_modules/clipboard/webpack.config.js index 7a61bf8d8..14dc705d7 100644 --- a/node_modules/clipboard/webpack.config.js +++ b/node_modules/clipboard/webpack.config.js @@ -6,40 +6,41 @@ const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const production = process.env.NODE_ENV === 'production' || false; const banner = `clipboard.js v${pkg.version} -https://zenorocha.github.io/clipboard.js +https://clipboardjs.com/ Licensed MIT © Zeno Rocha`; module.exports = { - entry: './src/clipboard.js', - mode: 'production', - output: { - filename: production ? 'clipboard.min.js' : 'clipboard.js', - path: path.resolve(__dirname, 'dist'), - library: 'ClipboardJS', - libraryTarget: 'umd', - globalObject: 'this' - }, - module: { - rules: [ - {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'} - ] - }, - optimization: { - minimize: production, - minimizer: [ - new UglifyJSPlugin({ - parallel: require('os').cpus().length, - uglifyOptions: { - ie8: false, - keep_fnames: false, - output: { - beautify: false, - comments: (node, {value, type}) => type == 'comment2' && value.startsWith('!') - } - } - }) - ] - }, - plugins: [new webpack.BannerPlugin({ banner })] + entry: './src/clipboard.js', + mode: 'production', + target: ['web', 'es5'], + output: { + filename: production ? 'clipboard.min.js' : 'clipboard.js', + path: path.resolve(__dirname, 'dist'), + library: 'ClipboardJS', + globalObject: 'this', + libraryExport: 'default', + libraryTarget: 'umd', + }, + module: { + rules: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }], + }, + optimization: { + minimize: production, + minimizer: [ + new UglifyJSPlugin({ + parallel: require('os').cpus().length, + uglifyOptions: { + ie8: false, + keep_fnames: false, + output: { + beautify: false, + comments: (node, { value, type }) => + type == 'comment2' && value.startsWith('!'), + }, + }, + }), + ], + }, + plugins: [new webpack.BannerPlugin({ banner })], }; diff --git a/package-lock.json b/package-lock.json index aa42c1ba8..5323bf09e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "blueimp-file-upload": "^10.32.0", "bulma-scss": "^0.9.4", "c3": "^0.4.11", - "clipboard": "^2.0.4", + "clipboard": "^2.0.11", "d3": "^3.5.16", "datatables.net": "^1.11.3", "datatables.net-fixedheader": "^3.1.2", @@ -124,9 +124,9 @@ } }, "node_modules/clipboard": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", - "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "dependencies": { "good-listener": "^1.2.2", "select": "^1.1.2", @@ -510,9 +510,9 @@ } }, "clipboard": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", - "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "requires": { "good-listener": "^1.2.2", "select": "^1.1.2", diff --git a/package.json b/package.json index 2081ff93a..54facdb7f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "blueimp-file-upload": "^10.32.0", "bulma-scss": "^0.9.4", "c3": "^0.4.11", - "clipboard": "^2.0.4", + "clipboard": "^2.0.11", "d3": "^3.5.16", "datatables.net": "^1.11.3", "datatables.net-fixedheader": "^3.1.2", diff --git a/sources/Dependencies/NPM/iTopNPM.php b/sources/Dependencies/NPM/iTopNPM.php index d8e03eb78..3d571eb94 100644 --- a/sources/Dependencies/NPM/iTopNPM.php +++ b/sources/Dependencies/NPM/iTopNPM.php @@ -26,7 +26,7 @@ use Combodo\iTop\Dependencies\AbstractFolderAnalyzer; class iTopNPM extends AbstractFolderAnalyzer { /** @inheritDoc */ - public const QUESTIONNABLE_FOLDER_REGEXP = '/^(tests?|examples?|htdocs?|demos?|website|external|libs?|src)$/i'; + public const QUESTIONNABLE_FOLDER_REGEXP = '/^(tests?|examples?|htdocs?|demos?|.github|website|external|libs?|src)$/i'; /** * @inheritDoc @@ -77,6 +77,7 @@ class iTopNPM extends AbstractFolderAnalyzer 'c3/htdocs', 'c3/src', + 'clipboard/.github', 'clipboard/demo', 'clipboard/src', 'clipboard/test',