mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Updates good-listener package which removes two dependencies
This commit is contained in:
parent
26a9e9d56c
commit
0149e1de5e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clipboard",
|
"name": "clipboard",
|
||||||
"version": "1.5.13",
|
"version": "1.5.14",
|
||||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/clipboard.js",
|
"main": "dist/clipboard.js",
|
||||||
|
145
dist/clipboard.js
vendored
145
dist/clipboard.js
vendored
@ -1,124 +1,41 @@
|
|||||||
/*!
|
/*!
|
||||||
* clipboard.js v1.5.13
|
* clipboard.js v1.5.14
|
||||||
* https://zenorocha.github.io/clipboard.js
|
* https://zenorocha.github.io/clipboard.js
|
||||||
*
|
*
|
||||||
* Licensed MIT © Zeno Rocha
|
* Licensed MIT © Zeno Rocha
|
||||||
*/
|
*/
|
||||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Module Dependencies
|
* A polyfill for Element.matches()
|
||||||
*/
|
*/
|
||||||
|
if (Element && !Element.prototype.matches) {
|
||||||
try {
|
|
||||||
var matches = require('matches-selector')
|
|
||||||
} catch (err) {
|
|
||||||
var matches = require('component-matches-selector')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export `closest`
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = closest
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closest
|
|
||||||
*
|
|
||||||
* @param {Element} el
|
|
||||||
* @param {String} selector
|
|
||||||
* @param {Element} scope (optional)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function closest (el, selector, scope) {
|
|
||||||
scope = scope || document.documentElement;
|
|
||||||
|
|
||||||
// walk up the dom
|
|
||||||
while (el && el !== scope) {
|
|
||||||
if (matches(el, selector)) return el;
|
|
||||||
el = el.parentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check scope for match
|
|
||||||
return matches(el, selector) ? el : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
},{"component-matches-selector":2,"matches-selector":2}],2:[function(require,module,exports){
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
|
||||||
var query = require('query');
|
|
||||||
} catch (err) {
|
|
||||||
var query = require('component-query');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Element prototype.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var proto = Element.prototype;
|
var proto = Element.prototype;
|
||||||
|
|
||||||
/**
|
proto.matches = proto.matchesSelector ||
|
||||||
* Vendor function.
|
proto.mozMatchesSelector ||
|
||||||
*/
|
proto.msMatchesSelector ||
|
||||||
|
proto.oMatchesSelector ||
|
||||||
var vendor = proto.matches
|
proto.webkitMatchesSelector;
|
||||||
|| proto.webkitMatchesSelector
|
}
|
||||||
|| proto.mozMatchesSelector
|
|
||||||
|| proto.msMatchesSelector
|
|
||||||
|| proto.oMatchesSelector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose `match()`.
|
* Finds the closest parent that matches a selector.
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = match;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Match `el` to `selector`.
|
|
||||||
*
|
*
|
||||||
* @param {Element} el
|
* @param {Element} element
|
||||||
* @param {String} selector
|
* @param {String} selector
|
||||||
* @return {Boolean}
|
* @return {Function}
|
||||||
* @api public
|
|
||||||
*/
|
*/
|
||||||
|
function closest (element, selector) {
|
||||||
function match(el, selector) {
|
while (element && element !== document) {
|
||||||
if (!el || el.nodeType !== 1) return false;
|
if (element.matches(selector)) return element;
|
||||||
if (vendor) return vendor.call(el, selector);
|
element = element.parentNode;
|
||||||
var nodes = query.all(selector, el.parentNode);
|
|
||||||
for (var i = 0; i < nodes.length; ++i) {
|
|
||||||
if (nodes[i] == el) return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"component-query":3,"query":3}],3:[function(require,module,exports){
|
module.exports = closest;
|
||||||
function one(selector, el) {
|
|
||||||
return el.querySelector(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
exports = module.exports = function(selector, el){
|
},{}],2:[function(require,module,exports){
|
||||||
el = el || document;
|
var closest = require('./closest');
|
||||||
return one(selector, el);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.all = function(selector, el){
|
|
||||||
el = el || document;
|
|
||||||
return el.querySelectorAll(selector);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.engine = function(obj){
|
|
||||||
if (!obj.one) throw new Error('.one callback required');
|
|
||||||
if (!obj.all) throw new Error('.all callback required');
|
|
||||||
one = obj.one;
|
|
||||||
exports.all = obj.all;
|
|
||||||
return exports;
|
|
||||||
};
|
|
||||||
|
|
||||||
},{}],4:[function(require,module,exports){
|
|
||||||
var closest = require('component-closest');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delegates event to a selector.
|
* Delegates event to a selector.
|
||||||
@ -153,7 +70,7 @@ function delegate(element, selector, type, callback, useCapture) {
|
|||||||
*/
|
*/
|
||||||
function listener(element, selector, type, callback) {
|
function listener(element, selector, type, callback) {
|
||||||
return function(e) {
|
return function(e) {
|
||||||
e.delegateTarget = closest(e.target, selector, true);
|
e.delegateTarget = closest(e.target, selector);
|
||||||
|
|
||||||
if (e.delegateTarget) {
|
if (e.delegateTarget) {
|
||||||
callback.call(element, e);
|
callback.call(element, e);
|
||||||
@ -163,7 +80,7 @@ function listener(element, selector, type, callback) {
|
|||||||
|
|
||||||
module.exports = delegate;
|
module.exports = delegate;
|
||||||
|
|
||||||
},{"component-closest":1}],5:[function(require,module,exports){
|
},{"./closest":1}],3:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Check if argument is a HTML element.
|
* Check if argument is a HTML element.
|
||||||
*
|
*
|
||||||
@ -214,7 +131,7 @@ exports.fn = function(value) {
|
|||||||
return type === '[object Function]';
|
return type === '[object Function]';
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}],6:[function(require,module,exports){
|
},{}],4:[function(require,module,exports){
|
||||||
var is = require('./is');
|
var is = require('./is');
|
||||||
var delegate = require('delegate');
|
var delegate = require('delegate');
|
||||||
|
|
||||||
@ -311,7 +228,7 @@ function listenSelector(selector, type, callback) {
|
|||||||
|
|
||||||
module.exports = listen;
|
module.exports = listen;
|
||||||
|
|
||||||
},{"./is":5,"delegate":4}],7:[function(require,module,exports){
|
},{"./is":3,"delegate":2}],5:[function(require,module,exports){
|
||||||
function select(element) {
|
function select(element) {
|
||||||
var selectedText;
|
var selectedText;
|
||||||
|
|
||||||
@ -346,7 +263,7 @@ function select(element) {
|
|||||||
|
|
||||||
module.exports = select;
|
module.exports = select;
|
||||||
|
|
||||||
},{}],8:[function(require,module,exports){
|
},{}],6:[function(require,module,exports){
|
||||||
function E () {
|
function E () {
|
||||||
// Keep this empty so it's easier to inherit from
|
// Keep this empty so it's easier to inherit from
|
||||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||||
@ -414,7 +331,7 @@ E.prototype = {
|
|||||||
|
|
||||||
module.exports = E;
|
module.exports = E;
|
||||||
|
|
||||||
},{}],9:[function(require,module,exports){
|
},{}],7:[function(require,module,exports){
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define(['module', 'select'], factory);
|
define(['module', 'select'], factory);
|
||||||
@ -441,7 +358,7 @@ module.exports = E;
|
|||||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||||
return typeof obj;
|
return typeof obj;
|
||||||
} : function (obj) {
|
} : function (obj) {
|
||||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) {
|
function _classCallCheck(instance, Constructor) {
|
||||||
@ -486,7 +403,7 @@ module.exports = E;
|
|||||||
|
|
||||||
|
|
||||||
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
ClipboardAction.prototype.resolveOptions = function resolveOptions() {
|
||||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
|
||||||
this.action = options.action;
|
this.action = options.action;
|
||||||
this.emitter = options.emitter;
|
this.emitter = options.emitter;
|
||||||
@ -595,7 +512,7 @@ module.exports = E;
|
|||||||
_createClass(ClipboardAction, [{
|
_createClass(ClipboardAction, [{
|
||||||
key: 'action',
|
key: 'action',
|
||||||
set: function set() {
|
set: function set() {
|
||||||
var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
|
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
||||||
|
|
||||||
this._action = action;
|
this._action = action;
|
||||||
|
|
||||||
@ -636,7 +553,7 @@ module.exports = E;
|
|||||||
module.exports = ClipboardAction;
|
module.exports = ClipboardAction;
|
||||||
});
|
});
|
||||||
|
|
||||||
},{"select":7}],10:[function(require,module,exports){
|
},{"select":5}],8:[function(require,module,exports){
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
|
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
|
||||||
@ -719,7 +636,7 @@ module.exports = E;
|
|||||||
|
|
||||||
|
|
||||||
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
Clipboard.prototype.resolveOptions = function resolveOptions() {
|
||||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
|
||||||
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
||||||
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
||||||
@ -796,5 +713,5 @@ module.exports = E;
|
|||||||
module.exports = Clipboard;
|
module.exports = Clipboard;
|
||||||
});
|
});
|
||||||
|
|
||||||
},{"./clipboard-action":9,"good-listener":6,"tiny-emitter":8}]},{},[10])(10)
|
},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)
|
||||||
});
|
});
|
4
dist/clipboard.min.js
vendored
4
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clipboard",
|
"name": "clipboard",
|
||||||
"version": "1.5.13",
|
"version": "1.5.14",
|
||||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||||
"repository": "zenorocha/clipboard.js",
|
"repository": "zenorocha/clipboard.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"cut"
|
"cut"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"good-listener": "^1.1.6",
|
"good-listener": "^1.2.0",
|
||||||
"select": "^1.0.6",
|
"select": "^1.0.6",
|
||||||
"tiny-emitter": "^1.0.0"
|
"tiny-emitter": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user