UNPKG

33.8 kBJavaScriptView Raw
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId])
10/******/ return installedModules[moduleId].exports;
11/******/
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ exports: {},
15/******/ id: moduleId,
16/******/ loaded: false
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.loaded = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // __webpack_public_path__
37/******/ __webpack_require__.p = "";
38/******/
39/******/ // Load entry module and return exports
40/******/ return __webpack_require__(0);
41/******/ })
42/************************************************************************/
43/******/ ([
44/* 0 */
45/***/ function(module, exports, __webpack_require__) {
46
47 var notice = __webpack_require__(1)
48 var tap = __webpack_require__(8)
49 var event = __webpack_require__(4)
50 __webpack_require__(9)
51 var as = __webpack_require__(13)
52
53 event.bind(document.getElementById('demo'), 'touchstart', tap(function () {
54 as({
55 save: {
56 text: 'save',
57 callback: function () {
58 notice('Save tapped', {duration: 2000})
59 }
60 },
61 complain: {
62 text: 'complain',
63 callback: function () {
64 notice('Complain tapped', {duration: 2000})
65 }
66 },
67 cancel: {
68 text: 'cancel'
69 }
70 }).then(function () {
71 console.log('action sheet shown')
72 })
73 }))
74
75
76/***/ },
77/* 1 */
78/***/ function(module, exports, __webpack_require__) {
79
80 /**
81 * Notice
82 *
83 * A notice message at the top of a webpage.
84 *
85 */
86
87 var classes = __webpack_require__(2)
88 var events = __webpack_require__(4)
89 var query = __webpack_require__(5)
90 var tap = __webpack_require__(6)
91
92 var hasTouch = 'ontouchend' in window
93 var zIndex = 999
94
95 function create(o) {
96 var el = document.createElement(o.tag || 'div')
97 el.className = o.className
98 el.innerHTML = o.html || ''
99 if (o.parent) o.parent.appendChild(el)
100 return el
101 }
102 var container
103
104 function Notice(msg, options) {
105 if (! (this instanceof Notice)) return new Notice(msg, options)
106 options = options || {}
107 if (!container) {
108 container = create({
109 className: 'notice-container',
110 parent: options.parent || document.body
111 })
112 }
113 if (options.type == 'success') options.duration = options.duration || 2000
114 var closable = options.hasOwnProperty('closable')? options.closable : true
115 var duration = options.duration
116 if (!closable && duration == null) duration = 2000
117 options.message = msg
118 var el = createElement(options, closable)
119 el.style.zIndex = -- zIndex
120 this.el = el
121 container.appendChild(this.el)
122 this.closeEl = query('.notice-close', el)
123 this._hideFn = this.hide.bind(this)
124 if (hasTouch) {
125 this._tap = tap(this.closeEl, this._hideFn)
126 } else {
127 events.bind(this.closeEl, 'click', this._hideFn)
128 }
129 if (duration) {
130 setTimeout(this.hide.bind(this), duration)
131 }
132 }
133
134 Notice.prototype.hide = function(e) {
135 if (e) {
136 e.preventDefault()
137 e.stopPropagation()
138 }
139 if (this._hide) return
140 this._hide = true
141 var self = this
142 if (this._tap) {
143 this._tap.unbind()
144 } else {
145 events.bind(this.closeEl, 'click', this._hideFn)
146 }
147 dismiss(this.el)
148 }
149
150 Notice.prototype.clear = function () {
151 var el = this.el
152 if (el && el.parentNode) {
153 el.parentNode.removeChild(el)
154 }
155 }
156
157 function createElement(options, closable) {
158 var className = 'notice-item' + (options.type
159 ? ' notice-' + options.type
160 : '')
161 var item = create({className: className})
162 create({
163 className: 'notice-content',
164 html: options.message,
165 parent: item
166 })
167
168 if (closable) {
169 var close = create({
170 className : 'notice-close',
171 html: '×',
172 parent: item
173 })
174 }
175
176 return item
177 }
178
179 function dismiss(el) {
180 classes(el).add('notice-dismiss')
181 setTimeout(function() {
182 if (el && el.parentNode) {
183 el.parentNode.removeChild(el)
184 }
185 }, 200)
186 }
187
188 module.exports = Notice
189
190
191/***/ },
192/* 2 */
193/***/ function(module, exports, __webpack_require__) {
194
195 /**
196 * Module dependencies.
197 */
198
199 try {
200 var index = __webpack_require__(3);
201 } catch (err) {
202 var index = __webpack_require__(3);
203 }
204
205 /**
206 * Whitespace regexp.
207 */
208
209 var re = /\s+/;
210
211 /**
212 * toString reference.
213 */
214
215 var toString = Object.prototype.toString;
216
217 /**
218 * Wrap `el` in a `ClassList`.
219 *
220 * @param {Element} el
221 * @return {ClassList}
222 * @api public
223 */
224
225 module.exports = function(el){
226 return new ClassList(el);
227 };
228
229 /**
230 * Initialize a new ClassList for `el`.
231 *
232 * @param {Element} el
233 * @api private
234 */
235
236 function ClassList(el) {
237 if (!el || !el.nodeType) {
238 throw new Error('A DOM element reference is required');
239 }
240 this.el = el;
241 this.list = el.classList;
242 }
243
244 /**
245 * Add class `name` if not already present.
246 *
247 * @param {String} name
248 * @return {ClassList}
249 * @api public
250 */
251
252 ClassList.prototype.add = function(name){
253 // classList
254 if (this.list) {
255 this.list.add(name);
256 return this;
257 }
258
259 // fallback
260 var arr = this.array();
261 var i = index(arr, name);
262 if (!~i) arr.push(name);
263 this.el.className = arr.join(' ');
264 return this;
265 };
266
267 /**
268 * Remove class `name` when present, or
269 * pass a regular expression to remove
270 * any which match.
271 *
272 * @param {String|RegExp} name
273 * @return {ClassList}
274 * @api public
275 */
276
277 ClassList.prototype.remove = function(name){
278 if ('[object RegExp]' == toString.call(name)) {
279 return this.removeMatching(name);
280 }
281
282 // classList
283 if (this.list) {
284 this.list.remove(name);
285 return this;
286 }
287
288 // fallback
289 var arr = this.array();
290 var i = index(arr, name);
291 if (~i) arr.splice(i, 1);
292 this.el.className = arr.join(' ');
293 return this;
294 };
295
296 /**
297 * Remove all classes matching `re`.
298 *
299 * @param {RegExp} re
300 * @return {ClassList}
301 * @api private
302 */
303
304 ClassList.prototype.removeMatching = function(re){
305 var arr = this.array();
306 for (var i = 0; i < arr.length; i++) {
307 if (re.test(arr[i])) {
308 this.remove(arr[i]);
309 }
310 }
311 return this;
312 };
313
314 /**
315 * Toggle class `name`, can force state via `force`.
316 *
317 * For browsers that support classList, but do not support `force` yet,
318 * the mistake will be detected and corrected.
319 *
320 * @param {String} name
321 * @param {Boolean} force
322 * @return {ClassList}
323 * @api public
324 */
325
326 ClassList.prototype.toggle = function(name, force){
327 // classList
328 if (this.list) {
329 if ("undefined" !== typeof force) {
330 if (force !== this.list.toggle(name, force)) {
331 this.list.toggle(name); // toggle again to correct
332 }
333 } else {
334 this.list.toggle(name);
335 }
336 return this;
337 }
338
339 // fallback
340 if ("undefined" !== typeof force) {
341 if (!force) {
342 this.remove(name);
343 } else {
344 this.add(name);
345 }
346 } else {
347 if (this.has(name)) {
348 this.remove(name);
349 } else {
350 this.add(name);
351 }
352 }
353
354 return this;
355 };
356
357 /**
358 * Return an array of classes.
359 *
360 * @return {Array}
361 * @api public
362 */
363
364 ClassList.prototype.array = function(){
365 var className = this.el.getAttribute('class') || '';
366 var str = className.replace(/^\s+|\s+$/g, '');
367 var arr = str.split(re);
368 if ('' === arr[0]) arr.shift();
369 return arr;
370 };
371
372 /**
373 * Check if class `name` is present.
374 *
375 * @param {String} name
376 * @return {ClassList}
377 * @api public
378 */
379
380 ClassList.prototype.has =
381 ClassList.prototype.contains = function(name){
382 return this.list
383 ? this.list.contains(name)
384 : !! ~index(this.array(), name);
385 };
386
387
388/***/ },
389/* 3 */
390/***/ function(module, exports) {
391
392 module.exports = function(arr, obj){
393 if (arr.indexOf) return arr.indexOf(obj);
394 for (var i = 0; i < arr.length; ++i) {
395 if (arr[i] === obj) return i;
396 }
397 return -1;
398 };
399
400/***/ },
401/* 4 */
402/***/ function(module, exports) {
403
404 var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
405 unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
406 prefix = bind !== 'addEventListener' ? 'on' : '';
407
408 /**
409 * Bind `el` event `type` to `fn`.
410 *
411 * @param {Element} el
412 * @param {String} type
413 * @param {Function} fn
414 * @param {Boolean} capture
415 * @return {Function}
416 * @api public
417 */
418
419 exports.bind = function(el, type, fn, capture){
420 el[bind](prefix + type, fn, capture || false);
421 return fn;
422 };
423
424 /**
425 * Unbind `el` event `type`'s callback `fn`.
426 *
427 * @param {Element} el
428 * @param {String} type
429 * @param {Function} fn
430 * @param {Boolean} capture
431 * @return {Function}
432 * @api public
433 */
434
435 exports.unbind = function(el, type, fn, capture){
436 el[unbind](prefix + type, fn, capture || false);
437 return fn;
438 };
439
440/***/ },
441/* 5 */
442/***/ function(module, exports) {
443
444 function one(selector, el) {
445 return el.querySelector(selector);
446 }
447
448 exports = module.exports = function(selector, el){
449 el = el || document;
450 return one(selector, el);
451 };
452
453 exports.all = function(selector, el){
454 el = el || document;
455 return el.querySelectorAll(selector);
456 };
457
458 exports.engine = function(obj){
459 if (!obj.one) throw new Error('.one callback required');
460 if (!obj.all) throw new Error('.all callback required');
461 one = obj.one;
462 exports.all = obj.all;
463 return exports;
464 };
465
466
467/***/ },
468/* 6 */
469/***/ function(module, exports, __webpack_require__) {
470
471 /**
472 * Module Dependencies
473 */
474
475 var event = __webpack_require__(4),
476 bind = __webpack_require__(7);
477
478 /**
479 * Expose `Tap`
480 */
481
482 module.exports = Tap;
483
484 /**
485 * Touch support
486 */
487
488 var support = 'ontouchstart' in window;
489
490 /**
491 * Tap on `el` to trigger a `fn`
492 *
493 * Tap will not fire if you move your finger
494 * to scroll
495 *
496 * @param {Element} el
497 * @param {Function} fn
498 */
499
500 function Tap(el, fn) {
501 if(!(this instanceof Tap)) return new Tap(el, fn);
502 this.el = el;
503 this.fn = fn || function() {};
504 this.tap = true;
505
506 if (support) {
507 this.ontouchmove = bind(this, this.touchmove);
508 this.ontouchend = bind(this, this.touchend);
509 event.bind(el, 'touchmove', this.ontouchmove);
510 event.bind(el, 'touchend', this.ontouchend);
511 } else {
512 event.bind(el, 'click', this.fn);
513 }
514 }
515
516 /**
517 * Touch end
518 *
519 * @param {Event} e
520 * @return {Tap}
521 * @api private
522 */
523
524 Tap.prototype.touchend = function(e) {
525 if (this.tap) this.fn(e);
526 this.tap = true;
527 event.bind(this.el, 'touchmove', this.ontouchmove);
528 return this;
529 };
530
531 /**
532 * Touch move
533 *
534 * @return {Tap}
535 * @api private
536 */
537
538 Tap.prototype.touchmove = function() {
539 this.tap = false;
540 event.unbind(this.el, 'touchmove', this.ontouchmove);
541 return this;
542 };
543
544 /**
545 * Unbind the tap
546 *
547 * @return {Tap}
548 * @api public
549 */
550
551 Tap.prototype.unbind = function() {
552 event.unbind(this.el, 'touchend', this.ontouchend);
553 event.unbind(this.el, 'click', this.fn);
554 return this;
555 };
556
557
558/***/ },
559/* 7 */
560/***/ function(module, exports) {
561
562 /**
563 * Slice reference.
564 */
565
566 var slice = [].slice;
567
568 /**
569 * Bind `obj` to `fn`.
570 *
571 * @param {Object} obj
572 * @param {Function|String} fn or string
573 * @return {Function}
574 * @api public
575 */
576
577 module.exports = function(obj, fn){
578 if ('string' == typeof fn) fn = obj[fn];
579 if ('function' != typeof fn) throw new Error('bind() requires a function');
580 var args = slice.call(arguments, 2);
581 return function(){
582 return fn.apply(obj, args.concat(slice.call(arguments)));
583 }
584 };
585
586
587/***/ },
588/* 8 */
589/***/ function(module, exports) {
590
591 var endEvents = [
592 'touchend'
593 ]
594
595 module.exports = Tap
596
597 // default tap timeout in ms
598 Tap.timeout = 200
599
600 function Tap(callback, options) {
601 options = options || {}
602 // if the user holds his/her finger down for more than 200ms,
603 // then it's not really considered a tap.
604 // however, you can make this configurable.
605 var timeout = options.timeout || Tap.timeout
606
607 // to keep track of the original listener
608 listener.handler = callback
609
610 return listener
611
612 // el.addEventListener('touchstart', listener)
613 function listener(e1) {
614 // tap should only happen with a single finger
615 if (!e1.touches || e1.touches.length > 1) return
616
617 var el = e1.target
618 var context = this
619 var args = arguments;
620
621 var timeout_id = setTimeout(cleanup, timeout)
622
623 el.addEventListener('touchmove', cleanup)
624
625 endEvents.forEach(function (event) {
626 el.addEventListener(event, done)
627 })
628
629 function done(e2) {
630 // since touchstart is added on the same tick
631 // and because of bubbling,
632 // it'll execute this on the same touchstart.
633 // this filters out the same touchstart event.
634 if (e1 === e2) return
635
636 cleanup()
637
638 // already handled
639 if (e2.defaultPrevented) return
640
641 // overwrite these functions so that they all to both start and events.
642 var preventDefault = e1.preventDefault
643 var stopPropagation = e1.stopPropagation
644
645 e1.stopPropagation = function () {
646 stopPropagation.call(e1)
647 stopPropagation.call(e2)
648 }
649
650 e1.preventDefault = function () {
651 preventDefault.call(e1)
652 preventDefault.call(e2)
653 }
654
655 // calls the handler with the `end` event,
656 // but i don't think it matters.
657 callback.apply(context, args)
658 }
659
660 // cleanup end events
661 // to cancel the tap, just run this early
662 function cleanup(e2) {
663 // if it's the same event as the origin,
664 // then don't actually cleanup.
665 // hit issues with this - don't remember
666 if (e1 === e2) return
667
668 clearTimeout(timeout_id)
669
670 el.removeEventListener('touchmove', cleanup)
671
672 endEvents.forEach(function (event) {
673 el.removeEventListener(event, done)
674 })
675 }
676 }
677 }
678
679
680/***/ },
681/* 9 */
682/***/ function(module, exports, __webpack_require__) {
683
684 // style-loader: Adds some css to the DOM by adding a <style> tag
685
686 // load the styles
687 var content = __webpack_require__(10);
688 if(typeof content === 'string') content = [[module.id, content, '']];
689 // add the styles to the DOM
690 var update = __webpack_require__(12)(content, {});
691 if(content.locals) module.exports = content.locals;
692 // Hot Module Replacement
693 if(false) {
694 // When the styles change, update the <style> tags
695 if(!content.locals) {
696 module.hot.accept("!!./node_modules/css-loader/index.js!./style.css", function() {
697 var newContent = require("!!./node_modules/css-loader/index.js!./style.css");
698 if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
699 update(newContent);
700 });
701 }
702 // When the module is disposed, remove the <style> tags
703 module.hot.dispose(function() { update(); });
704 }
705
706/***/ },
707/* 10 */
708/***/ function(module, exports, __webpack_require__) {
709
710 exports = module.exports = __webpack_require__(11)();
711 // imports
712
713
714 // module
715 exports.push([module.id, ".actionsheet-overlay {\n background-color: rgba(0,0,0,0);\n position: fixed;\n z-index: 998;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n transition: all 200ms ease-out;\n}\n.actionsheet-overlay.active{\n background-color: rgba(0,0,0,0.2);\n}\n.actionsheet {\n position: absolute;\n font-family:\"Helvetica Neue\", Helvetica,sans-serif;\n left: 2px;\n right: 2px;\n bottom: 0px;\n z-index: 999;\n transform: translateY(110%);\n transition: all 200ms ease-out;\n}\n.actionsheet-overlay.active .actionsheet{\n transform: translateY(0);\n}\n.actionsheet-item {\n color: #000;\n line-height: 2.5;\n font-size: 18px;\n background-color: rgba(255,255,255,0.8);\n text-align: center;\n user-select: none;\n -webkit-user-select: none;\n}\n.actionsheet-item:active,\n.actionsheet-item:hover {\n background-color: rgba(255,255,255,0.3);\n}\n.actionsheet-foot {\n margin-top: 4px;\n}\n.actionsheet-item + .actionsheet-item {\n border-top: 1px solid rgba(0,0,0,0.2);\n}\n", ""]);
716
717 // exports
718
719
720/***/ },
721/* 11 */
722/***/ function(module, exports) {
723
724 /*
725 MIT License http://www.opensource.org/licenses/mit-license.php
726 Author Tobias Koppers @sokra
727 */
728 // css base code, injected by the css-loader
729 module.exports = function() {
730 var list = [];
731
732 // return the list of modules as css string
733 list.toString = function toString() {
734 var result = [];
735 for(var i = 0; i < this.length; i++) {
736 var item = this[i];
737 if(item[2]) {
738 result.push("@media " + item[2] + "{" + item[1] + "}");
739 } else {
740 result.push(item[1]);
741 }
742 }
743 return result.join("");
744 };
745
746 // import a list of modules into the list
747 list.i = function(modules, mediaQuery) {
748 if(typeof modules === "string")
749 modules = [[null, modules, ""]];
750 var alreadyImportedModules = {};
751 for(var i = 0; i < this.length; i++) {
752 var id = this[i][0];
753 if(typeof id === "number")
754 alreadyImportedModules[id] = true;
755 }
756 for(i = 0; i < modules.length; i++) {
757 var item = modules[i];
758 // skip already imported module
759 // this implementation is not 100% perfect for weird media query combinations
760 // when a module is imported multiple times with different media queries.
761 // I hope this will never occur (Hey this way we have smaller bundles)
762 if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
763 if(mediaQuery && !item[2]) {
764 item[2] = mediaQuery;
765 } else if(mediaQuery) {
766 item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
767 }
768 list.push(item);
769 }
770 }
771 };
772 return list;
773 };
774
775
776/***/ },
777/* 12 */
778/***/ function(module, exports, __webpack_require__) {
779
780 /*
781 MIT License http://www.opensource.org/licenses/mit-license.php
782 Author Tobias Koppers @sokra
783 */
784 var stylesInDom = {},
785 memoize = function(fn) {
786 var memo;
787 return function () {
788 if (typeof memo === "undefined") memo = fn.apply(this, arguments);
789 return memo;
790 };
791 },
792 isOldIE = memoize(function() {
793 return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
794 }),
795 getHeadElement = memoize(function () {
796 return document.head || document.getElementsByTagName("head")[0];
797 }),
798 singletonElement = null,
799 singletonCounter = 0,
800 styleElementsInsertedAtTop = [];
801
802 module.exports = function(list, options) {
803 if(true) {
804 if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
805 }
806
807 options = options || {};
808 // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
809 // tags it will allow on a page
810 if (typeof options.singleton === "undefined") options.singleton = isOldIE();
811
812 // By default, add <style> tags to the bottom of <head>.
813 if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
814
815 var styles = listToStyles(list);
816 addStylesToDom(styles, options);
817
818 return function update(newList) {
819 var mayRemove = [];
820 for(var i = 0; i < styles.length; i++) {
821 var item = styles[i];
822 var domStyle = stylesInDom[item.id];
823 domStyle.refs--;
824 mayRemove.push(domStyle);
825 }
826 if(newList) {
827 var newStyles = listToStyles(newList);
828 addStylesToDom(newStyles, options);
829 }
830 for(var i = 0; i < mayRemove.length; i++) {
831 var domStyle = mayRemove[i];
832 if(domStyle.refs === 0) {
833 for(var j = 0; j < domStyle.parts.length; j++)
834 domStyle.parts[j]();
835 delete stylesInDom[domStyle.id];
836 }
837 }
838 };
839 }
840
841 function addStylesToDom(styles, options) {
842 for(var i = 0; i < styles.length; i++) {
843 var item = styles[i];
844 var domStyle = stylesInDom[item.id];
845 if(domStyle) {
846 domStyle.refs++;
847 for(var j = 0; j < domStyle.parts.length; j++) {
848 domStyle.parts[j](item.parts[j]);
849 }
850 for(; j < item.parts.length; j++) {
851 domStyle.parts.push(addStyle(item.parts[j], options));
852 }
853 } else {
854 var parts = [];
855 for(var j = 0; j < item.parts.length; j++) {
856 parts.push(addStyle(item.parts[j], options));
857 }
858 stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
859 }
860 }
861 }
862
863 function listToStyles(list) {
864 var styles = [];
865 var newStyles = {};
866 for(var i = 0; i < list.length; i++) {
867 var item = list[i];
868 var id = item[0];
869 var css = item[1];
870 var media = item[2];
871 var sourceMap = item[3];
872 var part = {css: css, media: media, sourceMap: sourceMap};
873 if(!newStyles[id])
874 styles.push(newStyles[id] = {id: id, parts: [part]});
875 else
876 newStyles[id].parts.push(part);
877 }
878 return styles;
879 }
880
881 function insertStyleElement(options, styleElement) {
882 var head = getHeadElement();
883 var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
884 if (options.insertAt === "top") {
885 if(!lastStyleElementInsertedAtTop) {
886 head.insertBefore(styleElement, head.firstChild);
887 } else if(lastStyleElementInsertedAtTop.nextSibling) {
888 head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
889 } else {
890 head.appendChild(styleElement);
891 }
892 styleElementsInsertedAtTop.push(styleElement);
893 } else if (options.insertAt === "bottom") {
894 head.appendChild(styleElement);
895 } else {
896 throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
897 }
898 }
899
900 function removeStyleElement(styleElement) {
901 styleElement.parentNode.removeChild(styleElement);
902 var idx = styleElementsInsertedAtTop.indexOf(styleElement);
903 if(idx >= 0) {
904 styleElementsInsertedAtTop.splice(idx, 1);
905 }
906 }
907
908 function createStyleElement(options) {
909 var styleElement = document.createElement("style");
910 styleElement.type = "text/css";
911 insertStyleElement(options, styleElement);
912 return styleElement;
913 }
914
915 function createLinkElement(options) {
916 var linkElement = document.createElement("link");
917 linkElement.rel = "stylesheet";
918 insertStyleElement(options, linkElement);
919 return linkElement;
920 }
921
922 function addStyle(obj, options) {
923 var styleElement, update, remove;
924
925 if (options.singleton) {
926 var styleIndex = singletonCounter++;
927 styleElement = singletonElement || (singletonElement = createStyleElement(options));
928 update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
929 remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
930 } else if(obj.sourceMap &&
931 typeof URL === "function" &&
932 typeof URL.createObjectURL === "function" &&
933 typeof URL.revokeObjectURL === "function" &&
934 typeof Blob === "function" &&
935 typeof btoa === "function") {
936 styleElement = createLinkElement(options);
937 update = updateLink.bind(null, styleElement);
938 remove = function() {
939 removeStyleElement(styleElement);
940 if(styleElement.href)
941 URL.revokeObjectURL(styleElement.href);
942 };
943 } else {
944 styleElement = createStyleElement(options);
945 update = applyToTag.bind(null, styleElement);
946 remove = function() {
947 removeStyleElement(styleElement);
948 };
949 }
950
951 update(obj);
952
953 return function updateStyle(newObj) {
954 if(newObj) {
955 if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
956 return;
957 update(obj = newObj);
958 } else {
959 remove();
960 }
961 };
962 }
963
964 var replaceText = (function () {
965 var textStore = [];
966
967 return function (index, replacement) {
968 textStore[index] = replacement;
969 return textStore.filter(Boolean).join('\n');
970 };
971 })();
972
973 function applyToSingletonTag(styleElement, index, remove, obj) {
974 var css = remove ? "" : obj.css;
975
976 if (styleElement.styleSheet) {
977 styleElement.styleSheet.cssText = replaceText(index, css);
978 } else {
979 var cssNode = document.createTextNode(css);
980 var childNodes = styleElement.childNodes;
981 if (childNodes[index]) styleElement.removeChild(childNodes[index]);
982 if (childNodes.length) {
983 styleElement.insertBefore(cssNode, childNodes[index]);
984 } else {
985 styleElement.appendChild(cssNode);
986 }
987 }
988 }
989
990 function applyToTag(styleElement, obj) {
991 var css = obj.css;
992 var media = obj.media;
993
994 if(media) {
995 styleElement.setAttribute("media", media)
996 }
997
998 if(styleElement.styleSheet) {
999 styleElement.styleSheet.cssText = css;
1000 } else {
1001 while(styleElement.firstChild) {
1002 styleElement.removeChild(styleElement.firstChild);
1003 }
1004 styleElement.appendChild(document.createTextNode(css));
1005 }
1006 }
1007
1008 function updateLink(linkElement, obj) {
1009 var css = obj.css;
1010 var sourceMap = obj.sourceMap;
1011
1012 if(sourceMap) {
1013 // http://stackoverflow.com/a/26603875
1014 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
1015 }
1016
1017 var blob = new Blob([css], { type: "text/css" });
1018
1019 var oldSrc = linkElement.href;
1020
1021 linkElement.href = URL.createObjectURL(blob);
1022
1023 if(oldSrc)
1024 URL.revokeObjectURL(oldSrc);
1025 }
1026
1027
1028/***/ },
1029/* 13 */
1030/***/ function(module, exports, __webpack_require__) {
1031
1032 var tap = __webpack_require__(8)
1033 var domify = __webpack_require__(14)
1034 var template = __webpack_require__(15)
1035 var classes = __webpack_require__(2)
1036 var event = __webpack_require__(4)
1037 var detect = __webpack_require__(16)
1038 var transitionEnd = detect.transitionend
1039
1040 document.addEventListener('touchstart', function(){}, true)
1041
1042 /**
1043 * create action sheet
1044 * option contains key for actions.
1045 * action should contain text and callback
1046 *
1047 * @public
1048 * @param {Object} option
1049 * @returns {Promise}
1050 */
1051 module.exports = function (option) {
1052 var el = domify(template)
1053 var body = el.querySelector('.actionsheet-body')
1054 Object.keys(option).forEach(function (key) {
1055 if (key == 'cancel') return
1056 var o = option[key]
1057 body.appendChild(domify('<div class="actionsheet-item" data-action="' + key + '">' + o.text + '</div>'))
1058 })
1059 if (option.cancel) {
1060 var text = option.cancel.text || 'cancel'
1061 body.parentNode.appendChild(domify('<div class="actionsheet-foot"><div class="actionsheet-item cancel">' + text + '</div></div>'))
1062 }
1063 document.body.appendChild(el)
1064
1065 var ontap = tap(function (e) {
1066 var target = e.target
1067 cleanUp()
1068 if (target.hasAttribute('data-action')){
1069 var action = target.dataset.action
1070 var cb = option[action].callback
1071 if (cb) cb.call(null)
1072 }
1073 })
1074 event.bind(el, 'touchstart', ontap)
1075 function end() {
1076 event.unbind(el, transitionEnd, end)
1077 if (el.parentNode) el.parentNode.removeChild(el)
1078 }
1079 function cleanUp() {
1080 event.unbind(el, 'touchstart', ontap)
1081 event.bind(el, transitionEnd, end)
1082 classes(el).remove('active')
1083 }
1084 return new Promise(function (resolve) {
1085 setTimeout(function () {
1086 classes(el).add('active')
1087 resolve()
1088 }, 20)
1089 })
1090 }
1091
1092
1093/***/ },
1094/* 14 */
1095/***/ function(module, exports) {
1096
1097
1098 /**
1099 * Expose `parse`.
1100 */
1101
1102 module.exports = parse;
1103
1104 /**
1105 * Tests for browser support.
1106 */
1107
1108 var innerHTMLBug = false;
1109 var bugTestDiv;
1110 if (typeof document !== 'undefined') {
1111 bugTestDiv = document.createElement('div');
1112 // Setup
1113 bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
1114 // Make sure that link elements get serialized correctly by innerHTML
1115 // This requires a wrapper element in IE
1116 innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
1117 bugTestDiv = undefined;
1118 }
1119
1120 /**
1121 * Wrap map from jquery.
1122 */
1123
1124 var map = {
1125 legend: [1, '<fieldset>', '</fieldset>'],
1126 tr: [2, '<table><tbody>', '</tbody></table>'],
1127 col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
1128 // for script/link/style tags to work in IE6-8, you have to wrap
1129 // in a div with a non-whitespace character in front, ha!
1130 _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
1131 };
1132
1133 map.td =
1134 map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
1135
1136 map.option =
1137 map.optgroup = [1, '<select multiple="multiple">', '</select>'];
1138
1139 map.thead =
1140 map.tbody =
1141 map.colgroup =
1142 map.caption =
1143 map.tfoot = [1, '<table>', '</table>'];
1144
1145 map.polyline =
1146 map.ellipse =
1147 map.polygon =
1148 map.circle =
1149 map.text =
1150 map.line =
1151 map.path =
1152 map.rect =
1153 map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
1154
1155 /**
1156 * Parse `html` and return a DOM Node instance, which could be a TextNode,
1157 * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
1158 * instance, depending on the contents of the `html` string.
1159 *
1160 * @param {String} html - HTML string to "domify"
1161 * @param {Document} doc - The `document` instance to create the Node for
1162 * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
1163 * @api private
1164 */
1165
1166 function parse(html, doc) {
1167 if ('string' != typeof html) throw new TypeError('String expected');
1168
1169 // default to the global `document` object
1170 if (!doc) doc = document;
1171
1172 // tag name
1173 var m = /<([\w:]+)/.exec(html);
1174 if (!m) return doc.createTextNode(html);
1175
1176 html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
1177
1178 var tag = m[1];
1179
1180 // body support
1181 if (tag == 'body') {
1182 var el = doc.createElement('html');
1183 el.innerHTML = html;
1184 return el.removeChild(el.lastChild);
1185 }
1186
1187 // wrap map
1188 var wrap = map[tag] || map._default;
1189 var depth = wrap[0];
1190 var prefix = wrap[1];
1191 var suffix = wrap[2];
1192 var el = doc.createElement('div');
1193 el.innerHTML = prefix + html + suffix;
1194 while (depth--) el = el.lastChild;
1195
1196 // one element
1197 if (el.firstChild == el.lastChild) {
1198 return el.removeChild(el.firstChild);
1199 }
1200
1201 // several elements
1202 var fragment = doc.createDocumentFragment();
1203 while (el.firstChild) {
1204 fragment.appendChild(el.removeChild(el.firstChild));
1205 }
1206
1207 return fragment;
1208 }
1209
1210
1211/***/ },
1212/* 15 */
1213/***/ function(module, exports) {
1214
1215 module.exports = "<div class=\"actionsheet-overlay\">\n <div class=\"actionsheet\">\n <div class=\"actionsheet-body\">\n </div>\n </div>\n</div>\n";
1216
1217/***/ },
1218/* 16 */
1219/***/ function(module, exports, __webpack_require__) {
1220
1221 exports.transition = __webpack_require__(17)
1222
1223 exports.transform = __webpack_require__(18)
1224
1225 exports.touchAction = __webpack_require__(19)
1226
1227 exports.transitionend = __webpack_require__(20)
1228
1229 exports.has3d = __webpack_require__(21)
1230
1231
1232/***/ },
1233/* 17 */
1234/***/ function(module, exports) {
1235
1236 var styles = [
1237 'webkitTransition',
1238 'MozTransition',
1239 'OTransition',
1240 'msTransition',
1241 'transition'
1242 ]
1243
1244 var el = document.createElement('p')
1245 var style
1246
1247 for (var i = 0; i < styles.length; i++) {
1248 if (null != el.style[styles[i]]) {
1249 style = styles[i]
1250 break
1251 }
1252 }
1253 el = null
1254
1255 module.exports = style
1256
1257
1258/***/ },
1259/* 18 */
1260/***/ function(module, exports) {
1261
1262
1263 var styles = [
1264 'webkitTransform',
1265 'MozTransform',
1266 'msTransform',
1267 'OTransform',
1268 'transform'
1269 ];
1270
1271 var el = document.createElement('p');
1272 var style;
1273
1274 for (var i = 0; i < styles.length; i++) {
1275 style = styles[i];
1276 if (null != el.style[style]) {
1277 module.exports = style;
1278 break;
1279 }
1280 }
1281
1282
1283/***/ },
1284/* 19 */
1285/***/ function(module, exports) {
1286
1287
1288 /**
1289 * Module exports.
1290 */
1291
1292 module.exports = touchActionProperty();
1293
1294 /**
1295 * Returns "touchAction", "msTouchAction", or null.
1296 */
1297
1298 function touchActionProperty(doc) {
1299 if (!doc) doc = document;
1300 var div = doc.createElement('div');
1301 var prop = null;
1302 if ('touchAction' in div.style) prop = 'touchAction';
1303 else if ('msTouchAction' in div.style) prop = 'msTouchAction';
1304 div = null;
1305 return prop;
1306 }
1307
1308
1309/***/ },
1310/* 20 */
1311/***/ function(module, exports) {
1312
1313 /**
1314 * Transition-end mapping
1315 */
1316
1317 var map = {
1318 'WebkitTransition' : 'webkitTransitionEnd',
1319 'MozTransition' : 'transitionend',
1320 'OTransition' : 'oTransitionEnd',
1321 'msTransition' : 'MSTransitionEnd',
1322 'transition' : 'transitionend'
1323 };
1324
1325 /**
1326 * Expose `transitionend`
1327 */
1328
1329 var el = document.createElement('p');
1330
1331 for (var transition in map) {
1332 if (null != el.style[transition]) {
1333 module.exports = map[transition];
1334 break;
1335 }
1336 }
1337
1338
1339/***/ },
1340/* 21 */
1341/***/ function(module, exports, __webpack_require__) {
1342
1343
1344 var prop = __webpack_require__(18);
1345
1346 // IE <=8 doesn't have `getComputedStyle`
1347 if (!prop || !window.getComputedStyle) {
1348 module.exports = false;
1349
1350 } else {
1351 var map = {
1352 webkitTransform: '-webkit-transform',
1353 OTransform: '-o-transform',
1354 msTransform: '-ms-transform',
1355 MozTransform: '-moz-transform',
1356 transform: 'transform'
1357 };
1358
1359 // from: https://gist.github.com/lorenzopolidori/3794226
1360 var el = document.createElement('div');
1361 el.style[prop] = 'translate3d(1px,1px,1px)';
1362 document.body.insertBefore(el, null);
1363 var val = getComputedStyle(el).getPropertyValue(map[prop]);
1364 document.body.removeChild(el);
1365 module.exports = null != val && val.length && 'none' != val;
1366 }
1367
1368
1369/***/ }
1370/******/ ]);
1371//# sourceMappingURL=bundle.js.map
\No newline at end of file