Commit b727f20a b727f20aa28be9fc6ccf134725560e32f593c835 by zhanghao

commit

1 parent d43df021
Showing 98 changed files with 7733 additions and 26 deletions
1 {
2 "presets": [
3 [
4 "env",
5 {
6 "targets": {
7 "uglify": true
8 },
9 "modules": false
10 }
11 ]
12 ]
13 }
1 # EditorConfig helps developers define and maintain consistent
2 # coding styles between different editors and IDEs
3 # http://editorconfig.org
4
5 root = true
6
7 [*]
8 # Change these settings to your own preference
9 indent_style = space
10 indent_size = 4
11
12 # We recommend you to keep these unchanged
13 end_of_line = lf
14 charset = utf-8
15 trim_trailing_whitespace = true
16 insert_final_newline = true
17
18 [*.md]
19 trim_trailing_whitespace = false
20
21 [{package.json,bower.json}]
22 indent_size = 2
1 ### Minimal example
2
3 > Fork this [JSFiddle](https://jsfiddle.net/zenorocha/5kk0eysw/) and reproduce your issue.
4
5 ### Expected behaviour
6
7 I thought that by going to the page '...' and pressing the button '...' then '...' would happen.
8
9 ### Actual behaviour
10
11 Instead of '...', what I saw was that '...' happened instead.
12
13 ### Browsers affected
14
15 I tested on all major browsers and only IE 11 does not work.
1 # Number of days of inactivity before an issue becomes stale
2 daysUntilStale: 60
3
4 # Number of days of inactivity before a stale issue is closed
5 daysUntilClose: 7
6
7 # Issues with these labels will never be considered stale
8 exemptLabels:
9 - pinned
10
11 # Label to use when marking an issue as stale
12 staleLabel: stale
13
14 # Comment to post when marking an issue as stale. Set to `false` to disable
15 markComment: >
16 This issue has been automatically marked as stale because it has not had
17 recent activity. It will be closed if no further activity occurs. Thank you
18 for your contributions.
19
20 # Comment to post when closing a stale issue. Set to `false` to disable
21 closeComment: false
1 sudo: false
2 language: node_js
3 node_js:
4 - stable
1 MIT License
2
3 Copyright (c) Zeno Rocha
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE.
1 {
2 "name": "clipboard",
3 "version": "2.0.6",
4 "description": "Modern copy to clipboard. No Flash. Just 3kb",
5 "license": "MIT",
6 "main": "dist/clipboard.js",
7 "ignore": [
8 "/.*/",
9 "/demo/",
10 "/test/",
11 "/.*",
12 "/bower.json",
13 "/karma.conf.js",
14 "/src",
15 "/lib"
16 ],
17 "keywords": [
18 "clipboard",
19 "copy",
20 "cut"
21 ]
22 }
1 {
2 "name": "zenorocha/clipboardjs",
3 "description": "Modern copy to clipboard. No Flash. Just 3kb gzipped https://clipboardjs.com",
4 "type": "component",
5 "homepage": "https://clipboardjs.com/",
6 "authors": [
7 {
8 "name": "Zeno Rocha",
9 "homepage": "http://zenorocha.com/"
10 }
11 ],
12 "require": {
13 "oomphinc/composer-installers-extender": "*"
14 },
15 "extra": {
16 "component": {
17 "scripts": [
18 "dist/clipboard.js"
19 ],
20 "files": [
21 "dist/clipboard.min.js"
22 ]
23 }
24 }
25 }
1 # Contributing guide
2
3 Want to contribute to Clipboard.js? Awesome!
4 There are many ways you can contribute, see below.
5
6 ## Opening issues
7
8 Open an issue to report bugs or to propose new features.
9
10 - Reporting bugs: describe the bug as clearly as you can, including steps to reproduce, what happened and what you were expecting to happen. Also include browser version, OS and other related software's (npm, Node.js, etc) versions when applicable.
11
12 - Proposing features: explain the proposed feature, what it should do, why it is useful, how users should use it. Give us as much info as possible so it will be easier to discuss, access and implement the proposed feature. When you're unsure about a certain aspect of the feature, feel free to leave it open for others to discuss and find an appropriate solution.
13
14 ## Proposing pull requests
15
16 Pull requests are very welcome. Note that if you are going to propose drastic changes, be sure to open an issue for discussion first, to make sure that your PR will be accepted before you spend effort coding it.
17
18 Fork the Clipboard.js repository, clone it locally and create a branch for your proposed bug fix or new feature. Avoid working directly on the master branch.
19
20 Implement your bug fix or feature, write tests to cover it and make sure all tests are passing (run a final `npm test` to make sure everything is correct). Then commit your changes, push your bug fix/feature branch to the origin (your forked repo) and open a pull request to the upstream (the repository you originally forked)'s master branch.
21
22 ## Documentation
23
24 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.
25
26 ## Known issues
27 If you're using npm@3 you'll probably face some issues related to peerDependencies.
28 https://github.com/npm/npm/issues/9204
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>constructor-node</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <div id="btn" data-clipboard-text="1">
11 <span>Copy</span>
12 </div>
13
14 <!-- 2. Include library -->
15 <script src="../dist/clipboard.min.js"></script>
16
17 <!-- 3. Instantiate clipboard by passing a HTML element -->
18 <script>
19 var btn = document.getElementById('btn');
20 var clipboard = new ClipboardJS(btn);
21
22 clipboard.on('success', function(e) {
23 console.log(e);
24 });
25
26 clipboard.on('error', function(e) {
27 console.log(e);
28 });
29 </script>
30 </body>
31 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>constructor-nodelist</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <button data-clipboard-text="1">Copy</button>
11 <button data-clipboard-text="2">Copy</button>
12 <button data-clipboard-text="3">Copy</button>
13
14 <!-- 2. Include library -->
15 <script src="../dist/clipboard.min.js"></script>
16
17 <!-- 3. Instantiate clipboard by passing a list of HTML elements -->
18 <script>
19 var btns = document.querySelectorAll('button');
20 var clipboard = new ClipboardJS(btns);
21
22 clipboard.on('success', function(e) {
23 console.log(e);
24 });
25
26 clipboard.on('error', function(e) {
27 console.log(e);
28 });
29 </script>
30 </body>
31 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>constructor-selector</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <button class="btn" data-clipboard-text="1">Copy</button>
11 <button class="btn" data-clipboard-text="2">Copy</button>
12 <button class="btn" data-clipboard-text="3">Copy</button>
13
14 <!-- 2. Include library -->
15 <script src="../dist/clipboard.min.js"></script>
16
17 <!-- 3. Instantiate clipboard by passing a string selector -->
18 <script>
19 var clipboard = new ClipboardJS('.btn');
20
21 clipboard.on('success', function(e) {
22 console.log(e);
23 });
24
25 clipboard.on('error', function(e) {
26 console.log(e);
27 });
28 </script>
29 </body>
30 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>function-target</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <button class="btn">Copy</button>
11 <div>hello</div>
12
13 <!-- 2. Include library -->
14 <script src="../dist/clipboard.min.js"></script>
15
16 <!-- 3. Instantiate clipboard -->
17 <script>
18 var clipboard = new ClipboardJS('.btn', {
19 target: function() {
20 return document.querySelector('div');
21 }
22 });
23
24 clipboard.on('success', function(e) {
25 console.log(e);
26 });
27
28 clipboard.on('error', function(e) {
29 console.log(e);
30 });
31 </script>
32 </body>
33 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>function-text</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <button class="btn">Copy</button>
11
12 <!-- 2. Include library -->
13 <script src="../dist/clipboard.min.js"></script>
14
15 <!-- 3. Instantiate clipboard -->
16 <script>
17 var clipboard = new ClipboardJS('.btn', {
18 text: function() {
19 return 'to be or not to be';
20 }
21 });
22
23 clipboard.on('success', function(e) {
24 console.log(e);
25 });
26
27 clipboard.on('error', function(e) {
28 console.log(e);
29 });
30 </script>
31 </body>
32 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>target-div</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <div>hello</div>
11 <button class="btn" data-clipboard-action="copy" data-clipboard-target="div">Copy</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/clipboard.min.js"></script>
15
16 <!-- 3. Instantiate clipboard -->
17 <script>
18 var clipboard = new ClipboardJS('.btn');
19
20 clipboard.on('success', function(e) {
21 console.log(e);
22 });
23
24 clipboard.on('error', function(e) {
25 console.log(e);
26 });
27 </script>
28 </body>
29 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>target-input</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <input id="foo" type="text" value="hello">
11 <button class="btn" data-clipboard-action="copy" data-clipboard-target="#foo">Copy</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/clipboard.min.js"></script>
15
16 <!-- 3. Instantiate clipboard -->
17 <script>
18 var clipboard = new ClipboardJS('.btn');
19
20 clipboard.on('success', function(e) {
21 console.log(e);
22 });
23
24 clipboard.on('error', function(e) {
25 console.log(e);
26 });
27 </script>
28 </body>
29 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>target-textarea</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 </head>
8 <body>
9 <!-- 1. Define some markup -->
10 <textarea id="bar">hello</textarea>
11 <button class="btn" data-clipboard-action="cut" data-clipboard-target="#bar">Cut</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/clipboard.min.js"></script>
15
16 <!-- 3. Instantiate clipboard -->
17 <script>
18 var clipboard = new ClipboardJS('.btn');
19
20 clipboard.on('success', function(e) {
21 console.log(e);
22 });
23
24 clipboard.on('error', function(e) {
25 console.log(e);
26 });
27 </script>
28 </body>
29 </html>
1 /*!
2 * clipboard.js v2.0.6
3 * https://clipboardjs.com/
4 *
5 * Licensed MIT © Zeno Rocha
6 */
7 (function webpackUniversalModuleDefinition(root, factory) {
8 if(typeof exports === 'object' && typeof module === 'object')
9 module.exports = factory();
10 else if(typeof define === 'function' && define.amd)
11 define([], factory);
12 else if(typeof exports === 'object')
13 exports["ClipboardJS"] = factory();
14 else
15 root["ClipboardJS"] = factory();
16 })(this, function() {
17 return /******/ (function(modules) { // webpackBootstrap
18 /******/ // The module cache
19 /******/ var installedModules = {};
20 /******/
21 /******/ // The require function
22 /******/ function __webpack_require__(moduleId) {
23 /******/
24 /******/ // Check if module is in cache
25 /******/ if(installedModules[moduleId]) {
26 /******/ return installedModules[moduleId].exports;
27 /******/ }
28 /******/ // Create a new module (and put it into the cache)
29 /******/ var module = installedModules[moduleId] = {
30 /******/ i: moduleId,
31 /******/ l: false,
32 /******/ exports: {}
33 /******/ };
34 /******/
35 /******/ // Execute the module function
36 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
37 /******/
38 /******/ // Flag the module as loaded
39 /******/ module.l = true;
40 /******/
41 /******/ // Return the exports of the module
42 /******/ return module.exports;
43 /******/ }
44 /******/
45 /******/
46 /******/ // expose the modules object (__webpack_modules__)
47 /******/ __webpack_require__.m = modules;
48 /******/
49 /******/ // expose the module cache
50 /******/ __webpack_require__.c = installedModules;
51 /******/
52 /******/ // define getter function for harmony exports
53 /******/ __webpack_require__.d = function(exports, name, getter) {
54 /******/ if(!__webpack_require__.o(exports, name)) {
55 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
56 /******/ }
57 /******/ };
58 /******/
59 /******/ // define __esModule on exports
60 /******/ __webpack_require__.r = function(exports) {
61 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
62 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
63 /******/ }
64 /******/ Object.defineProperty(exports, '__esModule', { value: true });
65 /******/ };
66 /******/
67 /******/ // create a fake namespace object
68 /******/ // mode & 1: value is a module id, require it
69 /******/ // mode & 2: merge all properties of value into the ns
70 /******/ // mode & 4: return value when already ns object
71 /******/ // mode & 8|1: behave like require
72 /******/ __webpack_require__.t = function(value, mode) {
73 /******/ if(mode & 1) value = __webpack_require__(value);
74 /******/ if(mode & 8) return value;
75 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
76 /******/ var ns = Object.create(null);
77 /******/ __webpack_require__.r(ns);
78 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
79 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
80 /******/ return ns;
81 /******/ };
82 /******/
83 /******/ // getDefaultExport function for compatibility with non-harmony modules
84 /******/ __webpack_require__.n = function(module) {
85 /******/ var getter = module && module.__esModule ?
86 /******/ function getDefault() { return module['default']; } :
87 /******/ function getModuleExports() { return module; };
88 /******/ __webpack_require__.d(getter, 'a', getter);
89 /******/ return getter;
90 /******/ };
91 /******/
92 /******/ // Object.prototype.hasOwnProperty.call
93 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
94 /******/
95 /******/ // __webpack_public_path__
96 /******/ __webpack_require__.p = "";
97 /******/
98 /******/
99 /******/ // Load entry module and return exports
100 /******/ return __webpack_require__(__webpack_require__.s = 6);
101 /******/ })
102 /************************************************************************/
103 /******/ ([
104 /* 0 */
105 /***/ (function(module, exports) {
106
107 function select(element) {
108 var selectedText;
109
110 if (element.nodeName === 'SELECT') {
111 element.focus();
112
113 selectedText = element.value;
114 }
115 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
116 var isReadOnly = element.hasAttribute('readonly');
117
118 if (!isReadOnly) {
119 element.setAttribute('readonly', '');
120 }
121
122 element.select();
123 element.setSelectionRange(0, element.value.length);
124
125 if (!isReadOnly) {
126 element.removeAttribute('readonly');
127 }
128
129 selectedText = element.value;
130 }
131 else {
132 if (element.hasAttribute('contenteditable')) {
133 element.focus();
134 }
135
136 var selection = window.getSelection();
137 var range = document.createRange();
138
139 range.selectNodeContents(element);
140 selection.removeAllRanges();
141 selection.addRange(range);
142
143 selectedText = selection.toString();
144 }
145
146 return selectedText;
147 }
148
149 module.exports = select;
150
151
152 /***/ }),
153 /* 1 */
154 /***/ (function(module, exports) {
155
156 function E () {
157 // Keep this empty so it's easier to inherit from
158 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
159 }
160
161 E.prototype = {
162 on: function (name, callback, ctx) {
163 var e = this.e || (this.e = {});
164
165 (e[name] || (e[name] = [])).push({
166 fn: callback,
167 ctx: ctx
168 });
169
170 return this;
171 },
172
173 once: function (name, callback, ctx) {
174 var self = this;
175 function listener () {
176 self.off(name, listener);
177 callback.apply(ctx, arguments);
178 };
179
180 listener._ = callback
181 return this.on(name, listener, ctx);
182 },
183
184 emit: function (name) {
185 var data = [].slice.call(arguments, 1);
186 var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
187 var i = 0;
188 var len = evtArr.length;
189
190 for (i; i < len; i++) {
191 evtArr[i].fn.apply(evtArr[i].ctx, data);
192 }
193
194 return this;
195 },
196
197 off: function (name, callback) {
198 var e = this.e || (this.e = {});
199 var evts = e[name];
200 var liveEvents = [];
201
202 if (evts && callback) {
203 for (var i = 0, len = evts.length; i < len; i++) {
204 if (evts[i].fn !== callback && evts[i].fn._ !== callback)
205 liveEvents.push(evts[i]);
206 }
207 }
208
209 // Remove event from queue to prevent memory leak
210 // Suggested by https://github.com/lazd
211 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
212
213 (liveEvents.length)
214 ? e[name] = liveEvents
215 : delete e[name];
216
217 return this;
218 }
219 };
220
221 module.exports = E;
222 module.exports.TinyEmitter = E;
223
224
225 /***/ }),
226 /* 2 */
227 /***/ (function(module, exports, __webpack_require__) {
228
229 var is = __webpack_require__(3);
230 var delegate = __webpack_require__(4);
231
232 /**
233 * Validates all params and calls the right
234 * listener function based on its target type.
235 *
236 * @param {String|HTMLElement|HTMLCollection|NodeList} target
237 * @param {String} type
238 * @param {Function} callback
239 * @return {Object}
240 */
241 function listen(target, type, callback) {
242 if (!target && !type && !callback) {
243 throw new Error('Missing required arguments');
244 }
245
246 if (!is.string(type)) {
247 throw new TypeError('Second argument must be a String');
248 }
249
250 if (!is.fn(callback)) {
251 throw new TypeError('Third argument must be a Function');
252 }
253
254 if (is.node(target)) {
255 return listenNode(target, type, callback);
256 }
257 else if (is.nodeList(target)) {
258 return listenNodeList(target, type, callback);
259 }
260 else if (is.string(target)) {
261 return listenSelector(target, type, callback);
262 }
263 else {
264 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
265 }
266 }
267
268 /**
269 * Adds an event listener to a HTML element
270 * and returns a remove listener function.
271 *
272 * @param {HTMLElement} node
273 * @param {String} type
274 * @param {Function} callback
275 * @return {Object}
276 */
277 function listenNode(node, type, callback) {
278 node.addEventListener(type, callback);
279
280 return {
281 destroy: function() {
282 node.removeEventListener(type, callback);
283 }
284 }
285 }
286
287 /**
288 * Add an event listener to a list of HTML elements
289 * and returns a remove listener function.
290 *
291 * @param {NodeList|HTMLCollection} nodeList
292 * @param {String} type
293 * @param {Function} callback
294 * @return {Object}
295 */
296 function listenNodeList(nodeList, type, callback) {
297 Array.prototype.forEach.call(nodeList, function(node) {
298 node.addEventListener(type, callback);
299 });
300
301 return {
302 destroy: function() {
303 Array.prototype.forEach.call(nodeList, function(node) {
304 node.removeEventListener(type, callback);
305 });
306 }
307 }
308 }
309
310 /**
311 * Add an event listener to a selector
312 * and returns a remove listener function.
313 *
314 * @param {String} selector
315 * @param {String} type
316 * @param {Function} callback
317 * @return {Object}
318 */
319 function listenSelector(selector, type, callback) {
320 return delegate(document.body, selector, type, callback);
321 }
322
323 module.exports = listen;
324
325
326 /***/ }),
327 /* 3 */
328 /***/ (function(module, exports) {
329
330 /**
331 * Check if argument is a HTML element.
332 *
333 * @param {Object} value
334 * @return {Boolean}
335 */
336 exports.node = function(value) {
337 return value !== undefined
338 && value instanceof HTMLElement
339 && value.nodeType === 1;
340 };
341
342 /**
343 * Check if argument is a list of HTML elements.
344 *
345 * @param {Object} value
346 * @return {Boolean}
347 */
348 exports.nodeList = function(value) {
349 var type = Object.prototype.toString.call(value);
350
351 return value !== undefined
352 && (type === '[object NodeList]' || type === '[object HTMLCollection]')
353 && ('length' in value)
354 && (value.length === 0 || exports.node(value[0]));
355 };
356
357 /**
358 * Check if argument is a string.
359 *
360 * @param {Object} value
361 * @return {Boolean}
362 */
363 exports.string = function(value) {
364 return typeof value === 'string'
365 || value instanceof String;
366 };
367
368 /**
369 * Check if argument is a function.
370 *
371 * @param {Object} value
372 * @return {Boolean}
373 */
374 exports.fn = function(value) {
375 var type = Object.prototype.toString.call(value);
376
377 return type === '[object Function]';
378 };
379
380
381 /***/ }),
382 /* 4 */
383 /***/ (function(module, exports, __webpack_require__) {
384
385 var closest = __webpack_require__(5);
386
387 /**
388 * Delegates event to a selector.
389 *
390 * @param {Element} element
391 * @param {String} selector
392 * @param {String} type
393 * @param {Function} callback
394 * @param {Boolean} useCapture
395 * @return {Object}
396 */
397 function _delegate(element, selector, type, callback, useCapture) {
398 var listenerFn = listener.apply(this, arguments);
399
400 element.addEventListener(type, listenerFn, useCapture);
401
402 return {
403 destroy: function() {
404 element.removeEventListener(type, listenerFn, useCapture);
405 }
406 }
407 }
408
409 /**
410 * Delegates event to a selector.
411 *
412 * @param {Element|String|Array} [elements]
413 * @param {String} selector
414 * @param {String} type
415 * @param {Function} callback
416 * @param {Boolean} useCapture
417 * @return {Object}
418 */
419 function delegate(elements, selector, type, callback, useCapture) {
420 // Handle the regular Element usage
421 if (typeof elements.addEventListener === 'function') {
422 return _delegate.apply(null, arguments);
423 }
424
425 // Handle Element-less usage, it defaults to global delegation
426 if (typeof type === 'function') {
427 // Use `document` as the first parameter, then apply arguments
428 // This is a short way to .unshift `arguments` without running into deoptimizations
429 return _delegate.bind(null, document).apply(null, arguments);
430 }
431
432 // Handle Selector-based usage
433 if (typeof elements === 'string') {
434 elements = document.querySelectorAll(elements);
435 }
436
437 // Handle Array-like based usage
438 return Array.prototype.map.call(elements, function (element) {
439 return _delegate(element, selector, type, callback, useCapture);
440 });
441 }
442
443 /**
444 * Finds closest match and invokes callback.
445 *
446 * @param {Element} element
447 * @param {String} selector
448 * @param {String} type
449 * @param {Function} callback
450 * @return {Function}
451 */
452 function listener(element, selector, type, callback) {
453 return function(e) {
454 e.delegateTarget = closest(e.target, selector);
455
456 if (e.delegateTarget) {
457 callback.call(element, e);
458 }
459 }
460 }
461
462 module.exports = delegate;
463
464
465 /***/ }),
466 /* 5 */
467 /***/ (function(module, exports) {
468
469 var DOCUMENT_NODE_TYPE = 9;
470
471 /**
472 * A polyfill for Element.matches()
473 */
474 if (typeof Element !== 'undefined' && !Element.prototype.matches) {
475 var proto = Element.prototype;
476
477 proto.matches = proto.matchesSelector ||
478 proto.mozMatchesSelector ||
479 proto.msMatchesSelector ||
480 proto.oMatchesSelector ||
481 proto.webkitMatchesSelector;
482 }
483
484 /**
485 * Finds the closest parent that matches a selector.
486 *
487 * @param {Element} element
488 * @param {String} selector
489 * @return {Function}
490 */
491 function closest (element, selector) {
492 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
493 if (typeof element.matches === 'function' &&
494 element.matches(selector)) {
495 return element;
496 }
497 element = element.parentNode;
498 }
499 }
500
501 module.exports = closest;
502
503
504 /***/ }),
505 /* 6 */
506 /***/ (function(module, __webpack_exports__, __webpack_require__) {
507
508 "use strict";
509 __webpack_require__.r(__webpack_exports__);
510
511 // EXTERNAL MODULE: ./node_modules/select/src/select.js
512 var src_select = __webpack_require__(0);
513 var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
514
515 // CONCATENATED MODULE: ./src/clipboard-action.js
516 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; };
517
518 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; }; }();
519
520 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
521
522
523
524 /**
525 * Inner class which performs selection from either `text` or `target`
526 * properties and then executes copy or cut operations.
527 */
528
529 var clipboard_action_ClipboardAction = function () {
530 /**
531 * @param {Object} options
532 */
533 function ClipboardAction(options) {
534 _classCallCheck(this, ClipboardAction);
535
536 this.resolveOptions(options);
537 this.initSelection();
538 }
539
540 /**
541 * Defines base properties passed from constructor.
542 * @param {Object} options
543 */
544
545
546 _createClass(ClipboardAction, [{
547 key: 'resolveOptions',
548 value: function resolveOptions() {
549 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
550
551 this.action = options.action;
552 this.container = options.container;
553 this.emitter = options.emitter;
554 this.target = options.target;
555 this.text = options.text;
556 this.trigger = options.trigger;
557
558 this.selectedText = '';
559 }
560
561 /**
562 * Decides which selection strategy is going to be applied based
563 * on the existence of `text` and `target` properties.
564 */
565
566 }, {
567 key: 'initSelection',
568 value: function initSelection() {
569 if (this.text) {
570 this.selectFake();
571 } else if (this.target) {
572 this.selectTarget();
573 }
574 }
575
576 /**
577 * Creates a fake textarea element, sets its value from `text` property,
578 * and makes a selection on it.
579 */
580
581 }, {
582 key: 'selectFake',
583 value: function selectFake() {
584 var _this = this;
585
586 var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
587
588 this.removeFake();
589
590 this.fakeHandlerCallback = function () {
591 return _this.removeFake();
592 };
593 this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
594
595 this.fakeElem = document.createElement('textarea');
596 // Prevent zooming on iOS
597 this.fakeElem.style.fontSize = '12pt';
598 // Reset box model
599 this.fakeElem.style.border = '0';
600 this.fakeElem.style.padding = '0';
601 this.fakeElem.style.margin = '0';
602 // Move element out of screen horizontally
603 this.fakeElem.style.position = 'absolute';
604 this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
605 // Move element to the same position vertically
606 var yPosition = window.pageYOffset || document.documentElement.scrollTop;
607 this.fakeElem.style.top = yPosition + 'px';
608
609 this.fakeElem.setAttribute('readonly', '');
610 this.fakeElem.value = this.text;
611
612 this.container.appendChild(this.fakeElem);
613
614 this.selectedText = select_default()(this.fakeElem);
615 this.copyText();
616 }
617
618 /**
619 * Only removes the fake element after another click event, that way
620 * a user can hit `Ctrl+C` to copy because selection still exists.
621 */
622
623 }, {
624 key: 'removeFake',
625 value: function removeFake() {
626 if (this.fakeHandler) {
627 this.container.removeEventListener('click', this.fakeHandlerCallback);
628 this.fakeHandler = null;
629 this.fakeHandlerCallback = null;
630 }
631
632 if (this.fakeElem) {
633 this.container.removeChild(this.fakeElem);
634 this.fakeElem = null;
635 }
636 }
637
638 /**
639 * Selects the content from element passed on `target` property.
640 */
641
642 }, {
643 key: 'selectTarget',
644 value: function selectTarget() {
645 this.selectedText = select_default()(this.target);
646 this.copyText();
647 }
648
649 /**
650 * Executes the copy operation based on the current selection.
651 */
652
653 }, {
654 key: 'copyText',
655 value: function copyText() {
656 var succeeded = void 0;
657
658 try {
659 succeeded = document.execCommand(this.action);
660 } catch (err) {
661 succeeded = false;
662 }
663
664 this.handleResult(succeeded);
665 }
666
667 /**
668 * Fires an event based on the copy operation result.
669 * @param {Boolean} succeeded
670 */
671
672 }, {
673 key: 'handleResult',
674 value: function handleResult(succeeded) {
675 this.emitter.emit(succeeded ? 'success' : 'error', {
676 action: this.action,
677 text: this.selectedText,
678 trigger: this.trigger,
679 clearSelection: this.clearSelection.bind(this)
680 });
681 }
682
683 /**
684 * Moves focus away from `target` and back to the trigger, removes current selection.
685 */
686
687 }, {
688 key: 'clearSelection',
689 value: function clearSelection() {
690 if (this.trigger) {
691 this.trigger.focus();
692 }
693 document.activeElement.blur();
694 window.getSelection().removeAllRanges();
695 }
696
697 /**
698 * Sets the `action` to be performed which can be either 'copy' or 'cut'.
699 * @param {String} action
700 */
701
702 }, {
703 key: 'destroy',
704
705
706 /**
707 * Destroy lifecycle.
708 */
709 value: function destroy() {
710 this.removeFake();
711 }
712 }, {
713 key: 'action',
714 set: function set() {
715 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
716
717 this._action = action;
718
719 if (this._action !== 'copy' && this._action !== 'cut') {
720 throw new Error('Invalid "action" value, use either "copy" or "cut"');
721 }
722 }
723
724 /**
725 * Gets the `action` property.
726 * @return {String}
727 */
728 ,
729 get: function get() {
730 return this._action;
731 }
732
733 /**
734 * Sets the `target` property using an element
735 * that will be have its content copied.
736 * @param {Element} target
737 */
738
739 }, {
740 key: 'target',
741 set: function set(target) {
742 if (target !== undefined) {
743 if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
744 if (this.action === 'copy' && target.hasAttribute('disabled')) {
745 throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
746 }
747
748 if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
749 throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
750 }
751
752 this._target = target;
753 } else {
754 throw new Error('Invalid "target" value, use a valid Element');
755 }
756 }
757 }
758
759 /**
760 * Gets the `target` property.
761 * @return {String|HTMLElement}
762 */
763 ,
764 get: function get() {
765 return this._target;
766 }
767 }]);
768
769 return ClipboardAction;
770 }();
771
772 /* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction);
773 // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
774 var tiny_emitter = __webpack_require__(1);
775 var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
776
777 // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
778 var listen = __webpack_require__(2);
779 var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
780
781 // CONCATENATED MODULE: ./src/clipboard.js
782 var clipboard_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; };
783
784 var clipboard_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; }; }();
785
786 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
787
788 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; }
789
790 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; }
791
792
793
794
795
796 /**
797 * Base class which takes one or more elements, adds event listeners to them,
798 * and instantiates a new `ClipboardAction` on each click.
799 */
800
801 var clipboard_Clipboard = function (_Emitter) {
802 _inherits(Clipboard, _Emitter);
803
804 /**
805 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
806 * @param {Object} options
807 */
808 function Clipboard(trigger, options) {
809 clipboard_classCallCheck(this, Clipboard);
810
811 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
812
813 _this.resolveOptions(options);
814 _this.listenClick(trigger);
815 return _this;
816 }
817
818 /**
819 * Defines if attributes would be resolved using internal setter functions
820 * or custom functions that were passed in the constructor.
821 * @param {Object} options
822 */
823
824
825 clipboard_createClass(Clipboard, [{
826 key: 'resolveOptions',
827 value: function resolveOptions() {
828 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
829
830 this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
831 this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
832 this.text = typeof options.text === 'function' ? options.text : this.defaultText;
833 this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
834 }
835
836 /**
837 * Adds a click event listener to the passed trigger.
838 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
839 */
840
841 }, {
842 key: 'listenClick',
843 value: function listenClick(trigger) {
844 var _this2 = this;
845
846 this.listener = listen_default()(trigger, 'click', function (e) {
847 return _this2.onClick(e);
848 });
849 }
850
851 /**
852 * Defines a new `ClipboardAction` on each click event.
853 * @param {Event} e
854 */
855
856 }, {
857 key: 'onClick',
858 value: function onClick(e) {
859 var trigger = e.delegateTarget || e.currentTarget;
860
861 if (this.clipboardAction) {
862 this.clipboardAction = null;
863 }
864
865 this.clipboardAction = new clipboard_action({
866 action: this.action(trigger),
867 target: this.target(trigger),
868 text: this.text(trigger),
869 container: this.container,
870 trigger: trigger,
871 emitter: this
872 });
873 }
874
875 /**
876 * Default `action` lookup function.
877 * @param {Element} trigger
878 */
879
880 }, {
881 key: 'defaultAction',
882 value: function defaultAction(trigger) {
883 return getAttributeValue('action', trigger);
884 }
885
886 /**
887 * Default `target` lookup function.
888 * @param {Element} trigger
889 */
890
891 }, {
892 key: 'defaultTarget',
893 value: function defaultTarget(trigger) {
894 var selector = getAttributeValue('target', trigger);
895
896 if (selector) {
897 return document.querySelector(selector);
898 }
899 }
900
901 /**
902 * Returns the support of the given action, or all actions if no action is
903 * given.
904 * @param {String} [action]
905 */
906
907 }, {
908 key: 'defaultText',
909
910
911 /**
912 * Default `text` lookup function.
913 * @param {Element} trigger
914 */
915 value: function defaultText(trigger) {
916 return getAttributeValue('text', trigger);
917 }
918
919 /**
920 * Destroy lifecycle.
921 */
922
923 }, {
924 key: 'destroy',
925 value: function destroy() {
926 this.listener.destroy();
927
928 if (this.clipboardAction) {
929 this.clipboardAction.destroy();
930 this.clipboardAction = null;
931 }
932 }
933 }], [{
934 key: 'isSupported',
935 value: function isSupported() {
936 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
937
938 var actions = typeof action === 'string' ? [action] : action;
939 var support = !!document.queryCommandSupported;
940
941 actions.forEach(function (action) {
942 support = support && !!document.queryCommandSupported(action);
943 });
944
945 return support;
946 }
947 }]);
948
949 return Clipboard;
950 }(tiny_emitter_default.a);
951
952 /**
953 * Helper function to retrieve attribute value.
954 * @param {String} suffix
955 * @param {Element} element
956 */
957
958
959 function getAttributeValue(suffix, element) {
960 var attribute = 'data-clipboard-' + suffix;
961
962 if (!element.hasAttribute(attribute)) {
963 return;
964 }
965
966 return element.getAttribute(attribute);
967 }
968
969 /* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard);
970
971 /***/ })
972 /******/ ])["default"];
973 });
...\ No newline at end of file ...\ No newline at end of file
1 /*!
2 * clipboard.js v2.0.6
3 * https://clipboardjs.com/
4 *
5 * Licensed MIT © Zeno Rocha
6 */
7 !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 o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;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,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n,t.exports.TinyEmitter=n},function(t,e,n){var d=n(3),h=n(4);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(u=t).addEventListener(s,f),{destroy:function(){u.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,l=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,l)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,l)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,l,u,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(5);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},function(t,e,n){"use strict";n.r(e);var o=n(0),r=n.n(o),i="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};function a(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function c(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),this.resolveOptions(t),this.initSelection()}var l=(function(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),t}(c,[{key:"resolveOptions",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=r()(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=r()(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(t){var e=0<arguments.length&&void 0!==t?t:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":i(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),c),u=n(1),s=n.n(u),f=n(2),d=n.n(f),h="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},p=function(t,e,n){return e&&y(t.prototype,e),n&&y(t,n),t};function y(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var m=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(v,s.a),p(v,[{key:"resolveOptions",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===h(e.container)?e.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=d()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return b("action",t)}},{key:"defaultTarget",value:function(t){var e=b("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return b("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(t){var e=0<arguments.length&&void 0!==t?t:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),v);function v(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,v);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return n.resolveOptions(e),n.listenClick(t),n}function b(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}e.default=m}],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=6).default;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}var n,o});
...\ No newline at end of file ...\ No newline at end of file
1 var webpackConfig = require('./webpack.config.js');
2
3 module.exports = function (karma) {
4 karma.set({
5 plugins: ['karma-webpack', 'karma-chai', 'karma-sinon', 'karma-mocha', 'karma-chrome-launcher'],
6
7 frameworks: ['chai', 'sinon', 'mocha'],
8
9 files: [
10 'src/**/*.js',
11 'test/**/*.js',
12 ],
13
14 preprocessors: {
15 'src/**/*.js': ['webpack'],
16 'test/**/*.js': ['webpack']
17 },
18
19 webpack: {
20 module: webpackConfig.module,
21 plugins: webpackConfig.plugins
22 },
23
24 webpackMiddleware: {
25 stats: 'errors-only'
26 },
27
28 browsers: ['ChromeHeadless']
29 });
30 };
1 // Package metadata for Meteor.js.
2
3 Package.describe({
4 name: "zenorocha:clipboard",
5 summary: "Modern copy to clipboard. No Flash. Just 3kb.",
6 version: "2.0.6",
7 git: "https://github.com/zenorocha/clipboard.js"
8 });
9
10 Package.onUse(function(api) {
11 api.addFiles("dist/clipboard.js", "client");
12 });
1 {
2 "_from": "clipboard@^2.0.0",
3 "_id": "clipboard@2.0.6",
4 "_inBundle": false,
5 "_integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
6 "_location": "/clipboard",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "range",
10 "registry": true,
11 "raw": "clipboard@^2.0.0",
12 "name": "clipboard",
13 "escapedName": "clipboard",
14 "rawSpec": "^2.0.0",
15 "saveSpec": null,
16 "fetchSpec": "^2.0.0"
17 },
18 "_requiredBy": [
19 "/vue-clipboard2"
20 ],
21 "_resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
22 "_shasum": "52921296eec0fdf77ead1749421b21c968647376",
23 "_spec": "clipboard@^2.0.0",
24 "_where": "/Users/zhanghao/brcode/br-client/node_modules/vue-clipboard2",
25 "bugs": {
26 "url": "https://github.com/zenorocha/clipboard.js/issues"
27 },
28 "bundleDependencies": false,
29 "dependencies": {
30 "good-listener": "^1.2.2",
31 "select": "^1.1.2",
32 "tiny-emitter": "^2.0.0"
33 },
34 "deprecated": false,
35 "description": "Modern copy to clipboard. No Flash. Just 2kb",
36 "devDependencies": {
37 "babel-core": "^6.26.0",
38 "babel-loader": "^7.1.4",
39 "babel-preset-env": "^1.7.0",
40 "chai": "^4.2.0",
41 "cross-env": "^5.2.0",
42 "karma": "^3.1.1",
43 "karma-chai": "^0.1.0",
44 "karma-chrome-launcher": "^2.2.0",
45 "karma-mocha": "^1.2.0",
46 "karma-sinon": "^1.0.4",
47 "karma-webpack": "^3.0.5",
48 "mocha": "^5.2.0",
49 "sinon": "^7.1.1",
50 "uglifyjs-webpack-plugin": "^2.0.1",
51 "webpack": "^4.5.0",
52 "webpack-cli": "^3.1.2"
53 },
54 "homepage": "https://github.com/zenorocha/clipboard.js#readme",
55 "keywords": [
56 "clipboard",
57 "copy",
58 "cut"
59 ],
60 "license": "MIT",
61 "main": "dist/clipboard.js",
62 "name": "clipboard",
63 "repository": {
64 "type": "git",
65 "url": "git+https://github.com/zenorocha/clipboard.js.git"
66 },
67 "scripts": {
68 "build": "npm run build-debug && npm run build-min",
69 "build-debug": "webpack",
70 "build-min": "cross-env NODE_ENV=production webpack",
71 "build-watch": "webpack --watch",
72 "prepublish": "npm run build",
73 "test": "karma start --single-run"
74 },
75 "version": "2.0.6"
76 }
1 # clipboard.js
2
3 [![Build Status](http://img.shields.io/travis/zenorocha/clipboard.js/master.svg?style=flat)](https://travis-ci.org/zenorocha/clipboard.js)
4 ![Killing Flash](https://img.shields.io/badge/killing-flash-brightgreen.svg?style=flat)
5
6 > Modern copy to clipboard. No Flash. Just 3kb gzipped.
7
8 <a href="https://clipboardjs.com/"><img width="728" src="https://cloud.githubusercontent.com/assets/398893/16165747/a0f6fc46-349a-11e6-8c9b-c5fd58d9099c.png" alt="Demo"></a>
9
10 ## Why
11
12 Copying text to the clipboard shouldn't be hard. It shouldn't require dozens of steps to configure or hundreds of KBs to load. But most of all, it shouldn't depend on Flash or any bloated framework.
13
14 That's why clipboard.js exists.
15
16 ## Install
17
18 You can get it on npm.
19
20 ```
21 npm install clipboard --save
22 ```
23
24 Or if you're not into package management, just [download a ZIP](https://github.com/zenorocha/clipboard.js/archive/master.zip) file.
25
26 ## Setup
27
28 First, include the script located on the `dist` folder or load it from [a third-party CDN provider](https://github.com/zenorocha/clipboard.js/wiki/CDN-Providers).
29
30 ```html
31 <script src="dist/clipboard.min.js"></script>
32 ```
33
34 Now, you need to instantiate it by [passing a DOM selector](https://github.com/zenorocha/clipboard.js/blob/master/demo/constructor-selector.html#L18), [HTML element](https://github.com/zenorocha/clipboard.js/blob/master/demo/constructor-node.html#L16-L17), or [list of HTML elements](https://github.com/zenorocha/clipboard.js/blob/master/demo/constructor-nodelist.html#L18-L19).
35
36 ```js
37 new ClipboardJS('.btn');
38 ```
39
40 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.
41
42 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).
43
44 # Usage
45
46 We're living a _declarative renaissance_, that's why we decided to take advantage of [HTML5 data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) for better usability.
47
48 ### Copy text from another element
49
50 A pretty common use case is to copy content from another element. You can do that by adding a `data-clipboard-target` attribute in your trigger element.
51
52 The value you include on this attribute needs to match another's element selector.
53
54 <a href="https://clipboardjs.com/#example-target"><img width="473" alt="example-2" src="https://cloud.githubusercontent.com/assets/398893/9983467/a4946aaa-5fb1-11e5-9780-f09fcd7ca6c8.png"></a>
55
56 ```html
57 <!-- Target -->
58 <input id="foo" value="https://github.com/zenorocha/clipboard.js.git">
59
60 <!-- Trigger -->
61 <button class="btn" data-clipboard-target="#foo">
62 <img src="assets/clippy.svg" alt="Copy to clipboard">
63 </button>
64 ```
65
66 ### Cut text from another element
67
68 Additionally, you can define a `data-clipboard-action` attribute to specify if you want to either `copy` or `cut` content.
69
70 If you omit this attribute, `copy` will be used by default.
71
72 <a href="https://clipboardjs.com/#example-action"><img width="473" alt="example-3" src="https://cloud.githubusercontent.com/assets/398893/10000358/7df57b9c-6050-11e5-9cd1-fbc51d2fd0a7.png"></a>
73
74 ```html
75 <!-- Target -->
76 <textarea id="bar">Mussum ipsum cacilds...</textarea>
77
78 <!-- Trigger -->
79 <button class="btn" data-clipboard-action="cut" data-clipboard-target="#bar">
80 Cut to clipboard
81 </button>
82 ```
83
84 As you may expect, the `cut` action only works on `<input>` or `<textarea>` elements.
85
86 ### Copy text from attribute
87
88 Truth is, you don't even need another element to copy its content from. You can just include a `data-clipboard-text` attribute in your trigger element.
89
90 <a href="https://clipboardjs.com/#example-text"><img width="147" alt="example-1" src="https://cloud.githubusercontent.com/assets/398893/10000347/6e16cf8c-6050-11e5-9883-1c5681f9ec45.png"></a>
91
92 ```html
93 <!-- Trigger -->
94 <button class="btn" data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">
95 Copy to clipboard
96 </button>
97 ```
98
99 ## Events
100
101 There are cases where you'd like to show some user feedback or capture what has been selected after a copy/cut operation.
102
103 That's why we fire custom events such as `success` and `error` for you to listen and implement your custom logic.
104
105 ```js
106 var clipboard = new ClipboardJS('.btn');
107
108 clipboard.on('success', function(e) {
109 console.info('Action:', e.action);
110 console.info('Text:', e.text);
111 console.info('Trigger:', e.trigger);
112
113 e.clearSelection();
114 });
115
116 clipboard.on('error', function(e) {
117 console.error('Action:', e.action);
118 console.error('Trigger:', e.trigger);
119 });
120 ```
121
122 For a live demonstration, go to this [site](https://clipboardjs.com/) and open your console.
123
124 ## Tooltips
125
126 Each application has different design needs, that's why clipboard.js does not include any CSS or built-in tooltip solution.
127
128 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.
129
130 ## Advanced Options
131
132 If you don't want to modify your HTML, there's a pretty handy imperative API for you to use. All you need to do is declare a function, do your thing, and return a value.
133
134 For instance, if you want to dynamically set a `target`, you'll need to return a Node.
135
136 ```js
137 new ClipboardJS('.btn', {
138 target: function(trigger) {
139 return trigger.nextElementSibling;
140 }
141 });
142 ```
143
144 If you want to dynamically set a `text`, you'll return a String.
145
146 ```js
147 new ClipboardJS('.btn', {
148 text: function(trigger) {
149 return trigger.getAttribute('aria-label');
150 }
151 });
152 ```
153
154 For use in Bootstrap Modals or with any other library that changes the focus you'll want to set the focused element as the `container` value.
155
156 ```js
157 new ClipboardJS('.btn', {
158 container: document.getElementById('modal')
159 });
160 ```
161
162 Also, if you are working with single page apps, you may want to manage the lifecycle of the DOM more precisely. Here's how you clean up the events and objects that we create.
163
164 ```js
165 var clipboard = new ClipboardJS('.btn');
166 clipboard.destroy();
167 ```
168
169 ## Browser Support
170
171 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.
172
173 | <img src="https://clipboardjs.com/assets/images/chrome.png" width="48px" height="48px" alt="Chrome logo"> | <img src="https://clipboardjs.com/assets/images/edge.png" width="48px" height="48px" alt="Edge logo"> | <img src="https://clipboardjs.com/assets/images/firefox.png" width="48px" height="48px" alt="Firefox logo"> | <img src="https://clipboardjs.com/assets/images/ie.png" width="48px" height="48px" alt="Internet Explorer logo"> | <img src="https://clipboardjs.com/assets/images/opera.png" width="48px" height="48px" alt="Opera logo"> | <img src="https://clipboardjs.com/assets/images/safari.png" width="48px" height="48px" alt="Safari logo"> |
174 |:---:|:---:|:---:|:---:|:---:|:---:|
175 | 42+ ✔ | 12+ ✔ | 41+ ✔ | 9+ ✔ | 29+ ✔ | 10+ ✔ |
176
177 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.
178
179 You can also check if clipboard.js is supported or not by running `ClipboardJS.isSupported()`, that way you can hide copy/cut buttons from the UI.
180
181 ## Bonus
182
183 A browser extension that adds a "copy to clipboard" button to every code block on *GitHub, MDN, Gist, StackOverflow, StackExchange, npm, and even Medium.*
184
185 Install for [Chrome](https://chrome.google.com/webstore/detail/codecopy/fkbfebkcoelajmhanocgppanfoojcdmg) and [Firefox](https://addons.mozilla.org/en-US/firefox/addon/codecopy/).
186
187 ## License
188
189 [MIT License](https://zenorocha.mit-license.org/) © Zeno Rocha
1 import select from 'select';
2
3 /**
4 * Inner class which performs selection from either `text` or `target`
5 * properties and then executes copy or cut operations.
6 */
7 class ClipboardAction {
8 /**
9 * @param {Object} options
10 */
11 constructor(options) {
12 this.resolveOptions(options);
13 this.initSelection();
14 }
15
16 /**
17 * Defines base properties passed from constructor.
18 * @param {Object} options
19 */
20 resolveOptions(options = {}) {
21 this.action = options.action;
22 this.container = options.container;
23 this.emitter = options.emitter;
24 this.target = options.target;
25 this.text = options.text;
26 this.trigger = options.trigger;
27
28 this.selectedText = '';
29 }
30
31 /**
32 * Decides which selection strategy is going to be applied based
33 * on the existence of `text` and `target` properties.
34 */
35 initSelection() {
36 if (this.text) {
37 this.selectFake();
38 }
39 else if (this.target) {
40 this.selectTarget();
41 }
42 }
43
44 /**
45 * Creates a fake textarea element, sets its value from `text` property,
46 * and makes a selection on it.
47 */
48 selectFake() {
49 const isRTL = document.documentElement.getAttribute('dir') == 'rtl';
50
51 this.removeFake();
52
53 this.fakeHandlerCallback = () => this.removeFake();
54 this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
55
56 this.fakeElem = document.createElement('textarea');
57 // Prevent zooming on iOS
58 this.fakeElem.style.fontSize = '12pt';
59 // Reset box model
60 this.fakeElem.style.border = '0';
61 this.fakeElem.style.padding = '0';
62 this.fakeElem.style.margin = '0';
63 // Move element out of screen horizontally
64 this.fakeElem.style.position = 'absolute';
65 this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
66 // Move element to the same position vertically
67 let yPosition = window.pageYOffset || document.documentElement.scrollTop;
68 this.fakeElem.style.top = `${yPosition}px`;
69
70 this.fakeElem.setAttribute('readonly', '');
71 this.fakeElem.value = this.text;
72
73 this.container.appendChild(this.fakeElem);
74
75 this.selectedText = select(this.fakeElem);
76 this.copyText();
77 }
78
79 /**
80 * Only removes the fake element after another click event, that way
81 * a user can hit `Ctrl+C` to copy because selection still exists.
82 */
83 removeFake() {
84 if (this.fakeHandler) {
85 this.container.removeEventListener('click', this.fakeHandlerCallback);
86 this.fakeHandler = null;
87 this.fakeHandlerCallback = null;
88 }
89
90 if (this.fakeElem) {
91 this.container.removeChild(this.fakeElem);
92 this.fakeElem = null;
93 }
94 }
95
96 /**
97 * Selects the content from element passed on `target` property.
98 */
99 selectTarget() {
100 this.selectedText = select(this.target);
101 this.copyText();
102 }
103
104 /**
105 * Executes the copy operation based on the current selection.
106 */
107 copyText() {
108 let succeeded;
109
110 try {
111 succeeded = document.execCommand(this.action);
112 }
113 catch (err) {
114 succeeded = false;
115 }
116
117 this.handleResult(succeeded);
118 }
119
120 /**
121 * Fires an event based on the copy operation result.
122 * @param {Boolean} succeeded
123 */
124 handleResult(succeeded) {
125 this.emitter.emit(succeeded ? 'success' : 'error', {
126 action: this.action,
127 text: this.selectedText,
128 trigger: this.trigger,
129 clearSelection: this.clearSelection.bind(this)
130 });
131 }
132
133 /**
134 * Moves focus away from `target` and back to the trigger, removes current selection.
135 */
136 clearSelection() {
137 if (this.trigger) {
138 this.trigger.focus();
139 }
140 document.activeElement.blur();
141 window.getSelection().removeAllRanges();
142 }
143
144 /**
145 * Sets the `action` to be performed which can be either 'copy' or 'cut'.
146 * @param {String} action
147 */
148 set action(action = 'copy') {
149 this._action = action;
150
151 if (this._action !== 'copy' && this._action !== 'cut') {
152 throw new Error('Invalid "action" value, use either "copy" or "cut"');
153 }
154 }
155
156 /**
157 * Gets the `action` property.
158 * @return {String}
159 */
160 get action() {
161 return this._action;
162 }
163
164 /**
165 * Sets the `target` property using an element
166 * that will be have its content copied.
167 * @param {Element} target
168 */
169 set target(target) {
170 if (target !== undefined) {
171 if (target && typeof target === 'object' && target.nodeType === 1) {
172 if (this.action === 'copy' && target.hasAttribute('disabled')) {
173 throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
174 }
175
176 if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
177 throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
178 }
179
180 this._target = target;
181 }
182 else {
183 throw new Error('Invalid "target" value, use a valid Element');
184 }
185 }
186 }
187
188 /**
189 * Gets the `target` property.
190 * @return {String|HTMLElement}
191 */
192 get target() {
193 return this._target;
194 }
195
196 /**
197 * Destroy lifecycle.
198 */
199 destroy() {
200 this.removeFake();
201 }
202 }
203
204 export default ClipboardAction;
1 import ClipboardAction from './clipboard-action';
2 import Emitter from 'tiny-emitter';
3 import listen from 'good-listener';
4
5 /**
6 * Base class which takes one or more elements, adds event listeners to them,
7 * and instantiates a new `ClipboardAction` on each click.
8 */
9 class Clipboard extends Emitter {
10 /**
11 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
12 * @param {Object} options
13 */
14 constructor(trigger, options) {
15 super();
16
17 this.resolveOptions(options);
18 this.listenClick(trigger);
19 }
20
21 /**
22 * Defines if attributes would be resolved using internal setter functions
23 * or custom functions that were passed in the constructor.
24 * @param {Object} options
25 */
26 resolveOptions(options = {}) {
27 this.action = (typeof options.action === 'function') ? options.action : this.defaultAction;
28 this.target = (typeof options.target === 'function') ? options.target : this.defaultTarget;
29 this.text = (typeof options.text === 'function') ? options.text : this.defaultText;
30 this.container = (typeof options.container === 'object') ? options.container : document.body;
31 }
32
33 /**
34 * Adds a click event listener to the passed trigger.
35 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
36 */
37 listenClick(trigger) {
38 this.listener = listen(trigger, 'click', (e) => this.onClick(e));
39 }
40
41 /**
42 * Defines a new `ClipboardAction` on each click event.
43 * @param {Event} e
44 */
45 onClick(e) {
46 const trigger = e.delegateTarget || e.currentTarget;
47
48 if (this.clipboardAction) {
49 this.clipboardAction = null;
50 }
51
52 this.clipboardAction = new ClipboardAction({
53 action : this.action(trigger),
54 target : this.target(trigger),
55 text : this.text(trigger),
56 container : this.container,
57 trigger : trigger,
58 emitter : this
59 });
60 }
61
62 /**
63 * Default `action` lookup function.
64 * @param {Element} trigger
65 */
66 defaultAction(trigger) {
67 return getAttributeValue('action', trigger);
68 }
69
70 /**
71 * Default `target` lookup function.
72 * @param {Element} trigger
73 */
74 defaultTarget(trigger) {
75 const selector = getAttributeValue('target', trigger);
76
77 if (selector) {
78 return document.querySelector(selector);
79 }
80 }
81
82 /**
83 * Returns the support of the given action, or all actions if no action is
84 * given.
85 * @param {String} [action]
86 */
87 static isSupported(action = ['copy', 'cut']) {
88 const actions = (typeof action === 'string') ? [action] : action;
89 let support = !!document.queryCommandSupported;
90
91 actions.forEach((action) => {
92 support = support && !!document.queryCommandSupported(action);
93 });
94
95 return support;
96 }
97
98 /**
99 * Default `text` lookup function.
100 * @param {Element} trigger
101 */
102 defaultText(trigger) {
103 return getAttributeValue('text', trigger);
104 }
105
106 /**
107 * Destroy lifecycle.
108 */
109 destroy() {
110 this.listener.destroy();
111
112 if (this.clipboardAction) {
113 this.clipboardAction.destroy();
114 this.clipboardAction = null;
115 }
116 }
117 }
118
119
120 /**
121 * Helper function to retrieve attribute value.
122 * @param {String} suffix
123 * @param {Element} element
124 */
125 function getAttributeValue(suffix, element) {
126 const attribute = `data-clipboard-${suffix}`;
127
128 if (!element.hasAttribute(attribute)) {
129 return;
130 }
131
132 return element.getAttribute(attribute);
133 }
134
135 export default Clipboard;
1 import ClipboardAction from '../src/clipboard-action';
2 import Emitter from 'tiny-emitter';
3
4 describe('ClipboardAction', () => {
5 before(() => {
6 global.input = document.createElement('input');
7 global.input.setAttribute('id', 'input');
8 global.input.setAttribute('value', 'abc');
9 document.body.appendChild(global.input);
10
11 global.paragraph = document.createElement('p');
12 global.paragraph.setAttribute('id', 'paragraph');
13 global.paragraph.textContent = 'abc';
14 document.body.appendChild(global.paragraph);
15 });
16
17 after(() => {
18 document.body.innerHTML = '';
19 });
20
21 describe('#resolveOptions', () => {
22 it('should set base properties', () => {
23 let clip = new ClipboardAction({
24 emitter: new Emitter(),
25 container: document.body,
26 text: 'foo'
27 });
28
29 assert.property(clip, 'action');
30 assert.property(clip, 'container');
31 assert.property(clip, 'emitter');
32 assert.property(clip, 'target');
33 assert.property(clip, 'text');
34 assert.property(clip, 'trigger');
35 assert.property(clip, 'selectedText');
36 });
37 });
38
39 describe('#initSelection', () => {
40 it('should set the position right style property', done => {
41 // Set document direction
42 document.documentElement.setAttribute('dir', 'rtl');
43
44 let clip = new ClipboardAction({
45 emitter: new Emitter(),
46 container: document.body,
47 text: 'foo'
48 });
49
50 assert.equal(clip.fakeElem.style.right, '-9999px');
51 done();
52 });
53 });
54
55 describe('#set action', () => {
56 it('should throw an error since "action" is invalid', done => {
57 try {
58 new ClipboardAction({
59 text: 'foo',
60 action: 'paste'
61 });
62 }
63 catch(e) {
64 assert.equal(e.message, 'Invalid "action" value, use either "copy" or "cut"');
65 done();
66 }
67 });
68 });
69
70 describe('#set target', () => {
71 it('should throw an error since "target" do not match any element', done => {
72 try {
73 new ClipboardAction({
74 target: document.querySelector('#foo')
75 });
76 }
77 catch(e) {
78 assert.equal(e.message, 'Invalid "target" value, use a valid Element');
79 done();
80 }
81 });
82 });
83
84 describe('#selectText', () => {
85 it('should create a fake element and select its value', () => {
86 let clip = new ClipboardAction({
87 emitter: new Emitter(),
88 container: document.body,
89 text: 'blah'
90 });
91
92 assert.equal(clip.selectedText, clip.fakeElem.value);
93 });
94 });
95
96 describe('#removeFake', () => {
97 it('should remove a temporary fake element', () => {
98 let clip = new ClipboardAction({
99 emitter: new Emitter(),
100 container: document.body,
101 text: 'blah'
102 });
103
104 clip.removeFake();
105
106 assert.equal(clip.fakeElem, null);
107 });
108 });
109
110 describe('#selectTarget', () => {
111 it('should select text from editable element', () => {
112 let clip = new ClipboardAction({
113 emitter: new Emitter(),
114 container: document.body,
115 target: document.querySelector('#input')
116 });
117
118 assert.equal(clip.selectedText, clip.target.value);
119 });
120
121 it('should select text from non-editable element', () => {
122 let clip = new ClipboardAction({
123 emitter: new Emitter(),
124 container: document.body,
125 target: document.querySelector('#paragraph')
126 });
127
128 assert.equal(clip.selectedText, clip.target.textContent);
129 });
130 });
131
132 describe('#copyText', () => {
133 before(() => {
134 global.stub = sinon.stub(document, 'execCommand');
135 });
136
137 after(() => {
138 global.stub.restore();
139 });
140
141 it('should fire a success event on browsers that support copy command', done => {
142 global.stub.returns(true);
143
144 let emitter = new Emitter();
145
146 emitter.on('success', () => {
147 done();
148 });
149
150 let clip = new ClipboardAction({
151 emitter,
152 target: document.querySelector('#input')
153 });
154 });
155
156 it('should fire an error event on browsers that support copy command', done => {
157 global.stub.returns(false);
158
159 let emitter = new Emitter();
160
161 emitter.on('error', () => {
162 done();
163 });
164
165 let clip = new ClipboardAction({
166 emitter,
167 target: document.querySelector('#input')
168 });
169 });
170 });
171
172 describe('#handleResult', () => {
173 it('should fire a success event with certain properties', done => {
174 let clip = new ClipboardAction({
175 emitter: new Emitter(),
176 container: document.body,
177 target: document.querySelector('#input')
178 });
179
180 clip.emitter.on('success', (e) => {
181 assert.property(e, 'action');
182 assert.property(e, 'text');
183 assert.property(e, 'trigger');
184 assert.property(e, 'clearSelection');
185
186 done();
187 });
188
189 clip.handleResult(true);
190 });
191
192 it('should fire a error event with certain properties', done => {
193 let clip = new ClipboardAction({
194 emitter: new Emitter(),
195 container: document.body,
196 target: document.querySelector('#input')
197 });
198
199 clip.emitter.on('error', (e) => {
200 assert.property(e, 'action');
201 assert.property(e, 'trigger');
202 assert.property(e, 'clearSelection');
203
204 done();
205 });
206
207 clip.handleResult(false);
208 });
209 });
210
211 describe('#clearSelection', () => {
212 it('should remove focus from target and text selection', () => {
213 let clip = new ClipboardAction({
214 emitter: new Emitter(),
215 container: document.body,
216 target: document.querySelector('#input')
217 });
218
219 clip.clearSelection();
220
221 let selectedElem = document.activeElement;
222 let selectedText = window.getSelection().toString();
223
224 assert.equal(selectedElem, document.body);
225 assert.equal(selectedText, '');
226 });
227 });
228
229 describe('#destroy', () => {
230 it('should destroy an existing fake element', () => {
231 let clip = new ClipboardAction({
232 emitter: new Emitter(),
233 container: document.body,
234 text: 'blah'
235 });
236
237 clip.selectFake();
238 clip.destroy();
239
240 assert.equal(clip.fakeElem, null);
241 });
242 });
243 });
1 import Clipboard from '../src/clipboard';
2 import ClipboardAction from '../src/clipboard-action';
3 import listen from 'good-listener';
4
5 describe('Clipboard', () => {
6 before(() => {
7 global.button = document.createElement('button');
8 global.button.setAttribute('class', 'btn');
9 global.button.setAttribute('data-clipboard-text', 'foo');
10 document.body.appendChild(global.button);
11
12 global.span = document.createElement('span');
13 global.span.innerHTML = 'bar';
14
15 global.button.appendChild(span);
16
17 global.event = {
18 target: global.button,
19 currentTarget: global.button
20 };
21 });
22
23 after(() => {
24 document.body.innerHTML = '';
25 });
26
27 describe('#resolveOptions', () => {
28 before(() => {
29 global.fn = () => {};
30 });
31
32 it('should set action as a function', () => {
33 let clipboard = new Clipboard('.btn', {
34 action: global.fn
35 });
36
37 assert.equal(global.fn, clipboard.action);
38 });
39
40 it('should set target as a function', () => {
41 let clipboard = new Clipboard('.btn', {
42 target: global.fn
43 });
44
45 assert.equal(global.fn, clipboard.target);
46 });
47
48 it('should set text as a function', () => {
49 let clipboard = new Clipboard('.btn', {
50 text: global.fn
51 });
52
53 assert.equal(global.fn, clipboard.text);
54 });
55
56 it('should set container as an object', () => {
57 let clipboard = new Clipboard('.btn', {
58 container: document.body
59 });
60
61 assert.equal(document.body, clipboard.container);
62 });
63
64 it('should set container as body by default', () => {
65 let clipboard = new Clipboard('.btn');
66
67 assert.equal(document.body, clipboard.container);
68 });
69 });
70
71 describe('#listenClick', () => {
72 it('should add a click event listener to the passed selector', () => {
73 let clipboard = new Clipboard('.btn');
74 assert.isObject(clipboard.listener);
75 });
76 });
77
78 describe('#onClick', () => {
79 it('should create a new instance of ClipboardAction', () => {
80 let clipboard = new Clipboard('.btn');
81
82 clipboard.onClick(global.event);
83 assert.instanceOf(clipboard.clipboardAction, ClipboardAction);
84 });
85
86 it('should use an event\'s currentTarget when not equal to target', () => {
87 let clipboard = new Clipboard('.btn');
88 let bubbledEvent = { target: global.span, currentTarget: global.button };
89
90 clipboard.onClick(bubbledEvent);
91 assert.instanceOf(clipboard.clipboardAction, ClipboardAction);
92 });
93
94 it('should throw an exception when target is invalid', done => {
95 try {
96 const clipboard = new Clipboard('.btn', {
97 target() {
98 return null;
99 }
100 });
101
102 clipboard.onClick(global.event);
103 }
104 catch(e) {
105 assert.equal(e.message, 'Invalid "target" value, use a valid Element');
106 done();
107 }
108 });
109 });
110
111 describe('#static isSupported', () => {
112 it('should return the support of the given action', () => {
113 assert.equal(Clipboard.isSupported('copy'), true);
114 assert.equal(Clipboard.isSupported('cut'), true);
115 });
116
117 it('should return the support of the cut and copy actions', () => {
118 assert.equal(Clipboard.isSupported(), true);
119 });
120 });
121
122 describe('#destroy', () => {
123 it('should destroy an existing instance of ClipboardAction', () => {
124 let clipboard = new Clipboard('.btn');
125
126 clipboard.onClick(global.event);
127 clipboard.destroy();
128
129 assert.equal(clipboard.clipboardAction, null);
130 });
131 });
132 });
1 const pkg = require('./package.json');
2 const path = require('path');
3 const webpack = require('webpack');
4 const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
5
6 const production = process.env.NODE_ENV === 'production' || false;
7
8 const banner = `clipboard.js v${pkg.version}
9 https://clipboardjs.com/
10
11 Licensed MIT © Zeno Rocha`;
12
13 module.exports = {
14 entry: './src/clipboard.js',
15 mode: 'production',
16 output: {
17 filename: production ? 'clipboard.min.js' : 'clipboard.js',
18 path: path.resolve(__dirname, 'dist'),
19 library: 'ClipboardJS',
20 globalObject: 'this',
21 libraryExport: 'default',
22 libraryTarget: 'umd'
23 },
24 module: {
25 rules: [
26 {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
27 ]
28 },
29 optimization: {
30 minimize: production,
31 minimizer: [
32 new UglifyJSPlugin({
33 parallel: require('os').cpus().length,
34 uglifyOptions: {
35 ie8: false,
36 keep_fnames: false,
37 output: {
38 beautify: false,
39 comments: (node, {value, type}) => type == 'comment2' && value.startsWith('!')
40 }
41 }
42 })
43 ]
44 },
45 plugins: [new webpack.BannerPlugin({ banner })]
46 };
1 # EditorConfig helps developers define and maintain consistent
2 # coding styles between different editors and IDEs
3 # http://editorconfig.org
4
5 root = true
6
7 [*]
8 # Change these settings to your own preference
9 indent_style = space
10 indent_size = 4
11
12 # We recommend you to keep these unchanged
13 end_of_line = lf
14 charset = utf-8
15 trim_trailing_whitespace = true
16 insert_final_newline = true
17
18 [*.md]
19 trim_trailing_whitespace = false
20
21 [{package.json,bower.json}]
22 indent_size = 2
1 language: node_js
2 node_js:
3 - stable
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Delegate</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <ul>
10 <li><button>Item 1</button></li>
11 <li><button>Item 2</button></li>
12 <li><button>Item 3</button></li>
13 <li><button>Item 4</button></li>
14 <li><button>Item 5</button></li>
15 </ul>
16
17 <!-- 2. Include library -->
18 <script src="../dist/delegate.js"></script>
19
20 <!-- 3. Add event delegation -->
21 <script>
22 var ul = document.querySelector('ul');
23
24 delegate(ul, 'button', 'click', function(e) {
25 console.log(e.target);
26 });
27 </script>
28 </body>
29 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Delegate</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <ul>
10 <li><button>Item 1</button></li>
11 <li><button>Item 2</button></li>
12 <li><button>Item 3</button></li>
13 <li><button>Item 4</button></li>
14 <li><button>Item 5</button></li>
15 </ul>
16 <ul>
17 <li><span>Item 6</span></li>
18 <li><span>Item 7</span></li>
19 </ul>
20
21 <!-- 2. Include library -->
22 <script src="../dist/delegate.js"></script>
23
24 <!-- 3. Add event delegation -->
25 <script>
26 var ul = document.querySelector('ul');
27
28 delegate(ul, 'button', 'click', function(e) {
29 console.log(e.target);
30 });
31
32 delegate(document.body, 'span', 'click', function(e) {
33 console.log(e.target);
34 });
35 </script>
36 </body>
37 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Undelegate</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <ul>
10 <li><button>Item 1</button></li>
11 <li><button>Item 2</button></li>
12 <li><button>Item 3</button></li>
13 <li><button>Item 4</button></li>
14 <li><button>Item 5</button></li>
15 </ul>
16
17 <!-- 2. Include library -->
18 <script src="../dist/delegate.js"></script>
19
20 <!-- 3. Remove event delegation -->
21 <script>
22 var ul = document.querySelector('ul');
23
24 var delegation = delegate(ul, 'li button', 'click', function(e) {
25 console.log(e.target);
26 });
27
28 delegation.destroy();
29 </script>
30 </body>
31 </html>
1 (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.delegate = 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){
2 var DOCUMENT_NODE_TYPE = 9;
3
4 /**
5 * A polyfill for Element.matches()
6 */
7 if (typeof Element !== 'undefined' && !Element.prototype.matches) {
8 var proto = Element.prototype;
9
10 proto.matches = proto.matchesSelector ||
11 proto.mozMatchesSelector ||
12 proto.msMatchesSelector ||
13 proto.oMatchesSelector ||
14 proto.webkitMatchesSelector;
15 }
16
17 /**
18 * Finds the closest parent that matches a selector.
19 *
20 * @param {Element} element
21 * @param {String} selector
22 * @return {Function}
23 */
24 function closest (element, selector) {
25 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
26 if (element.matches(selector)) return element;
27 element = element.parentNode;
28 }
29 }
30
31 module.exports = closest;
32
33 },{}],2:[function(require,module,exports){
34 var closest = require('./closest');
35
36 /**
37 * Delegates event to a selector.
38 *
39 * @param {Element} element
40 * @param {String} selector
41 * @param {String} type
42 * @param {Function} callback
43 * @param {Boolean} useCapture
44 * @return {Object}
45 */
46 function delegate(element, selector, type, callback, useCapture) {
47 var listenerFn = listener.apply(this, arguments);
48
49 element.addEventListener(type, listenerFn, useCapture);
50
51 return {
52 destroy: function() {
53 element.removeEventListener(type, listenerFn, useCapture);
54 }
55 }
56 }
57
58 /**
59 * Finds closest match and invokes callback.
60 *
61 * @param {Element} element
62 * @param {String} selector
63 * @param {String} type
64 * @param {Function} callback
65 * @return {Function}
66 */
67 function listener(element, selector, type, callback) {
68 return function(e) {
69 e.delegateTarget = closest(e.target, selector);
70
71 if (e.delegateTarget) {
72 callback.call(element, e);
73 }
74 }
75 }
76
77 module.exports = delegate;
78
79 },{"./closest":1}]},{},[2])(2)
80 });
...\ No newline at end of file ...\ No newline at end of file
1 module.exports = function(karma) {
2 karma.set({
3 plugins: ['karma-browserify', 'karma-chai', 'karma-sinon', 'karma-mocha', 'karma-phantomjs-launcher'],
4
5 frameworks: ['browserify', 'chai', 'sinon', 'mocha'],
6
7 files: [
8 'src/**/*.js',
9 'test/**/*.js',
10 './node_modules/phantomjs-polyfill/bind-polyfill.js'
11 ],
12
13 preprocessors: {
14 'src/**/*.js' : ['browserify'],
15 'test/**/*.js': ['browserify']
16 },
17
18 browserify: {
19 debug: true
20 },
21
22 browsers: ['PhantomJS']
23 });
24 }
1 {
2 "_from": "delegate@^3.1.2",
3 "_id": "delegate@3.2.0",
4 "_inBundle": false,
5 "_integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
6 "_location": "/delegate",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "range",
10 "registry": true,
11 "raw": "delegate@^3.1.2",
12 "name": "delegate",
13 "escapedName": "delegate",
14 "rawSpec": "^3.1.2",
15 "saveSpec": null,
16 "fetchSpec": "^3.1.2"
17 },
18 "_requiredBy": [
19 "/good-listener"
20 ],
21 "_resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
22 "_shasum": "b66b71c3158522e8ab5744f720d8ca0c2af59166",
23 "_spec": "delegate@^3.1.2",
24 "_where": "/Users/zhanghao/brcode/br-client/node_modules/good-listener",
25 "bugs": {
26 "url": "https://github.com/zenorocha/delegate/issues"
27 },
28 "bundleDependencies": false,
29 "deprecated": false,
30 "description": "Lightweight event delegation",
31 "devDependencies": {
32 "browserify": "^13.1.0",
33 "chai": "^3.5.0",
34 "karma": "^1.3.0",
35 "karma-browserify": "^5.1.0",
36 "karma-chai": "^0.1.0",
37 "karma-mocha": "^1.2.0",
38 "karma-phantomjs-launcher": "^1.0.2",
39 "karma-sinon": "^1.0.4",
40 "mocha": "^3.1.2",
41 "phantomjs-polyfill": "0.0.2",
42 "simulant": "^0.2.2",
43 "sinon": "^1.17.6"
44 },
45 "homepage": "https://github.com/zenorocha/delegate#readme",
46 "keywords": [
47 "event",
48 "delegate",
49 "delegation"
50 ],
51 "license": "MIT",
52 "main": "src/delegate.js",
53 "name": "delegate",
54 "repository": {
55 "type": "git",
56 "url": "git+https://github.com/zenorocha/delegate.git"
57 },
58 "scripts": {
59 "build": "browserify src/delegate.js -s delegate -o dist/delegate.js",
60 "test": "karma start --single-run"
61 },
62 "version": "3.2.0"
63 }
1 # delegate
2
3 Lightweight event delegation.
4
5 ## Install
6
7 You can get it on npm.
8
9 ```
10 npm install delegate --save
11 ```
12
13 If you're not into package management, just [download a ZIP](https://github.com/zenorocha/delegate/archive/master.zip) file.
14
15 ## Setup
16
17 ###### Node (Browserify)
18
19 ```js
20 var delegate = require('delegate');
21 ```
22
23 ###### Browser (Standalone)
24
25 ```html
26 <script src="dist/delegate.js"></script>
27 ```
28
29 ## Usage
30
31 ### Add event delegation
32
33 #### With the default base (`document`)
34
35 ```js
36 delegate('.btn', 'click', function(e) {
37 console.log(e.delegateTarget);
38 }, false);
39 ```
40
41 #### With an element as base
42
43 ```js
44 delegate(document.body, '.btn', 'click', function(e) {
45 console.log(e.delegateTarget);
46 }, false);
47 ```
48
49 #### With a selector (of existing elements) as base
50
51 ```js
52 delegate('.container', '.btn', 'click', function(e) {
53 console.log(e.delegateTarget);
54 }, false);
55 ```
56
57 #### With an array/array-like of elements as base
58
59 ```js
60 delegate(document.querySelectorAll('.container'), '.btn', 'click', function(e) {
61 console.log(e.delegateTarget);
62 }, false);
63 ```
64
65 ### Remove event delegation
66
67 #### With a single base element (default or specified)
68
69 ```js
70 var delegation = delegate(document.body, '.btn', 'click', function(e) {
71 console.log(e.delegateTarget);
72 }, false);
73
74 delegation.destroy();
75 ```
76
77 #### With multiple elements (via selector or array)
78
79 Note: selectors are always treated as multiple elements, even if one or none are matched. `delegate()` will return an array.
80
81 ```js
82 var delegations = delegate('.container', '.btn', 'click', function(e) {
83 console.log(e.delegateTarget);
84 }, false);
85
86 delegations.forEach(function (delegation) {
87 delegation.destroy();
88 });
89 ```
90
91 ## Browser Support
92
93 | <img src="https://clipboardjs.com/assets/images/chrome.png" width="48px" height="48px" alt="Chrome logo"> | <img src="https://clipboardjs.com/assets/images/edge.png" width="48px" height="48px" alt="Edge logo"> | <img src="https://clipboardjs.com/assets/images/firefox.png" width="48px" height="48px" alt="Firefox logo"> | <img src="https://clipboardjs.com/assets/images/ie.png" width="48px" height="48px" alt="Internet Explorer logo"> | <img src="https://clipboardjs.com/assets/images/opera.png" width="48px" height="48px" alt="Opera logo"> | <img src="https://clipboardjs.com/assets/images/safari.png" width="48px" height="48px" alt="Safari logo"> |
94 |:---:|:---:|:---:|:---:|:---:|:---:|
95 | Latest ✔ | Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | Latest ✔ |
96
97 ## License
98
99 [MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha
1 var DOCUMENT_NODE_TYPE = 9;
2
3 /**
4 * A polyfill for Element.matches()
5 */
6 if (typeof Element !== 'undefined' && !Element.prototype.matches) {
7 var proto = Element.prototype;
8
9 proto.matches = proto.matchesSelector ||
10 proto.mozMatchesSelector ||
11 proto.msMatchesSelector ||
12 proto.oMatchesSelector ||
13 proto.webkitMatchesSelector;
14 }
15
16 /**
17 * Finds the closest parent that matches a selector.
18 *
19 * @param {Element} element
20 * @param {String} selector
21 * @return {Function}
22 */
23 function closest (element, selector) {
24 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
25 if (typeof element.matches === 'function' &&
26 element.matches(selector)) {
27 return element;
28 }
29 element = element.parentNode;
30 }
31 }
32
33 module.exports = closest;
1 var closest = require('./closest');
2
3 /**
4 * Delegates event to a selector.
5 *
6 * @param {Element} element
7 * @param {String} selector
8 * @param {String} type
9 * @param {Function} callback
10 * @param {Boolean} useCapture
11 * @return {Object}
12 */
13 function _delegate(element, selector, type, callback, useCapture) {
14 var listenerFn = listener.apply(this, arguments);
15
16 element.addEventListener(type, listenerFn, useCapture);
17
18 return {
19 destroy: function() {
20 element.removeEventListener(type, listenerFn, useCapture);
21 }
22 }
23 }
24
25 /**
26 * Delegates event to a selector.
27 *
28 * @param {Element|String|Array} [elements]
29 * @param {String} selector
30 * @param {String} type
31 * @param {Function} callback
32 * @param {Boolean} useCapture
33 * @return {Object}
34 */
35 function delegate(elements, selector, type, callback, useCapture) {
36 // Handle the regular Element usage
37 if (typeof elements.addEventListener === 'function') {
38 return _delegate.apply(null, arguments);
39 }
40
41 // Handle Element-less usage, it defaults to global delegation
42 if (typeof type === 'function') {
43 // Use `document` as the first parameter, then apply arguments
44 // This is a short way to .unshift `arguments` without running into deoptimizations
45 return _delegate.bind(null, document).apply(null, arguments);
46 }
47
48 // Handle Selector-based usage
49 if (typeof elements === 'string') {
50 elements = document.querySelectorAll(elements);
51 }
52
53 // Handle Array-like based usage
54 return Array.prototype.map.call(elements, function (element) {
55 return _delegate(element, selector, type, callback, useCapture);
56 });
57 }
58
59 /**
60 * Finds closest match and invokes callback.
61 *
62 * @param {Element} element
63 * @param {String} selector
64 * @param {String} type
65 * @param {Function} callback
66 * @return {Function}
67 */
68 function listener(element, selector, type, callback) {
69 return function(e) {
70 e.delegateTarget = closest(e.target, selector);
71
72 if (e.delegateTarget) {
73 callback.call(element, e);
74 }
75 }
76 }
77
78 module.exports = delegate;
1 var closest = require('../src/closest');
2
3 describe('closest', function() {
4 before(function() {
5 var html = '<div id="a">' +
6 '<div id="b">' +
7 '<div id="c"></div>' +
8 '</div>' +
9 '</div>';
10
11 document.body.innerHTML += html;
12
13 global.a = document.querySelector('#a');
14 global.b = document.querySelector('#b');
15 global.c = document.querySelector('#c');
16 });
17
18 after(function() {
19 document.body.innerHTML = '';
20 });
21
22 it('should return the closest parent based on the selector', function() {
23 assert.ok(closest(global.c, '#b'), global.b);
24 assert.ok(closest(global.c, '#a'), global.a);
25 assert.ok(closest(global.b, '#a'), global.a);
26 });
27
28 it('should return itself if the same selector is passed', function() {
29 assert.ok(closest(document.body, 'body'), document.body);
30 });
31
32 it('should not throw on elements without matches()', function() {
33 var fakeElement = {
34 nodeType: -1, // anything but DOCUMENT_NODE_TYPE
35 parentNode: null,
36 matches: undefined // undefined to emulate Elements without this function
37 };
38
39 try {
40 closest(fakeElement, '#a')
41 } catch (err) {
42 assert.fail();
43 }
44 });
45 });
1 var delegate = require('../src/delegate');
2 var simulant = require('simulant');
3
4 describe('delegate', function() {
5 before(function() {
6 var html = '<ul>' +
7 '<li><a>Item 1</a></li>' +
8 '<li><a>Item 2</a></li>' +
9 '<li><a>Item 3</a></li>' +
10 '<li><a>Item 4</a></li>' +
11 '<li><a>Item 5</a></li>' +
12 '</ul>';
13
14 document.body.innerHTML += html;
15
16 global.container = document.querySelector('ul');
17 global.anchor = document.querySelector('a');
18
19 global.spy = sinon.spy(global.container, 'removeEventListener');
20 });
21
22 after(function() {
23 global.spy.restore();
24 document.body.innerHTML = '';
25 });
26
27 it('should add an event listener', function(done) {
28 delegate(global.container, 'a', 'click', function() {
29 done();
30 });
31
32 simulant.fire(global.anchor, simulant('click'));
33 });
34
35 it('should remove an event listener', function() {
36 var delegation = delegate(global.container, 'a', 'click', function() {});
37
38 delegation.destroy();
39 assert.ok(global.spy.calledOnce);
40 });
41
42 it('should use `document` if the element is unspecified', function(done) {
43 delegate('a', 'click', function() {
44 done();
45 });
46
47 simulant.fire(global.anchor, simulant('click'));
48 });
49
50 it('should remove an event listener the unspecified base (`document`)', function() {
51 var delegation = delegate('a', 'click', function() {});
52 var spy = sinon.spy(document, 'removeEventListener');
53
54 delegation.destroy();
55 assert.ok(spy.calledOnce);
56
57 spy.restore();
58 });
59
60 it('should add event listeners to all the elements in a base selector', function() {
61 var spy = sinon.spy();
62 delegate('li', 'a', 'click', spy);
63
64 var anchors = document.querySelectorAll('a');
65 simulant.fire(anchors[0], simulant('click'));
66 simulant.fire(anchors[1], simulant('click'));
67 assert.ok(spy.calledTwice);
68 });
69
70 it('should remove the event listeners from all the elements in a base selector', function() {
71 var items = document.querySelectorAll('li')
72 var spies = Array.prototype.map.call(items, function (li) {
73 return sinon.spy(li, 'removeEventListener');
74 });
75
76 var delegations = delegate('li', 'a', 'click', function() {});
77 delegations.forEach(function (delegation) {
78 delegation.destroy();
79 });
80
81 spies.every(function (spy) {
82 var success = spy.calledOnce;
83 spy.restore();
84 return success;
85 });
86 });
87
88 it('should add event listeners to all the elements in a base array', function() {
89 var spy = sinon.spy();
90 var items = document.querySelectorAll('li')
91 delegate(items, 'a', 'click', spy);
92
93 var anchors = document.querySelectorAll('a')
94 simulant.fire(anchors[0], simulant('click'));
95 simulant.fire(anchors[1], simulant('click'));
96 assert.ok(spy.calledTwice);
97 });
98
99 it('should remove the event listeners from all the elements in a base array', function() {
100 var items = document.querySelectorAll('li')
101 var spies = Array.prototype.map.call(items, function (li) {
102 return sinon.spy(li, 'removeEventListener');
103 });
104
105 var delegations = delegate(items, 'a', 'click', function() {});
106 delegations.forEach(function (delegation) {
107 delegation.destroy();
108 });
109
110 spies.every(function (spy) {
111 var success = spy.calledOnce;
112 spy.restore();
113 return success;
114 });
115 });
116 });
1 # EditorConfig helps developers define and maintain consistent
2 # coding styles between different editors and IDEs
3 # http://editorconfig.org
4
5 root = true
6
7 [*]
8 # Change these settings to your own preference
9 indent_style = space
10 indent_size = 4
11
12 # We recommend you to keep these unchanged
13 end_of_line = lf
14 charset = utf-8
15 trim_trailing_whitespace = true
16 insert_final_newline = true
17
18 [*.md]
19 trim_trailing_whitespace = false
20
21 [{package.json,bower.json}]
22 indent_size = 2
1 node_modules
...\ No newline at end of file ...\ No newline at end of file
1 language: node_js
2 node_js:
3 - stable
1 {
2 "name": "good-listener",
3 "description": "A more versatile way of adding & removing event listeners",
4 "version": "1.2.1",
5 "license": "MIT",
6 "main": "dist/good-listener.js",
7 "keywords": [
8 "event",
9 "listener"
10 ]
11 }
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Destroy</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <button class="target">Click me</button>
10 <button class="target">Click me</button>
11 <button class="target">Click me</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/good-listener.js"></script>
15
16 <!-- 3. Remove listener by calling the destroy function -->
17 <script>
18 var listener = listen('.target', 'click', function(e) {
19 console.info(e);
20 });
21
22 listener.destroy();
23 </script>
24 </body>
25 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Selector</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <button data-a>Click me</button>
10 <button data-a>Click me</button>
11 <button data-a>Click me</button>
12 <button data-b>Click me</button>
13 <button data-b>Click me</button>
14 <button data-b>Click me</button>
15
16 <!-- 2. Include library -->
17 <script src="../dist/good-listener.js"></script>
18
19 <!-- 3. Add listener by passing a string selector -->
20 <script>
21 listen('[data-a]', 'click', function(e) {
22 console.info(e);
23 });
24
25 listen('[data-b]', 'click', function(e) {
26 console.info(e);
27 });
28 </script>
29 </body>
30 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Node</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <button id="target">Click me</button>
10
11 <!-- 2. Include library -->
12 <script src="../dist/good-listener.js"></script>
13
14 <!-- 3. Add listener by passing a HTML element -->
15 <script>
16 var target = document.getElementById('target');
17
18 listen(target, 'click', function(e) {
19 console.info(e);
20 });
21 </script>
22 </body>
23 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>NodeList</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <button>Click me</button>
10 <button>Click me</button>
11 <button>Click me</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/good-listener.js"></script>
15
16 <!-- 3. Add listener by passing a list of HTML elements -->
17 <script>
18 var targets = document.querySelectorAll('button');
19
20 listen(targets, 'click', function(e) {
21 console.info(e);
22 });
23 </script>
24 </body>
25 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Selector</title>
6 </head>
7 <body>
8 <!-- 1. Write some markup -->
9 <button class="target">Click me</button>
10 <button class="target">Click me</button>
11 <button class="target">Click me</button>
12
13 <!-- 2. Include library -->
14 <script src="../dist/good-listener.js"></script>
15
16 <!-- 3. Add listener by passing a string selector -->
17 <script>
18 listen('.target', 'click', function(e) {
19 console.info(e);
20 });
21 </script>
22 </body>
23 </html>
1 (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.listen = 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){
2 var DOCUMENT_NODE_TYPE = 9;
3
4 /**
5 * A polyfill for Element.matches()
6 */
7 if (typeof Element !== 'undefined' && !Element.prototype.matches) {
8 var proto = Element.prototype;
9
10 proto.matches = proto.matchesSelector ||
11 proto.mozMatchesSelector ||
12 proto.msMatchesSelector ||
13 proto.oMatchesSelector ||
14 proto.webkitMatchesSelector;
15 }
16
17 /**
18 * Finds the closest parent that matches a selector.
19 *
20 * @param {Element} element
21 * @param {String} selector
22 * @return {Function}
23 */
24 function closest (element, selector) {
25 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
26 if (element.matches(selector)) return element;
27 element = element.parentNode;
28 }
29 }
30
31 module.exports = closest;
32
33 },{}],2:[function(require,module,exports){
34 var closest = require('./closest');
35
36 /**
37 * Delegates event to a selector.
38 *
39 * @param {Element} element
40 * @param {String} selector
41 * @param {String} type
42 * @param {Function} callback
43 * @param {Boolean} useCapture
44 * @return {Object}
45 */
46 function delegate(element, selector, type, callback, useCapture) {
47 var listenerFn = listener.apply(this, arguments);
48
49 element.addEventListener(type, listenerFn, useCapture);
50
51 return {
52 destroy: function() {
53 element.removeEventListener(type, listenerFn, useCapture);
54 }
55 }
56 }
57
58 /**
59 * Finds closest match and invokes callback.
60 *
61 * @param {Element} element
62 * @param {String} selector
63 * @param {String} type
64 * @param {Function} callback
65 * @return {Function}
66 */
67 function listener(element, selector, type, callback) {
68 return function(e) {
69 e.delegateTarget = closest(e.target, selector);
70
71 if (e.delegateTarget) {
72 callback.call(element, e);
73 }
74 }
75 }
76
77 module.exports = delegate;
78
79 },{"./closest":1}],3:[function(require,module,exports){
80 /**
81 * Check if argument is a HTML element.
82 *
83 * @param {Object} value
84 * @return {Boolean}
85 */
86 exports.node = function(value) {
87 return value !== undefined
88 && value instanceof HTMLElement
89 && value.nodeType === 1;
90 };
91
92 /**
93 * Check if argument is a list of HTML elements.
94 *
95 * @param {Object} value
96 * @return {Boolean}
97 */
98 exports.nodeList = function(value) {
99 var type = Object.prototype.toString.call(value);
100
101 return value !== undefined
102 && (type === '[object NodeList]' || type === '[object HTMLCollection]')
103 && ('length' in value)
104 && (value.length === 0 || exports.node(value[0]));
105 };
106
107 /**
108 * Check if argument is a string.
109 *
110 * @param {Object} value
111 * @return {Boolean}
112 */
113 exports.string = function(value) {
114 return typeof value === 'string'
115 || value instanceof String;
116 };
117
118 /**
119 * Check if argument is a function.
120 *
121 * @param {Object} value
122 * @return {Boolean}
123 */
124 exports.fn = function(value) {
125 var type = Object.prototype.toString.call(value);
126
127 return type === '[object Function]';
128 };
129
130 },{}],4:[function(require,module,exports){
131 var is = require('./is');
132 var delegate = require('delegate');
133
134 /**
135 * Validates all params and calls the right
136 * listener function based on its target type.
137 *
138 * @param {String|HTMLElement|HTMLCollection|NodeList} target
139 * @param {String} type
140 * @param {Function} callback
141 * @return {Object}
142 */
143 function listen(target, type, callback) {
144 if (!target && !type && !callback) {
145 throw new Error('Missing required arguments');
146 }
147
148 if (!is.string(type)) {
149 throw new TypeError('Second argument must be a String');
150 }
151
152 if (!is.fn(callback)) {
153 throw new TypeError('Third argument must be a Function');
154 }
155
156 if (is.node(target)) {
157 return listenNode(target, type, callback);
158 }
159 else if (is.nodeList(target)) {
160 return listenNodeList(target, type, callback);
161 }
162 else if (is.string(target)) {
163 return listenSelector(target, type, callback);
164 }
165 else {
166 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
167 }
168 }
169
170 /**
171 * Adds an event listener to a HTML element
172 * and returns a remove listener function.
173 *
174 * @param {HTMLElement} node
175 * @param {String} type
176 * @param {Function} callback
177 * @return {Object}
178 */
179 function listenNode(node, type, callback) {
180 node.addEventListener(type, callback);
181
182 return {
183 destroy: function() {
184 node.removeEventListener(type, callback);
185 }
186 }
187 }
188
189 /**
190 * Add an event listener to a list of HTML elements
191 * and returns a remove listener function.
192 *
193 * @param {NodeList|HTMLCollection} nodeList
194 * @param {String} type
195 * @param {Function} callback
196 * @return {Object}
197 */
198 function listenNodeList(nodeList, type, callback) {
199 Array.prototype.forEach.call(nodeList, function(node) {
200 node.addEventListener(type, callback);
201 });
202
203 return {
204 destroy: function() {
205 Array.prototype.forEach.call(nodeList, function(node) {
206 node.removeEventListener(type, callback);
207 });
208 }
209 }
210 }
211
212 /**
213 * Add an event listener to a selector
214 * and returns a remove listener function.
215 *
216 * @param {String} selector
217 * @param {String} type
218 * @param {Function} callback
219 * @return {Object}
220 */
221 function listenSelector(selector, type, callback) {
222 return delegate(document.body, selector, type, callback);
223 }
224
225 module.exports = listen;
226
227 },{"./is":3,"delegate":2}]},{},[4])(4)
228 });
...\ No newline at end of file ...\ No newline at end of file
1 module.exports = function(karma) {
2 karma.set({
3 plugins: ['karma-browserify', 'karma-chai', 'karma-sinon', 'karma-mocha', 'karma-phantomjs-launcher'],
4
5 frameworks: ['browserify', 'chai', 'sinon', 'mocha'],
6
7 files: [
8 'src/**/*.js',
9 'test/**/*.js',
10 './node_modules/phantomjs-polyfill/bind-polyfill.js'
11 ],
12
13 preprocessors: {
14 'src/**/*.js' : ['browserify'],
15 'test/**/*.js': ['browserify']
16 },
17
18 browserify: {
19 debug: true
20 },
21
22 browsers: ['PhantomJS']
23 });
24 }
1 {
2 "_from": "good-listener@^1.2.2",
3 "_id": "good-listener@1.2.2",
4 "_inBundle": false,
5 "_integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
6 "_location": "/good-listener",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "range",
10 "registry": true,
11 "raw": "good-listener@^1.2.2",
12 "name": "good-listener",
13 "escapedName": "good-listener",
14 "rawSpec": "^1.2.2",
15 "saveSpec": null,
16 "fetchSpec": "^1.2.2"
17 },
18 "_requiredBy": [
19 "/clipboard"
20 ],
21 "_resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
22 "_shasum": "d53b30cdf9313dffb7dc9a0d477096aa6d145c50",
23 "_spec": "good-listener@^1.2.2",
24 "_where": "/Users/zhanghao/brcode/br-client/node_modules/clipboard",
25 "bugs": {
26 "url": "https://github.com/zenorocha/good-listener/issues"
27 },
28 "bundleDependencies": false,
29 "dependencies": {
30 "delegate": "^3.1.2"
31 },
32 "deprecated": false,
33 "description": "A more versatile way of adding & removing event listeners",
34 "devDependencies": {
35 "browserify": "^13.0.0",
36 "chai": "^3.5.0",
37 "karma": "^1.3.0",
38 "karma-browserify": "^5.0.1",
39 "karma-chai": "^0.1.0",
40 "karma-mocha": "^1.2.0",
41 "karma-phantomjs-launcher": "^1.0.0",
42 "karma-sinon": "^1.0.4",
43 "mocha": "^3.1.2",
44 "phantomjs-polyfill": "0.0.2",
45 "phantomjs-prebuilt": "^2.1.3",
46 "simulant": "^0.2.2",
47 "sinon": "^1.17.3",
48 "watchify": "^3.7.0"
49 },
50 "homepage": "https://github.com/zenorocha/good-listener#readme",
51 "keywords": [
52 "event",
53 "listener"
54 ],
55 "license": "MIT",
56 "main": "src/listen.js",
57 "name": "good-listener",
58 "repository": {
59 "type": "git",
60 "url": "git+https://github.com/zenorocha/good-listener.git"
61 },
62 "scripts": {
63 "build": "browserify src/listen.js -s listen -o dist/good-listener.js",
64 "test": "karma start --single-run"
65 },
66 "version": "1.2.2"
67 }
1 # good-listener
2
3 [![Build Status](http://img.shields.io/travis/zenorocha/good-listener/master.svg?style=flat)](https://travis-ci.org/zenorocha/good-listener)
4
5 > A more versatile way of adding & removing event listeners.
6
7 ![good listener](https://cloud.githubusercontent.com/assets/398893/10718224/dfc25f6c-7b2a-11e5-9d3d-75b35e8603c8.jpg)
8
9 ## Install
10
11 You can get it on npm.
12
13 ```
14 npm install good-listener --save
15 ```
16
17 Or bower, too.
18
19 ```
20 bower install good-listener --save
21 ```
22
23 If you're not into package management, just [download a ZIP](https://github.com/zenorocha/good-listener/archive/master.zip) file.
24
25 ## Setup
26
27 ###### Node (Browserify)
28
29 ```js
30 var listen = require('good-listener');
31 ```
32
33 ###### Browser (Standalone)
34
35 ```html
36 <script src="dist/good-listener.js"></script>
37 ```
38
39 ## Usage
40
41 ### Add an event listener
42
43 By passing a string selector [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/selector.html).
44
45 ```js
46 listen('.btn', 'click', function(e) {
47 console.log(e);
48 });
49 ```
50
51 Or by passing a HTML element [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/node.html).
52
53 ```js
54 var logo = document.getElementById('logo');
55
56 listen(logo, 'click', function(e) {
57 console.log(e);
58 });
59 ```
60
61 Or by passing a list of HTML elements [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/nodelist.html).
62
63 ```js
64 var anchors = document.querySelectorAll('a');
65
66 listen(anchors, 'click', function(e) {
67 console.log(e);
68 });
69 ```
70
71 ### Remove an event listener
72
73 By calling the `destroy` function that returned from previous operation [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/destroy.html).
74
75 ```js
76 var listener = listen('.btn', 'click', function(e) {
77 console.log(e);
78 });
79
80 listener.destroy();
81 ```
82
83 ## Browser Support
84
85 | <img src="https://clipboardjs.com/assets/images/chrome.png" width="48px" height="48px" alt="Chrome logo"> | <img src="https://clipboardjs.com/assets/images/edge.png" width="48px" height="48px" alt="Edge logo"> | <img src="https://clipboardjs.com/assets/images/firefox.png" width="48px" height="48px" alt="Firefox logo"> | <img src="https://clipboardjs.com/assets/images/ie.png" width="48px" height="48px" alt="Internet Explorer logo"> | <img src="https://clipboardjs.com/assets/images/opera.png" width="48px" height="48px" alt="Opera logo"> | <img src="https://clipboardjs.com/assets/images/safari.png" width="48px" height="48px" alt="Safari logo"> |
86 |:---:|:---:|:---:|:---:|:---:|:---:|
87 | Latest ✔ | Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | Latest ✔ |
88
89 ## License
90
91 [MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha
1 /**
2 * Check if argument is a HTML element.
3 *
4 * @param {Object} value
5 * @return {Boolean}
6 */
7 exports.node = function(value) {
8 return value !== undefined
9 && value instanceof HTMLElement
10 && value.nodeType === 1;
11 };
12
13 /**
14 * Check if argument is a list of HTML elements.
15 *
16 * @param {Object} value
17 * @return {Boolean}
18 */
19 exports.nodeList = function(value) {
20 var type = Object.prototype.toString.call(value);
21
22 return value !== undefined
23 && (type === '[object NodeList]' || type === '[object HTMLCollection]')
24 && ('length' in value)
25 && (value.length === 0 || exports.node(value[0]));
26 };
27
28 /**
29 * Check if argument is a string.
30 *
31 * @param {Object} value
32 * @return {Boolean}
33 */
34 exports.string = function(value) {
35 return typeof value === 'string'
36 || value instanceof String;
37 };
38
39 /**
40 * Check if argument is a function.
41 *
42 * @param {Object} value
43 * @return {Boolean}
44 */
45 exports.fn = function(value) {
46 var type = Object.prototype.toString.call(value);
47
48 return type === '[object Function]';
49 };
1 var is = require('./is');
2 var delegate = require('delegate');
3
4 /**
5 * Validates all params and calls the right
6 * listener function based on its target type.
7 *
8 * @param {String|HTMLElement|HTMLCollection|NodeList} target
9 * @param {String} type
10 * @param {Function} callback
11 * @return {Object}
12 */
13 function listen(target, type, callback) {
14 if (!target && !type && !callback) {
15 throw new Error('Missing required arguments');
16 }
17
18 if (!is.string(type)) {
19 throw new TypeError('Second argument must be a String');
20 }
21
22 if (!is.fn(callback)) {
23 throw new TypeError('Third argument must be a Function');
24 }
25
26 if (is.node(target)) {
27 return listenNode(target, type, callback);
28 }
29 else if (is.nodeList(target)) {
30 return listenNodeList(target, type, callback);
31 }
32 else if (is.string(target)) {
33 return listenSelector(target, type, callback);
34 }
35 else {
36 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
37 }
38 }
39
40 /**
41 * Adds an event listener to a HTML element
42 * and returns a remove listener function.
43 *
44 * @param {HTMLElement} node
45 * @param {String} type
46 * @param {Function} callback
47 * @return {Object}
48 */
49 function listenNode(node, type, callback) {
50 node.addEventListener(type, callback);
51
52 return {
53 destroy: function() {
54 node.removeEventListener(type, callback);
55 }
56 }
57 }
58
59 /**
60 * Add an event listener to a list of HTML elements
61 * and returns a remove listener function.
62 *
63 * @param {NodeList|HTMLCollection} nodeList
64 * @param {String} type
65 * @param {Function} callback
66 * @return {Object}
67 */
68 function listenNodeList(nodeList, type, callback) {
69 Array.prototype.forEach.call(nodeList, function(node) {
70 node.addEventListener(type, callback);
71 });
72
73 return {
74 destroy: function() {
75 Array.prototype.forEach.call(nodeList, function(node) {
76 node.removeEventListener(type, callback);
77 });
78 }
79 }
80 }
81
82 /**
83 * Add an event listener to a selector
84 * and returns a remove listener function.
85 *
86 * @param {String} selector
87 * @param {String} type
88 * @param {Function} callback
89 * @return {Object}
90 */
91 function listenSelector(selector, type, callback) {
92 return delegate(document.body, selector, type, callback);
93 }
94
95 module.exports = listen;
1 var is = require('../src/is');
2
3 describe('is', function() {
4 before(function() {
5 global.node = document.createElement('div');
6 global.node.setAttribute('id', 'foo');
7 global.node.setAttribute('class', 'foo');
8 document.body.appendChild(global.node);
9 });
10
11 after(function() {
12 document.body.innerHTML = '';
13 });
14
15 describe('is.node', function() {
16 it('should be considered as node', function() {
17 assert.ok(is.node(document.getElementById('foo')));
18 assert.ok(is.node(document.getElementsByTagName('div')[0]));
19 assert.ok(is.node(document.getElementsByClassName('foo')[0]));
20 assert.ok(is.node(document.querySelector('.foo')));
21 });
22
23 it('should not be considered as node', function() {
24 assert.notOk(is.node(undefined));
25 assert.notOk(is.node(null));
26 assert.notOk(is.node(false));
27 assert.notOk(is.node(true));
28 assert.notOk(is.node(function () {}));
29 assert.notOk(is.node([]));
30 assert.notOk(is.node({}));
31 assert.notOk(is.node(/a/g));
32 assert.notOk(is.node(new RegExp('a', 'g')));
33 assert.notOk(is.node(new Date()));
34 assert.notOk(is.node(42));
35 assert.notOk(is.node(NaN));
36 assert.notOk(is.node(Infinity));
37 assert.notOk(is.node(new Number(42)));
38 });
39 });
40
41 describe('is.nodeList', function() {
42 it('should be considered as nodeList', function() {
43 assert.ok(is.nodeList(document.getElementsByTagName('div')));
44 assert.ok(is.nodeList(document.getElementsByClassName('foo')));
45 assert.ok(is.nodeList(document.querySelectorAll('.foo')));
46 });
47
48 it('should not be considered as nodeList', function() {
49 assert.notOk(is.nodeList(undefined));
50 assert.notOk(is.nodeList(null));
51 assert.notOk(is.nodeList(false));
52 assert.notOk(is.nodeList(true));
53 assert.notOk(is.nodeList(function () {}));
54 assert.notOk(is.nodeList([]));
55 assert.notOk(is.nodeList({}));
56 assert.notOk(is.nodeList(/a/g));
57 assert.notOk(is.nodeList(new RegExp('a', 'g')));
58 assert.notOk(is.nodeList(new Date()));
59 assert.notOk(is.nodeList(42));
60 assert.notOk(is.nodeList(NaN));
61 assert.notOk(is.nodeList(Infinity));
62 assert.notOk(is.nodeList(new Number(42)));
63 });
64 });
65
66 describe('is.string', function() {
67 it('should be considered as string', function() {
68 assert.ok(is.string('abc'));
69 assert.ok(is.string(new String('abc')));
70 });
71
72 it('should not be considered as string', function() {
73 assert.notOk(is.string(undefined));
74 assert.notOk(is.string(null));
75 assert.notOk(is.string(false));
76 assert.notOk(is.string(true));
77 assert.notOk(is.string(function () {}));
78 assert.notOk(is.string([]));
79 assert.notOk(is.string({}));
80 assert.notOk(is.string(/a/g));
81 assert.notOk(is.string(new RegExp('a', 'g')));
82 assert.notOk(is.string(new Date()));
83 assert.notOk(is.string(42));
84 assert.notOk(is.string(NaN));
85 assert.notOk(is.string(Infinity));
86 assert.notOk(is.string(new Number(42)));
87 });
88 });
89
90 describe('is.fn', function() {
91 it('should be considered as function', function() {
92 assert.ok(is.fn(function () {}));
93 });
94
95 it('should not be considered as function', function() {
96 assert.notOk(is.fn(undefined));
97 assert.notOk(is.fn(null));
98 assert.notOk(is.fn(false));
99 assert.notOk(is.fn(true));
100 assert.notOk(is.fn([]));
101 assert.notOk(is.fn({}));
102 assert.notOk(is.fn(/a/g));
103 assert.notOk(is.fn(new RegExp('a', 'g')));
104 assert.notOk(is.fn(new Date()));
105 assert.notOk(is.fn(42));
106 assert.notOk(is.fn(NaN));
107 assert.notOk(is.fn(Infinity));
108 assert.notOk(is.fn(new Number(42)));
109 });
110 });
111 });
1 var listen = require('../src/listen');
2 var simulant = require('simulant');
3
4 describe('good-listener', function() {
5 before(function() {
6 global.node = document.createElement('div');
7 global.node.setAttribute('id', 'foo');
8 global.node.setAttribute('class', 'foo');
9 document.body.appendChild(global.node);
10 });
11
12 after(function() {
13 document.body.innerHTML = '';
14 });
15
16 describe('listen', function() {
17 it('should throw an error since arguments were not passed', function(done) {
18 try {
19 listen();
20 }
21 catch(error) {
22 assert.equal(error.message, 'Missing required arguments');
23 done();
24 }
25 });
26
27 it('should throw an error since "target" was invalid', function(done) {
28 try {
29 listen(null, 'click', function() {});
30 }
31 catch(error) {
32 assert.equal(error.message, 'First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
33 done();
34 }
35 });
36
37 it('should throw an error since "type" was invalid', function(done) {
38 try {
39 listen('.btn', false, function() {});
40 }
41 catch(error) {
42 assert.equal(error.message, 'Second argument must be a String');
43 done();
44 }
45 });
46
47 it('should throw an error since "callback" was invalid', function(done) {
48 try {
49 listen('.btn', 'click', []);
50 }
51 catch(error) {
52 assert.equal(error.message, 'Third argument must be a Function');
53 done();
54 }
55 });
56 });
57
58 describe('listenNode', function() {
59 before(function() {
60 global.target = document.querySelector('#foo');
61 global.spy = sinon.spy(global.target, 'removeEventListener');
62 });
63
64 after(function() {
65 global.spy.restore();
66 });
67
68 it('should add an event listener', function(done) {
69 listen(global.target, 'click', function() {
70 done();
71 });
72
73 simulant.fire(global.target, simulant('click'));
74 });
75
76 it('should remove an event listener', function() {
77 var listener = listen(global.target, 'click', function() {});
78
79 listener.destroy();
80 assert.ok(global.spy.calledOnce);
81 });
82 });
83
84 describe('listenNodeList', function() {
85 before(function() {
86 global.targets = document.querySelectorAll('.foo');
87 global.spy = sinon.spy(global.targets[0], 'removeEventListener');
88 });
89
90 after(function() {
91 global.spy.restore();
92 });
93
94 it('should add an event listener', function(done) {
95 listen(global.targets, 'click', function() {
96 done();
97 });
98
99 simulant.fire(global.targets[0], simulant('click'));
100 });
101
102 it('should remove an event listener', function() {
103 var listener = listen(global.targets, 'click', function() {});
104
105 listener.destroy();
106 assert.ok(global.spy.calledOnce);
107 });
108 });
109
110 describe('listenSelector', function() {
111 before(function() {
112 global.target = document.querySelector('.foo');
113 global.spy = sinon.spy(document.body, 'removeEventListener');
114 });
115
116 after(function() {
117 global.spy.restore();
118 });
119
120 it('should add an event listener', function(done) {
121 listen('.foo', 'click', function() {
122 done();
123 });
124
125 simulant.fire(global.target, simulant('click'));
126 });
127
128 it('should remove an event listener', function() {
129 var listener = listen('.foo', 'click', function() {});
130
131 listener.destroy();
132 assert.ok(global.spy.calledOnce);
133 });
134 });
135 });
1 # EditorConfig helps developers define and maintain consistent
2 # coding styles between different editors and IDEs
3 # http://editorconfig.org
4
5 root = true
6
7 [*]
8 # Change these settings to your own preference
9 indent_style = space
10 indent_size = 4
11
12 # We recommend you to keep these unchanged
13 end_of_line = lf
14 charset = utf-8
15 trim_trailing_whitespace = true
16 insert_final_newline = true
17
18 [*.md]
19 trim_trailing_whitespace = false
20
21 [{package.json,bower.json}]
22 indent_size = 2
1 node_modules
...\ No newline at end of file ...\ No newline at end of file
1 language: node_js
2 node_js:
3 - stable
1 {
2 "name": "select",
3 "version": "1.1.0",
4 "description": "Programmatically select the text of a HTML element",
5 "license": "MIT",
6 "main": "dist/select.js",
7 "keywords": [
8 "range",
9 "select",
10 "selecting",
11 "selection"
12 ]
13 }
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>contenteditable</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <p contenteditable>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio totam adipisci, saepe ad vero dignissimos laborum non eum eveniet aperiam, consequuntur repellendus architecto inventore iusto blanditiis quasi commodi voluptatum vitae!</p>
11
12 <!-- 2. Include library -->
13 <script src="../dist/select.js"></script>
14
15 <!-- 3. Select! -->
16 <script>
17 var p = document.querySelector('p');
18 var button = document.querySelector('button');
19
20 button.addEventListener('click', function(e) {
21 var selected = select(p);
22 console.log(selected);
23 });
24 </script>
25 </body>
26 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>dropdown</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <select>
11 <option>Option 1</option>
12 <option selected>Option 2</option>
13 <option>Option 3</option>
14 </select>
15
16 <!-- 2. Include library -->
17 <script src="../dist/select.js"></script>
18
19 <!-- 3. Select! -->
20 <script>
21 var dropdown = document.querySelector('select');
22 var button = document.querySelector('button');
23
24 button.addEventListener('click', function(e) {
25 var selected = select(dropdown);
26 console.log(selected);
27 });
28 </script>
29 </body>
30 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>editable</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <input type="text" value="Lorem ipsum">
11
12 <!-- 2. Include library -->
13 <script src="../dist/select.js"></script>
14
15 <!-- 3. Select! -->
16 <script>
17 var input = document.querySelector('input');
18 var button = document.querySelector('button');
19
20 button.addEventListener('click', function(e) {
21 var selected = select(input);
22 console.log(selected);
23 });
24 </script>
25 </body>
26 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>multiple</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <input type="text" value="Lorem ipsum">
11 <textarea>Lorem ipsum</textarea>
12
13 <!-- 2. Include library -->
14 <script src="../dist/select.js"></script>
15
16 <!-- 3. Select! -->
17 <script>
18 var input = document.querySelector('input');
19 var textarea = document.querySelector('textarea');
20 var button = document.querySelector('button');
21
22 button.addEventListener('click', function(e) {
23 console.log(select(input));
24 console.log(select(textarea));
25 });
26 </script>
27 </body>
28 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>non-editable</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <div>
11 <p>Item 1</p>
12 <p>Item 2</p>
13 <ul>
14 <li>Item 3</li>
15 <li>Item 4</li>
16 <li>Item 5</li>
17 </ul>
18 </div>
19
20 <!-- 2. Include library -->
21 <script src="../dist/select.js"></script>
22
23 <!-- 3. Select! -->
24 <script>
25 var div = document.querySelector('div');
26 var button = document.querySelector('button');
27
28 button.addEventListener('click', function(e) {
29 var selected = select(div);
30 console.log(selected);
31 });
32 </script>
33 </body>
34 </html>
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>non-editable</title>
6 </head>
7 <body>
8 <!-- 1. Define some markup -->
9 <button type="button">Select</button>
10 <p>Lorem ipsum</p>
11
12 <!-- 2. Include library -->
13 <script src="../dist/select.js"></script>
14
15 <!-- 3. Select! -->
16 <script>
17 var p = document.querySelector('p');
18 var button = document.querySelector('button');
19
20 button.addEventListener('click', function(e) {
21 var selected = select(p);
22 console.log(selected);
23 });
24 </script>
25 </body>
26 </html>
1 (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.select = 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){
2 function select(element) {
3 var selectedText;
4
5 if (element.nodeName === 'SELECT') {
6 element.focus();
7
8 selectedText = element.value;
9 }
10 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
11 var isReadOnly = element.hasAttribute('readonly');
12
13 if (!isReadOnly) {
14 element.setAttribute('readonly', '');
15 }
16
17 element.select();
18 element.setSelectionRange(0, element.value.length);
19
20 if (!isReadOnly) {
21 element.removeAttribute('readonly');
22 }
23
24 selectedText = element.value;
25 }
26 else {
27 if (element.hasAttribute('contenteditable')) {
28 element.focus();
29 }
30
31 var selection = window.getSelection();
32 var range = document.createRange();
33
34 range.selectNodeContents(element);
35 selection.removeAllRanges();
36 selection.addRange(range);
37
38 selectedText = selection.toString();
39 }
40
41 return selectedText;
42 }
43
44 module.exports = select;
45
46 },{}]},{},[1])(1)
47 });
...\ No newline at end of file ...\ No newline at end of file
1 module.exports = function(karma) {
2 karma.set({
3 plugins: ['karma-browserify', 'karma-chai', 'karma-mocha', 'karma-phantomjs-launcher'],
4
5 frameworks: ['browserify', 'chai', 'mocha'],
6
7 files: [
8 'src/**/*.js',
9 'test/**/*.js'
10 ],
11
12 preprocessors: {
13 'src/**/*.js' : ['browserify'],
14 'test/**/*.js': ['browserify']
15 },
16
17 browserify: {
18 debug: true
19 },
20
21 browsers: ['PhantomJS']
22 });
23 }
1 {
2 "_from": "select@^1.1.2",
3 "_id": "select@1.1.2",
4 "_inBundle": false,
5 "_integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=",
6 "_location": "/select",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "range",
10 "registry": true,
11 "raw": "select@^1.1.2",
12 "name": "select",
13 "escapedName": "select",
14 "rawSpec": "^1.1.2",
15 "saveSpec": null,
16 "fetchSpec": "^1.1.2"
17 },
18 "_requiredBy": [
19 "/clipboard"
20 ],
21 "_resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
22 "_shasum": "0e7350acdec80b1108528786ec1d4418d11b396d",
23 "_spec": "select@^1.1.2",
24 "_where": "/Users/zhanghao/brcode/br-client/node_modules/clipboard",
25 "bugs": {
26 "url": "https://github.com/zenorocha/select/issues"
27 },
28 "bundleDependencies": false,
29 "deprecated": false,
30 "description": "Programmatically select the text of a HTML element",
31 "devDependencies": {
32 "browserify": "^14.0.0",
33 "chai": "^3.3.0",
34 "karma": "^1.4.1",
35 "karma-browserify": "^5.1.1",
36 "karma-chai": "^0.1.0",
37 "karma-mocha": "^1.3.0",
38 "karma-phantomjs-launcher": "^1.0.2",
39 "mocha": "^3.2.0",
40 "phantomjs": "^2.1.7"
41 },
42 "homepage": "https://github.com/zenorocha/select#readme",
43 "keywords": [
44 "range",
45 "select",
46 "selecting",
47 "selection"
48 ],
49 "license": "MIT",
50 "main": "src/select.js",
51 "name": "select",
52 "repository": {
53 "type": "git",
54 "url": "git+https://github.com/zenorocha/select.git"
55 },
56 "scripts": {
57 "build": "browserify src/select.js -s select -o dist/select.js",
58 "test": "karma start --single-run"
59 },
60 "version": "1.1.2"
61 }
1 # select
2
3 [![Build Status](http://img.shields.io/travis/zenorocha/select/master.svg?style=flat)](https://travis-ci.org/zenorocha/select)
4
5 Programmatically select the text of a HTML element.
6
7 ## Install
8
9 You can get it on npm.
10
11 ```
12 npm install select --save
13 ```
14
15 Or bower, too.
16
17 ```
18 bower install select --save
19 ```
20
21 If you're not into package management, just [download a ZIP](https://github.com/zenorocha/select/archive/master.zip) file.
22
23 ## Usage
24
25 ### Standalone
26
27 ```html
28 <script src="dist/select.js"></script>
29 ```
30
31 ```js
32 var input = document.querySelector('input');
33 var result = select(input);
34 ```
35
36 ### Browserify
37
38 ```js
39 var select = require('select');
40 ```
41
42 ```js
43 var input = document.querySelector('input');
44 var result = select(input);
45 ```
46
47 ## License
48
49 [MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha
1 function select(element) {
2 var selectedText;
3
4 if (element.nodeName === 'SELECT') {
5 element.focus();
6
7 selectedText = element.value;
8 }
9 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
10 var isReadOnly = element.hasAttribute('readonly');
11
12 if (!isReadOnly) {
13 element.setAttribute('readonly', '');
14 }
15
16 element.select();
17 element.setSelectionRange(0, element.value.length);
18
19 if (!isReadOnly) {
20 element.removeAttribute('readonly');
21 }
22
23 selectedText = element.value;
24 }
25 else {
26 if (element.hasAttribute('contenteditable')) {
27 element.focus();
28 }
29
30 var selection = window.getSelection();
31 var range = document.createRange();
32
33 range.selectNodeContents(element);
34 selection.removeAllRanges();
35 selection.addRange(range);
36
37 selectedText = selection.toString();
38 }
39
40 return selectedText;
41 }
42
43 module.exports = select;
1 var select = require('../src/select');
2
3 describe('select editable elements', function() {
4 before(function() {
5 global.input = document.createElement('input');
6 global.input.value = 'lorem ipsum';
7
8 global.textarea = document.createElement('textarea');
9 global.textarea.value = 'lorem ipsum';
10
11 document.body.appendChild(global.input);
12 document.body.appendChild(global.textarea);
13 });
14
15 after(function() {
16 document.body.innerHTML = '';
17 });
18
19 it('should return the selected text on input', function() {
20 var result = select(global.input);
21 assert.equal(result, global.input.value);
22 });
23
24 it('should return the selected text on textarea', function() {
25 var result = select(global.textarea);
26 assert.equal(result, global.textarea.value);
27 });
28 });
29
30 describe('select non-editable element with no children', function() {
31 before(function() {
32 global.paragraph = document.createElement('p');
33 global.paragraph.textContent = 'lorem ipsum';
34
35 document.body.appendChild(global.paragraph);
36 });
37
38 after(function() {
39 document.body.innerHTML = '';
40 });
41
42 it('should return the selected text', function() {
43 var result = select(global.paragraph);
44 assert.equal(result, global.paragraph.textContent);
45 });
46 });
47
48 describe('select non-editable element with child node', function() {
49 before(function() {
50 global.li = document.createElement('li');
51 global.li.textContent = 'lorem ipsum';
52
53 global.ul = document.createElement('ul');
54 global.ul.appendChild(global.li);
55
56 document.body.appendChild(global.ul);
57 });
58
59 after(function() {
60 document.body.innerHTML = '';
61 });
62
63 it('should return the selected text', function() {
64 var result = select(global.ul);
65 assert.equal(result, global.ul.textContent);
66 });
67 });
68
69 describe('select non-editable svg element w/ multiple text children', function() {
70 before(function() {
71 global.text1 = document.createElement('text');
72 global.text1.textContent = 'lorem ipsum';
73
74 global.text2 = document.createElement('text');
75 global.text2.textContent = 'dolor zet';
76
77 global.svg = document.createElement('svg');
78 global.svg.appendChild(global.text1);
79 global.svg.appendChild(global.text2);
80
81 document.body.appendChild(global.svg);
82 });
83
84 after(function() {
85 document.body.innerHTML = '';
86 });
87
88 it('should return the selected text', function() {
89 var result = select(global.svg);
90 assert.equal(result, global.text1.textContent +
91 global.text2.textContent);
92 });
93 });
1 The MIT License (MIT)
2
3 Copyright (c) 2017 Scott Corgan
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE.
22
1 # tiny-emitter
2
3 A tiny (less than 1k) event emitter library.
4
5 ## Install
6
7 ### npm
8
9 ```
10 npm install tiny-emitter --save
11 ```
12
13 ## Usage
14
15 ```js
16 var Emitter = require('tiny-emitter');
17 var emitter = new Emitter();
18
19 emitter.on('some-event', function (arg1, arg2, arg3) {
20 //
21 });
22
23 emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');
24 ```
25
26 Alternatively, you can skip the initialization step by requiring `tiny-emitter/instance` instead. This pulls in an already initialized emitter.
27
28 ```js
29 var emitter = require('tiny-emitter/instance');
30
31 emitter.on('some-event', function (arg1, arg2, arg3) {
32 //
33 });
34
35 emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');
36 ```
37
38 ## Instance Methods
39
40 ### on(event, callback[, context])
41
42 Subscribe to an event
43
44 * `event` - the name of the event to subscribe to
45 * `callback` - the function to call when event is emitted
46 * `context` - (OPTIONAL) - the context to bind the event callback to
47
48 ### once(event, callback[, context])
49
50 Subscribe to an event only **once**
51
52 * `event` - the name of the event to subscribe to
53 * `callback` - the function to call when event is emitted
54 * `context` - (OPTIONAL) - the context to bind the event callback to
55
56 ### off(event[, callback])
57
58 Unsubscribe from an event or all events. If no callback is provided, it unsubscribes you from all events.
59
60 * `event` - the name of the event to unsubscribe from
61 * `callback` - the function used when binding to the event
62
63 ### emit(event[, arguments...])
64
65 Trigger a named event
66
67 * `event` - the event name to emit
68 * `arguments...` - any number of arguments to pass to the event subscribers
69
70 ## Test and Build
71
72 Build (Tests, Browserifies, and minifies)
73
74 ```
75 npm install
76 npm run build
77 ```
78
79 Test
80
81 ```
82 npm install
83 npm test
84 ```
85
86 ## License
87
88 [MIT](https://github.com/scottcorgan/tiny-emitter/blob/master/LICENSE)
1 (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.TinyEmitter = 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){
2 function E () {
3 // Keep this empty so it's easier to inherit from
4 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
5 }
6
7 E.prototype = {
8 on: function (name, callback, ctx) {
9 var e = this.e || (this.e = {});
10
11 (e[name] || (e[name] = [])).push({
12 fn: callback,
13 ctx: ctx
14 });
15
16 return this;
17 },
18
19 once: function (name, callback, ctx) {
20 var self = this;
21 function listener () {
22 self.off(name, listener);
23 callback.apply(ctx, arguments);
24 };
25
26 listener._ = callback
27 return this.on(name, listener, ctx);
28 },
29
30 emit: function (name) {
31 var data = [].slice.call(arguments, 1);
32 var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
33 var i = 0;
34 var len = evtArr.length;
35
36 for (i; i < len; i++) {
37 evtArr[i].fn.apply(evtArr[i].ctx, data);
38 }
39
40 return this;
41 },
42
43 off: function (name, callback) {
44 var e = this.e || (this.e = {});
45 var evts = e[name];
46 var liveEvents = [];
47
48 if (evts && callback) {
49 for (var i = 0, len = evts.length; i < len; i++) {
50 if (evts[i].fn !== callback && evts[i].fn._ !== callback)
51 liveEvents.push(evts[i]);
52 }
53 }
54
55 // Remove event from queue to prevent memory leak
56 // Suggested by https://github.com/lazd
57 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
58
59 (liveEvents.length)
60 ? e[name] = liveEvents
61 : delete e[name];
62
63 return this;
64 }
65 };
66
67 module.exports = E;
68 module.exports.TinyEmitter = E;
69
70 },{}]},{},[1])(1)
71 });
...\ No newline at end of file ...\ No newline at end of file
1 (function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var n;if(typeof window!=="undefined"){n=window}else if(typeof global!=="undefined"){n=global}else if(typeof self!=="undefined"){n=self}else{n=this}n.TinyEmitter=e()}})(function(){var e,n,t;return function r(e,n,t){function i(o,u){if(!n[o]){if(!e[o]){var s=typeof require=="function"&&require;if(!u&&s)return s(o,!0);if(f)return f(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[o]={exports:{}};e[o][0].call(l.exports,function(n){var t=e[o][1][n];return i(t?t:n)},l,l.exports,r,e,n,t)}return n[o].exports}var f=typeof require=="function"&&require;for(var o=0;o<t.length;o++)i(t[o]);return i}({1:[function(e,n,t){function r(){}r.prototype={on:function(e,n,t){var r=this.e||(this.e={});(r[e]||(r[e]=[])).push({fn:n,ctx:t});return this},once:function(e,n,t){var r=this;function i(){r.off(e,i);n.apply(t,arguments)}i._=n;return this.on(e,i,t)},emit:function(e){var n=[].slice.call(arguments,1);var t=((this.e||(this.e={}))[e]||[]).slice();var r=0;var i=t.length;for(r;r<i;r++){t[r].fn.apply(t[r].ctx,n)}return this},off:function(e,n){var t=this.e||(this.e={});var r=t[e];var i=[];if(r&&n){for(var f=0,o=r.length;f<o;f++){if(r[f].fn!==n&&r[f].fn._!==n)i.push(r[f])}}i.length?t[e]=i:delete t[e];return this}};n.exports=r;n.exports.TinyEmitter=r},{}]},{},[1])(1)});
...\ No newline at end of file ...\ No newline at end of file
1 export declare class TinyEmitter {
2 on(event: string, callback: Function, ctx?: any): this;
3 once(event: string, callback: Function, ctx?: any): this;
4 emit(event: string, ...args: any[]): this;
5 off(event: string, callback?: Function): this;
6 }
...\ No newline at end of file ...\ No newline at end of file
1 function E () {
2 // Keep this empty so it's easier to inherit from
3 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
4 }
5
6 E.prototype = {
7 on: function (name, callback, ctx) {
8 var e = this.e || (this.e = {});
9
10 (e[name] || (e[name] = [])).push({
11 fn: callback,
12 ctx: ctx
13 });
14
15 return this;
16 },
17
18 once: function (name, callback, ctx) {
19 var self = this;
20 function listener () {
21 self.off(name, listener);
22 callback.apply(ctx, arguments);
23 };
24
25 listener._ = callback
26 return this.on(name, listener, ctx);
27 },
28
29 emit: function (name) {
30 var data = [].slice.call(arguments, 1);
31 var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
32 var i = 0;
33 var len = evtArr.length;
34
35 for (i; i < len; i++) {
36 evtArr[i].fn.apply(evtArr[i].ctx, data);
37 }
38
39 return this;
40 },
41
42 off: function (name, callback) {
43 var e = this.e || (this.e = {});
44 var evts = e[name];
45 var liveEvents = [];
46
47 if (evts && callback) {
48 for (var i = 0, len = evts.length; i < len; i++) {
49 if (evts[i].fn !== callback && evts[i].fn._ !== callback)
50 liveEvents.push(evts[i]);
51 }
52 }
53
54 // Remove event from queue to prevent memory leak
55 // Suggested by https://github.com/lazd
56 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
57
58 (liveEvents.length)
59 ? e[name] = liveEvents
60 : delete e[name];
61
62 return this;
63 }
64 };
65
66 module.exports = E;
67 module.exports.TinyEmitter = E;
1 var E = require('./index.js');
2 module.exports = new E();
1 {
2 "_from": "tiny-emitter@^2.0.0",
3 "_id": "tiny-emitter@2.1.0",
4 "_inBundle": false,
5 "_integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
6 "_location": "/tiny-emitter",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "range",
10 "registry": true,
11 "raw": "tiny-emitter@^2.0.0",
12 "name": "tiny-emitter",
13 "escapedName": "tiny-emitter",
14 "rawSpec": "^2.0.0",
15 "saveSpec": null,
16 "fetchSpec": "^2.0.0"
17 },
18 "_requiredBy": [
19 "/clipboard"
20 ],
21 "_resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
22 "_shasum": "1d1a56edfc51c43e863cbb5382a72330e3555423",
23 "_spec": "tiny-emitter@^2.0.0",
24 "_where": "/Users/zhanghao/brcode/br-client/node_modules/clipboard",
25 "author": {
26 "name": "Scott Corgan"
27 },
28 "bugs": {
29 "url": "https://github.com/scottcorgan/tiny-emitter/issues"
30 },
31 "bundleDependencies": false,
32 "deprecated": false,
33 "description": "A tiny (less than 1k) event emitter library",
34 "devDependencies": {
35 "@tap-format/spec": "0.2.0",
36 "browserify": "11.2.0",
37 "tape": "4.2.1",
38 "testling": "1.7.1",
39 "uglify-js": "2.5.0"
40 },
41 "homepage": "https://github.com/scottcorgan/tiny-emitter#readme",
42 "keywords": [
43 "event",
44 "emitter",
45 "pubsub",
46 "tiny",
47 "events",
48 "bind"
49 ],
50 "license": "MIT",
51 "main": "index.js",
52 "name": "tiny-emitter",
53 "repository": {
54 "type": "git",
55 "url": "git+https://github.com/scottcorgan/tiny-emitter.git"
56 },
57 "scripts": {
58 "build": "npm test && npm run bundle && npm run minify",
59 "bundle": "browserify index.js > dist/tinyemitter.js -s TinyEmitter && echo 'Bundled'",
60 "minify": "uglifyjs dist/tinyemitter.js -o dist/tinyemitter.min.js -m && echo 'Minified'",
61 "size": "uglifyjs index.js -o minified.js -m && ls -l && rm minified.js",
62 "test": "testling | tap-format-spec",
63 "test-node": "tape test/index.js | tap-format-spec"
64 },
65 "testling": {
66 "files": [
67 "test/index.js"
68 ],
69 "browsers": [
70 "iexplore/10.0",
71 "iexplore/9.0",
72 "firefox/16..latest",
73 "chrome/22..latest",
74 "safari/5.1..latest",
75 "ipad/6.0..latest",
76 "iphone/6.0..latest",
77 "android-browser/4.2..latest"
78 ]
79 },
80 "version": "2.1.0"
81 }
1 var Emitter = require('../index');
2 var emitter = require('../instance');
3 var test = require('tape');
4
5 test('subscribes to an event', function (t) {
6 var emitter = new Emitter();
7 emitter.on('test', function () {});
8
9 t.equal(emitter.e.test.length, 1, 'subscribed to event');
10 t.end();
11 });
12
13 test('subscribes to an event with context', function (t) {
14 var emitter = new Emitter();
15 var context = {
16 contextValue: true
17 };
18
19 emitter.on('test', function () {
20 t.ok(this.contextValue, 'is in context');
21 t.end();
22 }, context);
23
24 emitter.emit('test');
25 });
26
27 test('subscibes only once to an event', function (t) {
28 var emitter = new Emitter();
29
30 emitter.once('test', function () {
31 t.notOk(emitter.e.test, 'removed event from list');
32 t.end();
33 });
34
35 emitter.emit('test');
36 });
37
38 test('keeps context when subscribed only once', function (t) {
39 var emitter = new Emitter();
40 var context = {
41 contextValue: true
42 };
43
44 emitter.once('test', function () {
45 t.ok(this.contextValue, 'is in context');
46 t.notOk(emitter.e.test, 'not subscribed anymore');
47 t.end();
48 }, context);
49
50 emitter.emit('test');
51 });
52
53 test('emits an event', function (t) {
54 var emitter = new Emitter();
55
56 emitter.on('test', function () {
57 t.ok(true, 'triggered event');
58 t.end();
59 });
60
61 emitter.emit('test');
62 });
63
64 test('passes all arguments to event listener', function (t) {
65 var emitter = new Emitter();
66
67 emitter.on('test', function (arg1, arg2) {
68 t.equal(arg1, 'arg1', 'passed the first argument');
69 t.equal(arg2, 'arg2', 'passed the second argument');
70 t.end();
71 });
72
73 emitter.emit('test', 'arg1', 'arg2');
74 });
75
76 test('unsubscribes from all events with name', function (t) {
77 var emitter = new Emitter();
78 emitter.on('test', function () {
79 t.fail('should not get called');
80 });
81 emitter.off('test');
82 emitter.emit('test')
83
84 process.nextTick(function () {
85 t.end();
86 });
87 });
88
89 test('unsubscribes single event with name and callback', function (t) {
90 var emitter = new Emitter();
91 var fn = function () {
92 t.fail('should not get called');
93 }
94
95 emitter.on('test', fn);
96 emitter.off('test', fn);
97 emitter.emit('test')
98
99 process.nextTick(function () {
100 t.end();
101 });
102 });
103
104 // Test added by https://github.com/lazd
105 // From PR: https://github.com/scottcorgan/tiny-emitter/pull/6
106 test('unsubscribes single event with name and callback when subscribed twice', function (t) {
107 var emitter = new Emitter();
108 var fn = function () {
109 t.fail('should not get called');
110 };
111
112 emitter.on('test', fn);
113 emitter.on('test', fn);
114
115 emitter.off('test', fn);
116 emitter.emit('test');
117
118 process.nextTick(function () {
119 t.notOk(emitter.e['test'], 'removes all events');
120 t.end();
121 });
122 });
123
124 test('unsubscribes single event with name and callback when subscribed twice out of order', function (t) {
125 var emitter = new Emitter();
126 var calls = 0;
127 var fn = function () {
128 t.fail('should not get called');
129 };
130 var fn2 = function () {
131 calls++;
132 };
133
134 emitter.on('test', fn);
135 emitter.on('test', fn2);
136 emitter.on('test', fn);
137 emitter.off('test', fn);
138 emitter.emit('test');
139
140 process.nextTick(function () {
141 t.equal(calls, 1, 'callback was called');
142 t.end();
143 });
144 });
145
146 test('removes an event inside another event', function (t) {
147 var emitter = new Emitter();
148
149 emitter.on('test', function () {
150 t.equal(emitter.e.test.length, 1, 'event is still in list');
151
152 emitter.off('test');
153
154 t.notOk(emitter.e.test, 0, 'event is gone from list');
155 t.end();
156 });
157
158 emitter.emit('test');
159 });
160
161 test('event is emitted even if unsubscribed in the event callback', function (t) {
162 var emitter = new Emitter();
163 var calls = 0;
164 var fn = function () {
165 calls += 1;
166 emitter.off('test', fn);
167 };
168
169 emitter.on('test', fn);
170
171 emitter.on('test', function () {
172 calls += 1;
173 });
174
175 emitter.on('test', function () {
176 calls += 1;
177 });
178
179 process.nextTick(function () {
180 t.equal(calls, 3, 'all callbacks were called');
181 t.end();
182 });
183
184 emitter.emit('test');
185 });
186
187 test('calling off before any events added does nothing', function (t) {
188 var emitter = new Emitter();
189 emitter.off('test', function () {});
190 t.end();
191 });
192
193 test('emitting event that has not been subscribed to yet', function (t) {
194 var emitter = new Emitter();
195
196 emitter.emit('some-event', 'some message');
197 t.end();
198 });
199
200 test('unsubscribes single event with name and callback which was subscribed once', function (t) {
201 var emitter = new Emitter();
202 var fn = function () {
203 t.fail('event not unsubscribed');
204 }
205
206 emitter.once('test', fn);
207 emitter.off('test', fn);
208 emitter.emit('test');
209
210 t.end();
211 });
212
213 test('exports an instance', function (t) {
214 t.ok(emitter, 'exports an instance')
215 t.ok(emitter instanceof Emitter, 'an instance of the Emitter class');
216 t.end();
217 });
1 # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 # yarn lockfile v1
3
4
5 "@tap-format/exit@0.2.0":
6 version "0.2.0"
7 resolved "https://registry.yarnpkg.com/@tap-format/exit/-/exit-0.2.0.tgz#b58736bc55d30802c012c5adfca51b47040310cd"
8 dependencies:
9 ramda "^0.18.0"
10 rx "^4.0.7"
11
12 "@tap-format/failures@0.2.0":
13 version "0.2.0"
14 resolved "https://registry.yarnpkg.com/@tap-format/failures/-/failures-0.2.0.tgz#bb6f5edc3bc3c57c62885bc7c214cc7abdfc2a07"
15 dependencies:
16 chalk "^1.1.1"
17 diff "^2.2.1"
18 figures "^1.4.0"
19 ramda "^0.18.0"
20 rx "^4.0.7"
21
22 "@tap-format/parser@0.2.0":
23 version "0.2.0"
24 resolved "https://registry.yarnpkg.com/@tap-format/parser/-/parser-0.2.0.tgz#bdc1d95e694781157593283bb3c3fec132a3115d"
25 dependencies:
26 duplexer "^0.1.1"
27 js-yaml "^3.4.6"
28 ramda "^0.18.0"
29 readable-stream "^2.0.4"
30 rx "^4.0.7"
31 rx-node "^1.0.1"
32 split "^1.0.0"
33
34 "@tap-format/results@0.2.0":
35 version "0.2.0"
36 resolved "https://registry.yarnpkg.com/@tap-format/results/-/results-0.2.0.tgz#192d64ac41f146fa2722db1c0a22ed80478f54fd"
37 dependencies:
38 chalk "^1.1.1"
39 hirestime "^1.0.6"
40 pretty-ms "^2.1.0"
41 rx "^4.0.7"
42
43 "@tap-format/spec@0.2.0":
44 version "0.2.0"
45 resolved "https://registry.yarnpkg.com/@tap-format/spec/-/spec-0.2.0.tgz#93f7d2f0dcefe526b4776800b9bd7f80db5aaec7"
46 dependencies:
47 "@tap-format/exit" "0.2.0"
48 "@tap-format/failures" "0.2.0"
49 "@tap-format/parser" "0.2.0"
50 "@tap-format/results" "0.2.0"
51 chalk "^1.1.1"
52 figures "^1.4.0"
53 rx "^4.0.7"
54
55 Base64@~0.2.0:
56 version "0.2.1"
57 resolved "https://registry.yarnpkg.com/Base64/-/Base64-0.2.1.tgz#ba3a4230708e186705065e66babdd4c35cf60028"
58
59 JSONStream@^1.0.3:
60 version "1.3.2"
61 resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"
62 dependencies:
63 jsonparse "^1.2.0"
64 through ">=2.2.7 <3"
65
66 JSONStream@~0.6.4:
67 version "0.6.4"
68 resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-0.6.4.tgz#4b2c8063f8f512787b2375f7ee9db69208fa2dcb"
69 dependencies:
70 jsonparse "0.0.5"
71 through "~2.2.7"
72
73 JSONStream@~0.7.1:
74 version "0.7.4"
75 resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-0.7.4.tgz#734290e41511eea7c2cfe151fbf9a563a97b9786"
76 dependencies:
77 jsonparse "0.0.5"
78 through ">=2.2.7 <3"
79
80 acorn-node@^1.2.0:
81 version "1.3.0"
82 resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.3.0.tgz#5f86d73346743810ef1269b901dbcbded020861b"
83 dependencies:
84 acorn "^5.4.1"
85 xtend "^4.0.1"
86
87 acorn@^2.7.0:
88 version "2.7.0"
89 resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7"
90
91 acorn@^4.0.3:
92 version "4.0.13"
93 resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
94
95 acorn@^5.2.1, acorn@^5.4.1:
96 version "5.4.1"
97 resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
98
99 amdefine@>=0.0.4:
100 version "1.0.1"
101 resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
102
103 ansi-regex@^2.0.0:
104 version "2.1.1"
105 resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
106
107 ansi-styles@^2.2.1:
108 version "2.2.1"
109 resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
110
111 argparse@^1.0.7:
112 version "1.0.10"
113 resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
114 dependencies:
115 sprintf-js "~1.0.2"
116
117 asn1.js@^4.0.0:
118 version "4.10.1"
119 resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0"
120 dependencies:
121 bn.js "^4.0.0"
122 inherits "^2.0.1"
123 minimalistic-assert "^1.0.0"
124
125 assert@~1.1.0:
126 version "1.1.2"
127 resolved "https://registry.yarnpkg.com/assert/-/assert-1.1.2.tgz#adaa04c46bb58c6dd1f294da3eb26e6228eb6e44"
128 dependencies:
129 util "0.10.3"
130
131 assert@~1.3.0:
132 version "1.3.0"
133 resolved "https://registry.yarnpkg.com/assert/-/assert-1.3.0.tgz#03939a622582a812cc202320a0b9a56c9b815849"
134 dependencies:
135 util "0.10.3"
136
137 astw@^2.0.0:
138 version "2.2.0"
139 resolved "https://registry.yarnpkg.com/astw/-/astw-2.2.0.tgz#7bd41784d32493987aeb239b6b4e1c57a873b917"
140 dependencies:
141 acorn "^4.0.3"
142
143 async@~0.2.6:
144 version "0.2.10"
145 resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
146
147 balanced-match@^1.0.0:
148 version "1.0.0"
149 resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
150
151 base64-js@0.0.2:
152 version "0.0.2"
153 resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-0.0.2.tgz#024f0f72afa25b75f9c0ee73cd4f55ec1bed9784"
154
155 base64-js@0.0.8, base64-js@~0.0.4:
156 version "0.0.8"
157 resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-0.0.8.tgz#1101e9544f4a76b1bc3b26d452ca96d7a35e7978"
158
159 bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
160 version "4.11.8"
161 resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
162
163 bops@0.0.6:
164 version "0.0.6"
165 resolved "https://registry.yarnpkg.com/bops/-/bops-0.0.6.tgz#082d1d55fa01e60dbdc2ebc2dba37f659554cf3a"
166 dependencies:
167 base64-js "0.0.2"
168 to-utf8 "0.0.1"
169
170 bouncy@~3.2.0:
171 version "3.2.2"
172 resolved "https://registry.yarnpkg.com/bouncy/-/bouncy-3.2.2.tgz#82ab4ad7beae05890eed54b9af3c45394b185dc7"
173 dependencies:
174 optimist "~0.3.5"
175 through "~2.3.4"
176
177 brace-expansion@^1.0.0, brace-expansion@^1.1.7:
178 version "1.1.11"
179 resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
180 dependencies:
181 balanced-match "^1.0.0"
182 concat-map "0.0.1"
183
184 brorand@^1.0.1:
185 version "1.1.0"
186 resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
187
188 browser-launcher@~0.3.2:
189 version "0.3.5"
190 resolved "https://registry.yarnpkg.com/browser-launcher/-/browser-launcher-0.3.5.tgz#d9a3663fa064d8155044991c00e61dbcb6730a16"
191 dependencies:
192 headless "~0.1.3"
193 merge "~1.0.0"
194 minimist "0.0.5"
195 mkdirp "~0.3.3"
196 plist "0.2.1"
197 xtend "^4.0.0"
198
199 browser-pack@^5.0.0:
200 version "5.0.1"
201 resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d"
202 dependencies:
203 JSONStream "^1.0.3"
204 combine-source-map "~0.6.1"
205 defined "^1.0.0"
206 through2 "^1.0.0"
207 umd "^3.0.0"
208
209 browser-pack@~2.0.0:
210 version "2.0.1"
211 resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-2.0.1.tgz#5d1c527f56c582677411c4db2a128648ff6bf150"
212 dependencies:
213 JSONStream "~0.6.4"
214 combine-source-map "~0.3.0"
215 through "~2.3.4"
216
217 browser-resolve@^1.7.0, browser-resolve@^1.7.1:
218 version "1.11.2"
219 resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce"
220 dependencies:
221 resolve "1.1.7"
222
223 browser-resolve@~1.2.1, browser-resolve@~1.2.4:
224 version "1.2.4"
225 resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.2.4.tgz#59ae7820a82955ecd32f5fb7c468ac21c4723806"
226 dependencies:
227 resolve "0.6.3"
228
229 browserify-aes@^1.0.0, browserify-aes@^1.0.4:
230 version "1.1.1"
231 resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f"
232 dependencies:
233 buffer-xor "^1.0.3"
234 cipher-base "^1.0.0"
235 create-hash "^1.1.0"
236 evp_bytestokey "^1.0.3"
237 inherits "^2.0.1"
238 safe-buffer "^5.0.1"
239
240 browserify-cipher@^1.0.0:
241 version "1.0.0"
242 resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a"
243 dependencies:
244 browserify-aes "^1.0.4"
245 browserify-des "^1.0.0"
246 evp_bytestokey "^1.0.0"
247
248 browserify-des@^1.0.0:
249 version "1.0.0"
250 resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd"
251 dependencies:
252 cipher-base "^1.0.1"
253 des.js "^1.0.0"
254 inherits "^2.0.1"
255
256 browserify-rsa@^4.0.0:
257 version "4.0.1"
258 resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524"
259 dependencies:
260 bn.js "^4.1.0"
261 randombytes "^2.0.1"
262
263 browserify-sign@^4.0.0:
264 version "4.0.4"
265 resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298"
266 dependencies:
267 bn.js "^4.1.1"
268 browserify-rsa "^4.0.0"
269 create-hash "^1.1.0"
270 create-hmac "^1.1.2"
271 elliptic "^6.0.0"
272 inherits "^2.0.1"
273 parse-asn1 "^5.0.0"
274
275 browserify-zlib@~0.1.2:
276 version "0.1.4"
277 resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d"
278 dependencies:
279 pako "~0.2.0"
280
281 browserify@11.2.0:
282 version "11.2.0"
283 resolved "https://registry.yarnpkg.com/browserify/-/browserify-11.2.0.tgz#a11bb9dd209d79572b813f7eeeaf828a5f5c0e4e"
284 dependencies:
285 JSONStream "^1.0.3"
286 assert "~1.3.0"
287 browser-pack "^5.0.0"
288 browser-resolve "^1.7.1"
289 browserify-zlib "~0.1.2"
290 buffer "^3.0.0"
291 builtins "~0.0.3"
292 commondir "0.0.1"
293 concat-stream "~1.4.1"
294 console-browserify "^1.1.0"
295 constants-browserify "~0.0.1"
296 crypto-browserify "^3.0.0"
297 defined "^1.0.0"
298 deps-sort "^1.3.7"
299 domain-browser "~1.1.0"
300 duplexer2 "~0.0.2"
301 events "~1.0.0"
302 glob "^4.0.5"
303 has "^1.0.0"
304 htmlescape "^1.1.0"
305 https-browserify "~0.0.0"
306 inherits "~2.0.1"
307 insert-module-globals "^6.4.1"
308 isarray "0.0.1"
309 labeled-stream-splicer "^1.0.0"
310 module-deps "^3.7.11"
311 os-browserify "~0.1.1"
312 parents "^1.0.1"
313 path-browserify "~0.0.0"
314 process "~0.11.0"
315 punycode "^1.3.2"
316 querystring-es3 "~0.2.0"
317 read-only-stream "^1.1.1"
318 readable-stream "^2.0.2"
319 resolve "^1.1.4"
320 shasum "^1.0.0"
321 shell-quote "~0.0.1"
322 stream-browserify "^2.0.0"
323 stream-http "^1.2.0"
324 string_decoder "~0.10.0"
325 subarg "^1.0.0"
326 syntax-error "^1.1.1"
327 through2 "^1.0.0"
328 timers-browserify "^1.0.1"
329 tty-browserify "~0.0.0"
330 url "~0.10.1"
331 util "~0.10.1"
332 vm-browserify "~0.0.1"
333 xtend "^4.0.0"
334
335 browserify@3.x.x:
336 version "3.46.1"
337 resolved "https://registry.yarnpkg.com/browserify/-/browserify-3.46.1.tgz#2c2e4a7f2f408178e78c223b5b57b37c2185ad8e"
338 dependencies:
339 JSONStream "~0.7.1"
340 assert "~1.1.0"
341 browser-pack "~2.0.0"
342 browser-resolve "~1.2.1"
343 browserify-zlib "~0.1.2"
344 buffer "~2.1.4"
345 builtins "~0.0.3"
346 commondir "0.0.1"
347 concat-stream "~1.4.1"
348 console-browserify "~1.0.1"
349 constants-browserify "~0.0.1"
350 crypto-browserify "~1.0.9"
351 deep-equal "~0.1.0"
352 defined "~0.0.0"
353 deps-sort "~0.1.1"
354 derequire "~0.8.0"
355 domain-browser "~1.1.0"
356 duplexer "~0.1.1"
357 events "~1.0.0"
358 glob "~3.2.8"
359 http-browserify "~1.3.1"
360 https-browserify "~0.0.0"
361 inherits "~2.0.1"
362 insert-module-globals "~6.0.0"
363 module-deps "~2.0.0"
364 os-browserify "~0.1.1"
365 parents "~0.0.1"
366 path-browserify "~0.0.0"
367 process "^0.7.0"
368 punycode "~1.2.3"
369 querystring-es3 "0.2.0"
370 resolve "~0.6.1"
371 shallow-copy "0.0.1"
372 shell-quote "~0.0.1"
373 stream-browserify "~0.1.0"
374 stream-combiner "~0.0.2"
375 string_decoder "~0.0.0"
376 subarg "0.0.1"
377 syntax-error "~1.1.0"
378 through2 "~0.4.1"
379 timers-browserify "~1.0.1"
380 tty-browserify "~0.0.0"
381 umd "~2.0.0"
382 url "~0.10.1"
383 util "~0.10.1"
384 vm-browserify "~0.0.1"
385 xtend "^3.0.0"
386
387 buffer-xor@^1.0.3:
388 version "1.0.3"
389 resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
390
391 buffer@^3.0.0:
392 version "3.6.0"
393 resolved "https://registry.yarnpkg.com/buffer/-/buffer-3.6.0.tgz#a72c936f77b96bf52f5f7e7b467180628551defb"
394 dependencies:
395 base64-js "0.0.8"
396 ieee754 "^1.1.4"
397 isarray "^1.0.0"
398
399 buffer@~2.1.4:
400 version "2.1.13"
401 resolved "https://registry.yarnpkg.com/buffer/-/buffer-2.1.13.tgz#c88838ebf79f30b8b4a707788470bea8a62c2355"
402 dependencies:
403 base64-js "~0.0.4"
404 ieee754 "~1.1.1"
405
406 builtin-status-codes@^1.0.0:
407 version "1.0.0"
408 resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-1.0.0.tgz#30637ee262978ac07174e16d7f82f0ad06e085ad"
409
410 builtins@~0.0.3:
411 version "0.0.7"
412 resolved "https://registry.yarnpkg.com/builtins/-/builtins-0.0.7.tgz#355219cd6cf18dbe7c01cc7fd2dce765cfdc549a"
413
414 callsite@~1.0.0:
415 version "1.0.0"
416 resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20"
417
418 camelcase@^1.0.2:
419 version "1.2.1"
420 resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
421
422 chalk@^1.1.1:
423 version "1.1.3"
424 resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
425 dependencies:
426 ansi-styles "^2.2.1"
427 escape-string-regexp "^1.0.2"
428 has-ansi "^2.0.0"
429 strip-ansi "^3.0.0"
430 supports-color "^2.0.0"
431
432 cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
433 version "1.0.4"
434 resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
435 dependencies:
436 inherits "^2.0.1"
437 safe-buffer "^5.0.1"
438
439 combine-source-map@~0.3.0:
440 version "0.3.0"
441 resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.3.0.tgz#d9e74f593d9cd43807312cb5d846d451efaa9eb7"
442 dependencies:
443 convert-source-map "~0.3.0"
444 inline-source-map "~0.3.0"
445 source-map "~0.1.31"
446
447 combine-source-map@~0.6.1:
448 version "0.6.1"
449 resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96"
450 dependencies:
451 convert-source-map "~1.1.0"
452 inline-source-map "~0.5.0"
453 lodash.memoize "~3.0.3"
454 source-map "~0.4.2"
455
456 commondir@0.0.1:
457 version "0.0.1"
458 resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2"
459
460 concat-map@0.0.1:
461 version "0.0.1"
462 resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
463
464 concat-stream@~0.1.0:
465 version "0.1.1"
466 resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-0.1.1.tgz#d7f4e278b90cfc4f0f3ef77fe4c03b40eb3f7900"
467
468 concat-stream@~1.0.0:
469 version "1.0.1"
470 resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.0.1.tgz#018b18bc1c7d073a2dc82aa48442341a2c4dd79f"
471 dependencies:
472 bops "0.0.6"
473
474 concat-stream@~1.4.1, concat-stream@~1.4.5:
475 version "1.4.10"
476 resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.4.10.tgz#acc3bbf5602cb8cc980c6ac840fa7d8603e3ef36"
477 dependencies:
478 inherits "~2.0.1"
479 readable-stream "~1.1.9"
480 typedarray "~0.0.5"
481
482 console-browserify@^1.1.0:
483 version "1.1.0"
484 resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
485 dependencies:
486 date-now "^0.1.4"
487
488 console-browserify@~1.0.1:
489 version "1.0.3"
490 resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.0.3.tgz#d3898d2c3a93102f364197f8874b4f92b5286a8e"
491
492 constants-browserify@~0.0.1:
493 version "0.0.1"
494 resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-0.0.1.tgz#92577db527ba6c4cf0a4568d84bc031f441e21f2"
495
496 convert-source-map@~0.3.0:
497 version "0.3.5"
498 resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190"
499
500 convert-source-map@~1.1.0:
501 version "1.1.3"
502 resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860"
503
504 core-util-is@~1.0.0:
505 version "1.0.2"
506 resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
507
508 create-ecdh@^4.0.0:
509 version "4.0.0"
510 resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d"
511 dependencies:
512 bn.js "^4.1.0"
513 elliptic "^6.0.0"
514
515 create-hash@^1.1.0, create-hash@^1.1.2:
516 version "1.1.3"
517 resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd"
518 dependencies:
519 cipher-base "^1.0.1"
520 inherits "^2.0.1"
521 ripemd160 "^2.0.0"
522 sha.js "^2.4.0"
523
524 create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
525 version "1.1.6"
526 resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06"
527 dependencies:
528 cipher-base "^1.0.3"
529 create-hash "^1.1.0"
530 inherits "^2.0.1"
531 ripemd160 "^2.0.0"
532 safe-buffer "^5.0.1"
533 sha.js "^2.4.8"
534
535 crypto-browserify@^3.0.0:
536 version "3.12.0"
537 resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
538 dependencies:
539 browserify-cipher "^1.0.0"
540 browserify-sign "^4.0.0"
541 create-ecdh "^4.0.0"
542 create-hash "^1.1.0"
543 create-hmac "^1.1.0"
544 diffie-hellman "^5.0.0"
545 inherits "^2.0.1"
546 pbkdf2 "^3.0.3"
547 public-encrypt "^4.0.0"
548 randombytes "^2.0.0"
549 randomfill "^1.0.3"
550
551 crypto-browserify@~1.0.9:
552 version "1.0.9"
553 resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-1.0.9.tgz#cc5449685dfb85eb11c9828acc7cb87ab5bbfcc0"
554
555 date-now@^0.1.4:
556 version "0.1.4"
557 resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
558
559 decamelize@^1.0.0:
560 version "1.2.0"
561 resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
562
563 deep-equal@~0.0.0:
564 version "0.0.0"
565 resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-0.0.0.tgz#99679d3bbd047156fcd450d3d01eeb9068691e83"
566
567 deep-equal@~0.1.0:
568 version "0.1.2"
569 resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-0.1.2.tgz#b246c2b80a570a47c11be1d9bd1070ec878b87ce"
570
571 deep-equal@~1.0.0:
572 version "1.0.1"
573 resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
574
575 define-properties@^1.1.2:
576 version "1.1.2"
577 resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
578 dependencies:
579 foreach "^2.0.5"
580 object-keys "^1.0.8"
581
582 defined@^1.0.0, defined@~1.0.0:
583 version "1.0.0"
584 resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
585
586 defined@~0.0.0:
587 version "0.0.0"
588 resolved "https://registry.yarnpkg.com/defined/-/defined-0.0.0.tgz#f35eea7d705e933baf13b2f03b3f83d921403b3e"
589
590 deps-sort@^1.3.7:
591 version "1.3.9"
592 resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-1.3.9.tgz#29dfff53e17b36aecae7530adbbbf622c2ed1a71"
593 dependencies:
594 JSONStream "^1.0.3"
595 shasum "^1.0.0"
596 subarg "^1.0.0"
597 through2 "^1.0.0"
598
599 deps-sort@~0.1.1:
600 version "0.1.2"
601 resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-0.1.2.tgz#daa2fb614a17c9637d801e2f55339ae370f3611a"
602 dependencies:
603 JSONStream "~0.6.4"
604 minimist "~0.0.1"
605 through "~2.3.4"
606
607 derequire@~0.8.0:
608 version "0.8.0"
609 resolved "https://registry.yarnpkg.com/derequire/-/derequire-0.8.0.tgz#c1f7f1da2cede44adede047378f03f444e9c4c0d"
610 dependencies:
611 esprima-fb "^3001.1.0-dev-harmony-fb"
612 esrefactor "~0.1.0"
613 estraverse "~1.5.0"
614
615 des.js@^1.0.0:
616 version "1.0.0"
617 resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc"
618 dependencies:
619 inherits "^2.0.1"
620 minimalistic-assert "^1.0.0"
621
622 detective@^4.0.0:
623 version "4.7.1"
624 resolved "https://registry.yarnpkg.com/detective/-/detective-4.7.1.tgz#0eca7314338442febb6d65da54c10bb1c82b246e"
625 dependencies:
626 acorn "^5.2.1"
627 defined "^1.0.0"
628
629 detective@~3.1.0:
630 version "3.1.0"
631 resolved "https://registry.yarnpkg.com/detective/-/detective-3.1.0.tgz#77782444ab752b88ca1be2e9d0a0395f1da25eed"
632 dependencies:
633 escodegen "~1.1.0"
634 esprima-fb "3001.1.0-dev-harmony-fb"
635
636 diff@^2.2.1:
637 version "2.2.3"
638 resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99"
639
640 diffie-hellman@^5.0.0:
641 version "5.0.2"
642 resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e"
643 dependencies:
644 bn.js "^4.1.0"
645 miller-rabin "^4.0.0"
646 randombytes "^2.0.0"
647
648 domain-browser@~1.1.0:
649 version "1.1.7"
650 resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc"
651
652 duplexer2@0.0.2, duplexer2@~0.0.2:
653 version "0.0.2"
654 resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db"
655 dependencies:
656 readable-stream "~1.1.9"
657
658 duplexer@^0.1.1, duplexer@~0.1.1:
659 version "0.1.1"
660 resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
661
662 ecstatic@~0.4.5:
663 version "0.4.13"
664 resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-0.4.13.tgz#9cb6eaffe211b9c84efb3f553cde2c3002717b29"
665 dependencies:
666 ent "0.0.x"
667 mime "1.2.x"
668 optimist "~0.3.5"
669
670 elliptic@^6.0.0:
671 version "6.4.0"
672 resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df"
673 dependencies:
674 bn.js "^4.4.0"
675 brorand "^1.0.1"
676 hash.js "^1.0.0"
677 hmac-drbg "^1.0.0"
678 inherits "^2.0.1"
679 minimalistic-assert "^1.0.0"
680 minimalistic-crypto-utils "^1.0.0"
681
682 ent@0.0.x, ent@~0.0.5:
683 version "0.0.7"
684 resolved "https://registry.yarnpkg.com/ent/-/ent-0.0.7.tgz#835d4e7f9e7a8d4921c692e9010ec976da5e9949"
685
686 es-abstract@^1.5.0:
687 version "1.10.0"
688 resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
689 dependencies:
690 es-to-primitive "^1.1.1"
691 function-bind "^1.1.1"
692 has "^1.0.1"
693 is-callable "^1.1.3"
694 is-regex "^1.0.4"
695
696 es-to-primitive@^1.1.1:
697 version "1.1.1"
698 resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
699 dependencies:
700 is-callable "^1.1.1"
701 is-date-object "^1.0.1"
702 is-symbol "^1.0.1"
703
704 escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
705 version "1.0.5"
706 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
707
708 escodegen@~1.1.0:
709 version "1.1.0"
710 resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.1.0.tgz#c663923f6e20aad48d0c0fa49f31c6d4f49360cf"
711 dependencies:
712 esprima "~1.0.4"
713 estraverse "~1.5.0"
714 esutils "~1.0.0"
715 optionalDependencies:
716 source-map "~0.1.30"
717
718 escope@~0.0.13:
719 version "0.0.16"
720 resolved "https://registry.yarnpkg.com/escope/-/escope-0.0.16.tgz#418c7a0afca721dafe659193fd986283e746538f"
721 dependencies:
722 estraverse ">= 0.0.2"
723
724 esprima-fb@3001.1.0-dev-harmony-fb, esprima-fb@^3001.1.0-dev-harmony-fb:
725 version "3001.1.0-dev-harmony-fb"
726 resolved "https://registry.yarnpkg.com/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz#b77d37abcd38ea0b77426bb8bc2922ce6b426411"
727
728 esprima@^4.0.0:
729 version "4.0.0"
730 resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
731
732 esprima@~1.0.2, esprima@~1.0.4:
733 version "1.0.4"
734 resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"
735
736 esrefactor@~0.1.0:
737 version "0.1.0"
738 resolved "https://registry.yarnpkg.com/esrefactor/-/esrefactor-0.1.0.tgz#d142795a282339ab81e936b5b7a21b11bf197b13"
739 dependencies:
740 escope "~0.0.13"
741 esprima "~1.0.2"
742 estraverse "~0.0.4"
743
744 "estraverse@>= 0.0.2":
745 version "4.2.0"
746 resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
747
748 estraverse@~0.0.4:
749 version "0.0.4"
750 resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-0.0.4.tgz#01a0932dfee574684a598af5a67c3bf9b6428db2"
751
752 estraverse@~1.5.0:
753 version "1.5.1"
754 resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.5.1.tgz#867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71"
755
756 esutils@~1.0.0:
757 version "1.0.0"
758 resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.0.0.tgz#8151d358e20c8acc7fb745e7472c0025fe496570"
759
760 events@~1.0.0:
761 version "1.0.2"
762 resolved "https://registry.yarnpkg.com/events/-/events-1.0.2.tgz#75849dcfe93d10fb057c30055afdbd51d06a8e24"
763
764 evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
765 version "1.0.3"
766 resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02"
767 dependencies:
768 md5.js "^1.3.4"
769 safe-buffer "^5.1.1"
770
771 figures@^1.4.0:
772 version "1.7.0"
773 resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
774 dependencies:
775 escape-string-regexp "^1.0.5"
776 object-assign "^4.1.0"
777
778 foreach@^2.0.5:
779 version "2.0.5"
780 resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
781
782 function-bind@^1.0.2, function-bind@^1.1.1:
783 version "1.1.1"
784 resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
785
786 function-bind@~1.0.2:
787 version "1.0.2"
788 resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.0.2.tgz#c2873b69c5e6d7cefae47d2555172926c8c2e05e"
789
790 glob@^4.0.5:
791 version "4.5.3"
792 resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f"
793 dependencies:
794 inflight "^1.0.4"
795 inherits "2"
796 minimatch "^2.0.1"
797 once "^1.3.0"
798
799 glob@~3.2.1, glob@~3.2.8:
800 version "3.2.11"
801 resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d"
802 dependencies:
803 inherits "2"
804 minimatch "0.3"
805
806 glob@~5.0.3:
807 version "5.0.15"
808 resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
809 dependencies:
810 inflight "^1.0.4"
811 inherits "2"
812 minimatch "2 || 3"
813 once "^1.3.0"
814 path-is-absolute "^1.0.0"
815
816 has-ansi@^2.0.0:
817 version "2.0.0"
818 resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
819 dependencies:
820 ansi-regex "^2.0.0"
821
822 has@^1.0.0, has@^1.0.1, has@~1.0.1:
823 version "1.0.1"
824 resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
825 dependencies:
826 function-bind "^1.0.2"
827
828 hash-base@^2.0.0:
829 version "2.0.2"
830 resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1"
831 dependencies:
832 inherits "^2.0.1"
833
834 hash-base@^3.0.0:
835 version "3.0.4"
836 resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918"
837 dependencies:
838 inherits "^2.0.1"
839 safe-buffer "^5.0.1"
840
841 hash.js@^1.0.0, hash.js@^1.0.3:
842 version "1.1.3"
843 resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846"
844 dependencies:
845 inherits "^2.0.3"
846 minimalistic-assert "^1.0.0"
847
848 headless@~0.1.3:
849 version "0.1.7"
850 resolved "https://registry.yarnpkg.com/headless/-/headless-0.1.7.tgz#6e62fae668947f88184d5c156ede7c5695a7e9c8"
851
852 hirestime@^1.0.6:
853 version "1.0.7"
854 resolved "https://registry.yarnpkg.com/hirestime/-/hirestime-1.0.7.tgz#2d5271ea84356cec3f25da8c56a9402f8fc0a700"
855
856 hmac-drbg@^1.0.0:
857 version "1.0.1"
858 resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
859 dependencies:
860 hash.js "^1.0.3"
861 minimalistic-assert "^1.0.0"
862 minimalistic-crypto-utils "^1.0.1"
863
864 htmlescape@^1.1.0:
865 version "1.1.1"
866 resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351"
867
868 http-browserify@~1.3.1:
869 version "1.3.2"
870 resolved "https://registry.yarnpkg.com/http-browserify/-/http-browserify-1.3.2.tgz#b562c34479349a690d7a6597df495aefa8c604f5"
871 dependencies:
872 Base64 "~0.2.0"
873 inherits "~2.0.1"
874
875 https-browserify@~0.0.0:
876 version "0.0.1"
877 resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"
878
879 ieee754@^1.1.4, ieee754@~1.1.1:
880 version "1.1.8"
881 resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
882
883 indexof@0.0.1:
884 version "0.0.1"
885 resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d"
886
887 inflight@^1.0.4:
888 version "1.0.6"
889 resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
890 dependencies:
891 once "^1.3.0"
892 wrappy "1"
893
894 inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3:
895 version "2.0.3"
896 resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
897
898 inherits@2.0.1:
899 version "2.0.1"
900 resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
901
902 inline-source-map@~0.3.0:
903 version "0.3.1"
904 resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.3.1.tgz#a528b514e689fce90db3089e870d92f527acb5eb"
905 dependencies:
906 source-map "~0.3.0"
907
908 inline-source-map@~0.5.0:
909 version "0.5.0"
910 resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.5.0.tgz#4a4c5dd8e4fb5e9b3cda60c822dfadcaee66e0af"
911 dependencies:
912 source-map "~0.4.0"
913
914 insert-module-globals@^6.4.1:
915 version "6.6.3"
916 resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-6.6.3.tgz#20638e29a30f9ed1ca2e3a825fbc2cba5246ddfc"
917 dependencies:
918 JSONStream "^1.0.3"
919 combine-source-map "~0.6.1"
920 concat-stream "~1.4.1"
921 is-buffer "^1.1.0"
922 lexical-scope "^1.2.0"
923 process "~0.11.0"
924 through2 "^1.0.0"
925 xtend "^4.0.0"
926
927 insert-module-globals@~6.0.0:
928 version "6.0.0"
929 resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-6.0.0.tgz#ee8aeb9dee16819e33aa14588a558824af0c15dc"
930 dependencies:
931 JSONStream "~0.7.1"
932 concat-stream "~1.4.1"
933 lexical-scope "~1.1.0"
934 process "~0.6.0"
935 through "~2.3.4"
936 xtend "^3.0.0"
937
938 is-buffer@^1.1.0:
939 version "1.1.6"
940 resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
941
942 is-callable@^1.1.1, is-callable@^1.1.3:
943 version "1.1.3"
944 resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
945
946 is-date-object@^1.0.1:
947 version "1.0.1"
948 resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
949
950 is-finite@^1.0.1:
951 version "1.0.2"
952 resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa"
953 dependencies:
954 number-is-nan "^1.0.0"
955
956 is-regex@^1.0.4:
957 version "1.0.4"
958 resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
959 dependencies:
960 has "^1.0.1"
961
962 is-symbol@^1.0.1:
963 version "1.0.1"
964 resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
965
966 isarray@0.0.1, isarray@~0.0.1:
967 version "0.0.1"
968 resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
969
970 isarray@^1.0.0, isarray@~1.0.0:
971 version "1.0.0"
972 resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
973
974 js-yaml@^3.4.6:
975 version "3.10.0"
976 resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
977 dependencies:
978 argparse "^1.0.7"
979 esprima "^4.0.0"
980
981 json-stable-stringify@~0.0.0:
982 version "0.0.1"
983 resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45"
984 dependencies:
985 jsonify "~0.0.0"
986
987 jsonify@~0.0.0:
988 version "0.0.0"
989 resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
990
991 jsonparse@0.0.5:
992 version "0.0.5"
993 resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-0.0.5.tgz#330542ad3f0a654665b778f3eb2d9a9fa507ac64"
994
995 jsonparse@^1.2.0:
996 version "1.3.1"
997 resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
998
999 labeled-stream-splicer@^1.0.0:
1000 version "1.0.2"
1001 resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-1.0.2.tgz#4615331537784981e8fd264e1f3a434c4e0ddd65"
1002 dependencies:
1003 inherits "^2.0.1"
1004 isarray "~0.0.1"
1005 stream-splicer "^1.1.0"
1006
1007 lexical-scope@^1.2.0:
1008 version "1.2.0"
1009 resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.2.0.tgz#fcea5edc704a4b3a8796cdca419c3a0afaf22df4"
1010 dependencies:
1011 astw "^2.0.0"
1012
1013 lexical-scope@~1.1.0:
1014 version "1.1.1"
1015 resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.1.1.tgz#debac1067435f1359d90fcfd9e94bcb2ee47b2bf"
1016 dependencies:
1017 astw "^2.0.0"
1018
1019 lodash.memoize@~3.0.3:
1020 version "3.0.4"
1021 resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"
1022
1023 lru-cache@2:
1024 version "2.7.3"
1025 resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952"
1026
1027 md5.js@^1.3.4:
1028 version "1.3.4"
1029 resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.4.tgz#e9bdbde94a20a5ac18b04340fc5764d5b09d901d"
1030 dependencies:
1031 hash-base "^3.0.0"
1032 inherits "^2.0.1"
1033
1034 merge@~1.0.0:
1035 version "1.0.0"
1036 resolved "https://registry.yarnpkg.com/merge/-/merge-1.0.0.tgz#b443ab46d837c491e6222056ab0f7933ecb3568f"
1037
1038 miller-rabin@^4.0.0:
1039 version "4.0.1"
1040 resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d"
1041 dependencies:
1042 bn.js "^4.0.0"
1043 brorand "^1.0.1"
1044
1045 mime@1.2.x:
1046 version "1.2.11"
1047 resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10"
1048
1049 minimalistic-assert@^1.0.0:
1050 version "1.0.0"
1051 resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
1052
1053 minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
1054 version "1.0.1"
1055 resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
1056
1057 minimatch@0.3:
1058 version "0.3.0"
1059 resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd"
1060 dependencies:
1061 lru-cache "2"
1062 sigmund "~1.0.0"
1063
1064 "minimatch@2 || 3":
1065 version "3.0.4"
1066 resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
1067 dependencies:
1068 brace-expansion "^1.1.7"
1069
1070 minimatch@^2.0.1:
1071 version "2.0.10"
1072 resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-2.0.10.tgz#8d087c39c6b38c001b97fca7ce6d0e1e80afbac7"
1073 dependencies:
1074 brace-expansion "^1.0.0"
1075
1076 minimist@0.0.5:
1077 version "0.0.5"
1078 resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.5.tgz#d7aa327bcecf518f9106ac6b8f003fa3bcea8566"
1079
1080 minimist@^1.1.0:
1081 version "1.2.0"
1082 resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
1083
1084 minimist@~0.0.1, minimist@~0.0.7, minimist@~0.0.9:
1085 version "0.0.10"
1086 resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
1087
1088 mkdirp@~0.3.3:
1089 version "0.3.5"
1090 resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7"
1091
1092 module-deps@^3.7.11:
1093 version "3.9.1"
1094 resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-3.9.1.tgz#ea75caf9199090d25b0d5512b5acacb96e7f87f3"
1095 dependencies:
1096 JSONStream "^1.0.3"
1097 browser-resolve "^1.7.0"
1098 concat-stream "~1.4.5"
1099 defined "^1.0.0"
1100 detective "^4.0.0"
1101 duplexer2 "0.0.2"
1102 inherits "^2.0.1"
1103 parents "^1.0.0"
1104 readable-stream "^1.1.13"
1105 resolve "^1.1.3"
1106 stream-combiner2 "~1.0.0"
1107 subarg "^1.0.0"
1108 through2 "^1.0.0"
1109 xtend "^4.0.0"
1110
1111 module-deps@~2.0.0:
1112 version "2.0.6"
1113 resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-2.0.6.tgz#b999321c73ac33580f00712c0f3075fdca42563f"
1114 dependencies:
1115 JSONStream "~0.7.1"
1116 browser-resolve "~1.2.4"
1117 concat-stream "~1.4.5"
1118 detective "~3.1.0"
1119 duplexer2 "0.0.2"
1120 inherits "~2.0.1"
1121 minimist "~0.0.9"
1122 parents "0.0.2"
1123 readable-stream "^1.0.27-1"
1124 resolve "~0.6.3"
1125 stream-combiner "~0.1.0"
1126 through2 "~0.4.1"
1127
1128 number-is-nan@^1.0.0:
1129 version "1.0.1"
1130 resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
1131
1132 object-assign@^4.1.0:
1133 version "4.1.1"
1134 resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
1135
1136 object-inspect@~0.1.3:
1137 version "0.1.3"
1138 resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-0.1.3.tgz#d05a65c2e34fe8225d9fda2e484e4e47b7e2f490"
1139 dependencies:
1140 tape "~1.0.4"
1141
1142 object-inspect@~1.0.0:
1143 version "1.0.2"
1144 resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.0.2.tgz#a97885b553e575eb4009ebc09bdda9b1cd21979a"
1145
1146 object-keys@^1.0.4, object-keys@^1.0.8:
1147 version "1.0.11"
1148 resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
1149
1150 object-keys@~0.4.0:
1151 version "0.4.0"
1152 resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336"
1153
1154 once@^1.3.0:
1155 version "1.4.0"
1156 resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
1157 dependencies:
1158 wrappy "1"
1159
1160 optimist@~0.3.5:
1161 version "0.3.7"
1162 resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9"
1163 dependencies:
1164 wordwrap "~0.0.2"
1165
1166 optimist@~0.5.2:
1167 version "0.5.2"
1168 resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.5.2.tgz#85c8c1454b3315e4a78947e857b1df033450bfbc"
1169 dependencies:
1170 wordwrap "~0.0.2"
1171
1172 ordered-emitter@~0.1.0:
1173 version "0.1.1"
1174 resolved "https://registry.yarnpkg.com/ordered-emitter/-/ordered-emitter-0.1.1.tgz#aa20bdafbdcc1631834a350f68b4ef8eb34eed7b"
1175
1176 os-browserify@~0.1.1:
1177 version "0.1.2"
1178 resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54"
1179
1180 pako@~0.2.0:
1181 version "0.2.9"
1182 resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
1183
1184 parents@0.0.2:
1185 version "0.0.2"
1186 resolved "https://registry.yarnpkg.com/parents/-/parents-0.0.2.tgz#67147826e497d40759aaf5ba4c99659b6034d302"
1187
1188 parents@^1.0.0, parents@^1.0.1:
1189 version "1.0.1"
1190 resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751"
1191 dependencies:
1192 path-platform "~0.11.15"
1193
1194 parents@~0.0.1:
1195 version "0.0.3"
1196 resolved "https://registry.yarnpkg.com/parents/-/parents-0.0.3.tgz#fa212f024d9fa6318dbb6b4ce676c8be493b9c43"
1197 dependencies:
1198 path-platform "^0.0.1"
1199
1200 parse-asn1@^5.0.0:
1201 version "5.1.0"
1202 resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712"
1203 dependencies:
1204 asn1.js "^4.0.0"
1205 browserify-aes "^1.0.0"
1206 create-hash "^1.1.0"
1207 evp_bytestokey "^1.0.0"
1208 pbkdf2 "^3.0.3"
1209
1210 parse-ms@^1.0.0:
1211 version "1.0.1"
1212 resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-1.0.1.tgz#56346d4749d78f23430ca0c713850aef91aa361d"
1213
1214 path-browserify@~0.0.0:
1215 version "0.0.0"
1216 resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a"
1217
1218 path-is-absolute@^1.0.0:
1219 version "1.0.1"
1220 resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
1221
1222 path-parse@^1.0.5:
1223 version "1.0.5"
1224 resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
1225
1226 path-platform@^0.0.1:
1227 version "0.0.1"
1228 resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.0.1.tgz#b5585d7c3c463d89aa0060d86611cf1afd617e2a"
1229
1230 path-platform@~0.11.15:
1231 version "0.11.15"
1232 resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2"
1233
1234 pbkdf2@^3.0.3:
1235 version "3.0.14"
1236 resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade"
1237 dependencies:
1238 create-hash "^1.1.2"
1239 create-hmac "^1.1.4"
1240 ripemd160 "^2.0.1"
1241 safe-buffer "^5.0.1"
1242 sha.js "^2.4.8"
1243
1244 plist@0.2.1:
1245 version "0.2.1"
1246 resolved "https://registry.yarnpkg.com/plist/-/plist-0.2.1.tgz#f3a3de07885d773e66d8a96782f1bec28cf2b2d0"
1247 dependencies:
1248 sax "0.1.x"
1249
1250 plur@^1.0.0:
1251 version "1.0.0"
1252 resolved "https://registry.yarnpkg.com/plur/-/plur-1.0.0.tgz#db85c6814f5e5e5a3b49efc28d604fec62975156"
1253
1254 pretty-ms@^2.1.0:
1255 version "2.1.0"
1256 resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-2.1.0.tgz#4257c256df3fb0b451d6affaab021884126981dc"
1257 dependencies:
1258 is-finite "^1.0.1"
1259 parse-ms "^1.0.0"
1260 plur "^1.0.0"
1261
1262 process-nextick-args@~2.0.0:
1263 version "2.0.0"
1264 resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
1265
1266 process@^0.7.0:
1267 version "0.7.0"
1268 resolved "https://registry.yarnpkg.com/process/-/process-0.7.0.tgz#c52208161a34adf3812344ae85d3e6150469389d"
1269
1270 process@~0.11.0:
1271 version "0.11.10"
1272 resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
1273
1274 process@~0.5.1:
1275 version "0.5.2"
1276 resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
1277
1278 process@~0.6.0:
1279 version "0.6.0"
1280 resolved "https://registry.yarnpkg.com/process/-/process-0.6.0.tgz#7dd9be80ffaaedd4cb628f1827f1cbab6dc0918f"
1281
1282 public-encrypt@^4.0.0:
1283 version "4.0.0"
1284 resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6"
1285 dependencies:
1286 bn.js "^4.1.0"
1287 browserify-rsa "^4.0.0"
1288 create-hash "^1.1.0"
1289 parse-asn1 "^5.0.0"
1290 randombytes "^2.0.1"
1291
1292 punycode@1.3.2:
1293 version "1.3.2"
1294 resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
1295
1296 punycode@^1.3.2:
1297 version "1.4.1"
1298 resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
1299
1300 punycode@~1.2.3:
1301 version "1.2.4"
1302 resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.2.4.tgz#54008ac972aec74175def9cba6df7fa9d3918740"
1303
1304 querystring-es3@0.2.0:
1305 version "0.2.0"
1306 resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.0.tgz#c365a08a69c443accfeb3a9deab35e3f0abaa476"
1307
1308 querystring-es3@~0.2.0:
1309 version "0.2.1"
1310 resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
1311
1312 querystring@0.2.0:
1313 version "0.2.0"
1314 resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
1315
1316 ramda@^0.18.0:
1317 version "0.18.0"
1318 resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.18.0.tgz#c6e3c5d4b9ab1f7906727fdeeb039152a85d4db3"
1319
1320 randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
1321 version "2.0.6"
1322 resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80"
1323 dependencies:
1324 safe-buffer "^5.1.0"
1325
1326 randomfill@^1.0.3:
1327 version "1.0.4"
1328 resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458"
1329 dependencies:
1330 randombytes "^2.0.5"
1331 safe-buffer "^5.1.0"
1332
1333 read-only-stream@^1.1.1:
1334 version "1.1.1"
1335 resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-1.1.1.tgz#5da77c799ed1388d3ef88a18471bb5924f8a0ba1"
1336 dependencies:
1337 readable-stream "^1.0.31"
1338 readable-wrap "^1.0.0"
1339
1340 "readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@^1.0.27-1, readable-stream@^1.0.31, readable-stream@^1.1.13, readable-stream@^1.1.13-1, readable-stream@~1.1.9:
1341 version "1.1.14"
1342 resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
1343 dependencies:
1344 core-util-is "~1.0.0"
1345 inherits "~2.0.1"
1346 isarray "0.0.1"
1347 string_decoder "~0.10.x"
1348
1349 readable-stream@^2.0.2, readable-stream@^2.0.4:
1350 version "2.3.4"
1351 resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071"
1352 dependencies:
1353 core-util-is "~1.0.0"
1354 inherits "~2.0.3"
1355 isarray "~1.0.0"
1356 process-nextick-args "~2.0.0"
1357 safe-buffer "~5.1.1"
1358 string_decoder "~1.0.3"
1359 util-deprecate "~1.0.1"
1360
1361 readable-stream@~1.0.17:
1362 version "1.0.34"
1363 resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
1364 dependencies:
1365 core-util-is "~1.0.0"
1366 inherits "~2.0.1"
1367 isarray "0.0.1"
1368 string_decoder "~0.10.x"
1369
1370 readable-wrap@^1.0.0:
1371 version "1.0.0"
1372 resolved "https://registry.yarnpkg.com/readable-wrap/-/readable-wrap-1.0.0.tgz#3b5a211c631e12303a54991c806c17e7ae206bff"
1373 dependencies:
1374 readable-stream "^1.1.13-1"
1375
1376 resolve@0.6.3, resolve@~0.6.1, resolve@~0.6.3:
1377 version "0.6.3"
1378 resolved "https://registry.yarnpkg.com/resolve/-/resolve-0.6.3.tgz#dd957982e7e736debdf53b58a4dd91754575dd46"
1379
1380 resolve@1.1.7:
1381 version "1.1.7"
1382 resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
1383
1384 resolve@^1.1.3, resolve@^1.1.4:
1385 version "1.5.0"
1386 resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
1387 dependencies:
1388 path-parse "^1.0.5"
1389
1390 resolve@~0.3.0:
1391 version "0.3.1"
1392 resolved "https://registry.yarnpkg.com/resolve/-/resolve-0.3.1.tgz#34c63447c664c70598d1c9b126fc43b2a24310a4"
1393
1394 resolve@~0.4.0:
1395 version "0.4.3"
1396 resolved "https://registry.yarnpkg.com/resolve/-/resolve-0.4.3.tgz#dcadad202e7cacc2467e3a38800211f42f9c13df"
1397
1398 resumer@~0.0.0:
1399 version "0.0.0"
1400 resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759"
1401 dependencies:
1402 through "~2.3.4"
1403
1404 rfile@~1.0, rfile@~1.0.0:
1405 version "1.0.0"
1406 resolved "https://registry.yarnpkg.com/rfile/-/rfile-1.0.0.tgz#59708cf90ca1e74c54c3cfc5c36fdb9810435261"
1407 dependencies:
1408 callsite "~1.0.0"
1409 resolve "~0.3.0"
1410
1411 ripemd160@^2.0.0, ripemd160@^2.0.1:
1412 version "2.0.1"
1413 resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7"
1414 dependencies:
1415 hash-base "^2.0.0"
1416 inherits "^2.0.1"
1417
1418 ruglify@~1.0.0:
1419 version "1.0.0"
1420 resolved "https://registry.yarnpkg.com/ruglify/-/ruglify-1.0.0.tgz#dc8930e2a9544a274301cc9972574c0d0986b675"
1421 dependencies:
1422 rfile "~1.0"
1423 uglify-js "~2.2"
1424
1425 rx-node@^1.0.1:
1426 version "1.0.2"
1427 resolved "https://registry.yarnpkg.com/rx-node/-/rx-node-1.0.2.tgz#151240725a79e857360ab06cc626799965e094de"
1428 dependencies:
1429 rx "*"
1430
1431 rx@*, rx@^4.0.7:
1432 version "4.1.0"
1433 resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
1434
1435 safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
1436 version "5.1.1"
1437 resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
1438
1439 sax@0.1.x:
1440 version "0.1.5"
1441 resolved "https://registry.yarnpkg.com/sax/-/sax-0.1.5.tgz#d1829a6120fa01665eb4dbff6c43f29fd6d61471"
1442
1443 sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4:
1444 version "2.4.10"
1445 resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.10.tgz#b1fde5cd7d11a5626638a07c604ab909cfa31f9b"
1446 dependencies:
1447 inherits "^2.0.1"
1448 safe-buffer "^5.0.1"
1449
1450 shallow-copy@0.0.1, shallow-copy@~0.0.0:
1451 version "0.0.1"
1452 resolved "https://registry.yarnpkg.com/shallow-copy/-/shallow-copy-0.0.1.tgz#415f42702d73d810330292cc5ee86eae1a11a170"
1453
1454 shasum@^1.0.0:
1455 version "1.0.2"
1456 resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f"
1457 dependencies:
1458 json-stable-stringify "~0.0.0"
1459 sha.js "~2.4.4"
1460
1461 shell-quote@~0.0.1:
1462 version "0.0.1"
1463 resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-0.0.1.tgz#1a41196f3c0333c482323593d6886ecf153dd986"
1464
1465 shell-quote@~1.3.1:
1466 version "1.3.3"
1467 resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.3.3.tgz#07b8826f427c052511e8b5627639e172596e8e4b"
1468
1469 sigmund@~1.0.0:
1470 version "1.0.1"
1471 resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
1472
1473 source-map@0.1.34:
1474 version "0.1.34"
1475 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.34.tgz#a7cfe89aec7b1682c3b198d0acfb47d7d090566b"
1476 dependencies:
1477 amdefine ">=0.0.4"
1478
1479 source-map@~0.1.30, source-map@~0.1.31, source-map@~0.1.7:
1480 version "0.1.43"
1481 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
1482 dependencies:
1483 amdefine ">=0.0.4"
1484
1485 source-map@~0.3.0:
1486 version "0.3.0"
1487 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.3.0.tgz#8586fb9a5a005e5b501e21cd18b6f21b457ad1f9"
1488 dependencies:
1489 amdefine ">=0.0.4"
1490
1491 source-map@~0.4.0, source-map@~0.4.2:
1492 version "0.4.4"
1493 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
1494 dependencies:
1495 amdefine ">=0.0.4"
1496
1497 source-map@~0.5.1:
1498 version "0.5.7"
1499 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
1500
1501 split@^1.0.0:
1502 version "1.0.1"
1503 resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9"
1504 dependencies:
1505 through "2"
1506
1507 split@~0.1.2:
1508 version "0.1.2"
1509 resolved "https://registry.yarnpkg.com/split/-/split-0.1.2.tgz#f0710744c453d551fc7143ead983da6014e336cc"
1510 dependencies:
1511 through "1"
1512
1513 sprintf-js@~1.0.2:
1514 version "1.0.3"
1515 resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
1516
1517 stream-browserify@^2.0.0:
1518 version "2.0.1"
1519 resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db"
1520 dependencies:
1521 inherits "~2.0.1"
1522 readable-stream "^2.0.2"
1523
1524 stream-browserify@~0.1.0:
1525 version "0.1.3"
1526 resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-0.1.3.tgz#95cf1b369772e27adaf46352265152689c6c4be9"
1527 dependencies:
1528 inherits "~2.0.1"
1529 process "~0.5.1"
1530
1531 stream-combiner2@~1.0.0:
1532 version "1.0.2"
1533 resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.0.2.tgz#ba72a6b50cbfabfa950fc8bc87604bd01eb60671"
1534 dependencies:
1535 duplexer2 "~0.0.2"
1536 through2 "~0.5.1"
1537
1538 stream-combiner@~0.0.2:
1539 version "0.0.4"
1540 resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14"
1541 dependencies:
1542 duplexer "~0.1.1"
1543
1544 stream-combiner@~0.1.0:
1545 version "0.1.0"
1546 resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.1.0.tgz#0dc389a3c203f8f4d56368f95dde52eb9269b5be"
1547 dependencies:
1548 duplexer "~0.1.1"
1549 through "~2.3.4"
1550
1551 stream-http@^1.2.0:
1552 version "1.7.1"
1553 resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-1.7.1.tgz#d3d2a6e14c36a38b9dafb199aee7bbc570519978"
1554 dependencies:
1555 builtin-status-codes "^1.0.0"
1556 foreach "^2.0.5"
1557 indexof "0.0.1"
1558 inherits "^2.0.1"
1559 object-keys "^1.0.4"
1560 xtend "^4.0.0"
1561
1562 stream-splicer@^1.1.0:
1563 version "1.3.2"
1564 resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-1.3.2.tgz#3c0441be15b9bf4e226275e6dc83964745546661"
1565 dependencies:
1566 indexof "0.0.1"
1567 inherits "^2.0.1"
1568 isarray "~0.0.1"
1569 readable-stream "^1.1.13-1"
1570 readable-wrap "^1.0.0"
1571 through2 "^1.0.0"
1572
1573 string.prototype.trim@^1.1.1:
1574 version "1.1.2"
1575 resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea"
1576 dependencies:
1577 define-properties "^1.1.2"
1578 es-abstract "^1.5.0"
1579 function-bind "^1.0.2"
1580
1581 string_decoder@~0.0.0:
1582 version "0.0.1"
1583 resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.0.1.tgz#f5472d0a8d1650ec823752d24e6fd627b39bf141"
1584
1585 string_decoder@~0.10.0, string_decoder@~0.10.x:
1586 version "0.10.31"
1587 resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
1588
1589 string_decoder@~1.0.3:
1590 version "1.0.3"
1591 resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab"
1592 dependencies:
1593 safe-buffer "~5.1.0"
1594
1595 strip-ansi@^3.0.0:
1596 version "3.0.1"
1597 resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
1598 dependencies:
1599 ansi-regex "^2.0.0"
1600
1601 subarg@0.0.1:
1602 version "0.0.1"
1603 resolved "https://registry.yarnpkg.com/subarg/-/subarg-0.0.1.tgz#3d56b07dacfbc45bbb63f7672b43b63e46368e3a"
1604 dependencies:
1605 minimist "~0.0.7"
1606
1607 subarg@^1.0.0:
1608 version "1.0.0"
1609 resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2"
1610 dependencies:
1611 minimist "^1.1.0"
1612
1613 supports-color@^2.0.0:
1614 version "2.0.0"
1615 resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
1616
1617 syntax-error@^1.1.1:
1618 version "1.4.0"
1619 resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c"
1620 dependencies:
1621 acorn-node "^1.2.0"
1622
1623 syntax-error@~1.1.0:
1624 version "1.1.6"
1625 resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.1.6.tgz#b4549706d386cc1c1dc7c2423f18579b6cade710"
1626 dependencies:
1627 acorn "^2.7.0"
1628
1629 tap-finished@~0.0.0:
1630 version "0.0.1"
1631 resolved "https://registry.yarnpkg.com/tap-finished/-/tap-finished-0.0.1.tgz#08b5b543fdc04830290c6c561279552e71c4bd67"
1632 dependencies:
1633 tap-parser "~0.2.0"
1634 through "~2.3.4"
1635
1636 tap-parser@~0.2.0:
1637 version "0.2.1"
1638 resolved "https://registry.yarnpkg.com/tap-parser/-/tap-parser-0.2.1.tgz#8e1e823f2114ee21d032e2f31e4fb642a296f50b"
1639 dependencies:
1640 split "~0.1.2"
1641
1642 tape@4.2.1:
1643 version "4.2.1"
1644 resolved "https://registry.yarnpkg.com/tape/-/tape-4.2.1.tgz#1a0ed63cc86bfaa84ebb3bb311f09d8520416216"
1645 dependencies:
1646 deep-equal "~1.0.0"
1647 defined "~1.0.0"
1648 function-bind "~1.0.2"
1649 glob "~5.0.3"
1650 has "~1.0.1"
1651 inherits "~2.0.1"
1652 object-inspect "~1.0.0"
1653 resumer "~0.0.0"
1654 string.prototype.trim "^1.1.1"
1655 through "~2.3.4"
1656
1657 tape@~1.0.4:
1658 version "1.0.4"
1659 resolved "https://registry.yarnpkg.com/tape/-/tape-1.0.4.tgz#e2e8e5c6dd3f00fdc2a5e4514f62fc221e59f9c4"
1660 dependencies:
1661 deep-equal "~0.0.0"
1662 defined "~0.0.0"
1663 jsonify "~0.0.0"
1664 through "~2.3.4"
1665
1666 testling@1.7.1:
1667 version "1.7.1"
1668 resolved "https://registry.yarnpkg.com/testling/-/testling-1.7.1.tgz#bfcfa877c8b15dd28d920692c03d8d64ca47874e"
1669 dependencies:
1670 bouncy "~3.2.0"
1671 browser-launcher "~0.3.2"
1672 browserify "3.x.x"
1673 concat-stream "~1.0.0"
1674 ecstatic "~0.4.5"
1675 ent "~0.0.5"
1676 glob "~3.2.1"
1677 jsonify "~0.0.0"
1678 object-inspect "~0.1.3"
1679 optimist "~0.5.2"
1680 resolve "~0.4.0"
1681 shallow-copy "~0.0.0"
1682 shell-quote "~1.3.1"
1683 tap-finished "~0.0.0"
1684 win-spawn "~2.0.0"
1685 xhr-write-stream "~0.1.2"
1686
1687 through2@^1.0.0:
1688 version "1.1.1"
1689 resolved "https://registry.yarnpkg.com/through2/-/through2-1.1.1.tgz#0847cbc4449f3405574dbdccd9bb841b83ac3545"
1690 dependencies:
1691 readable-stream ">=1.1.13-1 <1.2.0-0"
1692 xtend ">=4.0.0 <4.1.0-0"
1693
1694 through2@~0.4.1:
1695 version "0.4.2"
1696 resolved "https://registry.yarnpkg.com/through2/-/through2-0.4.2.tgz#dbf5866031151ec8352bb6c4db64a2292a840b9b"
1697 dependencies:
1698 readable-stream "~1.0.17"
1699 xtend "~2.1.1"
1700
1701 through2@~0.5.1:
1702 version "0.5.1"
1703 resolved "https://registry.yarnpkg.com/through2/-/through2-0.5.1.tgz#dfdd012eb9c700e2323fd334f38ac622ab372da7"
1704 dependencies:
1705 readable-stream "~1.0.17"
1706 xtend "~3.0.0"
1707
1708 through@1:
1709 version "1.1.2"
1710 resolved "https://registry.yarnpkg.com/through/-/through-1.1.2.tgz#344a5425a3773314ca7e0eb6512fbafaf76c0bfe"
1711
1712 through@2, "through@>=2.2.7 <3", through@~2.3.4:
1713 version "2.3.8"
1714 resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
1715
1716 through@~2.2.7:
1717 version "2.2.7"
1718 resolved "https://registry.yarnpkg.com/through/-/through-2.2.7.tgz#6e8e21200191d4eb6a99f6f010df46aa1c6eb2bd"
1719
1720 timers-browserify@^1.0.1:
1721 version "1.4.2"
1722 resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d"
1723 dependencies:
1724 process "~0.11.0"
1725
1726 timers-browserify@~1.0.1:
1727 version "1.0.3"
1728 resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.0.3.tgz#ffba70c9c12eed916fd67318e629ac6f32295551"
1729 dependencies:
1730 process "~0.5.1"
1731
1732 to-utf8@0.0.1:
1733 version "0.0.1"
1734 resolved "https://registry.yarnpkg.com/to-utf8/-/to-utf8-0.0.1.tgz#d17aea72ff2fba39b9e43601be7b3ff72e089852"
1735
1736 tty-browserify@~0.0.0:
1737 version "0.0.1"
1738 resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811"
1739
1740 typedarray@~0.0.5:
1741 version "0.0.6"
1742 resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1743
1744 uglify-js@2.5.0:
1745 version "2.5.0"
1746 resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.5.0.tgz#4ab5d65a4730ecb7a4fb62d3f499e2054d98fba1"
1747 dependencies:
1748 async "~0.2.6"
1749 source-map "~0.5.1"
1750 uglify-to-browserify "~1.0.0"
1751 yargs "~3.5.4"
1752
1753 uglify-js@~2.2:
1754 version "2.2.5"
1755 resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.2.5.tgz#a6e02a70d839792b9780488b7b8b184c095c99c7"
1756 dependencies:
1757 optimist "~0.3.5"
1758 source-map "~0.1.7"
1759
1760 uglify-js@~2.4.0:
1761 version "2.4.24"
1762 resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.4.24.tgz#fad5755c1e1577658bb06ff9ab6e548c95bebd6e"
1763 dependencies:
1764 async "~0.2.6"
1765 source-map "0.1.34"
1766 uglify-to-browserify "~1.0.0"
1767 yargs "~3.5.4"
1768
1769 uglify-to-browserify@~1.0.0:
1770 version "1.0.2"
1771 resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
1772
1773 umd@^3.0.0:
1774 version "3.0.1"
1775 resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e"
1776
1777 umd@~2.0.0:
1778 version "2.0.0"
1779 resolved "https://registry.yarnpkg.com/umd/-/umd-2.0.0.tgz#749683b0d514728ae0e1b6195f5774afc0ad4f8f"
1780 dependencies:
1781 rfile "~1.0.0"
1782 ruglify "~1.0.0"
1783 through "~2.3.4"
1784 uglify-js "~2.4.0"
1785
1786 url@~0.10.1:
1787 version "0.10.3"
1788 resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
1789 dependencies:
1790 punycode "1.3.2"
1791 querystring "0.2.0"
1792
1793 util-deprecate@~1.0.1:
1794 version "1.0.2"
1795 resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
1796
1797 util@0.10.3, util@~0.10.1:
1798 version "0.10.3"
1799 resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9"
1800 dependencies:
1801 inherits "2.0.1"
1802
1803 vm-browserify@~0.0.1:
1804 version "0.0.4"
1805 resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73"
1806 dependencies:
1807 indexof "0.0.1"
1808
1809 win-spawn@~2.0.0:
1810 version "2.0.0"
1811 resolved "https://registry.yarnpkg.com/win-spawn/-/win-spawn-2.0.0.tgz#397a29130ec98d0aa0bc86baa4621393effd0b07"
1812
1813 window-size@0.1.0:
1814 version "0.1.0"
1815 resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
1816
1817 wordwrap@0.0.2:
1818 version "0.0.2"
1819 resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
1820
1821 wordwrap@~0.0.2:
1822 version "0.0.3"
1823 resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
1824
1825 wrappy@1:
1826 version "1.0.2"
1827 resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
1828
1829 xhr-write-stream@~0.1.2:
1830 version "0.1.2"
1831 resolved "https://registry.yarnpkg.com/xhr-write-stream/-/xhr-write-stream-0.1.2.tgz#e357848e0d039b411fdd5b3bf81be47ee5ce26aa"
1832 dependencies:
1833 concat-stream "~0.1.0"
1834 ordered-emitter "~0.1.0"
1835
1836 "xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1:
1837 version "4.0.1"
1838 resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
1839
1840 xtend@^3.0.0, xtend@~3.0.0:
1841 version "3.0.0"
1842 resolved "https://registry.yarnpkg.com/xtend/-/xtend-3.0.0.tgz#5cce7407baf642cba7becda568111c493f59665a"
1843
1844 xtend@~2.1.1:
1845 version "2.1.2"
1846 resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b"
1847 dependencies:
1848 object-keys "~0.4.0"
1849
1850 yargs@~3.5.4:
1851 version "3.5.4"
1852 resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.5.4.tgz#d8aff8f665e94c34bd259bdebd1bfaf0ddd35361"
1853 dependencies:
1854 camelcase "^1.0.2"
1855 decamelize "^1.0.0"
1856 window-size "0.1.0"
1857 wordwrap "0.0.2"
1 {
2 "extends": "standard",
3 "env": {
4 "browser": true,
5 "amd": true
6 }
7 }
1 # 0.3.1
2
3 - Add TypeScript type definiation from @vlad-ro
4
5 # 0.3.0
6
7 - Add config option `appendToBody` to support IE
8
9 # 0.2.1
10
11 - Fix VueClipboard.config is undefined
12
13 # 0.2.0
14
15 - Add config option `autoSetContainer`
16
17 # 0.1.1
18
19 - Move vue to peerDependency
20 - Fix links in npmjs page
21
22 # 0.1.0
23
24 Add support for `contianer` option from `clipboard.js` v1.7.0, thanks robmazur
25
26 # 0.0.9
27
28 Upgrade dependency package version
29
30 # 0.0.8
31
32 Change vue dependency version to ^2.0.0
33
34 # 0.0.7
35
36 Add method: this.$copyText
37
38 # 0.0.6
39
40 Add error handler `v-clipboard:error`
41
42 # 0.0.5
43
44 Add success handler `v-clipboard:success`
45
46 # 0.0.3
47
48 Add pre-built version for browser
49
50 # 0.0.1
51
52 First usable version
1 The MIT License (MIT)
2
3 Copyright (c) 2017 Inndy <inndy \dot tw \at gmail \dot com>
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 THE SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
1 # vue-clipboard2
2
3 A simple vuejs 2 binding for clipboard.js
4
5 ## Install
6
7 `npm install --save vue-clipboard2` or use `dist/vue-clipboard.min.js` without webpack
8
9 ## Usage
10
11 For vue-cli user:
12
13 ```javascript
14 import Vue from 'vue'
15 import VueClipboard from 'vue-clipboard2'
16
17 Vue.use(VueClipboard)
18 ```
19
20 For standalone usage:
21
22 ```html
23 <script src="vue.min.js"></script>
24 <!-- must place this line after vue.js -->
25 <script src="dist/vue-clipboard.min.js"></script>
26 ```
27
28 ## I want to copy texts without a specific button!
29
30 Yes, you can do it by using our new method: `this.$copyText`. See
31 [sample2](https://github.com/Inndy/vue-clipboard2/blob/master/samples/sample2.html),
32 where we replace the clipboard directives with a v-on directive.
33
34 Modern browsers have some limitations like that you can't use `window.open` without a user interaction.
35 So there's the same restriction on copying things! Test it before you use it. Make sure you are not
36 using this method inside any async method.
37
38 Before using this feature, read:
39 [this issue](https://github.com/zenorocha/clipboard.js/issues/218) and
40 [this page](https://github.com/zenorocha/clipboard.js/wiki/Known-Limitations) first.
41
42 ## It doesn't work with bootstrap modals
43
44 See [clipboardjs](https://clipboardjs.com/#advanced-usage) document and [this pull request](https://github.com/Inndy/vue-clipboard2/pull/23), `container` option is available like this:
45
46 ```js
47 let container = this.$refs.container
48 this.$copyText("Text to copy", container)
49 ```
50
51 Or you can let `vue-clipboard2` set `container` to current element by doing this:
52
53 ```js
54 import Vue from 'vue'
55 import VueClipboard from 'vue-clipboard2'
56
57 VueClipboard.config.autoSetContainer = true // add this line
58 Vue.use(VueClipboard)
59 ```
60
61 ## Sample
62
63 ```html
64 <div id="app"></div>
65
66 <template id="t">
67 <div class="container">
68 <input type="text" v-model="message">
69 <button type="button"
70 v-clipboard:copy="message"
71 v-clipboard:success="onCopy"
72 v-clipboard:error="onError">Copy!</button>
73 </div>
74 </template>
75
76 <script>
77 new Vue({
78 el: '#app',
79 template: '#t',
80 data: function () {
81 return {
82 message: 'Copy These Text'
83 }
84 },
85 methods: {
86 onCopy: function (e) {
87 alert('You just copied: ' + e.text)
88 },
89 onError: function (e) {
90 alert('Failed to copy texts')
91 }
92 }
93 })
94 </script>
95 ```
96
97 ## Sample 2
98
99 ```html
100 <div id="app"></div>
101
102 <template id="t">
103 <div class="container">
104 <input type="text" v-model="message">
105 <button type="button" @click="doCopy">Copy!</button>
106 </div>
107 </template>
108
109 <script>
110 new Vue({
111 el: '#app',
112 template: '#t',
113 data: function () {
114 return {
115 message: 'Copy These Text'
116 }
117 },
118 methods: {
119 doCopy: function () {
120 this.$copyText(this.message).then(function (e) {
121 alert('Copied')
122 console.log(e)
123 }, function (e) {
124 alert('Can not copy')
125 console.log(e)
126 })
127 }
128 }
129 })
130 </script>
131
132 ```
133
134 You can use [your Vue instance ```vm.$el```](https://vuejs.org/v2/api/#vm-el) to get DOM elements via the usual traversal methods, e.g.:
135
136 ```this.$el.children[1].children[2].textContent```
137
138 This will allow you to access the *rendered* content of your components, rather than the components themselves.
139
140 ### Contribution
141
142 PRs welcome, and issues as well! If you want any feature that we don't have currently,
143 please fire an issue for a feature request.
144
145 ### License
146
147 [MIT License](https://github.com/Inndy/vue-clipboard2/blob/master/LICENSE)
1 var VueClipboard = require('./vue-clipboard.js')
2
3 global.VueClipboard = VueClipboard
4
5 window.Vue && global.Vue.use(VueClipboard)
1 (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2 (function (global){
3 var VueClipboard = require('./vue-clipboard.js')
4
5 global.VueClipboard = VueClipboard
6
7 window.Vue && global.Vue.use(VueClipboard)
8
9 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
10 },{"./vue-clipboard.js":3}],2:[function(require,module,exports){
11 /*!
12 * clipboard.js v2.0.4
13 * https://zenorocha.github.io/clipboard.js
14 *
15 * Licensed MIT © Zeno Rocha
16 */
17 !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<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}t.exports=l},function(t,e,n){"use strict";var o,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<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;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,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])});
18 },{}],3:[function(require,module,exports){
19 var Clipboard = require('clipboard/dist/clipboard.min.js') // FIXME: workaround for browserify
20
21 var VueClipboardConfig = {
22 autoSetContainer: false,
23 appendToBody: true // This fixes IE, see #50
24 }
25
26 var VueClipboard = {
27 install: function (Vue) {
28 Vue.prototype.$clipboardConfig = VueClipboardConfig
29 Vue.prototype.$copyText = function (text, container) {
30 return new Promise(function (resolve, reject) {
31 var fakeElement = document.createElement('button')
32 var clipboard = new Clipboard(fakeElement, {
33 text: function () { return text },
34 action: function () { return 'copy' },
35 container: typeof container === 'object' ? container : document.body
36 })
37 clipboard.on('success', function (e) {
38 clipboard.destroy()
39 resolve(e)
40 })
41 clipboard.on('error', function (e) {
42 clipboard.destroy()
43 reject(e)
44 })
45 if (VueClipboardConfig.appendToBody) document.body.appendChild(fakeElement)
46 fakeElement.click()
47 if (VueClipboardConfig.appendToBody) document.body.removeChild(fakeElement)
48 })
49 }
50
51 Vue.directive('clipboard', {
52 bind: function (el, binding, vnode) {
53 if (binding.arg === 'success') {
54 el._vClipboard_success = binding.value
55 } else if (binding.arg === 'error') {
56 el._vClipboard_error = binding.value
57 } else {
58 var clipboard = new Clipboard(el, {
59 text: function () { return binding.value },
60 action: function () { return binding.arg === 'cut' ? 'cut' : 'copy' },
61 container: VueClipboardConfig.autoSetContainer ? el : undefined
62 })
63 clipboard.on('success', function (e) {
64 var callback = el._vClipboard_success
65 callback && callback(e)
66 })
67 clipboard.on('error', function (e) {
68 var callback = el._vClipboard_error
69 callback && callback(e)
70 })
71 el._vClipboard = clipboard
72 }
73 },
74 update: function (el, binding) {
75 if (binding.arg === 'success') {
76 el._vClipboard_success = binding.value
77 } else if (binding.arg === 'error') {
78 el._vClipboard_error = binding.value
79 } else {
80 el._vClipboard.text = function () { return binding.value }
81 el._vClipboard.action = function () { return binding.arg === 'cut' ? 'cut' : 'copy' }
82 }
83 },
84 unbind: function (el, binding) {
85 if (binding.arg === 'success') {
86 delete el._vClipboard_success
87 } else if (binding.arg === 'error') {
88 delete el._vClipboard_error
89 } else {
90 el._vClipboard.destroy()
91 delete el._vClipboard
92 }
93 }
94 })
95 },
96 config: VueClipboardConfig
97 }
98
99 if (typeof exports === 'object') {
100 module.exports = VueClipboard
101 } else if (typeof define === 'function' && define.amd) {
102 define([], function () {
103 return VueClipboard
104 })
105 }
106
107 },{"clipboard/dist/clipboard.min.js":2}]},{},[1]);
1 (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){(function(global){var VueClipboard=require("./vue-clipboard.js");global.VueClipboard=VueClipboard;window.Vue&&global.Vue.use(VueClipboard)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./vue-clipboard.js":3}],2:[function(require,module,exports){!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<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}t.exports=l},function(t,e,n){"use strict";var o,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<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;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,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])})},{}],3:[function(require,module,exports){var Clipboard=require("clipboard/dist/clipboard.min.js");var VueClipboardConfig={autoSetContainer:false,appendToBody:true};var VueClipboard={install:function(Vue){Vue.prototype.$clipboardConfig=VueClipboardConfig;Vue.prototype.$copyText=function(text,container){return new Promise(function(resolve,reject){var fakeElement=document.createElement("button");var clipboard=new Clipboard(fakeElement,{text:function(){return text},action:function(){return"copy"},container:typeof container==="object"?container:document.body});clipboard.on("success",function(e){clipboard.destroy();resolve(e)});clipboard.on("error",function(e){clipboard.destroy();reject(e)});if(VueClipboardConfig.appendToBody)document.body.appendChild(fakeElement);fakeElement.click();if(VueClipboardConfig.appendToBody)document.body.removeChild(fakeElement)})};Vue.directive("clipboard",{bind:function(el,binding,vnode){if(binding.arg==="success"){el._vClipboard_success=binding.value}else if(binding.arg==="error"){el._vClipboard_error=binding.value}else{var clipboard=new Clipboard(el,{text:function(){return binding.value},action:function(){return binding.arg==="cut"?"cut":"copy"},container:VueClipboardConfig.autoSetContainer?el:undefined});clipboard.on("success",function(e){var callback=el._vClipboard_success;callback&&callback(e)});clipboard.on("error",function(e){var callback=el._vClipboard_error;callback&&callback(e)});el._vClipboard=clipboard}},update:function(el,binding){if(binding.arg==="success"){el._vClipboard_success=binding.value}else if(binding.arg==="error"){el._vClipboard_error=binding.value}else{el._vClipboard.text=function(){return binding.value};el._vClipboard.action=function(){return binding.arg==="cut"?"cut":"copy"}}},unbind:function(el,binding){if(binding.arg==="success"){delete el._vClipboard_success}else if(binding.arg==="error"){delete el._vClipboard_error}else{el._vClipboard.destroy();delete el._vClipboard}}})},config:VueClipboardConfig};if(typeof exports==="object"){module.exports=VueClipboard}else if(typeof define==="function"&&define.amd){define([],function(){return VueClipboard})}},{"clipboard/dist/clipboard.min.js":2}]},{},[1]);
...\ No newline at end of file ...\ No newline at end of file
1 declare module 'vue-clipboard2' {
2 import Vue, { PluginFunction, WatchOptions } from 'vue'
3 module "vue/types/vue" {
4 interface Vue {
5 $clipboardConfig: {
6 autoSetContainer: boolean,
7 appendToBody: boolean
8 }
9 $copyText(text: string, container?: object | HTMLElement): Promise<{
10 action: string,
11 text: string,
12 trigger: String | HTMLElement | HTMLCollection | NodeList,
13 clearSelection: () => void
14 }>
15 }
16 }
17
18 class VueClipboard {
19 static install: PluginFunction<never>
20 static config: {
21 autoSetContainer: boolean
22 appendToBody: boolean
23 }
24 }
25 export default VueClipboard
26 }
1 {
2 "_from": "vue-clipboard2",
3 "_id": "vue-clipboard2@0.3.1",
4 "_inBundle": false,
5 "_integrity": "sha512-H5S/agEDj0kXjUb5GP2c0hCzIXWRBygaWLN3NEFsaI9I3uWin778SFEMt8QRXiPG+7anyjqWiw2lqcxWUSfkYg==",
6 "_location": "/vue-clipboard2",
7 "_phantomChildren": {},
8 "_requested": {
9 "type": "tag",
10 "registry": true,
11 "raw": "vue-clipboard2",
12 "name": "vue-clipboard2",
13 "escapedName": "vue-clipboard2",
14 "rawSpec": "",
15 "saveSpec": null,
16 "fetchSpec": "latest"
17 },
18 "_requiredBy": [
19 "#USER",
20 "/"
21 ],
22 "_resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.3.1.tgz",
23 "_shasum": "6e551fb7bd384889b28b0da3b12289ed6bca4894",
24 "_spec": "vue-clipboard2",
25 "_where": "/Users/zhanghao/brcode/br-client",
26 "author": {
27 "name": "Inndy"
28 },
29 "bugs": {
30 "url": "https://github.com/Inndy/vue-clipboard2/issues"
31 },
32 "bundleDependencies": false,
33 "dependencies": {
34 "clipboard": "^2.0.0"
35 },
36 "deprecated": false,
37 "description": "A Vuejs2 binding for clipboard.js",
38 "devDependencies": {
39 "browserify": "^16.1.0",
40 "eslint": ">=5.0.0",
41 "eslint-config-standard": "^12.0.0",
42 "eslint-plugin-import": ">=2.13.0",
43 "eslint-plugin-node": ">=7.0.0",
44 "eslint-plugin-promise": ">=4.0.0",
45 "eslint-plugin-standard": ">=4.0.0",
46 "uglify-js": "^3.3.12"
47 },
48 "homepage": "https://github.com/Inndy/vue-clipboard2#readme",
49 "keywords": [
50 "vue",
51 "vue2",
52 "clipboard",
53 "clipboard.js"
54 ],
55 "license": "MIT",
56 "main": "vue-clipboard.js",
57 "name": "vue-clipboard2",
58 "peerDependecies": {
59 "vue": "^2.0.0"
60 },
61 "repository": {
62 "type": "git",
63 "url": "git+https://github.com/Inndy/vue-clipboard2.git"
64 },
65 "scripts": {
66 "build": "$(npm bin)/eslint vue-clipboard.js && $(npm bin)/browserify browserify-me.js -o dist/vue-clipboard.js && $(npm bin)/uglifyjs dist/vue-clipboard.js -o dist/vue-clipboard.min.js && echo Success"
67 },
68 "version": "0.3.1"
69 }
1 var Clipboard = require('clipboard/dist/clipboard.min.js') // FIXME: workaround for browserify
2
3 var VueClipboardConfig = {
4 autoSetContainer: false,
5 appendToBody: true // This fixes IE, see #50
6 }
7
8 var VueClipboard = {
9 install: function (Vue) {
10 Vue.prototype.$clipboardConfig = VueClipboardConfig
11 Vue.prototype.$copyText = function (text, container) {
12 return new Promise(function (resolve, reject) {
13 var fakeElement = document.createElement('button')
14 var clipboard = new Clipboard(fakeElement, {
15 text: function () { return text },
16 action: function () { return 'copy' },
17 container: typeof container === 'object' ? container : document.body
18 })
19 clipboard.on('success', function (e) {
20 clipboard.destroy()
21 resolve(e)
22 })
23 clipboard.on('error', function (e) {
24 clipboard.destroy()
25 reject(e)
26 })
27 if (VueClipboardConfig.appendToBody) document.body.appendChild(fakeElement)
28 fakeElement.click()
29 if (VueClipboardConfig.appendToBody) document.body.removeChild(fakeElement)
30 })
31 }
32
33 Vue.directive('clipboard', {
34 bind: function (el, binding, vnode) {
35 if (binding.arg === 'success') {
36 el._vClipboard_success = binding.value
37 } else if (binding.arg === 'error') {
38 el._vClipboard_error = binding.value
39 } else {
40 var clipboard = new Clipboard(el, {
41 text: function () { return binding.value },
42 action: function () { return binding.arg === 'cut' ? 'cut' : 'copy' },
43 container: VueClipboardConfig.autoSetContainer ? el : undefined
44 })
45 clipboard.on('success', function (e) {
46 var callback = el._vClipboard_success
47 callback && callback(e)
48 })
49 clipboard.on('error', function (e) {
50 var callback = el._vClipboard_error
51 callback && callback(e)
52 })
53 el._vClipboard = clipboard
54 }
55 },
56 update: function (el, binding) {
57 if (binding.arg === 'success') {
58 el._vClipboard_success = binding.value
59 } else if (binding.arg === 'error') {
60 el._vClipboard_error = binding.value
61 } else {
62 el._vClipboard.text = function () { return binding.value }
63 el._vClipboard.action = function () { return binding.arg === 'cut' ? 'cut' : 'copy' }
64 }
65 },
66 unbind: function (el, binding) {
67 if (binding.arg === 'success') {
68 delete el._vClipboard_success
69 } else if (binding.arg === 'error') {
70 delete el._vClipboard_error
71 } else {
72 el._vClipboard.destroy()
73 delete el._vClipboard
74 }
75 }
76 })
77 },
78 config: VueClipboardConfig
79 }
80
81 if (typeof exports === 'object') {
82 module.exports = VueClipboard
83 } else if (typeof define === 'function' && define.amd) {
84 define([], function () {
85 return VueClipboard
86 })
87 }
...@@ -1759,6 +1759,16 @@ ...@@ -1759,6 +1759,16 @@
1759 "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==", 1759 "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==",
1760 "dev": true 1760 "dev": true
1761 }, 1761 },
1762 "clipboard": {
1763 "version": "2.0.6",
1764 "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
1765 "integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
1766 "requires": {
1767 "good-listener": "^1.2.2",
1768 "select": "^1.1.2",
1769 "tiny-emitter": "^2.0.0"
1770 }
1771 },
1762 "cliui": { 1772 "cliui": {
1763 "version": "2.1.0", 1773 "version": "2.1.0",
1764 "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", 1774 "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
...@@ -3251,6 +3261,11 @@ ...@@ -3251,6 +3261,11 @@
3251 } 3261 }
3252 } 3262 }
3253 }, 3263 },
3264 "delegate": {
3265 "version": "3.2.0",
3266 "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
3267 "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
3268 },
3254 "depd": { 3269 "depd": {
3255 "version": "1.1.2", 3270 "version": "1.1.2",
3256 "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 3271 "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
...@@ -4306,6 +4321,14 @@ ...@@ -4306,6 +4321,14 @@
4306 "slash": "^1.0.0" 4321 "slash": "^1.0.0"
4307 } 4322 }
4308 }, 4323 },
4324 "good-listener": {
4325 "version": "1.2.2",
4326 "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
4327 "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
4328 "requires": {
4329 "delegate": "^3.1.2"
4330 }
4331 },
4309 "graceful-fs": { 4332 "graceful-fs": {
4310 "version": "4.2.4", 4333 "version": "4.2.4",
4311 "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", 4334 "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
...@@ -9403,6 +9426,11 @@ ...@@ -9403,6 +9426,11 @@
9403 "ajv": "^5.0.0" 9426 "ajv": "^5.0.0"
9404 } 9427 }
9405 }, 9428 },
9429 "select": {
9430 "version": "1.1.2",
9431 "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
9432 "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
9433 },
9406 "select-hose": { 9434 "select-hose": {
9407 "version": "2.0.0", 9435 "version": "2.0.0",
9408 "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", 9436 "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
...@@ -10250,6 +10278,11 @@ ...@@ -10250,6 +10278,11 @@
10250 "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", 10278 "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
10251 "dev": true 10279 "dev": true
10252 }, 10280 },
10281 "tiny-emitter": {
10282 "version": "2.1.0",
10283 "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
10284 "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
10285 },
10253 "to-arraybuffer": { 10286 "to-arraybuffer": {
10254 "version": "1.0.1", 10287 "version": "1.0.1",
10255 "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", 10288 "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
...@@ -10703,6 +10736,14 @@ ...@@ -10703,6 +10736,14 @@
10703 "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz", 10736 "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
10704 "integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==" 10737 "integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg=="
10705 }, 10738 },
10739 "vue-clipboard2": {
10740 "version": "0.3.1",
10741 "resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.3.1.tgz",
10742 "integrity": "sha512-H5S/agEDj0kXjUb5GP2c0hCzIXWRBygaWLN3NEFsaI9I3uWin778SFEMt8QRXiPG+7anyjqWiw2lqcxWUSfkYg==",
10743 "requires": {
10744 "clipboard": "^2.0.0"
10745 }
10746 },
10706 "vue-hot-reload-api": { 10747 "vue-hot-reload-api": {
10707 "version": "2.3.4", 10748 "version": "2.3.4",
10708 "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", 10749 "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
14 "element-ui": "^2.13.2", 14 "element-ui": "^2.13.2",
15 "qs": "^6.9.4", 15 "qs": "^6.9.4",
16 "vue": "^2.5.2", 16 "vue": "^2.5.2",
17 "vue-clipboard2": "^0.3.1",
17 "vue-router": "^3.0.1" 18 "vue-router": "^3.0.1"
18 }, 19 },
19 "devDependencies": { 20 "devDependencies": {
......
...@@ -7,6 +7,7 @@ import axios from 'axios' ...@@ -7,6 +7,7 @@ import axios from 'axios'
7 import Element from 'element-ui'; 7 import Element from 'element-ui';
8 import 'element-ui/lib/theme-chalk/index.css'; 8 import 'element-ui/lib/theme-chalk/index.css';
9 import qs from 'qs' 9 import qs from 'qs'
10 import vueClipboard from 'vue-clipboard2'
10 11
11 Vue.config.productionTip = false 12 Vue.config.productionTip = false
12 Vue.prototype.$http = axios 13 Vue.prototype.$http = axios
...@@ -15,6 +16,7 @@ axios.defaults.baseURL = 'http://192.168.8.216:9090' ...@@ -15,6 +16,7 @@ axios.defaults.baseURL = 'http://192.168.8.216:9090'
15 // axios.defaults.baseURL = 'http://127.0.0.1:9090' 16 // axios.defaults.baseURL = 'http://127.0.0.1:9090'
16 17
17 Vue.use(Element, { size: 'small', zIndex: 3000 }); 18 Vue.use(Element, { size: 'small', zIndex: 3000 });
19 Vue.use(vueClipboard);
18 20
19 router.beforeEach((to, from, next) => { 21 router.beforeEach((to, from, next) => {
20 if (to.meta.title) { 22 if (to.meta.title) {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
56 width="30%"> 56 width="30%">
57 <span>{{mybizdata}}</span> 57 <span>{{mybizdata}}</span>
58 <span slot="footer" class="dialog-footer"> 58 <span slot="footer" class="dialog-footer">
59 <el-button type="primary" @click="dialogVisible = false">确 定</el-button> 59 <el-button type="primary" v-clipboard:copy="JSON.stringify(mybizdata)" v-clipboard:success="onCopy" @click="dialogVisible = false">点击复制</el-button>
60 </span> 60 </span>
61 </el-dialog> 61 </el-dialog>
62 </el-col> 62 </el-col>
...@@ -112,6 +112,57 @@ ...@@ -112,6 +112,57 @@
112 </el-form> 112 </el-form>
113 </el-col> 113 </el-col>
114 <el-col :span="8"> 114 <el-col :span="8">
115 <el-form ref="createUserInfo" :model="createUserInfo" label-width="0px">
116 <el-card class="CadetBlue" shadow="always">
117 <div slot="header" class="clearfix">
118 <span>创建指定代理人的健康坊用户</span>
119 </div>
120 <div class="text item">
121 <el-form-item>
122 <el-input placeholder="代理人手机号" v-model="createUserInfo.agentPhone" clearable></el-input>
123 </el-form-item>
124 <div style="margin: 15px 0;"></div>
125 <el-form-item>
126 <el-input placeholder="该代理人名下的健康坊用户手机号" v-model="createUserInfo.phone" clearable></el-input>
127 </el-form-item>
128 <div style="margin: 15px 0;"></div>
129 <el-form-item>
130 <el-button round @click="createUserInfoSubmit">创建用户</el-button>
131 </el-form-item>
132 </div>
133 </el-card>
134 </el-form>
135 </el-col>
136 <el-col :span="8">
137 <el-form ref="createUserInfo" :model="queryUserInfo" label-width="0px">
138 <el-card class="LightPink" shadow="always">
139 <div slot="header" class="clearfix">
140 <span>查询指定代理人的健康坊用户</span>
141 </div>
142 <div class="text item">
143 <el-form-item>
144 <el-input placeholder="代理人手机号" v-model="queryUserInfo.agentPhone" clearable></el-input>
145 </el-form-item>
146 <div style="margin: 15px 0;"></div>
147 <el-form-item>
148 <el-button round @click="queryUserInfoSubmit">查询用户</el-button>
149 </el-form-item>
150 </div>
151 </el-card>
152 </el-form>
153 <el-dialog
154 title="健康坊用户:"
155 :visible.sync="dialogQueryUserInfo"
156 width="30%">
157 <span>{{myQueryUserInfo}}</span>
158 <span slot="footer" class="dialog-footer">
159 <el-button type="primary" v-clipboard:copy="JSON.stringify(myQueryUserInfo)" v-clipboard:success="onCopy" @click="dialogQueryUserInfo = false">点击复制</el-button>
160 </span>
161 </el-dialog>
162 </el-col>
163 </el-row>
164 <el-row style="margin-bottom: 15px;">
165 <el-col :span="8">
115 <el-form ref="createCluesYoubaoe" :model="createCluesYoubaoe" label-width="0px"> 166 <el-form ref="createCluesYoubaoe" :model="createCluesYoubaoe" label-width="0px">
116 <el-card class="aquamarine" shadow="always"> 167 <el-card class="aquamarine" shadow="always">
117 <div slot="header" class="clearfix"> 168 <div slot="header" class="clearfix">
...@@ -138,7 +189,7 @@ ...@@ -138,7 +189,7 @@
138 </el-col> 189 </el-col>
139 <el-col :span="8"> 190 <el-col :span="8">
140 <el-form ref="createAPI" :model="createAPI" label-width="0px"> 191 <el-form ref="createAPI" :model="createAPI" label-width="0px">
141 <el-card class="CadetBlue" shadow="always"> 192 <el-card class="LightSalmon" shadow="always">
142 <div slot="header" class="clearfix"> 193 <div slot="header" class="clearfix">
143 <span>生成接口请求参数</span> 194 <span>生成接口请求参数</span>
144 </div> 195 </div>
...@@ -178,32 +229,10 @@ ...@@ -178,32 +229,10 @@
178 width="30%"> 229 width="30%">
179 <span>{{myApi}}</span> 230 <span>{{myApi}}</span>
180 <span slot="footer" class="dialog-footer"> 231 <span slot="footer" class="dialog-footer">
181 <el-button type="primary" @click="dialogCreateApi = false">确 定</el-button> 232 <el-button type="primary" v-clipboard:copy="JSON.stringify(myApi)" v-clipboard:success="onCopy" @click="dialogCreateApi = false">点击复制</el-button>
182 </span> 233 </span>
183 </el-dialog> 234 </el-dialog>
184 </el-col> 235 </el-col>
185 <!-- <el-col :span="8">-->
186 <!-- <el-form ref="createUserInfo" :model="createUserInfo" label-width="0px">-->
187 <!-- <el-card class="CadetBlue" shadow="always">-->
188 <!-- <div slot="header" class="clearfix">-->
189 <!-- <span>创建指定代理人的健康坊用户</span>-->
190 <!-- </div>-->
191 <!-- <div class="text item">-->
192 <!-- <el-form-item>-->
193 <!-- <el-input placeholder="代理人手机号" v-model="createUserInfo.phone" clearable></el-input>-->
194 <!-- </el-form-item>-->
195 <!-- <div style="margin: 15px 0;"></div>-->
196 <!-- <el-form-item>-->
197 <!-- <el-input placeholder="该代理人名下的健康坊用户手机号" v-model="createUserInfo.agentPhone" clearable></el-input>-->
198 <!-- </el-form-item>-->
199 <!-- <div style="margin: 15px 0;"></div>-->
200 <!-- <el-form-item>-->
201 <!-- <el-button round @click="">创建用户</el-button>-->
202 <!-- </el-form-item>-->
203 <!-- </div>-->
204 <!-- </el-card>-->
205 <!-- </el-form>-->
206 <!-- </el-col>-->
207 </el-row> 236 </el-row>
208 </div> 237 </div>
209 </template> 238 </template>
...@@ -260,6 +289,16 @@ ...@@ -260,6 +289,16 @@
260 padding: 0px; 289 padding: 0px;
261 background-color: CadetBlue; 290 background-color: CadetBlue;
262 } 291 }
292 .LightPink {
293 width: calc(100% - 20px);
294 padding: 0px;
295 background-color: LightPink;
296 }
297 .LightSalmon {
298 width: calc(100% - 20px);
299 padding: 0px;
300 background-color: LightSalmon;
301 }
263 </style> 302 </style>
264 303
265 <script> 304 <script>
...@@ -307,6 +346,9 @@ ...@@ -307,6 +346,9 @@
307 phone: '', 346 phone: '',
308 agentPhone: '' 347 agentPhone: ''
309 }, 348 },
349 queryUserInfo: {
350 agentPhone: ''
351 },
310 createAPI: { 352 createAPI: {
311 method: '', 353 method: '',
312 biz_data: '', 354 biz_data: '',
...@@ -322,7 +364,9 @@ ...@@ -322,7 +364,9 @@
322 label: '线上环境' 364 label: '线上环境'
323 }], 365 }],
324 dialogCreateApi: false, 366 dialogCreateApi: false,
325 myApi: '' 367 myApi: '',
368 dialogQueryUserInfo: false,
369 myQueryUserInfo: ''
326 // activityConfigRules: { 370 // activityConfigRules: {
327 // id: [ 371 // id: [
328 // { required: true, message: '请输入活动ID', trigger: 'blur' } 372 // { required: true, message: '请输入活动ID', trigger: 'blur' }
...@@ -331,6 +375,13 @@ ...@@ -331,6 +375,13 @@
331 } 375 }
332 }, 376 },
333 methods: { 377 methods: {
378 onCopy (e) {
379 this.$message({
380 showClose: true,
381 message: '内容已复制到剪切板!',
382 type: 'success'
383 });
384 },
334 onSubmit() { 385 onSubmit() {
335 let config = { 386 let config = {
336 headers: { 387 headers: {
...@@ -492,6 +543,74 @@ ...@@ -492,6 +543,74 @@
492 type: 'error' 543 type: 'error'
493 }); 544 });
494 }) 545 })
546 },
547 createUserInfoSubmit() {
548 let config = {
549 headers: {
550 'Content-Type': 'application/x-www-form-urlencoded'
551 }
552 }
553 this.$http.get('/tool/createUser?'+this.$qs.stringify({
554 phone: this.createUserInfo.phone,
555 agent_phone: this.createUserInfo.agentPhone
556 }),config).then((res)=>{
557 console.log(res);
558 if(res.data=='agentnull') {
559 this.$message({
560 showClose: true,
561 message: '代理人手机号不存在',
562 type: 'error'
563 });
564 } else if(res.data=='usermore') {
565 this.$message({
566 showClose: true,
567 message: '该用户手机号已存在,请更换手机号',
568 type: 'error'
569 });
570 } else if(res.data=='success') {
571 this.$message({
572 showClose: true,
573 message: '创建健康坊用户成功',
574 type: 'success'
575 });
576 }
577 }).catch(error=>{
578 console.log(error);
579 this.$message({
580 showClose: true,
581 message: '服务器处理失败,请核对参数!',
582 type: 'error'
583 });
584 })
585 },
586 queryUserInfoSubmit() {
587 let config = {
588 headers: {
589 'Content-Type': 'application/x-www-form-urlencoded'
590 }
591 }
592 this.$http.get('/tool/queryJiankangfang?'+this.$qs.stringify({
593 phone: this.queryUserInfo.agentPhone
594 }),config).then((res)=>{
595 console.log(res);
596 if(res.data=='usernull') {
597 this.$message({
598 showClose: true,
599 message: '代理人手机号不存在',
600 type: 'error'
601 });
602 } else {
603 this.myQueryUserInfo = res.data
604 this.dialogQueryUserInfo = true
605 }
606 }).catch(error=>{
607 console.log(error);
608 this.$message({
609 showClose: true,
610 message: '服务器处理失败,请核对参数!',
611 type: 'error'
612 });
613 })
495 } 614 }
496 } 615 }
497 } 616 }
......