automan-cmd 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +56 -0
  3. package/bin/automan +3 -0
  4. package/bin/automan-build +3 -0
  5. package/bin/automan-config +3 -0
  6. package/bin/automan-create +3 -0
  7. package/bin/automan-publish +3 -0
  8. package/lib/automan-build.js +41 -0
  9. package/lib/automan-config.js +82 -0
  10. package/lib/automan-create.js +137 -0
  11. package/lib/automan-publish.js +331 -0
  12. package/lib/index.js +13 -0
  13. package/lib/install.js.tpl +47 -0
  14. package/lib/util.js +174 -0
  15. package/package.json +37 -0
  16. package/tpl/.babelrc +16 -0
  17. package/tpl/.browserslistrc +3 -0
  18. package/tpl/.eslintignore +2 -0
  19. package/tpl/.eslintrc.js +228 -0
  20. package/tpl/.gitignore.ejs +12 -0
  21. package/tpl/.postcssrc.js +12 -0
  22. package/tpl/README.md +1 -0
  23. package/tpl/changelog.md +1 -0
  24. package/tpl/editor/index.vue +45 -0
  25. package/tpl/icon.png +0 -0
  26. package/tpl/jsconfig.json +7 -0
  27. package/tpl/package.json.ejs +66 -0
  28. package/tpl/preview/app.vue +326 -0
  29. package/tpl/preview/attr/Data.vue +69 -0
  30. package/tpl/preview/attr/Resource.vue +79 -0
  31. package/tpl/preview/attr/com.vue +21 -0
  32. package/tpl/preview/attr/index.js +16 -0
  33. package/tpl/preview/components/Attribute.vue +365 -0
  34. package/tpl/preview/components/FitImg.vue +152 -0
  35. package/tpl/preview/components/ImgViewer.vue +80 -0
  36. package/tpl/preview/components/Loading.vue +55 -0
  37. package/tpl/preview/components/Toast.vue +111 -0
  38. package/tpl/preview/index.js +22 -0
  39. package/tpl/preview/index.tpl +13 -0
  40. package/tpl/preview/lib/ESlog.js +46 -0
  41. package/tpl/preview/lib/Util.js +57 -0
  42. package/tpl/preview/lib/fetch.js +139 -0
  43. package/tpl/preview/lib/index.js +15 -0
  44. package/tpl/preview/lib/vue/filters.js +53 -0
  45. package/tpl/preview/lib/vue/index.js +9 -0
  46. package/tpl/preview/lib/vue/mixin.js +166 -0
  47. package/tpl/preview/mint-ui/message-box/index.js +1503 -0
  48. package/tpl/preview/mint-ui/message-box/style.css +159 -0
  49. package/tpl/preview/mint-ui/popup/index.js +1046 -0
  50. package/tpl/preview/mint-ui/popup/style.css +115 -0
  51. package/tpl/preview/mint-ui/spinner/index.js +657 -0
  52. package/tpl/preview/mint-ui/spinner/style.css +227 -0
  53. package/tpl/preview/mint-ui/swipe/index.js +907 -0
  54. package/tpl/preview/mint-ui/swipe/style.css +43 -0
  55. package/tpl/preview/mint-ui/swipe-item/index.js +171 -0
  56. package/tpl/preview/mint-ui/swipe-item/style.css +1 -0
  57. package/tpl/preview/style.css +126 -0
  58. package/tpl/server.config.js +6 -0
  59. package/tpl/src/assets/css/index.scss +29 -0
  60. package/tpl/src/example.vue +165 -0
  61. package/tpl/src/index.vue.ejs +32 -0
  62. package/tpl/webpack.config.js.ejs +267 -0
  63. package/tpl/yarn.lock +6037 -0
