From 83b9d6a84dac05d938eaf8054e8bdc89dcff7bf8 Mon Sep 17 00:00:00 2001 From: Helder Santana Date: Sat, 20 Feb 2016 01:14:33 -0500 Subject: [PATCH 1/3] update modules and fix #176 --- .babelrc | 4 + dist/clipboard.js | 722 +++++++++++++++++++++--------------------- dist/clipboard.min.js | 2 +- package.json | 23 +- 4 files changed, 375 insertions(+), 376 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..69386bd --- /dev/null +++ b/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["es2015-loose"], + "plugins": ["transform-es2015-modules-umd"] +} diff --git a/dist/clipboard.js b/dist/clipboard.js index 24dbac6..9ccd1fe 100644 --- a/dist/clipboard.js +++ b/dist/clipboard.js @@ -350,406 +350,396 @@ E.prototype = { module.exports = E; },{}],8:[function(require,module,exports){ -'use strict'; +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define(['exports', 'select'], factory); + } else if (typeof exports !== "undefined") { + factory(exports, require('select')); + } else { + var mod = { + exports: {} + }; + factory(mod.exports, global.select); + global.clipboardAction = mod.exports; + } +})(this, function (exports, _select) { + 'use strict'; -exports.__esModule = true; + Object.defineProperty(exports, "__esModule", { + value: true + }); -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 _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'); } } - -var _select = require('select'); - -var _select2 = _interopRequireDefault(_select); - -/** - * Inner class which performs selection from either `text` or `target` - * properties and then executes copy or cut operations. - */ - -var ClipboardAction = (function () { - /** - * @param {Object} options - */ - - function ClipboardAction(options) { - _classCallCheck(this, ClipboardAction); - - this.resolveOptions(options); - this.initSelection(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; } - /** - * Defines base properties passed from constructor. - * @param {Object} options - */ - - ClipboardAction.prototype.resolveOptions = function resolveOptions() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - this.action = options.action; - this.emitter = options.emitter; - this.target = options.target; - this.text = options.text; - this.trigger = options.trigger; - - this.selectedText = ''; + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - /** - * Decides which selection strategy is going to be applied based - * on the existence of `text` and `target` properties. - */ - - ClipboardAction.prototype.initSelection = function initSelection() { - if (this.text && this.target) { - throw new Error('Multiple attributes declared, use either "target" or "text"'); - } else if (this.text) { - this.selectFake(); - } else if (this.target) { - this.selectTarget(); - } else { - throw new Error('Missing required attributes, use either "target" or "text"'); + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - }; + } - /** - * Creates a fake textarea element, sets its value from `text` property, - * and makes a selection on it. - */ - - ClipboardAction.prototype.selectFake = function selectFake() { - var _this = this; - - var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; - - this.removeFake(); - - this.fakeHandler = document.body.addEventListener('click', function () { - return _this.removeFake(); - }); - - 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 - this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px'; - this.fakeElem.setAttribute('readonly', ''); - this.fakeElem.value = this.text; - - document.body.appendChild(this.fakeElem); - - this.selectedText = _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. - */ - - ClipboardAction.prototype.removeFake = function removeFake() { - if (this.fakeHandler) { - document.body.removeEventListener('click'); - this.fakeHandler = null; - } - - if (this.fakeElem) { - document.body.removeChild(this.fakeElem); - this.fakeElem = null; - } - }; - - /** - * Selects the content from element passed on `target` property. - */ - - ClipboardAction.prototype.selectTarget = function selectTarget() { - this.selectedText = _select2['default'](this.target); - this.copyText(); - }; - - /** - * Executes the copy operation based on the current selection. - */ - - ClipboardAction.prototype.copyText = function copyText() { - var succeeded = undefined; - - 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 - */ - - ClipboardAction.prototype.handleResult = function handleResult(succeeded) { - if (succeeded) { - this.emitter.emit('success', { - action: this.action, - text: this.selectedText, - trigger: this.trigger, - clearSelection: this.clearSelection.bind(this) - }); - } else { - this.emitter.emit('error', { - action: this.action, - trigger: this.trigger, - clearSelection: this.clearSelection.bind(this) - }); - } - }; - - /** - * Removes current selection and focus from `target` element. - */ - - ClipboardAction.prototype.clearSelection = function clearSelection() { - if (this.target) { - this.target.blur(); - } - - window.getSelection().removeAllRanges(); - }; - - /** - * Sets the `action` to be performed which can be either 'copy' or 'cut'. - * @param {String} action - */ - - /** - * Destroy lifecycle. - */ - - ClipboardAction.prototype.destroy = function destroy() { - this.removeFake(); - }; - - _createClass(ClipboardAction, [{ - key: 'action', - set: function set() { - var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0]; - - this._action = action; - - if (this._action !== 'copy' && this._action !== 'cut') { - throw new Error('Invalid "action" value, use either "copy" or "cut"'); + 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 = function () { /** - * Gets the `action` property. - * @return {String} + * @param {Object} options */ - get: function get() { - return this._action; + + function ClipboardAction(options) { + _classCallCheck(this, ClipboardAction); + + this.resolveOptions(options); + this.initSelection(); } /** - * Sets the `target` property using an element - * that will be have its content copied. - * @param {Element} target + * Defines base properties passed from constructor. + * @param {Object} options */ - }, { - key: 'target', - set: function set(target) { - if (target !== undefined) { - if (target && typeof target === 'object' && target.nodeType === 1) { - this._target = target; - } else { - throw new Error('Invalid "target" value, use a valid Element'); + + + ClipboardAction.prototype.resolveOptions = function resolveOptions() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + this.action = options.action; + this.emitter = options.emitter; + this.target = options.target; + this.text = options.text; + this.trigger = options.trigger; + + this.selectedText = ''; + }; + + ClipboardAction.prototype.initSelection = function initSelection() { + if (this.text && this.target) { + throw new Error('Multiple attributes declared, use either "target" or "text"'); + } else if (this.text) { + this.selectFake(); + } else if (this.target) { + this.selectTarget(); + } else { + throw new Error('Missing required attributes, use either "target" or "text"'); + } + }; + + ClipboardAction.prototype.selectFake = function selectFake() { + var _this = this; + + var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; + + this.removeFake(); + + this.fakeHandler = document.body.addEventListener('click', function () { + return _this.removeFake(); + }); + + 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 + this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px'; + this.fakeElem.setAttribute('readonly', ''); + this.fakeElem.value = this.text; + + document.body.appendChild(this.fakeElem); + + this.selectedText = (0, _select2.default)(this.fakeElem); + this.copyText(); + }; + + ClipboardAction.prototype.removeFake = function removeFake() { + if (this.fakeHandler) { + document.body.removeEventListener('click'); + this.fakeHandler = null; + } + + if (this.fakeElem) { + document.body.removeChild(this.fakeElem); + this.fakeElem = null; + } + }; + + ClipboardAction.prototype.selectTarget = function selectTarget() { + this.selectedText = (0, _select2.default)(this.target); + this.copyText(); + }; + + ClipboardAction.prototype.copyText = function copyText() { + var succeeded = undefined; + + try { + succeeded = document.execCommand(this.action); + } catch (err) { + succeeded = false; + } + + this.handleResult(succeeded); + }; + + ClipboardAction.prototype.handleResult = function handleResult(succeeded) { + if (succeeded) { + this.emitter.emit('success', { + action: this.action, + text: this.selectedText, + trigger: this.trigger, + clearSelection: this.clearSelection.bind(this) + }); + } else { + this.emitter.emit('error', { + action: this.action, + trigger: this.trigger, + clearSelection: this.clearSelection.bind(this) + }); + } + }; + + ClipboardAction.prototype.clearSelection = function clearSelection() { + if (this.target) { + this.target.blur(); + } + + window.getSelection().removeAllRanges(); + }; + + ClipboardAction.prototype.destroy = function destroy() { + this.removeFake(); + }; + + _createClass(ClipboardAction, [{ + key: 'action', + set: function set() { + var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0]; + + this._action = action; + + if (this._action !== 'copy' && this._action !== 'cut') { + throw new Error('Invalid "action" value, use either "copy" or "cut"'); } + }, + get: function get() { + return this._action; } - }, + }, { + key: 'target', + set: function set(target) { + if (target !== undefined) { + if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { + this._target = target; + } else { + throw new Error('Invalid "target" value, use a valid Element'); + } + } + }, + get: function get() { + return this._target; + } + }]); - /** - * Gets the `target` property. - * @return {String|HTMLElement} - */ - get: function get() { - return this._target; - } - }]); + return ClipboardAction; + }(); - return ClipboardAction; -})(); - -exports['default'] = ClipboardAction; -module.exports = exports['default']; + exports.default = ClipboardAction; +}); },{"select":6}],9:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -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'); } } - -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; } - -var _clipboardAction = require('./clipboard-action'); - -var _clipboardAction2 = _interopRequireDefault(_clipboardAction); - -var _tinyEmitter = require('tiny-emitter'); - -var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); - -var _goodListener = require('good-listener'); - -var _goodListener2 = _interopRequireDefault(_goodListener); - -/** - * 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); - - /** - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - * @param {Object} options - */ - - function Clipboard(trigger, options) { - _classCallCheck(this, Clipboard); - - _Emitter.call(this); - - this.resolveOptions(options); - this.listenClick(trigger); +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define(['exports', './clipboard-action', 'tiny-emitter', 'good-listener'], factory); + } else if (typeof exports !== "undefined") { + factory(exports, require('./clipboard-action'), require('tiny-emitter'), require('good-listener')); + } else { + var mod = { + exports: {} + }; + factory(mod.exports, global.clipboardAction, global.tinyEmitter, global.goodListener); + global.clipboard = mod.exports; } +})(this, function (exports, _clipboardAction, _tinyEmitter, _goodListener) { + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _clipboardAction2 = _interopRequireDefault(_clipboardAction); + + var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); + + var _goodListener2 = _interopRequireDefault(_goodListener); + + 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"); + } + } + + 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 _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; + } + + var Clipboard = function (_Emitter) { + _inherits(Clipboard, _Emitter); + + /** + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + * @param {Object} options + */ + + function Clipboard(trigger, options) { + _classCallCheck(this, Clipboard); + + var _this = _possibleConstructorReturn(this, _Emitter.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 + */ + + + Clipboard.prototype.resolveOptions = 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; + }; + + Clipboard.prototype.listenClick = function listenClick(trigger) { + var _this2 = this; + + this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) { + return _this2.onClick(e); + }); + }; + + Clipboard.prototype.onClick = 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), + trigger: trigger, + emitter: this + }); + }; + + Clipboard.prototype.defaultAction = function defaultAction(trigger) { + return getAttributeValue('action', trigger); + }; + + Clipboard.prototype.defaultTarget = function defaultTarget(trigger) { + var selector = getAttributeValue('target', trigger); + + if (selector) { + return document.querySelector(selector); + } + }; + + Clipboard.prototype.defaultText = function defaultText(trigger) { + return getAttributeValue('text', trigger); + }; + + Clipboard.prototype.destroy = function destroy() { + this.listener.destroy(); + + if (this.clipboardAction) { + this.clipboardAction.destroy(); + this.clipboardAction = null; + } + }; + + return Clipboard; + }(_tinyEmitter2.default); + + exports.default = Clipboard; + /** * Helper function to retrieve attribute value. * @param {String} suffix * @param {Element} element */ + function getAttributeValue(suffix, element) { + var attribute = 'data-clipboard-' + suffix; - /** - * Defines if attributes would be resolved using internal setter functions - * or custom functions that were passed in the constructor. - * @param {Object} options - */ - - Clipboard.prototype.resolveOptions = 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; - }; - - /** - * Adds a click event listener to the passed trigger. - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - */ - - Clipboard.prototype.listenClick = function listenClick(trigger) { - var _this = this; - - this.listener = _goodListener2['default'](trigger, 'click', function (e) { - return _this.onClick(e); - }); - }; - - /** - * Defines a new `ClipboardAction` on each click event. - * @param {Event} e - */ - - Clipboard.prototype.onClick = function onClick(e) { - var trigger = e.delegateTarget || e.currentTarget; - - if (this.clipboardAction) { - this.clipboardAction = null; + if (!element.hasAttribute(attribute)) { + return; } - this.clipboardAction = new _clipboardAction2['default']({ - action: this.action(trigger), - target: this.target(trigger), - text: this.text(trigger), - trigger: trigger, - emitter: this - }); - }; - - /** - * Default `action` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultAction = function defaultAction(trigger) { - return getAttributeValue('action', trigger); - }; - - /** - * Default `target` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultTarget = function defaultTarget(trigger) { - var selector = getAttributeValue('target', trigger); - - if (selector) { - return document.querySelector(selector); - } - }; - - /** - * Default `text` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultText = function defaultText(trigger) { - return getAttributeValue('text', trigger); - }; - - /** - * Destroy lifecycle. - */ - - Clipboard.prototype.destroy = function destroy() { - this.listener.destroy(); - - if (this.clipboardAction) { - this.clipboardAction.destroy(); - this.clipboardAction = null; - } - }; - - return Clipboard; -})(_tinyEmitter2['default']); - -exports['default'] = Clipboard; -function getAttributeValue(suffix, element) { - var attribute = 'data-clipboard-' + suffix; - - if (!element.hasAttribute(attribute)) { - return; + return element.getAttribute(attribute); } - - return element.getAttribute(attribute); -} -module.exports = exports['default']; +}); },{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9) }); \ No newline at end of file diff --git a/dist/clipboard.min.js b/dist/clipboard.min.js index 15210c8..84a690d 100644 --- a/dist/clipboard.min.js +++ b/dist/clipboard.min.js @@ -4,4 +4,4 @@ * * Licensed MIT © Zeno Rocha */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ar;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;no;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,s=o.length;s>i;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(n,r){if("function"==typeof t&&t.amd)t(["exports","select"],r);else if("undefined"!=typeof o)r(o,e("select"));else{var i={exports:{}};r(i.exports,n.select),n.clipboardAction=i.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=n(e),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s=function(){function t(t,e){for(var n=0;n Date: Sat, 20 Feb 2016 01:41:40 -0500 Subject: [PATCH 2/3] fix babel 6 export default behaviour --- dist/clipboard.js | 31 +++++++++++-------------------- dist/clipboard.min.js | 2 +- src/clipboard-action.js | 4 +++- src/clipboard.js | 4 +++- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/dist/clipboard.js b/dist/clipboard.js index 9ccd1fe..0f979c9 100644 --- a/dist/clipboard.js +++ b/dist/clipboard.js @@ -352,23 +352,19 @@ module.exports = E; },{}],8:[function(require,module,exports){ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(['exports', 'select'], factory); + define(['module', 'select'], factory); } else if (typeof exports !== "undefined") { - factory(exports, require('select')); + factory(module, require('select')); } else { var mod = { exports: {} }; - factory(mod.exports, global.select); + factory(mod, global.select); global.clipboardAction = mod.exports; } -})(this, function (exports, _select) { +})(this, function (module, _select) { 'use strict'; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _select2 = _interopRequireDefault(_select); function _interopRequireDefault(obj) { @@ -572,29 +568,25 @@ module.exports = E; return ClipboardAction; }(); - exports.default = ClipboardAction; + module.exports = ClipboardAction; }); },{"select":6}],9:[function(require,module,exports){ (function (global, factory) { if (typeof define === "function" && define.amd) { - define(['exports', './clipboard-action', 'tiny-emitter', 'good-listener'], factory); + define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory); } else if (typeof exports !== "undefined") { - factory(exports, require('./clipboard-action'), require('tiny-emitter'), require('good-listener')); + factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener')); } else { var mod = { exports: {} }; - factory(mod.exports, global.clipboardAction, global.tinyEmitter, global.goodListener); + factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener); global.clipboard = mod.exports; } -})(this, function (exports, _clipboardAction, _tinyEmitter, _goodListener) { +})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) { 'use strict'; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _clipboardAction2 = _interopRequireDefault(_clipboardAction); var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); @@ -722,9 +714,6 @@ module.exports = E; return Clipboard; }(_tinyEmitter2.default); - exports.default = Clipboard; - - /** * Helper function to retrieve attribute value. * @param {String} suffix @@ -739,6 +728,8 @@ module.exports = E; return element.getAttribute(attribute); } + + module.exports = Clipboard; }); },{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9) diff --git a/dist/clipboard.min.js b/dist/clipboard.min.js index 84a690d..9ed4af7 100644 --- a/dist/clipboard.min.js +++ b/dist/clipboard.min.js @@ -4,4 +4,4 @@ * * Licensed MIT © Zeno Rocha */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function r(s,c){if(!n[s]){if(!e[s]){var a="function"==typeof require&&require;if(!c&&a)return a(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return r(n?n:t)},l,l.exports,t,e,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;so;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,s=o.length;s>i;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(n,r){if("function"==typeof t&&t.amd)t(["exports","select"],r);else if("undefined"!=typeof o)r(o,e("select"));else{var i={exports:{}};r(i.exports,n.select),n.clipboardAction=i.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=n(e),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s=function(){function t(t,e){for(var n=0;no;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,c=o.length;c>i;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(r,i){if("function"==typeof t&&t.amd)t(["module","select"],i);else if("undefined"!=typeof o)i(n,e("select"));else{var c={exports:{}};i(c,r.select),r.clipboardAction=c.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(e),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n Date: Thu, 25 Feb 2016 15:17:07 -0500 Subject: [PATCH 3/3] WTF?! npm --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a4e3bef..d236c70 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "karma-phantomjs-launcher": "^1.0.0", "karma-sinon": "^1.0.4", "mocha": "^2.3.3", - "npm": "^3.7.3", "phantomjs-prebuilt": "^2.1.4", "sinon": "^1.17.2", "uglify-js": "^2.4.24",