@@ -0,0 +1,907 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId])
11
+ /******/ return installedModules[moduleId].exports;
12
+
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+
30
+
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+
37
+ /******/ // identity function for calling harmony imports with the correct context
38
+ /******/ __webpack_require__.i = function(value) { return value; };
39
+
40
+ /******/ // define getter function for harmony exports
41
+ /******/ __webpack_require__.d = function(exports, name, getter) {
42
+ /******/ if(!__webpack_require__.o(exports, name)) {
43
+ /******/ Object.defineProperty(exports, name, {
44
+ /******/ configurable: false,
45
+ /******/ enumerable: true,
46
+ /******/ get: getter
47
+ /******/ });
48
+ /******/ }
49
+ /******/ };
50
+
51
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
52
+ /******/ __webpack_require__.n = function(module) {
53
+ /******/ var getter = module && module.__esModule ?
54
+ /******/ function getDefault() { return module['default']; } :
55
+ /******/ function getModuleExports() { return module; };
56
+ /******/ __webpack_require__.d(getter, 'a', getter);
57
+ /******/ return getter;
58
+ /******/ };
59
+
60
+ /******/ // Object.prototype.hasOwnProperty.call
61
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
62
+
63
+ /******/ // __webpack_public_path__
64
+ /******/ __webpack_require__.p = "";
65
+
66
+ /******/ // Load entry module and return exports
67
+ /******/ return __webpack_require__(__webpack_require__.s = 247);
68
+ /******/ })
69
+ /************************************************************************/
70
+ /******/ ({
71
+
72
+ /***/ 0:
73
+ /***/ function(module, exports) {
74
+
75
+ module.exports = require("vue");
76
+
77
+ /***/ },
78
+
79
+ /***/ 1:
80
+ /***/ function(module, exports, __webpack_require__) {
81
+
82
+ "use strict";
83
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(0);
84
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
85
+ /* unused harmony export on */
86
+ /* unused harmony export off */
87
+ /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
88
+ /* unused harmony export hasClass */
89
+ /* harmony export (immutable) */ exports["a"] = addClass;
90
+ /* harmony export (immutable) */ exports["b"] = removeClass;
91
+ /* unused harmony export getStyle */
92
+ /* unused harmony export setStyle */
93
+ /* istanbul ignore next */
94
+
95
+
96
+
97
+ var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer;
98
+ var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
99
+ var MOZ_HACK_REGEXP = /^moz([A-Z])/;
100
+ var ieVersion = isServer ? 0 : Number(document.documentMode);
101
+
102
+ /* istanbul ignore next */
103
+ var trim = function(string) {
104
+ return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
105
+ };
106
+ /* istanbul ignore next */
107
+ var camelCase = function(name) {
108
+ return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
109
+ return offset ? letter.toUpperCase() : letter;
110
+ }).replace(MOZ_HACK_REGEXP, 'Moz$1');
111
+ };
112
+
113
+ /* istanbul ignore next */
114
+ var on = (function() {
115
+ if (!isServer && document.addEventListener) {
116
+ return function(element, event, handler) {
117
+ if (element && event && handler) {
118
+ element.addEventListener(event, handler, false);
119
+ }
120
+ };
121
+ } else {
122
+ return function(element, event, handler) {
123
+ if (element && event && handler) {
124
+ element.attachEvent('on' + event, handler);
125
+ }
126
+ };
127
+ }
128
+ })();
129
+
130
+ /* istanbul ignore next */
131
+ var off = (function() {
132
+ if (!isServer && document.removeEventListener) {
133
+ return function(element, event, handler) {
134
+ if (element && event) {
135
+ element.removeEventListener(event, handler, false);
136
+ }
137
+ };
138
+ } else {
139
+ return function(element, event, handler) {
140
+ if (element && event) {
141
+ element.detachEvent('on' + event, handler);
142
+ }
143
+ };
144
+ }
145
+ })();
146
+
147
+ /* istanbul ignore next */
148
+ var once = function(el, event, fn) {
149
+ var listener = function() {
150
+ if (fn) {
151
+ fn.apply(this, arguments);
152
+ }
153
+ off(el, event, listener);
154
+ };
155
+ on(el, event, listener);
156
+ };
157
+
158
+ /* istanbul ignore next */
159
+ function hasClass(el, cls) {
160
+ if (!el || !cls) return false;
161
+ if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
162
+ if (el.classList) {
163
+ return el.classList.contains(cls);
164
+ } else {
165
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
166
+ }
167
+ };
168
+
169
+ /* istanbul ignore next */
170
+ function addClass(el, cls) {
171
+ if (!el) return;
172
+ var curClass = el.className;
173
+ var classes = (cls || '').split(' ');
174
+
175
+ for (var i = 0, j = classes.length; i < j; i++) {
176
+ var clsName = classes[i];
177
+ if (!clsName) continue;
178
+
179
+ if (el.classList) {
180
+ el.classList.add(clsName);
181
+ } else {
182
+ if (!hasClass(el, clsName)) {
183
+ curClass += ' ' + clsName;
184
+ }
185
+ }
186
+ }
187
+ if (!el.classList) {
188
+ el.className = curClass;
189
+ }
190
+ };
191
+
192
+ /* istanbul ignore next */
193
+ function removeClass(el, cls) {
194
+ if (!el || !cls) return;
195
+ var classes = cls.split(' ');
196
+ var curClass = ' ' + el.className + ' ';
197
+
198
+ for (var i = 0, j = classes.length; i < j; i++) {
199
+ var clsName = classes[i];
200
+ if (!clsName) continue;
201
+
202
+ if (el.classList) {
203
+ el.classList.remove(clsName);
204
+ } else {
205
+ if (hasClass(el, clsName)) {
206
+ curClass = curClass.replace(' ' + clsName + ' ', ' ');
207
+ }
208
+ }
209
+ }
210
+ if (!el.classList) {
211
+ el.className = trim(curClass);
212
+ }
213
+ };
214
+
215
+ /* istanbul ignore next */
216
+ var getStyle = ieVersion < 9 ? function(element, styleName) {
217
+ if (isServer) return;
218
+ if (!element || !styleName) return null;
219
+ styleName = camelCase(styleName);
220
+ if (styleName === 'float') {
221
+ styleName = 'styleFloat';
222
+ }
223
+ try {
224
+ switch (styleName) {
225
+ case 'opacity':
226
+ try {
227
+ return element.filters.item('alpha').opacity / 100;
228
+ } catch (e) {
229
+ return 1.0;
230
+ }
231
+ default:
232
+ return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
233
+ }
234
+ } catch (e) {
235
+ return element.style[styleName];
236
+ }
237
+ } : function(element, styleName) {
238
+ if (isServer) return;
239
+ if (!element || !styleName) return null;
240
+ styleName = camelCase(styleName);
241
+ if (styleName === 'float') {
242
+ styleName = 'cssFloat';
243
+ }
244
+ try {
245
+ var computed = document.defaultView.getComputedStyle(element, '');
246
+ return element.style[styleName] || computed ? computed[styleName] : null;
247
+ } catch (e) {
248
+ return element.style[styleName];
249
+ }
250
+ };
251
+
252
+ /* istanbul ignore next */
253
+ function setStyle(element, styleName, value) {
254
+ if (!element || !styleName) return;
255
+
256
+ if (typeof styleName === 'object') {
257
+ for (var prop in styleName) {
258
+ if (styleName.hasOwnProperty(prop)) {
259
+ setStyle(element, prop, styleName[prop]);
260
+ }
261
+ }
262
+ } else {
263
+ styleName = camelCase(styleName);
264
+ if (styleName === 'opacity' && ieVersion < 9) {
265
+ element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
266
+ } else {
267
+ element.style[styleName] = value;
268
+ }
269
+ }
270
+ };
271
+
272
+
273
+ /***/ },
274
+
275
+ /***/ 132:
276
+ /***/ function(module, exports) {
277
+
278
+ // removed by extract-text-webpack-plugin
279
+
280
+ /***/ },
281
+
282
+ /***/ 168:
283
+ /***/ function(module, exports, __webpack_require__) {
284
+
285
+ var __vue_exports__, __vue_options__
286
+ var __vue_styles__ = {}
287
+
288
+ /* styles */
289
+ __webpack_require__(132)
290
+
291
+ /* script */
292
+ __vue_exports__ = __webpack_require__(86)
293
+
294
+ /* template */
295
+ var __vue_template__ = __webpack_require__(205)
296
+ __vue_options__ = __vue_exports__ = __vue_exports__ || {}
297
+ if (
298
+ typeof __vue_exports__.default === "object" ||
299
+ typeof __vue_exports__.default === "function"
300
+ ) {
301
+ __vue_options__ = __vue_exports__ = __vue_exports__.default
302
+ }
303
+ if (typeof __vue_options__ === "function") {
304
+ __vue_options__ = __vue_options__.options
305
+ }
306
+
307
+ __vue_options__.render = __vue_template__.render
308
+ __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
309
+
310
+ module.exports = __vue_exports__
311
+
312
+
313
+ /***/ },
314
+
315
+ /***/ 205:
316
+ /***/ function(module, exports) {
317
+
318
+ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
319
+ return _c('div', {
320
+ staticClass: "mint-swipe"
321
+ }, [_c('div', {
322
+ ref: "wrap",
323
+ staticClass: "mint-swipe-items-wrap"
324
+ }, [_vm._t("default")], 2), _vm._v(" "), _c('div', {
325
+ directives: [{
326
+ name: "show",
327
+ rawName: "v-show",
328
+ value: (_vm.showIndicators),
329
+ expression: "showIndicators"
330
+ }],
331
+ staticClass: "mint-swipe-indicators"
332
+ }, _vm._l((_vm.pages), function(page, $index) {
333
+ return _c('div', {
334
+ staticClass: "mint-swipe-indicator",
335
+ class: {
336
+ 'is-active': $index === _vm.index
337
+ }
338
+ })
339
+ }))])
340
+ },staticRenderFns: []}
341
+
342
+ /***/ },
343
+
344
+ /***/ 247:
345
+ /***/ function(module, exports, __webpack_require__) {
346
+
347
+ module.exports = __webpack_require__(48);
348
+
349
+
350
+ /***/ },
351
+
352
+ /***/ 48:
353
+ /***/ function(module, exports, __webpack_require__) {
354
+
355
+ "use strict";
356
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_swipe_vue__ = __webpack_require__(168);
357
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_swipe_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_swipe_vue__);
358
+ Object.defineProperty(exports, "__esModule", { value: true });
359
+ /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_swipe_vue___default.a; });
360
+
361
+
362
+
363
+ /***/ },
364
+
365
+ /***/ 86:
366
+ /***/ function(module, exports, __webpack_require__) {
367
+
368
+ "use strict";
369
+ Object.defineProperty(exports, "__esModule", { value: true });
370
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__ = __webpack_require__(1);
371
+ //
372
+ //
373
+ //
374
+ //
375
+ //
376
+ //
377
+ //
378
+ //
379
+ //
380
+ //
381
+ //
382
+ //
383
+ //
384
+ //
385
+ //
386
+ //
387
+ //
388
+ //
389
+ //
390
+ //
391
+ //
392
+ //
393
+ //
394
+ //
395
+ //
396
+ //
397
+ //
398
+ //
399
+ //
400
+ //
401
+ //
402
+ //
403
+ //
404
+ //
405
+ //
406
+ //
407
+ //
408
+ //
409
+ //
410
+ //
411
+ //
412
+ //
413
+ //
414
+ //
415
+ //
416
+ //
417
+ //
418
+ //
419
+ //
420
+ //
421
+ //
422
+ //
423
+ //
424
+ //
425
+ //
426
+ //
427
+ //
428
+ //
429
+ //
430
+ //
431
+ //
432
+
433
+
434
+
435
+
436
+ /* harmony default export */ exports["default"] = {
437
+ name: 'mt-swipe',
438
+
439
+ created: function created() {
440
+ this.dragState = {};
441
+ },
442
+
443
+ data: function data() {
444
+ return {
445
+ ready: false,
446
+ dragging: false,
447
+ userScrolling: false,
448
+ animating: false,
449
+ index: 0,
450
+ pages: [],
451
+ timer: null,
452
+ reInitTimer: null,
453
+ noDrag: false,
454
+ isDone: false
455
+ };
456
+ },
457
+
458
+ props: {
459
+ speed: {
460
+ type: Number,
461
+ default: 300
462
+ },
463
+
464
+ defaultIndex: {
465
+ type: Number,
466
+ default: 0
467
+ },
468
+
469
+ auto: {
470
+ type: Number,
471
+ default: 3000
472
+ },
473
+
474
+ continuous: {
475
+ type: Boolean,
476
+ default: true
477
+ },
478
+
479
+ showIndicators: {
480
+ type: Boolean,
481
+ default: true
482
+ },
483
+
484
+ noDragWhenSingle: {
485
+ type: Boolean,
486
+ default: true
487
+ },
488
+
489
+ prevent: {
490
+ type: Boolean,
491
+ default: false
492
+ }
493
+ },
494
+
495
+ watch: {
496
+ index: function index(newIndex) {
497
+ this.$emit('change', newIndex);
498
+ }
499
+ },
500
+
501
+ methods: {
502
+ swipeItemCreated: function swipeItemCreated() {
503
+ var this$1 = this;
504
+
505
+ if (!this.ready) return;
506
+
507
+ clearTimeout(this.reInitTimer);
508
+ this.reInitTimer = setTimeout(function () {
509
+ this$1.reInitPages();
510
+ }, 100);
511
+ },
512
+
513
+ swipeItemDestroyed: function swipeItemDestroyed() {
514
+ var this$1 = this;
515
+
516
+ if (!this.ready) return;
517
+
518
+ clearTimeout(this.reInitTimer);
519
+ this.reInitTimer = setTimeout(function () {
520
+ this$1.reInitPages();
521
+ }, 100);
522
+ },
523
+
524
+ translate: function translate(element, offset, speed, callback) {
525
+ var arguments$1 = arguments;
526
+ var this$1 = this;
527
+
528
+ if (speed) {
529
+ this.animating = true;
530
+ element.style.webkitTransition = '-webkit-transform ' + speed + 'ms ease-in-out';
531
+ setTimeout(function () {
532
+ element.style.webkitTransform = "translate3d(" + offset + "px, 0, 0)";
533
+ }, 50);
534
+
535
+ var called = false;
536
+
537
+ var transitionEndCallback = function () {
538
+ if (called) return;
539
+ called = true;
540
+ this$1.animating = false;
541
+ element.style.webkitTransition = '';
542
+ element.style.webkitTransform = '';
543
+ if (callback) {
544
+ callback.apply(this$1, arguments$1);
545
+ }
546
+ };
547
+
548
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__["c" /* once */])(element, 'webkitTransitionEnd', transitionEndCallback);
549
+ setTimeout(transitionEndCallback, speed + 100); // webkitTransitionEnd maybe not fire on lower version android.
550
+ } else {
551
+ element.style.webkitTransition = '';
552
+ element.style.webkitTransform = "translate3d(" + offset + "px, 0, 0)";
553
+ }
554
+ },
555
+
556
+ reInitPages: function reInitPages() {
557
+ var children = this.$children;
558
+ this.noDrag = children.length === 1 && this.noDragWhenSingle;
559
+
560
+ var pages = [];
561
+ var intDefaultIndex = Math.floor(this.defaultIndex);
562
+ var defaultIndex = (intDefaultIndex >= 0 && intDefaultIndex < children.length) ? intDefaultIndex : 0;
563
+ this.index = defaultIndex;
564
+
565
+ children.forEach(function(child, index) {
566
+ pages.push(child.$el);
567
+
568
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__["b" /* removeClass */])(child.$el, 'is-active');
569
+
570
+ if (index === defaultIndex) {
571
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__["a" /* addClass */])(child.$el, 'is-active');
572
+ }
573
+ });
574
+
575
+ this.pages = pages;
576
+ },
577
+
578
+ doAnimate: function doAnimate(towards, options) {
579
+ var this$1 = this;
580
+
581
+ if (this.$children.length === 0) return;
582
+ if (!options && this.$children.length < 2) return;
583
+
584
+ var prevPage, nextPage, currentPage, pageWidth, offsetLeft;
585
+ var speed = this.speed || 300;
586
+ var index = this.index;
587
+ var pages = this.pages;
588
+ var pageCount = pages.length;
589
+
590
+ if (!options) {
591
+ pageWidth = this.$el.clientWidth;
592
+ currentPage = pages[index];
593
+ prevPage = pages[index - 1];
594
+ nextPage = pages[index + 1];
595
+ if (this.continuous && pages.length > 1) {
596
+ if (!prevPage) {
597
+ prevPage = pages[pages.length - 1];
598
+ }
599
+ if (!nextPage) {
600
+ nextPage = pages[0];
601
+ }
602
+ }
603
+ if (prevPage) {
604
+ prevPage.style.display = 'block';
605
+ this.translate(prevPage, -pageWidth);
606
+ }
607
+ if (nextPage) {
608
+ nextPage.style.display = 'block';
609
+ this.translate(nextPage, pageWidth);
610
+ }
611
+ } else {
612
+ prevPage = options.prevPage;
613
+ currentPage = options.currentPage;
614
+ nextPage = options.nextPage;
615
+ pageWidth = options.pageWidth;
616
+ offsetLeft = options.offsetLeft;
617
+ }
618
+
619
+ var newIndex;
620
+
621
+ var oldPage = this.$children[index].$el;
622
+
623
+ if (towards === 'prev') {
624
+ if (index > 0) {
625
+ newIndex = index - 1;
626
+ }
627
+ if (this.continuous && index === 0) {
628
+ newIndex = pageCount - 1;
629
+ }
630
+ } else if (towards === 'next') {
631
+ if (index < pageCount - 1) {
632
+ newIndex = index + 1;
633
+ }
634
+ if (this.continuous && index === pageCount - 1) {
635
+ newIndex = 0;
636
+ }
637
+ }
638
+
639
+ var callback = function () {
640
+ if (newIndex !== undefined) {
641
+ var newPage = this$1.$children[newIndex].$el;
642
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__["b" /* removeClass */])(oldPage, 'is-active');
643
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_dom__["a" /* addClass */])(newPage, 'is-active');
644
+
645
+ this$1.index = newIndex;
646
+ }
647
+ if (this$1.isDone) {
648
+ this$1.end();
649
+ }
650
+
651
+ if (prevPage) {
652
+ prevPage.style.display = '';
653
+ }
654
+
655
+ if (nextPage) {
656
+ nextPage.style.display = '';
657
+ }
658
+ };
659
+
660
+ setTimeout(function () {
661
+ if (towards === 'next') {
662
+ this$1.isDone = true;
663
+ this$1.before(currentPage);
664
+ this$1.translate(currentPage, -pageWidth, speed, callback);
665
+ if (nextPage) {
666
+ this$1.translate(nextPage, 0, speed);
667
+ }
668
+ } else if (towards === 'prev') {
669
+ this$1.isDone = true;
670
+ this$1.before(currentPage);
671
+ this$1.translate(currentPage, pageWidth, speed, callback);
672
+ if (prevPage) {
673
+ this$1.translate(prevPage, 0, speed);
674
+ }
675
+ } else {
676
+ this$1.isDone = false;
677
+ this$1.translate(currentPage, 0, speed, callback);
678
+ if (typeof offsetLeft !== 'undefined') {
679
+ if (prevPage && offsetLeft > 0) {
680
+ this$1.translate(prevPage, pageWidth * -1, speed);
681
+ }
682
+ if (nextPage && offsetLeft < 0) {
683
+ this$1.translate(nextPage, pageWidth, speed);
684
+ }
685
+ } else {
686
+ if (prevPage) {
687
+ this$1.translate(prevPage, pageWidth * -1, speed);
688
+ }
689
+ if (nextPage) {
690
+ this$1.translate(nextPage, pageWidth, speed);
691
+ }
692
+ }
693
+ }
694
+ }, 10);
695
+ },
696
+
697
+ next: function next() {
698
+ this.doAnimate('next');
699
+ },
700
+
701
+ prev: function prev() {
702
+ this.doAnimate('prev');
703
+ },
704
+
705
+ before: function before() {
706
+ this.$emit('before', this.index);
707
+ },
708
+
709
+ end: function end() {
710
+ this.$emit('end', this.index);
711
+ },
712
+
713
+ doOnTouchStart: function doOnTouchStart(event) {
714
+ if (this.noDrag) return;
715
+
716
+ var element = this.$el;
717
+ var dragState = this.dragState;
718
+ var touch = event.touches[0];
719
+
720
+ dragState.startTime = new Date();
721
+ dragState.startLeft = touch.pageX;
722
+ dragState.startTop = touch.pageY;
723
+ dragState.startTopAbsolute = touch.clientY;
724
+
725
+ dragState.pageWidth = element.offsetWidth;
726
+ dragState.pageHeight = element.offsetHeight;
727
+
728
+ var prevPage = this.$children[this.index - 1];
729
+ var dragPage = this.$children[this.index];
730
+ var nextPage = this.$children[this.index + 1];
731
+
732
+ if (this.continuous && this.pages.length > 1) {
733
+ if (!prevPage) {
734
+ prevPage = this.$children[this.$children.length - 1];
735
+ }
736
+ if (!nextPage) {
737
+ nextPage = this.$children[0];
738
+ }
739
+ }
740
+
741
+ dragState.prevPage = prevPage ? prevPage.$el : null;
742
+ dragState.dragPage = dragPage ? dragPage.$el : null;
743
+ dragState.nextPage = nextPage ? nextPage.$el : null;
744
+
745
+ if (dragState.prevPage) {
746
+ dragState.prevPage.style.display = 'block';
747
+ }
748
+
749
+ if (dragState.nextPage) {
750
+ dragState.nextPage.style.display = 'block';
751
+ }
752
+ },
753
+
754
+ doOnTouchMove: function doOnTouchMove(event) {
755
+ if (this.noDrag) return;
756
+
757
+ var dragState = this.dragState;
758
+ var touch = event.touches[0];
759
+
760
+ dragState.currentLeft = touch.pageX;
761
+ dragState.currentTop = touch.pageY;
762
+ dragState.currentTopAbsolute = touch.clientY;
763
+
764
+ var offsetLeft = dragState.currentLeft - dragState.startLeft;
765
+ var offsetTop = dragState.currentTopAbsolute - dragState.startTopAbsolute;
766
+
767
+ var distanceX = Math.abs(offsetLeft);
768
+ var distanceY = Math.abs(offsetTop);
769
+ if (distanceX < 5 || (distanceX >= 5 && distanceY >= 1.73 * distanceX)) {
770
+ this.userScrolling = true;
771
+ return;
772
+ } else {
773
+ this.userScrolling = false;
774
+ event.preventDefault();
775
+ }
776
+ offsetLeft = Math.min(Math.max(-dragState.pageWidth + 1, offsetLeft), dragState.pageWidth - 1);
777
+
778
+ var towards = offsetLeft < 0 ? 'next' : 'prev';
779
+
780
+ if (dragState.prevPage && towards === 'prev') {
781
+ this.translate(dragState.prevPage, offsetLeft - dragState.pageWidth);
782
+ }
783
+ this.translate(dragState.dragPage, offsetLeft);
784
+ if (dragState.nextPage && towards === 'next') {
785
+ this.translate(dragState.nextPage, offsetLeft + dragState.pageWidth);
786
+ }
787
+ },
788
+
789
+ doOnTouchEnd: function doOnTouchEnd() {
790
+ if (this.noDrag) return;
791
+
792
+ var dragState = this.dragState;
793
+
794
+ var dragDuration = new Date() - dragState.startTime;
795
+ var towards = null;
796
+
797
+ var offsetLeft = dragState.currentLeft - dragState.startLeft;
798
+ var offsetTop = dragState.currentTop - dragState.startTop;
799
+ var pageWidth = dragState.pageWidth;
800
+ var index = this.index;
801
+ var pageCount = this.pages.length;
802
+
803
+ if (dragDuration < 300) {
804
+ var fireTap = Math.abs(offsetLeft) < 5 && Math.abs(offsetTop) < 5;
805
+ if (isNaN(offsetLeft) || isNaN(offsetTop)) {
806
+ fireTap = true;
807
+ }
808
+ if (fireTap) {
809
+ this.$children[this.index].$emit('tap');
810
+ }
811
+ }
812
+
813
+ if (dragDuration < 300 && dragState.currentLeft === undefined) return;
814
+
815
+ if (dragDuration < 300 || Math.abs(offsetLeft) > pageWidth / 2) {
816
+ towards = offsetLeft < 0 ? 'next' : 'prev';
817
+ }
818
+
819
+ if (!this.continuous) {
820
+ if ((index === 0 && towards === 'prev') || (index === pageCount - 1 && towards === 'next')) {
821
+ towards = null;
822
+ }
823
+ }
824
+
825
+ if (this.$children.length < 2) {
826
+ towards = null;
827
+ }
828
+
829
+ this.doAnimate(towards, {
830
+ offsetLeft: offsetLeft,
831
+ pageWidth: dragState.pageWidth,
832
+ prevPage: dragState.prevPage,
833
+ currentPage: dragState.dragPage,
834
+ nextPage: dragState.nextPage
835
+ });
836
+
837
+ this.dragState = {};
838
+ },
839
+
840
+ clearTimer: function clearTimer() {
841
+ clearInterval(this.timer);
842
+ this.timer = null;
843
+ }
844
+ },
845
+
846
+ destroyed: function destroyed() {
847
+ if (this.timer) {
848
+ this.clearTimer();
849
+ }
850
+ if (this.reInitTimer) {
851
+ clearTimeout(this.reInitTimer);
852
+ this.reInitTimer = null;
853
+ }
854
+ },
855
+
856
+ mounted: function mounted() {
857
+ var this$1 = this;
858
+
859
+ this.ready = true;
860
+
861
+ if (this.auto > 0) {
862
+ this.timer = setInterval(function () {
863
+ if (!this$1.continuous && (this$1.index >= this$1.pages.length - 1)) {
864
+ return this$1.clearTimer();
865
+ }
866
+ if (!this$1.dragging && !this$1.animating) {
867
+ this$1.next();
868
+ }
869
+ }, this.auto);
870
+ }
871
+
872
+ this.reInitPages();
873
+
874
+ var element = this.$el;
875
+
876
+ element.addEventListener('touchstart', function (event) {
877
+ if (this$1.prevent) {
878
+ event.preventDefault();
879
+ }
880
+ if (this$1.animating) return;
881
+ this$1.dragging = true;
882
+ this$1.userScrolling = false;
883
+ this$1.doOnTouchStart(event);
884
+ });
885
+
886
+ element.addEventListener('touchmove', function (event) {
887
+ if (!this$1.dragging) return;
888
+ this$1.doOnTouchMove(event);
889
+ });
890
+
891
+ element.addEventListener('touchend', function (event) {
892
+ if (this$1.userScrolling) {
893
+ this$1.dragging = false;
894
+ this$1.dragState = {};
895
+ return;
896
+ }
897
+ if (!this$1.dragging) return;
898
+ this$1.doOnTouchEnd(event);
899
+ this$1.dragging = false;
900
+ });
901
+ }
902
+ };
903
+
904
+
905
+ /***/ }
906
+
907
+ /******/ });