1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6 |
|
7 | var deindent = _interopDefault(require('de-indent'));
|
8 | var he = _interopDefault(require('he'));
|
9 |
|
10 |
|
11 |
|
12 | var emptyObject = Object.freeze({});
|
13 |
|
14 |
|
15 |
|
16 | function isUndef (v) {
|
17 | return v === undefined || v === null
|
18 | }
|
19 |
|
20 | function isDef (v) {
|
21 | return v !== undefined && v !== null
|
22 | }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | function isPrimitive (value) {
|
28 | return (
|
29 | typeof value === 'string' ||
|
30 | typeof value === 'number' ||
|
31 |
|
32 | typeof value === 'symbol' ||
|
33 | typeof value === 'boolean'
|
34 | )
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | function isObject (obj) {
|
43 | return obj !== null && typeof obj === 'object'
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | var _toString = Object.prototype.toString;
|
50 |
|
51 | function toRawType (value) {
|
52 | return _toString.call(value).slice(8, -1)
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | function isPlainObject (obj) {
|
60 | return _toString.call(obj) === '[object Object]'
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | function isValidArrayIndex (val) {
|
67 | var n = parseFloat(String(val));
|
68 | return n >= 0 && Math.floor(n) === n && isFinite(val)
|
69 | }
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | function makeMap (
|
76 | str,
|
77 | expectsLowerCase
|
78 | ) {
|
79 | var map = Object.create(null);
|
80 | var list = str.split(',');
|
81 | for (var i = 0; i < list.length; i++) {
|
82 | map[list[i]] = true;
|
83 | }
|
84 | return expectsLowerCase
|
85 | ? function (val) { return map[val.toLowerCase()]; }
|
86 | : function (val) { return map[val]; }
|
87 | }
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | var isBuiltInTag = makeMap('slot,component', true);
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | function remove (arr, item) {
|
103 | if (arr.length) {
|
104 | var index = arr.indexOf(item);
|
105 | if (index > -1) {
|
106 | return arr.splice(index, 1)
|
107 | }
|
108 | }
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
115 | function hasOwn (obj, key) {
|
116 | return hasOwnProperty.call(obj, key)
|
117 | }
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | function cached (fn) {
|
123 | var cache = Object.create(null);
|
124 | return (function cachedFn (str) {
|
125 | var hit = cache[str];
|
126 | return hit || (cache[str] = fn(str))
|
127 | })
|
128 | }
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | var camelizeRE = /-(\w)/g;
|
134 | var camelize = cached(function (str) {
|
135 | return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
136 | });
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | var capitalize = cached(function (str) {
|
142 | return str.charAt(0).toUpperCase() + str.slice(1)
|
143 | });
|
144 |
|
145 |
|
146 |
|
147 |
|
148 | var hyphenateRE = /\B([A-Z])/g;
|
149 | var hyphenate = cached(function (str) {
|
150 | return str.replace(hyphenateRE, '-$1').toLowerCase()
|
151 | });
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 | function polyfillBind (fn, ctx) {
|
163 | function boundFn (a) {
|
164 | var l = arguments.length;
|
165 | return l
|
166 | ? l > 1
|
167 | ? fn.apply(ctx, arguments)
|
168 | : fn.call(ctx, a)
|
169 | : fn.call(ctx)
|
170 | }
|
171 |
|
172 | boundFn._length = fn.length;
|
173 | return boundFn
|
174 | }
|
175 |
|
176 | function nativeBind (fn, ctx) {
|
177 | return fn.bind(ctx)
|
178 | }
|
179 |
|
180 | var bind = Function.prototype.bind
|
181 | ? nativeBind
|
182 | : polyfillBind;
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | function extend (to, _from) {
|
188 | for (var key in _from) {
|
189 | to[key] = _from[key];
|
190 | }
|
191 | return to
|
192 | }
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 | function noop (a, b, c) {}
|
202 |
|
203 |
|
204 |
|
205 |
|
206 | var no = function (a, b, c) { return false; };
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | var identity = function (_) { return _; };
|
214 |
|
215 |
|
216 |
|
217 |
|
218 | function genStaticKeys (modules) {
|
219 | return modules.reduce(function (keys, m) {
|
220 | return keys.concat(m.staticKeys || [])
|
221 | }, []).join(',')
|
222 | }
|
223 |
|
224 |
|
225 |
|
226 | var isUnaryTag = makeMap(
|
227 | 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
228 | 'link,meta,param,source,track,wbr'
|
229 | );
|
230 |
|
231 |
|
232 |
|
233 | var canBeLeftOpenTag = makeMap(
|
234 | 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
235 | );
|
236 |
|
237 |
|
238 |
|
239 | var isNonPhrasingTag = makeMap(
|
240 | 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
241 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
242 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
243 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
244 | 'title,tr,track'
|
245 | );
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
|
255 |
|
256 |
|
257 |
|
258 |
|
259 | function def (obj, key, val, enumerable) {
|
260 | Object.defineProperty(obj, key, {
|
261 | value: val,
|
262 | enumerable: !!enumerable,
|
263 | writable: true,
|
264 | configurable: true
|
265 | });
|
266 | }
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 | var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
274 | var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
275 | var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
|
276 | var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
277 | var startTagOpen = new RegExp(("^<" + qnameCapture));
|
278 | var startTagClose = /^\s*(\/?)>/;
|
279 | var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
280 | var doctype = /^<!DOCTYPE [^>]+>/i;
|
281 |
|
282 | var comment = /^<!\--/;
|
283 | var conditionalComment = /^<!\[/;
|
284 |
|
285 |
|
286 | var isPlainTextElement = makeMap('script,style,textarea', true);
|
287 | var reCache = {};
|
288 |
|
289 | var decodingMap = {
|
290 | '<': '<',
|
291 | '>': '>',
|
292 | '"': '"',
|
293 | '&': '&',
|
294 | ' ': '\n',
|
295 | '	': '\t',
|
296 | ''': "'"
|
297 | };
|
298 | var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
299 | var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
300 |
|
301 |
|
302 | var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
303 | var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
304 |
|
305 | function decodeAttr (value, shouldDecodeNewlines) {
|
306 | var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
307 | return value.replace(re, function (match) { return decodingMap[match]; })
|
308 | }
|
309 |
|
310 | function parseHTML (html, options) {
|
311 | var stack = [];
|
312 | var expectHTML = options.expectHTML;
|
313 | var isUnaryTag$$1 = options.isUnaryTag || no;
|
314 | var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
315 | var index = 0;
|
316 | var last, lastTag;
|
317 | while (html) {
|
318 | last = html;
|
319 |
|
320 | if (!lastTag || !isPlainTextElement(lastTag)) {
|
321 | var textEnd = html.indexOf('<');
|
322 | if (textEnd === 0) {
|
323 |
|
324 | if (comment.test(html)) {
|
325 | var commentEnd = html.indexOf('-->');
|
326 |
|
327 | if (commentEnd >= 0) {
|
328 | if (options.shouldKeepComment) {
|
329 | options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
330 | }
|
331 | advance(commentEnd + 3);
|
332 | continue
|
333 | }
|
334 | }
|
335 |
|
336 |
|
337 | if (conditionalComment.test(html)) {
|
338 | var conditionalEnd = html.indexOf(']>');
|
339 |
|
340 | if (conditionalEnd >= 0) {
|
341 | advance(conditionalEnd + 2);
|
342 | continue
|
343 | }
|
344 | }
|
345 |
|
346 |
|
347 | var doctypeMatch = html.match(doctype);
|
348 | if (doctypeMatch) {
|
349 | advance(doctypeMatch[0].length);
|
350 | continue
|
351 | }
|
352 |
|
353 |
|
354 | var endTagMatch = html.match(endTag);
|
355 | if (endTagMatch) {
|
356 | var curIndex = index;
|
357 | advance(endTagMatch[0].length);
|
358 | parseEndTag(endTagMatch[1], curIndex, index);
|
359 | continue
|
360 | }
|
361 |
|
362 |
|
363 | var startTagMatch = parseStartTag();
|
364 | if (startTagMatch) {
|
365 | handleStartTag(startTagMatch);
|
366 | if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
367 | advance(1);
|
368 | }
|
369 | continue
|
370 | }
|
371 | }
|
372 |
|
373 | var text = (void 0), rest = (void 0), next = (void 0);
|
374 | if (textEnd >= 0) {
|
375 | rest = html.slice(textEnd);
|
376 | while (
|
377 | !endTag.test(rest) &&
|
378 | !startTagOpen.test(rest) &&
|
379 | !comment.test(rest) &&
|
380 | !conditionalComment.test(rest)
|
381 | ) {
|
382 |
|
383 | next = rest.indexOf('<', 1);
|
384 | if (next < 0) { break }
|
385 | textEnd += next;
|
386 | rest = html.slice(textEnd);
|
387 | }
|
388 | text = html.substring(0, textEnd);
|
389 | }
|
390 |
|
391 | if (textEnd < 0) {
|
392 | text = html;
|
393 | }
|
394 |
|
395 | if (text) {
|
396 | advance(text.length);
|
397 | }
|
398 |
|
399 | if (options.chars && text) {
|
400 | options.chars(text, index - text.length, index);
|
401 | }
|
402 | } else {
|
403 | var endTagLength = 0;
|
404 | var stackedTag = lastTag.toLowerCase();
|
405 | var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
406 | var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
407 | endTagLength = endTag.length;
|
408 | if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
409 | text = text
|
410 | .replace(/<!\--([\s\S]*?)-->/g, '$1')
|
411 | .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
412 | }
|
413 | if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
414 | text = text.slice(1);
|
415 | }
|
416 | if (options.chars) {
|
417 | options.chars(text);
|
418 | }
|
419 | return ''
|
420 | });
|
421 | index += html.length - rest$1.length;
|
422 | html = rest$1;
|
423 | parseEndTag(stackedTag, index - endTagLength, index);
|
424 | }
|
425 |
|
426 | if (html === last) {
|
427 | options.chars && options.chars(html);
|
428 | if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
|
429 | options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
430 | }
|
431 | break
|
432 | }
|
433 | }
|
434 |
|
435 |
|
436 | parseEndTag();
|
437 |
|
438 | function advance (n) {
|
439 | index += n;
|
440 | html = html.substring(n);
|
441 | }
|
442 |
|
443 | function parseStartTag () {
|
444 | var start = html.match(startTagOpen);
|
445 | if (start) {
|
446 | var match = {
|
447 | tagName: start[1],
|
448 | attrs: [],
|
449 | start: index
|
450 | };
|
451 | advance(start[0].length);
|
452 | var end, attr;
|
453 | while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
454 | attr.start = index;
|
455 | advance(attr[0].length);
|
456 | attr.end = index;
|
457 | match.attrs.push(attr);
|
458 | }
|
459 | if (end) {
|
460 | match.unarySlash = end[1];
|
461 | advance(end[0].length);
|
462 | match.end = index;
|
463 | return match
|
464 | }
|
465 | }
|
466 | }
|
467 |
|
468 | function handleStartTag (match) {
|
469 | var tagName = match.tagName;
|
470 | var unarySlash = match.unarySlash;
|
471 |
|
472 | if (expectHTML) {
|
473 | if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
474 | parseEndTag(lastTag);
|
475 | }
|
476 | if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
477 | parseEndTag(tagName);
|
478 | }
|
479 | }
|
480 |
|
481 | var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
482 |
|
483 | var l = match.attrs.length;
|
484 | var attrs = new Array(l);
|
485 | for (var i = 0; i < l; i++) {
|
486 | var args = match.attrs[i];
|
487 | var value = args[3] || args[4] || args[5] || '';
|
488 | var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
489 | ? options.shouldDecodeNewlinesForHref
|
490 | : options.shouldDecodeNewlines;
|
491 | attrs[i] = {
|
492 | name: args[1],
|
493 | value: decodeAttr(value, shouldDecodeNewlines)
|
494 | };
|
495 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
496 | attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
497 | attrs[i].end = args.end;
|
498 | }
|
499 | }
|
500 |
|
501 | if (!unary) {
|
502 | stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
503 | lastTag = tagName;
|
504 | }
|
505 |
|
506 | if (options.start) {
|
507 | options.start(tagName, attrs, unary, match.start, match.end);
|
508 | }
|
509 | }
|
510 |
|
511 | function parseEndTag (tagName, start, end) {
|
512 | var pos, lowerCasedTagName;
|
513 | if (start == null) { start = index; }
|
514 | if (end == null) { end = index; }
|
515 |
|
516 |
|
517 | if (tagName) {
|
518 | lowerCasedTagName = tagName.toLowerCase();
|
519 | for (pos = stack.length - 1; pos >= 0; pos--) {
|
520 | if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
521 | break
|
522 | }
|
523 | }
|
524 | } else {
|
525 |
|
526 | pos = 0;
|
527 | }
|
528 |
|
529 | if (pos >= 0) {
|
530 |
|
531 | for (var i = stack.length - 1; i >= pos; i--) {
|
532 | if (process.env.NODE_ENV !== 'production' &&
|
533 | (i > pos || !tagName) &&
|
534 | options.warn
|
535 | ) {
|
536 | options.warn(
|
537 | ("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
538 | { start: stack[i].start }
|
539 | );
|
540 | }
|
541 | if (options.end) {
|
542 | options.end(stack[i].tag, start, end);
|
543 | }
|
544 | }
|
545 |
|
546 |
|
547 | stack.length = pos;
|
548 | lastTag = pos && stack[pos - 1].tag;
|
549 | } else if (lowerCasedTagName === 'br') {
|
550 | if (options.start) {
|
551 | options.start(tagName, [], true, start, end);
|
552 | }
|
553 | } else if (lowerCasedTagName === 'p') {
|
554 | if (options.start) {
|
555 | options.start(tagName, [], false, start, end);
|
556 | }
|
557 | if (options.end) {
|
558 | options.end(tagName, start, end);
|
559 | }
|
560 | }
|
561 | }
|
562 | }
|
563 |
|
564 |
|
565 |
|
566 | var splitRE = /\r?\n/g;
|
567 | var replaceRE = /./g;
|
568 | var isSpecialTag = makeMap('script,style,template', true);
|
569 |
|
570 |
|
571 |
|
572 |
|
573 | function parseComponent (
|
574 | content,
|
575 | options
|
576 | ) {
|
577 | if ( options === void 0 ) options = {};
|
578 |
|
579 | var sfc = {
|
580 | template: null,
|
581 | script: null,
|
582 | styles: [],
|
583 | customBlocks: [],
|
584 | errors: []
|
585 | };
|
586 | var depth = 0;
|
587 | var currentBlock = null;
|
588 |
|
589 | var warn = function (msg) {
|
590 | sfc.errors.push(msg);
|
591 | };
|
592 |
|
593 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
594 | warn = function (msg, range) {
|
595 | var data = { msg: msg };
|
596 | if (range.start != null) {
|
597 | data.start = range.start;
|
598 | }
|
599 | if (range.end != null) {
|
600 | data.end = range.end;
|
601 | }
|
602 | sfc.errors.push(data);
|
603 | };
|
604 | }
|
605 |
|
606 | function start (
|
607 | tag,
|
608 | attrs,
|
609 | unary,
|
610 | start,
|
611 | end
|
612 | ) {
|
613 | if (depth === 0) {
|
614 | currentBlock = {
|
615 | type: tag,
|
616 | content: '',
|
617 | start: end,
|
618 | attrs: attrs.reduce(function (cumulated, ref) {
|
619 | var name = ref.name;
|
620 | var value = ref.value;
|
621 |
|
622 | cumulated[name] = value || true;
|
623 | return cumulated
|
624 | }, {})
|
625 | };
|
626 | if (isSpecialTag(tag)) {
|
627 | checkAttrs(currentBlock, attrs);
|
628 | if (tag === 'style') {
|
629 | sfc.styles.push(currentBlock);
|
630 | } else {
|
631 | sfc[tag] = currentBlock;
|
632 | }
|
633 | } else {
|
634 | sfc.customBlocks.push(currentBlock);
|
635 | }
|
636 | }
|
637 | if (!unary) {
|
638 | depth++;
|
639 | }
|
640 | }
|
641 |
|
642 | function checkAttrs (block, attrs) {
|
643 | for (var i = 0; i < attrs.length; i++) {
|
644 | var attr = attrs[i];
|
645 | if (attr.name === 'lang') {
|
646 | block.lang = attr.value;
|
647 | }
|
648 | if (attr.name === 'scoped') {
|
649 | block.scoped = true;
|
650 | }
|
651 | if (attr.name === 'module') {
|
652 | block.module = attr.value || true;
|
653 | }
|
654 | if (attr.name === 'src') {
|
655 | block.src = attr.value;
|
656 | }
|
657 | }
|
658 | }
|
659 |
|
660 | function end (tag, start) {
|
661 | if (depth === 1 && currentBlock) {
|
662 | currentBlock.end = start;
|
663 | var text = content.slice(currentBlock.start, currentBlock.end);
|
664 | if (options.deindent !== false) {
|
665 | text = deindent(text);
|
666 | }
|
667 |
|
668 |
|
669 | if (currentBlock.type !== 'template' && options.pad) {
|
670 | text = padContent(currentBlock, options.pad) + text;
|
671 | }
|
672 | currentBlock.content = text;
|
673 | currentBlock = null;
|
674 | }
|
675 | depth--;
|
676 | }
|
677 |
|
678 | function padContent (block, pad) {
|
679 | if (pad === 'space') {
|
680 | return content.slice(0, block.start).replace(replaceRE, ' ')
|
681 | } else {
|
682 | var offset = content.slice(0, block.start).split(splitRE).length;
|
683 | var padChar = block.type === 'script' && !block.lang
|
684 | ? '//\n'
|
685 | : '\n';
|
686 | return Array(offset).join(padChar)
|
687 | }
|
688 | }
|
689 |
|
690 | parseHTML(content, {
|
691 | warn: warn,
|
692 | start: start,
|
693 | end: end,
|
694 | outputSourceRange: options.outputSourceRange
|
695 | });
|
696 |
|
697 | return sfc
|
698 | }
|
699 |
|
700 |
|
701 |
|
702 |
|
703 | var hasProto = '__proto__' in {};
|
704 |
|
705 |
|
706 | var inBrowser = typeof window !== 'undefined';
|
707 | var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
708 | var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
709 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
710 | var isIE = UA && /msie|trident/.test(UA);
|
711 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
712 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
713 | var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
714 | var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
715 | var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
716 | var isPhantomJS = UA && /phantomjs/.test(UA);
|
717 | var isFF = UA && UA.match(/firefox\/(\d+)/);
|
718 |
|
719 |
|
720 | var nativeWatch = ({}).watch;
|
721 | if (inBrowser) {
|
722 | try {
|
723 | var opts = {};
|
724 | Object.defineProperty(opts, 'passive', ({
|
725 | get: function get () {
|
726 | }
|
727 | }));
|
728 | window.addEventListener('test-passive', null, opts);
|
729 | } catch (e) {}
|
730 | }
|
731 |
|
732 |
|
733 |
|
734 | var _isServer;
|
735 | var isServerRendering = function () {
|
736 | if (_isServer === undefined) {
|
737 |
|
738 | if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
739 |
|
740 |
|
741 | _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
742 | } else {
|
743 | _isServer = false;
|
744 | }
|
745 | }
|
746 | return _isServer
|
747 | };
|
748 |
|
749 |
|
750 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
751 |
|
752 |
|
753 | function isNative (Ctor) {
|
754 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
755 | }
|
756 |
|
757 | var hasSymbol =
|
758 | typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
759 | typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
760 |
|
761 | var _Set;
|
762 |
|
763 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
764 |
|
765 | _Set = Set;
|
766 | } else {
|
767 |
|
768 | _Set = (function () {
|
769 | function Set () {
|
770 | this.set = Object.create(null);
|
771 | }
|
772 | Set.prototype.has = function has (key) {
|
773 | return this.set[key] === true
|
774 | };
|
775 | Set.prototype.add = function add (key) {
|
776 | this.set[key] = true;
|
777 | };
|
778 | Set.prototype.clear = function clear () {
|
779 | this.set = Object.create(null);
|
780 | };
|
781 |
|
782 | return Set;
|
783 | }());
|
784 | }
|
785 |
|
786 | var ASSET_TYPES = [
|
787 | 'component',
|
788 | 'directive',
|
789 | 'filter'
|
790 | ];
|
791 |
|
792 | var LIFECYCLE_HOOKS = [
|
793 | 'beforeCreate',
|
794 | 'created',
|
795 | 'beforeMount',
|
796 | 'mounted',
|
797 | 'beforeUpdate',
|
798 | 'updated',
|
799 | 'beforeDestroy',
|
800 | 'destroyed',
|
801 | 'activated',
|
802 | 'deactivated',
|
803 | 'errorCaptured',
|
804 | 'serverPrefetch'
|
805 | ];
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | var config = ({
|
812 | |
813 |
|
814 |
|
815 |
|
816 | optionMergeStrategies: Object.create(null),
|
817 |
|
818 | |
819 |
|
820 |
|
821 | silent: false,
|
822 |
|
823 | |
824 |
|
825 |
|
826 | productionTip: process.env.NODE_ENV !== 'production',
|
827 |
|
828 | |
829 |
|
830 |
|
831 | devtools: process.env.NODE_ENV !== 'production',
|
832 |
|
833 | |
834 |
|
835 |
|
836 | performance: false,
|
837 |
|
838 | |
839 |
|
840 |
|
841 | errorHandler: null,
|
842 |
|
843 | |
844 |
|
845 |
|
846 | warnHandler: null,
|
847 |
|
848 | |
849 |
|
850 |
|
851 | ignoredElements: [],
|
852 |
|
853 | |
854 |
|
855 |
|
856 |
|
857 | keyCodes: Object.create(null),
|
858 |
|
859 | |
860 |
|
861 |
|
862 |
|
863 | isReservedTag: no,
|
864 |
|
865 | |
866 |
|
867 |
|
868 |
|
869 | isReservedAttr: no,
|
870 |
|
871 | |
872 |
|
873 |
|
874 |
|
875 | isUnknownElement: no,
|
876 |
|
877 | |
878 |
|
879 |
|
880 | getTagNamespace: noop,
|
881 |
|
882 | |
883 |
|
884 |
|
885 | parsePlatformTagName: identity,
|
886 |
|
887 | |
888 |
|
889 |
|
890 |
|
891 | mustUseProp: no,
|
892 |
|
893 | |
894 |
|
895 |
|
896 |
|
897 | async: true,
|
898 |
|
899 | |
900 |
|
901 |
|
902 | _lifecycleHooks: LIFECYCLE_HOOKS
|
903 | });
|
904 |
|
905 |
|
906 |
|
907 | var warn = noop;
|
908 | var tip = noop;
|
909 | var generateComponentTrace = (noop);
|
910 | var formatComponentName = (noop);
|
911 |
|
912 | if (process.env.NODE_ENV !== 'production') {
|
913 | var hasConsole = typeof console !== 'undefined';
|
914 | var classifyRE = /(?:^|[-_])(\w)/g;
|
915 | var classify = function (str) { return str
|
916 | .replace(classifyRE, function (c) { return c.toUpperCase(); })
|
917 | .replace(/[-_]/g, ''); };
|
918 |
|
919 | warn = function (msg, vm) {
|
920 | var trace = vm ? generateComponentTrace(vm) : '';
|
921 |
|
922 | if (hasConsole && (!config.silent)) {
|
923 | console.error(("[Vue warn]: " + msg + trace));
|
924 | }
|
925 | };
|
926 |
|
927 | tip = function (msg, vm) {
|
928 | if (hasConsole && (!config.silent)) {
|
929 | console.warn("[Vue tip]: " + msg + (
|
930 | vm ? generateComponentTrace(vm) : ''
|
931 | ));
|
932 | }
|
933 | };
|
934 |
|
935 | formatComponentName = function (vm, includeFile) {
|
936 | if (vm.$root === vm) {
|
937 | return '<Root>'
|
938 | }
|
939 | var options = typeof vm === 'function' && vm.cid != null
|
940 | ? vm.options
|
941 | : vm._isVue
|
942 | ? vm.$options || vm.constructor.options
|
943 | : vm;
|
944 | var name = options.name || options._componentTag;
|
945 | var file = options.__file;
|
946 | if (!name && file) {
|
947 | var match = file.match(/([^/\\]+)\.vue$/);
|
948 | name = match && match[1];
|
949 | }
|
950 |
|
951 | return (
|
952 | (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
953 | (file && includeFile !== false ? (" at " + file) : '')
|
954 | )
|
955 | };
|
956 |
|
957 | var repeat = function (str, n) {
|
958 | var res = '';
|
959 | while (n) {
|
960 | if (n % 2 === 1) { res += str; }
|
961 | if (n > 1) { str += str; }
|
962 | n >>= 1;
|
963 | }
|
964 | return res
|
965 | };
|
966 |
|
967 | generateComponentTrace = function (vm) {
|
968 | if (vm._isVue && vm.$parent) {
|
969 | var tree = [];
|
970 | var currentRecursiveSequence = 0;
|
971 | while (vm) {
|
972 | if (tree.length > 0) {
|
973 | var last = tree[tree.length - 1];
|
974 | if (last.constructor === vm.constructor) {
|
975 | currentRecursiveSequence++;
|
976 | vm = vm.$parent;
|
977 | continue
|
978 | } else if (currentRecursiveSequence > 0) {
|
979 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
980 | currentRecursiveSequence = 0;
|
981 | }
|
982 | }
|
983 | tree.push(vm);
|
984 | vm = vm.$parent;
|
985 | }
|
986 | return '\n\nfound in\n\n' + tree
|
987 | .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
988 | ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
989 | : formatComponentName(vm))); })
|
990 | .join('\n')
|
991 | } else {
|
992 | return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
993 | }
|
994 | };
|
995 | }
|
996 |
|
997 |
|
998 |
|
999 | var uid = 0;
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 | var Dep = function Dep () {
|
1006 | this.id = uid++;
|
1007 | this.subs = [];
|
1008 | };
|
1009 |
|
1010 | Dep.prototype.addSub = function addSub (sub) {
|
1011 | this.subs.push(sub);
|
1012 | };
|
1013 |
|
1014 | Dep.prototype.removeSub = function removeSub (sub) {
|
1015 | remove(this.subs, sub);
|
1016 | };
|
1017 |
|
1018 | Dep.prototype.depend = function depend () {
|
1019 | if (Dep.target) {
|
1020 | Dep.target.addDep(this);
|
1021 | }
|
1022 | };
|
1023 |
|
1024 | Dep.prototype.notify = function notify () {
|
1025 |
|
1026 | var subs = this.subs.slice();
|
1027 | if (process.env.NODE_ENV !== 'production' && !config.async) {
|
1028 |
|
1029 |
|
1030 |
|
1031 | subs.sort(function (a, b) { return a.id - b.id; });
|
1032 | }
|
1033 | for (var i = 0, l = subs.length; i < l; i++) {
|
1034 | subs[i].update();
|
1035 | }
|
1036 | };
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 | Dep.target = null;
|
1042 |
|
1043 |
|
1044 |
|
1045 | var VNode = function VNode (
|
1046 | tag,
|
1047 | data,
|
1048 | children,
|
1049 | text,
|
1050 | elm,
|
1051 | context,
|
1052 | componentOptions,
|
1053 | asyncFactory
|
1054 | ) {
|
1055 | this.tag = tag;
|
1056 | this.data = data;
|
1057 | this.children = children;
|
1058 | this.text = text;
|
1059 | this.elm = elm;
|
1060 | this.ns = undefined;
|
1061 | this.context = context;
|
1062 | this.fnContext = undefined;
|
1063 | this.fnOptions = undefined;
|
1064 | this.fnScopeId = undefined;
|
1065 | this.key = data && data.key;
|
1066 | this.componentOptions = componentOptions;
|
1067 | this.componentInstance = undefined;
|
1068 | this.parent = undefined;
|
1069 | this.raw = false;
|
1070 | this.isStatic = false;
|
1071 | this.isRootInsert = true;
|
1072 | this.isComment = false;
|
1073 | this.isCloned = false;
|
1074 | this.isOnce = false;
|
1075 | this.asyncFactory = asyncFactory;
|
1076 | this.asyncMeta = undefined;
|
1077 | this.isAsyncPlaceholder = false;
|
1078 | };
|
1079 |
|
1080 | var prototypeAccessors = { child: { configurable: true } };
|
1081 |
|
1082 |
|
1083 |
|
1084 | prototypeAccessors.child.get = function () {
|
1085 | return this.componentInstance
|
1086 | };
|
1087 |
|
1088 | Object.defineProperties( VNode.prototype, prototypeAccessors );
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 | var arrayProto = Array.prototype;
|
1096 | var arrayMethods = Object.create(arrayProto);
|
1097 |
|
1098 | var methodsToPatch = [
|
1099 | 'push',
|
1100 | 'pop',
|
1101 | 'shift',
|
1102 | 'unshift',
|
1103 | 'splice',
|
1104 | 'sort',
|
1105 | 'reverse'
|
1106 | ];
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 | methodsToPatch.forEach(function (method) {
|
1112 |
|
1113 | var original = arrayProto[method];
|
1114 | def(arrayMethods, method, function mutator () {
|
1115 | var args = [], len = arguments.length;
|
1116 | while ( len-- ) args[ len ] = arguments[ len ];
|
1117 |
|
1118 | var result = original.apply(this, args);
|
1119 | var ob = this.__ob__;
|
1120 | var inserted;
|
1121 | switch (method) {
|
1122 | case 'push':
|
1123 | case 'unshift':
|
1124 | inserted = args;
|
1125 | break
|
1126 | case 'splice':
|
1127 | inserted = args.slice(2);
|
1128 | break
|
1129 | }
|
1130 | if (inserted) { ob.observeArray(inserted); }
|
1131 |
|
1132 | ob.dep.notify();
|
1133 | return result
|
1134 | });
|
1135 | });
|
1136 |
|
1137 |
|
1138 |
|
1139 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 | var shouldObserve = true;
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 | var Observer = function Observer (value) {
|
1154 | this.value = value;
|
1155 | this.dep = new Dep();
|
1156 | this.vmCount = 0;
|
1157 | def(value, '__ob__', this);
|
1158 | if (Array.isArray(value)) {
|
1159 | if (hasProto) {
|
1160 | protoAugment(value, arrayMethods);
|
1161 | } else {
|
1162 | copyAugment(value, arrayMethods, arrayKeys);
|
1163 | }
|
1164 | this.observeArray(value);
|
1165 | } else {
|
1166 | this.walk(value);
|
1167 | }
|
1168 | };
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | Observer.prototype.walk = function walk (obj) {
|
1176 | var keys = Object.keys(obj);
|
1177 | for (var i = 0; i < keys.length; i++) {
|
1178 | defineReactive$$1(obj, keys[i]);
|
1179 | }
|
1180 | };
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 | Observer.prototype.observeArray = function observeArray (items) {
|
1186 | for (var i = 0, l = items.length; i < l; i++) {
|
1187 | observe(items[i]);
|
1188 | }
|
1189 | };
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 | function protoAugment (target, src) {
|
1198 |
|
1199 | target.__proto__ = src;
|
1200 |
|
1201 | }
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 | function copyAugment (target, src, keys) {
|
1209 | for (var i = 0, l = keys.length; i < l; i++) {
|
1210 | var key = keys[i];
|
1211 | def(target, key, src[key]);
|
1212 | }
|
1213 | }
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 | function observe (value, asRootData) {
|
1221 | if (!isObject(value) || value instanceof VNode) {
|
1222 | return
|
1223 | }
|
1224 | var ob;
|
1225 | if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
1226 | ob = value.__ob__;
|
1227 | } else if (
|
1228 | shouldObserve &&
|
1229 | !isServerRendering() &&
|
1230 | (Array.isArray(value) || isPlainObject(value)) &&
|
1231 | Object.isExtensible(value) &&
|
1232 | !value._isVue
|
1233 | ) {
|
1234 | ob = new Observer(value);
|
1235 | }
|
1236 | if (asRootData && ob) {
|
1237 | ob.vmCount++;
|
1238 | }
|
1239 | return ob
|
1240 | }
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 | function defineReactive$$1 (
|
1246 | obj,
|
1247 | key,
|
1248 | val,
|
1249 | customSetter,
|
1250 | shallow
|
1251 | ) {
|
1252 | var dep = new Dep();
|
1253 |
|
1254 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1255 | if (property && property.configurable === false) {
|
1256 | return
|
1257 | }
|
1258 |
|
1259 |
|
1260 | var getter = property && property.get;
|
1261 | var setter = property && property.set;
|
1262 | if ((!getter || setter) && arguments.length === 2) {
|
1263 | val = obj[key];
|
1264 | }
|
1265 |
|
1266 | var childOb = !shallow && observe(val);
|
1267 | Object.defineProperty(obj, key, {
|
1268 | enumerable: true,
|
1269 | configurable: true,
|
1270 | get: function reactiveGetter () {
|
1271 | var value = getter ? getter.call(obj) : val;
|
1272 | if (Dep.target) {
|
1273 | dep.depend();
|
1274 | if (childOb) {
|
1275 | childOb.dep.depend();
|
1276 | if (Array.isArray(value)) {
|
1277 | dependArray(value);
|
1278 | }
|
1279 | }
|
1280 | }
|
1281 | return value
|
1282 | },
|
1283 | set: function reactiveSetter (newVal) {
|
1284 | var value = getter ? getter.call(obj) : val;
|
1285 |
|
1286 | if (newVal === value || (newVal !== newVal && value !== value)) {
|
1287 | return
|
1288 | }
|
1289 |
|
1290 | if (process.env.NODE_ENV !== 'production' && customSetter) {
|
1291 | customSetter();
|
1292 | }
|
1293 |
|
1294 | if (getter && !setter) { return }
|
1295 | if (setter) {
|
1296 | setter.call(obj, newVal);
|
1297 | } else {
|
1298 | val = newVal;
|
1299 | }
|
1300 | childOb = !shallow && observe(newVal);
|
1301 | dep.notify();
|
1302 | }
|
1303 | });
|
1304 | }
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 | function set (target, key, val) {
|
1312 | if (process.env.NODE_ENV !== 'production' &&
|
1313 | (isUndef(target) || isPrimitive(target))
|
1314 | ) {
|
1315 | warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1316 | }
|
1317 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1318 | target.length = Math.max(target.length, key);
|
1319 | target.splice(key, 1, val);
|
1320 | return val
|
1321 | }
|
1322 | if (key in target && !(key in Object.prototype)) {
|
1323 | target[key] = val;
|
1324 | return val
|
1325 | }
|
1326 | var ob = (target).__ob__;
|
1327 | if (target._isVue || (ob && ob.vmCount)) {
|
1328 | process.env.NODE_ENV !== 'production' && warn(
|
1329 | 'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1330 | 'at runtime - declare it upfront in the data option.'
|
1331 | );
|
1332 | return val
|
1333 | }
|
1334 | if (!ob) {
|
1335 | target[key] = val;
|
1336 | return val
|
1337 | }
|
1338 | defineReactive$$1(ob.value, key, val);
|
1339 | ob.dep.notify();
|
1340 | return val
|
1341 | }
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 | function dependArray (value) {
|
1348 | for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1349 | e = value[i];
|
1350 | e && e.__ob__ && e.__ob__.dep.depend();
|
1351 | if (Array.isArray(e)) {
|
1352 | dependArray(e);
|
1353 | }
|
1354 | }
|
1355 | }
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 | var strats = config.optionMergeStrategies;
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 | if (process.env.NODE_ENV !== 'production') {
|
1370 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
1371 | if (!vm) {
|
1372 | warn(
|
1373 | "option \"" + key + "\" can only be used during instance " +
|
1374 | 'creation with the `new` keyword.'
|
1375 | );
|
1376 | }
|
1377 | return defaultStrat(parent, child)
|
1378 | };
|
1379 | }
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 | function mergeData (to, from) {
|
1385 | if (!from) { return to }
|
1386 | var key, toVal, fromVal;
|
1387 |
|
1388 | var keys = hasSymbol
|
1389 | ? Reflect.ownKeys(from)
|
1390 | : Object.keys(from);
|
1391 |
|
1392 | for (var i = 0; i < keys.length; i++) {
|
1393 | key = keys[i];
|
1394 |
|
1395 | if (key === '__ob__') { continue }
|
1396 | toVal = to[key];
|
1397 | fromVal = from[key];
|
1398 | if (!hasOwn(to, key)) {
|
1399 | set(to, key, fromVal);
|
1400 | } else if (
|
1401 | toVal !== fromVal &&
|
1402 | isPlainObject(toVal) &&
|
1403 | isPlainObject(fromVal)
|
1404 | ) {
|
1405 | mergeData(toVal, fromVal);
|
1406 | }
|
1407 | }
|
1408 | return to
|
1409 | }
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 | function mergeDataOrFn (
|
1415 | parentVal,
|
1416 | childVal,
|
1417 | vm
|
1418 | ) {
|
1419 | if (!vm) {
|
1420 |
|
1421 | if (!childVal) {
|
1422 | return parentVal
|
1423 | }
|
1424 | if (!parentVal) {
|
1425 | return childVal
|
1426 | }
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 | return function mergedDataFn () {
|
1433 | return mergeData(
|
1434 | typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1435 | typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1436 | )
|
1437 | }
|
1438 | } else {
|
1439 | return function mergedInstanceDataFn () {
|
1440 |
|
1441 | var instanceData = typeof childVal === 'function'
|
1442 | ? childVal.call(vm, vm)
|
1443 | : childVal;
|
1444 | var defaultData = typeof parentVal === 'function'
|
1445 | ? parentVal.call(vm, vm)
|
1446 | : parentVal;
|
1447 | if (instanceData) {
|
1448 | return mergeData(instanceData, defaultData)
|
1449 | } else {
|
1450 | return defaultData
|
1451 | }
|
1452 | }
|
1453 | }
|
1454 | }
|
1455 |
|
1456 | strats.data = function (
|
1457 | parentVal,
|
1458 | childVal,
|
1459 | vm
|
1460 | ) {
|
1461 | if (!vm) {
|
1462 | if (childVal && typeof childVal !== 'function') {
|
1463 | process.env.NODE_ENV !== 'production' && warn(
|
1464 | 'The "data" option should be a function ' +
|
1465 | 'that returns a per-instance value in component ' +
|
1466 | 'definitions.',
|
1467 | vm
|
1468 | );
|
1469 |
|
1470 | return parentVal
|
1471 | }
|
1472 | return mergeDataOrFn(parentVal, childVal)
|
1473 | }
|
1474 |
|
1475 | return mergeDataOrFn(parentVal, childVal, vm)
|
1476 | };
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | function mergeHook (
|
1482 | parentVal,
|
1483 | childVal
|
1484 | ) {
|
1485 | var res = childVal
|
1486 | ? parentVal
|
1487 | ? parentVal.concat(childVal)
|
1488 | : Array.isArray(childVal)
|
1489 | ? childVal
|
1490 | : [childVal]
|
1491 | : parentVal;
|
1492 | return res
|
1493 | ? dedupeHooks(res)
|
1494 | : res
|
1495 | }
|
1496 |
|
1497 | function dedupeHooks (hooks) {
|
1498 | var res = [];
|
1499 | for (var i = 0; i < hooks.length; i++) {
|
1500 | if (res.indexOf(hooks[i]) === -1) {
|
1501 | res.push(hooks[i]);
|
1502 | }
|
1503 | }
|
1504 | return res
|
1505 | }
|
1506 |
|
1507 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
1508 | strats[hook] = mergeHook;
|
1509 | });
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 | function mergeAssets (
|
1519 | parentVal,
|
1520 | childVal,
|
1521 | vm,
|
1522 | key
|
1523 | ) {
|
1524 | var res = Object.create(parentVal || null);
|
1525 | if (childVal) {
|
1526 | process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
|
1527 | return extend(res, childVal)
|
1528 | } else {
|
1529 | return res
|
1530 | }
|
1531 | }
|
1532 |
|
1533 | ASSET_TYPES.forEach(function (type) {
|
1534 | strats[type + 's'] = mergeAssets;
|
1535 | });
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 | strats.watch = function (
|
1544 | parentVal,
|
1545 | childVal,
|
1546 | vm,
|
1547 | key
|
1548 | ) {
|
1549 |
|
1550 | if (parentVal === nativeWatch) { parentVal = undefined; }
|
1551 | if (childVal === nativeWatch) { childVal = undefined; }
|
1552 |
|
1553 | if (!childVal) { return Object.create(parentVal || null) }
|
1554 | if (process.env.NODE_ENV !== 'production') {
|
1555 | assertObjectType(key, childVal, vm);
|
1556 | }
|
1557 | if (!parentVal) { return childVal }
|
1558 | var ret = {};
|
1559 | extend(ret, parentVal);
|
1560 | for (var key$1 in childVal) {
|
1561 | var parent = ret[key$1];
|
1562 | var child = childVal[key$1];
|
1563 | if (parent && !Array.isArray(parent)) {
|
1564 | parent = [parent];
|
1565 | }
|
1566 | ret[key$1] = parent
|
1567 | ? parent.concat(child)
|
1568 | : Array.isArray(child) ? child : [child];
|
1569 | }
|
1570 | return ret
|
1571 | };
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 | strats.props =
|
1577 | strats.methods =
|
1578 | strats.inject =
|
1579 | strats.computed = function (
|
1580 | parentVal,
|
1581 | childVal,
|
1582 | vm,
|
1583 | key
|
1584 | ) {
|
1585 | if (childVal && process.env.NODE_ENV !== 'production') {
|
1586 | assertObjectType(key, childVal, vm);
|
1587 | }
|
1588 | if (!parentVal) { return childVal }
|
1589 | var ret = Object.create(null);
|
1590 | extend(ret, parentVal);
|
1591 | if (childVal) { extend(ret, childVal); }
|
1592 | return ret
|
1593 | };
|
1594 | strats.provide = mergeDataOrFn;
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 | var defaultStrat = function (parentVal, childVal) {
|
1600 | return childVal === undefined
|
1601 | ? parentVal
|
1602 | : childVal
|
1603 | };
|
1604 |
|
1605 | function assertObjectType (name, value, vm) {
|
1606 | if (!isPlainObject(value)) {
|
1607 | warn(
|
1608 | "Invalid value for option \"" + name + "\": expected an Object, " +
|
1609 | "but got " + (toRawType(value)) + ".",
|
1610 | vm
|
1611 | );
|
1612 | }
|
1613 | }
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 | var callbacks = [];
|
1622 |
|
1623 | function flushCallbacks () {
|
1624 | var copies = callbacks.slice(0);
|
1625 | callbacks.length = 0;
|
1626 | for (var i = 0; i < copies.length; i++) {
|
1627 | copies[i]();
|
1628 | }
|
1629 | }
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 | if (typeof Promise !== 'undefined' && isNative(Promise)) ; else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1639 | isNative(MutationObserver) ||
|
1640 |
|
1641 | MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1642 | )) {
|
1643 |
|
1644 |
|
1645 |
|
1646 | var counter = 1;
|
1647 | var observer = new MutationObserver(flushCallbacks);
|
1648 | var textNode = document.createTextNode(String(counter));
|
1649 | observer.observe(textNode, {
|
1650 | characterData: true
|
1651 | });
|
1652 | } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 | var ROOT_DATA_VAR = '$root';
|
1676 | var HOLDER_VAR = 'h';
|
1677 | var SLOT_HOLDER_VAR = 's';
|
1678 | var PARENT_SCOPE_ID_VAR = 'p';
|
1679 | var FOR_TAIL_VAR = '_t';
|
1680 | var VM_ID_PREFIX = 'cp';
|
1681 |
|
1682 | var LIST_TAIL_SEPS = {
|
1683 | swan: '_',
|
1684 | wechat: '-',
|
1685 | alipay: '-'
|
1686 | };
|
1687 |
|
1688 | var HOLDER_TYPE_VARS = {
|
1689 | text: 't',
|
1690 | vtext: 'vt',
|
1691 | if: '_if',
|
1692 | for: 'li',
|
1693 | class: 'cl',
|
1694 | rootClass: 'rcl',
|
1695 | style: 'st',
|
1696 | value: 'value',
|
1697 | vhtml: 'html',
|
1698 | vshow: 'vs',
|
1699 | slot: 'slot'
|
1700 | };
|
1701 |
|
1702 |
|
1703 |
|
1704 | var notEmpty = function (e) { return !!e; };
|
1705 | var isPreTag = function (tag) { return tag === 'pre'; };
|
1706 |
|
1707 | var isHTMLTag = makeMap(
|
1708 | 'html,body,base,head,link,meta,style,title,' +
|
1709 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
1710 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
1711 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
1712 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
1713 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
1714 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
1715 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
1716 | 'output,progress,select,textarea,' +
|
1717 | 'details,dialog,menu,menuitem,summary,' +
|
1718 | 'content,element,shadow,template,blockquote,iframe,tfoot'
|
1719 | );
|
1720 |
|
1721 | var isReservedTag = function (tag) {
|
1722 | return isHTMLTag(tag)
|
1723 | };
|
1724 |
|
1725 |
|
1726 |
|
1727 | var isReservedAttr = makeMap('style,class');
|
1728 |
|
1729 |
|
1730 |
|
1731 | var canBeLeftOpenTag$1 = makeMap(
|
1732 | 'web,spinner,switch,video,textarea,canvas,' +
|
1733 | 'indicator,marquee,countdown',
|
1734 | true
|
1735 | );
|
1736 |
|
1737 | var isUnaryTag$1 = makeMap(
|
1738 | 'embed,img,image,input,link,meta',
|
1739 | true
|
1740 | );
|
1741 |
|
1742 | function mustUseProp () { }
|
1743 | function getTagNamespace () { }
|
1744 |
|
1745 |
|
1746 |
|
1747 | var validDivisionCharRE = /[\w).+\-_$\]]/;
|
1748 |
|
1749 | function parseFilters (exp) {
|
1750 | var inSingle = false;
|
1751 | var inDouble = false;
|
1752 | var inTemplateString = false;
|
1753 | var inRegex = false;
|
1754 | var curly = 0;
|
1755 | var square = 0;
|
1756 | var paren = 0;
|
1757 | var lastFilterIndex = 0;
|
1758 | var c, prev, i, expression, filters;
|
1759 |
|
1760 | for (i = 0; i < exp.length; i++) {
|
1761 | prev = c;
|
1762 | c = exp.charCodeAt(i);
|
1763 | if (inSingle) {
|
1764 | if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
1765 | } else if (inDouble) {
|
1766 | if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
1767 | } else if (inTemplateString) {
|
1768 | if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
1769 | } else if (inRegex) {
|
1770 | if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
1771 | } else if (
|
1772 | c === 0x7C &&
|
1773 | exp.charCodeAt(i + 1) !== 0x7C &&
|
1774 | exp.charCodeAt(i - 1) !== 0x7C &&
|
1775 | !curly && !square && !paren
|
1776 | ) {
|
1777 | if (expression === undefined) {
|
1778 |
|
1779 | lastFilterIndex = i + 1;
|
1780 | expression = exp.slice(0, i).trim();
|
1781 | } else {
|
1782 | pushFilter();
|
1783 | }
|
1784 | } else {
|
1785 | switch (c) {
|
1786 | case 0x22: inDouble = true; break
|
1787 | case 0x27: inSingle = true; break
|
1788 | case 0x60: inTemplateString = true; break
|
1789 | case 0x28: paren++; break
|
1790 | case 0x29: paren--; break
|
1791 | case 0x5B: square++; break
|
1792 | case 0x5D: square--; break
|
1793 | case 0x7B: curly++; break
|
1794 | case 0x7D: curly--; break
|
1795 | }
|
1796 | if (c === 0x2f) {
|
1797 | var j = i - 1;
|
1798 | var p = (void 0);
|
1799 |
|
1800 | for (; j >= 0; j--) {
|
1801 | p = exp.charAt(j);
|
1802 | if (p !== ' ') { break }
|
1803 | }
|
1804 | if (!p || !validDivisionCharRE.test(p)) {
|
1805 | inRegex = true;
|
1806 | }
|
1807 | }
|
1808 | }
|
1809 | }
|
1810 |
|
1811 | if (expression === undefined) {
|
1812 | expression = exp.slice(0, i).trim();
|
1813 | } else if (lastFilterIndex !== 0) {
|
1814 | pushFilter();
|
1815 | }
|
1816 |
|
1817 | function pushFilter () {
|
1818 | (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
1819 | lastFilterIndex = i + 1;
|
1820 | }
|
1821 |
|
1822 | if (filters) {
|
1823 | for (i = 0; i < filters.length; i++) {
|
1824 | expression = wrapFilter(expression, filters[i]);
|
1825 | }
|
1826 | }
|
1827 |
|
1828 | return expression
|
1829 | }
|
1830 |
|
1831 | function wrapFilter (exp, filter) {
|
1832 | var i = filter.indexOf('(');
|
1833 | if (i < 0) {
|
1834 |
|
1835 | return ("_f(\"" + filter + "\")(" + exp + ")")
|
1836 | } else {
|
1837 | var name = filter.slice(0, i);
|
1838 | var args = filter.slice(i + 1);
|
1839 | return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
1840 | }
|
1841 | }
|
1842 |
|
1843 |
|
1844 |
|
1845 | var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
1846 | var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
1847 |
|
1848 | var buildRegex = cached(function (delimiters) {
|
1849 | var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
1850 | var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
1851 | return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
1852 | });
|
1853 |
|
1854 |
|
1855 |
|
1856 | function parseText (
|
1857 | text,
|
1858 | delimiters
|
1859 | ) {
|
1860 | var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
1861 | if (!tagRE.test(text)) {
|
1862 | return
|
1863 | }
|
1864 | var tokens = [];
|
1865 | var rawTokens = [];
|
1866 | var lastIndex = tagRE.lastIndex = 0;
|
1867 | var match, index, tokenValue;
|
1868 | while ((match = tagRE.exec(text))) {
|
1869 | index = match.index;
|
1870 |
|
1871 | if (index > lastIndex) {
|
1872 | rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
1873 | tokens.push(JSON.stringify(tokenValue));
|
1874 | }
|
1875 |
|
1876 | var exp = parseFilters(match[1].trim());
|
1877 | tokens.push(("_s(" + exp + ")"));
|
1878 | rawTokens.push({ '@binding': exp });
|
1879 | lastIndex = index + match[0].length;
|
1880 | }
|
1881 | if (lastIndex < text.length) {
|
1882 | rawTokens.push(tokenValue = text.slice(lastIndex));
|
1883 | tokens.push(JSON.stringify(tokenValue));
|
1884 | }
|
1885 | return {
|
1886 | expression: tokens.join('+'),
|
1887 | tokens: rawTokens
|
1888 | }
|
1889 | }
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 | function baseWarn (msg, range) {
|
1897 | console.error(("[Vue compiler]: " + msg));
|
1898 | }
|
1899 |
|
1900 |
|
1901 | function pluckModuleFunction (
|
1902 | modules,
|
1903 | key
|
1904 | ) {
|
1905 | return modules
|
1906 | ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
1907 | : []
|
1908 | }
|
1909 |
|
1910 | function addProp (el, name, value, range, dynamic) {
|
1911 | (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
1912 | el.plain = false;
|
1913 | }
|
1914 |
|
1915 | function addAttr (el, name, value, range, dynamic) {
|
1916 | var attrs = dynamic
|
1917 | ? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
1918 | : (el.attrs || (el.attrs = []));
|
1919 | attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
1920 | el.plain = false;
|
1921 | }
|
1922 |
|
1923 | function addDirective (
|
1924 | el,
|
1925 | name,
|
1926 | rawName,
|
1927 | value,
|
1928 | arg,
|
1929 | isDynamicArg,
|
1930 | modifiers,
|
1931 | range
|
1932 | ) {
|
1933 | (el.directives || (el.directives = [])).push(rangeSetItem({
|
1934 | name: name,
|
1935 | rawName: rawName,
|
1936 | value: value,
|
1937 | arg: arg,
|
1938 | isDynamicArg: isDynamicArg,
|
1939 | modifiers: modifiers
|
1940 | }, range));
|
1941 | el.plain = false;
|
1942 | }
|
1943 |
|
1944 | function prependModifierMarker (symbol, name, dynamic) {
|
1945 | return dynamic
|
1946 | ? ("_p(" + name + ",\"" + symbol + "\")")
|
1947 | : symbol + name
|
1948 | }
|
1949 |
|
1950 | function addHandler (
|
1951 | el,
|
1952 | name,
|
1953 | value,
|
1954 | modifiers,
|
1955 | important,
|
1956 | warn,
|
1957 | range,
|
1958 | dynamic
|
1959 | ) {
|
1960 | modifiers = modifiers || emptyObject;
|
1961 |
|
1962 |
|
1963 | if (
|
1964 | process.env.NODE_ENV !== 'production' && warn &&
|
1965 | modifiers.prevent && modifiers.passive
|
1966 | ) {
|
1967 | warn(
|
1968 | 'passive and prevent can\'t be used together. ' +
|
1969 | 'Passive handler can\'t prevent default event.',
|
1970 | range
|
1971 | );
|
1972 | }
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 | if (modifiers.right) {
|
1978 | if (dynamic) {
|
1979 | name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
1980 | } else if (name === 'click') {
|
1981 | name = 'contextmenu';
|
1982 | delete modifiers.right;
|
1983 | }
|
1984 | } else if (modifiers.middle) {
|
1985 | if (dynamic) {
|
1986 | name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
1987 | } else if (name === 'click') {
|
1988 | name = 'mouseup';
|
1989 | }
|
1990 | }
|
1991 |
|
1992 |
|
1993 | if (modifiers.capture) {
|
1994 | delete modifiers.capture;
|
1995 | name = prependModifierMarker('!', name, dynamic);
|
1996 | }
|
1997 | if (modifiers.once) {
|
1998 | delete modifiers.once;
|
1999 | name = prependModifierMarker('~', name, dynamic);
|
2000 | }
|
2001 |
|
2002 | if (modifiers.passive) {
|
2003 | delete modifiers.passive;
|
2004 | name = prependModifierMarker('&', name, dynamic);
|
2005 | }
|
2006 |
|
2007 | var events;
|
2008 | if (modifiers.native) {
|
2009 | delete modifiers.native;
|
2010 | events = el.nativeEvents || (el.nativeEvents = {});
|
2011 | } else {
|
2012 | events = el.events || (el.events = {});
|
2013 | }
|
2014 |
|
2015 | var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
2016 | if (modifiers !== emptyObject) {
|
2017 | newHandler.modifiers = modifiers;
|
2018 | }
|
2019 |
|
2020 | var handlers = events[name];
|
2021 |
|
2022 | if (Array.isArray(handlers)) {
|
2023 | important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
2024 | } else if (handlers) {
|
2025 | events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
2026 | } else {
|
2027 | events[name] = newHandler;
|
2028 | }
|
2029 |
|
2030 | el.plain = false;
|
2031 | }
|
2032 |
|
2033 | function getRawBindingAttr (
|
2034 | el,
|
2035 | name
|
2036 | ) {
|
2037 | return el.rawAttrsMap[':' + name] ||
|
2038 | el.rawAttrsMap['v-bind:' + name] ||
|
2039 | el.rawAttrsMap[name]
|
2040 | }
|
2041 |
|
2042 | function getBindingAttr (
|
2043 | el,
|
2044 | name,
|
2045 | getStatic
|
2046 | ) {
|
2047 | var dynamicValue =
|
2048 | getAndRemoveAttr(el, ':' + name) ||
|
2049 | getAndRemoveAttr(el, 'v-bind:' + name);
|
2050 | if (dynamicValue != null) {
|
2051 | return parseFilters(dynamicValue)
|
2052 | } else if (getStatic !== false) {
|
2053 | var staticValue = getAndRemoveAttr(el, name);
|
2054 | if (staticValue != null) {
|
2055 | return JSON.stringify(staticValue)
|
2056 | }
|
2057 | }
|
2058 | }
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 | function getAndRemoveAttr (
|
2065 | el,
|
2066 | name,
|
2067 | removeFromMap
|
2068 | ) {
|
2069 | var val;
|
2070 | if ((val = el.attrsMap[name]) != null) {
|
2071 | var list = el.attrsList;
|
2072 | for (var i = 0, l = list.length; i < l; i++) {
|
2073 | if (list[i].name === name) {
|
2074 | list.splice(i, 1);
|
2075 | break
|
2076 | }
|
2077 | }
|
2078 | }
|
2079 | if (removeFromMap) {
|
2080 | delete el.attrsMap[name];
|
2081 | }
|
2082 | return val
|
2083 | }
|
2084 |
|
2085 | function getAndRemoveAttrByRegex (
|
2086 | el,
|
2087 | name
|
2088 | ) {
|
2089 | var list = el.attrsList;
|
2090 | for (var i = 0, l = list.length; i < l; i++) {
|
2091 | var attr = list[i];
|
2092 | if (name.test(attr.name)) {
|
2093 | list.splice(i, 1);
|
2094 | return attr
|
2095 | }
|
2096 | }
|
2097 | }
|
2098 |
|
2099 | function rangeSetItem (
|
2100 | item,
|
2101 | range
|
2102 | ) {
|
2103 | if (range) {
|
2104 | if (range.start != null) {
|
2105 | item.start = range.start;
|
2106 | }
|
2107 | if (range.end != null) {
|
2108 | item.end = range.end;
|
2109 | }
|
2110 | }
|
2111 | return item
|
2112 | }
|
2113 |
|
2114 |
|
2115 |
|
2116 | function transformNode (el, options) {
|
2117 | var warn = options.warn || baseWarn;
|
2118 | var staticClass = getAndRemoveAttr(el, 'class');
|
2119 | if (process.env.NODE_ENV !== 'production' && staticClass) {
|
2120 | var res = parseText(staticClass, options.delimiters);
|
2121 | if (res) {
|
2122 | warn(
|
2123 | "class=\"" + staticClass + "\": " +
|
2124 | 'Interpolation inside attributes has been removed. ' +
|
2125 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
2126 | 'instead of <div class="{{ val }}">, use <div :class="val">.',
|
2127 | el.rawAttrsMap['class']
|
2128 | );
|
2129 | }
|
2130 | }
|
2131 | if (staticClass) {
|
2132 | el.staticClass = JSON.stringify(staticClass);
|
2133 | }
|
2134 | var classBinding = getBindingAttr(el, 'class', false );
|
2135 | if (classBinding) {
|
2136 | el.classBinding = classBinding;
|
2137 | }
|
2138 | }
|
2139 |
|
2140 | function genData (el) {
|
2141 | var data = '';
|
2142 |
|
2143 | if (el.c_ && el.staticClass) {
|
2144 | data += "staticClass:" + (el.staticClass) + ",";
|
2145 | }
|
2146 | if (el.classBinding) {
|
2147 | data += "class:" + (el.classBinding) + ",";
|
2148 | }
|
2149 | return data
|
2150 | }
|
2151 |
|
2152 | var klass = {
|
2153 | staticKeys: ['staticClass'],
|
2154 | transformNode: transformNode,
|
2155 | genData: genData
|
2156 | };
|
2157 |
|
2158 |
|
2159 |
|
2160 | var parseStyleText = cached(function (cssText) {
|
2161 | var res = {};
|
2162 | var listDelimiter = /;(?![^(]*\))/g;
|
2163 | var propertyDelimiter = /:(.+)/;
|
2164 | cssText.split(listDelimiter).forEach(function (item) {
|
2165 | if (item) {
|
2166 | var tmp = item.split(propertyDelimiter);
|
2167 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
2168 | }
|
2169 | });
|
2170 | return res
|
2171 | });
|
2172 |
|
2173 |
|
2174 |
|
2175 | function transformNode$1 (el, options) {
|
2176 | var warn = options.warn || baseWarn;
|
2177 | var staticStyle = getAndRemoveAttr(el, 'style');
|
2178 | if (staticStyle) {
|
2179 |
|
2180 | if (process.env.NODE_ENV !== 'production') {
|
2181 | var res = parseText(staticStyle, options.delimiters);
|
2182 | if (res) {
|
2183 | warn(
|
2184 | "style=\"" + staticStyle + "\": " +
|
2185 | 'Interpolation inside attributes has been removed. ' +
|
2186 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
2187 | 'instead of <div style="{{ val }}">, use <div :style="val">.',
|
2188 | el.rawAttrsMap['style']
|
2189 | );
|
2190 | }
|
2191 | }
|
2192 | el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
2193 | }
|
2194 |
|
2195 | var styleBinding = getBindingAttr(el, 'style', false );
|
2196 | if (styleBinding) {
|
2197 | el.styleBinding = styleBinding;
|
2198 | }
|
2199 | }
|
2200 |
|
2201 | function genData$1 (el) {
|
2202 | var data = '';
|
2203 | if (el.c_ && el.staticStyle) {
|
2204 | data += "staticStyle:" + (el.staticStyle) + ",";
|
2205 | }
|
2206 | if (el.styleBinding) {
|
2207 | data += "style:(" + (el.styleBinding) + "),";
|
2208 | }
|
2209 | return data
|
2210 | }
|
2211 |
|
2212 | var style = {
|
2213 | staticKeys: ['staticStyle'],
|
2214 | transformNode: transformNode$1,
|
2215 | genData: genData$1
|
2216 | };
|
2217 |
|
2218 | var modules = [
|
2219 | klass,
|
2220 | style
|
2221 | ];
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 | function genComponentModel (
|
2229 | el,
|
2230 | value,
|
2231 | modifiers
|
2232 | ) {
|
2233 | var ref = modifiers || {};
|
2234 | var number = ref.number;
|
2235 | var trim = ref.trim;
|
2236 |
|
2237 | var baseValueExpression = '$$v';
|
2238 | var valueExpression = baseValueExpression;
|
2239 | if (trim) {
|
2240 | valueExpression =
|
2241 | "(typeof " + baseValueExpression + " === 'string'" +
|
2242 | "? " + baseValueExpression + ".trim()" +
|
2243 | ": " + baseValueExpression + ")";
|
2244 | }
|
2245 | if (number) {
|
2246 | valueExpression = "_n(" + valueExpression + ")";
|
2247 | }
|
2248 | var assignment = genAssignmentCode(value, valueExpression);
|
2249 |
|
2250 | el.model = {
|
2251 | value: ("(" + value + ")"),
|
2252 | expression: JSON.stringify(value),
|
2253 | callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
2254 | };
|
2255 | }
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 | function genAssignmentCode (
|
2261 | value,
|
2262 | assignment
|
2263 | ) {
|
2264 | var res = parseModel(value);
|
2265 | if (res.key === null) {
|
2266 | return (value + "=" + assignment)
|
2267 | } else {
|
2268 | return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
2269 | }
|
2270 | }
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 |
|
2287 | var len, str, chr, index, expressionPos, expressionEndPos;
|
2288 |
|
2289 |
|
2290 |
|
2291 | function parseModel (val) {
|
2292 |
|
2293 |
|
2294 | val = val.trim();
|
2295 | len = val.length;
|
2296 |
|
2297 | if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
2298 | index = val.lastIndexOf('.');
|
2299 | if (index > -1) {
|
2300 | return {
|
2301 | exp: val.slice(0, index),
|
2302 | key: '"' + val.slice(index + 1) + '"'
|
2303 | }
|
2304 | } else {
|
2305 | return {
|
2306 | exp: val,
|
2307 | key: null
|
2308 | }
|
2309 | }
|
2310 | }
|
2311 |
|
2312 | str = val;
|
2313 | index = expressionPos = expressionEndPos = 0;
|
2314 |
|
2315 | while (!eof()) {
|
2316 | chr = next();
|
2317 |
|
2318 | if (isStringStart(chr)) {
|
2319 | parseString(chr);
|
2320 | } else if (chr === 0x5B) {
|
2321 | parseBracket(chr);
|
2322 | }
|
2323 | }
|
2324 |
|
2325 | return {
|
2326 | exp: val.slice(0, expressionPos),
|
2327 | key: val.slice(expressionPos + 1, expressionEndPos)
|
2328 | }
|
2329 | }
|
2330 |
|
2331 | function next () {
|
2332 | return str.charCodeAt(++index)
|
2333 | }
|
2334 |
|
2335 | function eof () {
|
2336 | return index >= len
|
2337 | }
|
2338 |
|
2339 | function isStringStart (chr) {
|
2340 | return chr === 0x22 || chr === 0x27
|
2341 | }
|
2342 |
|
2343 | function parseBracket (chr) {
|
2344 | var inBracket = 1;
|
2345 | expressionPos = index;
|
2346 | while (!eof()) {
|
2347 | chr = next();
|
2348 | if (isStringStart(chr)) {
|
2349 | parseString(chr);
|
2350 | continue
|
2351 | }
|
2352 | if (chr === 0x5B) { inBracket++; }
|
2353 | if (chr === 0x5D) { inBracket--; }
|
2354 | if (inBracket === 0) {
|
2355 | expressionEndPos = index;
|
2356 | break
|
2357 | }
|
2358 | }
|
2359 | }
|
2360 |
|
2361 | function parseString (chr) {
|
2362 | var stringQuote = chr;
|
2363 | while (!eof()) {
|
2364 | chr = next();
|
2365 | if (chr === stringQuote) {
|
2366 | break
|
2367 | }
|
2368 | }
|
2369 | }
|
2370 |
|
2371 |
|
2372 |
|
2373 | var warn$1;
|
2374 |
|
2375 |
|
2376 |
|
2377 | var RANGE_TOKEN = '__r';
|
2378 |
|
2379 | function model (
|
2380 | el,
|
2381 | dir,
|
2382 | _warn
|
2383 | ) {
|
2384 | warn$1 = _warn;
|
2385 | var value = dir.value;
|
2386 | var modifiers = dir.modifiers;
|
2387 | var tag = el.tag;
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 | if (el.component) {
|
2404 | genComponentModel(el, value, modifiers);
|
2405 |
|
2406 | return false
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 | } else if (tag === 'input' || tag === 'textarea') {
|
2414 | genDefaultModel(el, value, modifiers);
|
2415 | } else if (!config.isReservedTag(tag)) {
|
2416 | genComponentModel(el, value, modifiers);
|
2417 |
|
2418 | return false
|
2419 |
|
2420 | } else if (process.env.NODE_ENV !== 'production') {
|
2421 | warn$1(
|
2422 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
2423 | "v-model is not supported on this element type. " +
|
2424 | 'If you are working with contenteditable, it\'s recommended to ' +
|
2425 | 'wrap a library dedicated for that purpose inside a custom component.',
|
2426 | el.rawAttrsMap['v-model']
|
2427 | );
|
2428 | }
|
2429 |
|
2430 |
|
2431 | return true
|
2432 | }
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 | function genDefaultModel (
|
2495 | el,
|
2496 | value,
|
2497 | modifiers
|
2498 | ) {
|
2499 | var type = el.attrsMap.type;
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 | if (process.env.NODE_ENV !== 'production') {
|
2505 | var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
2506 | var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
2507 | if (value$1 && !typeBinding) {
|
2508 | var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
2509 | warn$1(
|
2510 | binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
2511 | 'because the latter already expands to a value binding internally',
|
2512 | el.rawAttrsMap[binding]
|
2513 | );
|
2514 | }
|
2515 | }
|
2516 |
|
2517 | var ref = modifiers || {};
|
2518 | var lazy = ref.lazy;
|
2519 | var number = ref.number;
|
2520 | var trim = ref.trim;
|
2521 | var needCompositionGuard = !lazy && type !== 'range';
|
2522 |
|
2523 | var event = lazy
|
2524 | ? 'blur'
|
2525 | : type === 'range'
|
2526 | ? RANGE_TOKEN
|
2527 | : 'input';
|
2528 |
|
2529 | var valueExpression = '$event.target.value';
|
2530 | if (trim) {
|
2531 | valueExpression = "$event.target.value.trim()";
|
2532 | }
|
2533 | if (number) {
|
2534 | valueExpression = "_n(" + valueExpression + ")";
|
2535 | }
|
2536 |
|
2537 | var code = genAssignmentCode(value, valueExpression);
|
2538 | if (needCompositionGuard) {
|
2539 | code = "if($event.target.composing)return;" + code;
|
2540 | }
|
2541 |
|
2542 | addProp(el, 'value', ("(" + value + ")"));
|
2543 | addHandler(el, event, code, null, true);
|
2544 | if (trim || number) {
|
2545 | addHandler(el, 'blur', '$forceUpdate()');
|
2546 | }
|
2547 | }
|
2548 |
|
2549 |
|
2550 |
|
2551 | function text (el, dir) {
|
2552 |
|
2553 | if (dir.value) {
|
2554 | addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
2555 | }
|
2556 | }
|
2557 |
|
2558 |
|
2559 |
|
2560 | function html (el, dir) {
|
2561 |
|
2562 | if (dir.value) {
|
2563 | addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
2564 | }
|
2565 | }
|
2566 |
|
2567 | var directives = {
|
2568 | model: model,
|
2569 | text: text,
|
2570 | html: html
|
2571 | };
|
2572 |
|
2573 |
|
2574 |
|
2575 | var isUnaryTag$2 = makeMap(
|
2576 | 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
2577 | 'link,meta,param,source,track,wbr'
|
2578 | );
|
2579 |
|
2580 |
|
2581 |
|
2582 | var canBeLeftOpenTag$2 = makeMap(
|
2583 | 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
2584 | );
|
2585 |
|
2586 |
|
2587 |
|
2588 | var isNonPhrasingTag$1 = makeMap(
|
2589 | 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
2590 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
2591 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
2592 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
2593 | 'title,tr,track'
|
2594 | );
|
2595 |
|
2596 | var removeQuotes = function (t) {
|
2597 | if ( t === void 0 ) t = '';
|
2598 |
|
2599 | return t.replace(/"/g, '');
|
2600 | };
|
2601 |
|
2602 | function cloneAST (ast) {
|
2603 | var walked = [];
|
2604 | var newAst = doClone(ast);
|
2605 | return newAst
|
2606 | function doClone (old) {
|
2607 | var walkedVal = walked.find(function (v) { return v.old === old; });
|
2608 | if (walkedVal) {
|
2609 | return walkedVal._new
|
2610 | }
|
2611 | if (typeof old === 'object') {
|
2612 | var _new = Array.isArray(old) ? [] : {};
|
2613 | walked.push({ _new: _new, old: old });
|
2614 | for (var key in old) {
|
2615 | var newVal = doClone(old[key]);
|
2616 | _new[key] = newVal;
|
2617 | }
|
2618 | return _new
|
2619 | } else {
|
2620 | return old
|
2621 | }
|
2622 | }
|
2623 | }
|
2624 |
|
2625 | var Stack = function Stack () {
|
2626 | this.stack = [];
|
2627 | };
|
2628 |
|
2629 | var prototypeAccessors$1 = { top: { configurable: true } };
|
2630 | Stack.prototype.push = function push (data) {
|
2631 | return this.stack.push(data)
|
2632 | };
|
2633 | Stack.prototype.pop = function pop () {
|
2634 | return this.stack.pop()
|
2635 | };
|
2636 | prototypeAccessors$1.top.get = function () {
|
2637 | return this.stack[this.stack.length - 1] || null
|
2638 | };
|
2639 |
|
2640 | Object.defineProperties( Stack.prototype, prototypeAccessors$1 );
|
2641 |
|
2642 | var createUidFn = function (prefix) {
|
2643 | if ( prefix === void 0 ) prefix = '';
|
2644 |
|
2645 | var id = 0;
|
2646 | return function () {
|
2647 | return ("" + prefix + (id++))
|
2648 | }
|
2649 | };
|
2650 |
|
2651 | var uid$1 = createUidFn();
|
2652 |
|
2653 | var escapeText = function (str) {
|
2654 | if ( str === void 0 ) str = '';
|
2655 |
|
2656 | return str.replace(/\</g, "{{\"<\"}}")
|
2657 | };
|
2658 |
|
2659 | function getComponentInfo (name, imports) {
|
2660 | if ( imports === void 0 ) imports = {};
|
2661 |
|
2662 | var camelizedName = camelize(name);
|
2663 | var pascalizedName = pascalize(name);
|
2664 | return (
|
2665 | imports[name] ||
|
2666 | imports[camelizedName] ||
|
2667 | imports[pascalizedName] ||
|
2668 | null
|
2669 | )
|
2670 | }
|
2671 |
|
2672 | function pascalize (str) {
|
2673 | if ( str === void 0 ) str = '';
|
2674 |
|
2675 | var camelized = camelize(str);
|
2676 | var pascalized = capitalize(camelized);
|
2677 | return pascalized
|
2678 | }
|
2679 |
|
2680 |
|
2681 |
|
2682 | var baseOptions = {
|
2683 | expectHTML: true,
|
2684 | modules: modules,
|
2685 | directives: directives,
|
2686 | isPreTag: isPreTag,
|
2687 | isUnaryTag: isUnaryTag$2,
|
2688 | mustUseProp: mustUseProp,
|
2689 | canBeLeftOpenTag: canBeLeftOpenTag$2,
|
2690 | isReservedTag: isReservedTag,
|
2691 | getTagNamespace: getTagNamespace,
|
2692 | staticKeys: genStaticKeys(modules)
|
2693 | };
|
2694 |
|
2695 |
|
2696 |
|
2697 | var onRE = /^@|^v-on:/;
|
2698 | var dirRE = /^v-|^@|^:/;
|
2699 | var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
2700 | var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
2701 | var stripParensRE = /^\(|\)$/g;
|
2702 | var dynamicArgRE = /^\[.*\]$/;
|
2703 |
|
2704 | var argRE = /:(.*)$/;
|
2705 | var bindRE = /^:|^\.|^v-bind:/;
|
2706 | var modifierRE = /\.[^.]+/g;
|
2707 |
|
2708 | var slotRE = /^v-slot(:|$)|^#/;
|
2709 |
|
2710 | var lineBreakRE = /[\r\n]/;
|
2711 | var whitespaceRE = /\s+/g;
|
2712 |
|
2713 | var invalidAttributeRE = /[\s"'<>\/=]/;
|
2714 |
|
2715 | var decodeHTMLCached = cached(he.decode);
|
2716 |
|
2717 | var emptySlotScopeToken = "_empty_";
|
2718 |
|
2719 |
|
2720 | var warn$2;
|
2721 | var delimiters;
|
2722 | var transforms;
|
2723 | var preTransforms;
|
2724 | var postTransforms;
|
2725 | var platformIsPreTag;
|
2726 | var platformMustUseProp;
|
2727 | var platformGetTagNamespace;
|
2728 | var maybeComponent;
|
2729 |
|
2730 | function createASTElement (
|
2731 | tag,
|
2732 | attrs,
|
2733 | parent
|
2734 | ) {
|
2735 | return {
|
2736 | type: 1,
|
2737 | tag: tag,
|
2738 | attrsList: attrs,
|
2739 | attrsMap: makeAttrsMap(attrs),
|
2740 | rawAttrsMap: {},
|
2741 | parent: parent,
|
2742 | children: []
|
2743 | }
|
2744 | }
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 | function parse (
|
2750 | template,
|
2751 | options
|
2752 | ) {
|
2753 | warn$2 = options.warn || baseWarn;
|
2754 |
|
2755 | platformIsPreTag = options.isPreTag || no;
|
2756 | platformMustUseProp = options.mustUseProp || no;
|
2757 | platformGetTagNamespace = options.getTagNamespace || no;
|
2758 | var isReservedTag = options.isReservedTag || no;
|
2759 | maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
2760 |
|
2761 | transforms = pluckModuleFunction(options.modules, 'transformNode');
|
2762 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
2763 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
2764 |
|
2765 | delimiters = options.delimiters;
|
2766 |
|
2767 | var stack = [];
|
2768 | var preserveWhitespace = options.preserveWhitespace !== false;
|
2769 | var whitespaceOption = options.whitespace;
|
2770 | var root;
|
2771 | var currentParent;
|
2772 | var inVPre = false;
|
2773 | var inPre = false;
|
2774 | var warned = false;
|
2775 |
|
2776 | function warnOnce (msg, range) {
|
2777 | if (!warned) {
|
2778 | warned = true;
|
2779 | warn$2(msg, range);
|
2780 | }
|
2781 | }
|
2782 |
|
2783 | function closeElement (element) {
|
2784 | trimEndingWhitespace(element);
|
2785 | if (!inVPre && !element.processed) {
|
2786 | element = processElement(element, options);
|
2787 | }
|
2788 |
|
2789 | if (!stack.length && element !== root) {
|
2790 |
|
2791 | if (root.if && (element.elseif || element.else)) {
|
2792 | if (process.env.NODE_ENV !== 'production') {
|
2793 | checkRootConstraints(element);
|
2794 | }
|
2795 | addIfCondition(root, {
|
2796 | exp: element.elseif,
|
2797 | block: element
|
2798 | });
|
2799 | } else if (process.env.NODE_ENV !== 'production') {
|
2800 | warnOnce(
|
2801 | "Component template should contain exactly one root element. " +
|
2802 | "If you are using v-if on multiple elements, " +
|
2803 | "use v-else-if to chain them instead.",
|
2804 | { start: element.start }
|
2805 | );
|
2806 | }
|
2807 | }
|
2808 | if (currentParent && !element.forbidden) {
|
2809 | if (element.elseif || element.else) {
|
2810 | processIfConditions(element, currentParent);
|
2811 | } else {
|
2812 | if (element.slotScope) {
|
2813 |
|
2814 |
|
2815 |
|
2816 | var name = element.slotTarget || '"default"'
|
2817 | ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
2818 | }
|
2819 | currentParent.children.push(element);
|
2820 | element.parent = currentParent;
|
2821 | }
|
2822 | }
|
2823 |
|
2824 |
|
2825 |
|
2826 | element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
2827 |
|
2828 | trimEndingWhitespace(element);
|
2829 |
|
2830 |
|
2831 | if (element.pre) {
|
2832 | inVPre = false;
|
2833 | }
|
2834 | if (platformIsPreTag(element.tag)) {
|
2835 | inPre = false;
|
2836 | }
|
2837 |
|
2838 | for (var i = 0; i < postTransforms.length; i++) {
|
2839 | postTransforms[i](element, options);
|
2840 | }
|
2841 | }
|
2842 |
|
2843 | function trimEndingWhitespace (el) {
|
2844 |
|
2845 | if (!inPre) {
|
2846 | var lastNode;
|
2847 | while (
|
2848 | (lastNode = el.children[el.children.length - 1]) &&
|
2849 | lastNode.type === 3 &&
|
2850 | lastNode.text === ' '
|
2851 | ) {
|
2852 | el.children.pop();
|
2853 | }
|
2854 | }
|
2855 | }
|
2856 |
|
2857 | function checkRootConstraints (el) {
|
2858 | if (el.tag === 'slot' || el.tag === 'template') {
|
2859 | warnOnce(
|
2860 | "Cannot use <" + (el.tag) + "> as component root element because it may " +
|
2861 | 'contain multiple nodes.',
|
2862 | { start: el.start }
|
2863 | );
|
2864 | }
|
2865 | if (el.attrsMap.hasOwnProperty('v-for')) {
|
2866 | warnOnce(
|
2867 | 'Cannot use v-for on stateful component root element because ' +
|
2868 | 'it renders multiple elements.',
|
2869 | el.rawAttrsMap['v-for']
|
2870 | );
|
2871 | }
|
2872 | }
|
2873 |
|
2874 | parseHTML(template, {
|
2875 | warn: warn$2,
|
2876 | expectHTML: options.expectHTML,
|
2877 | isUnaryTag: options.isUnaryTag,
|
2878 | canBeLeftOpenTag: options.canBeLeftOpenTag,
|
2879 | shouldDecodeNewlines: options.shouldDecodeNewlines,
|
2880 | shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
2881 | shouldKeepComment: options.comments,
|
2882 | outputSourceRange: options.outputSourceRange,
|
2883 | start: function start (tag, attrs, unary, start$1) {
|
2884 |
|
2885 |
|
2886 | var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
2887 |
|
2888 |
|
2889 |
|
2890 | if (isIE && ns === 'svg') {
|
2891 | attrs = guardIESVGBug(attrs);
|
2892 | }
|
2893 |
|
2894 | var element = createASTElement(tag, attrs, currentParent);
|
2895 | if (ns) {
|
2896 | element.ns = ns;
|
2897 | }
|
2898 |
|
2899 | if (process.env.NODE_ENV !== 'production') {
|
2900 | if (options.outputSourceRange) {
|
2901 | element.start = start$1;
|
2902 | element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
2903 | cumulated[attr.name] = attr;
|
2904 | return cumulated
|
2905 | }, {});
|
2906 | }
|
2907 | attrs.forEach(function (attr) {
|
2908 | if (invalidAttributeRE.test(attr.name)) {
|
2909 | warn$2(
|
2910 | "Invalid dynamic argument expression: attribute names cannot contain " +
|
2911 | "spaces, quotes, <, >, / or =.",
|
2912 | {
|
2913 | start: attr.start + attr.name.indexOf("["),
|
2914 | end: attr.start + attr.name.length
|
2915 | }
|
2916 | );
|
2917 | }
|
2918 | });
|
2919 | }
|
2920 |
|
2921 | if (isForbiddenTag(element) && !isServerRendering()) {
|
2922 | element.forbidden = true;
|
2923 | process.env.NODE_ENV !== 'production' && warn$2(
|
2924 | 'Templates should only be responsible for mapping the state to the ' +
|
2925 | 'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
2926 | "<" + tag + ">" + ', as they will not be parsed.',
|
2927 | { start: element.start }
|
2928 | );
|
2929 | }
|
2930 |
|
2931 |
|
2932 | for (var i = 0; i < preTransforms.length; i++) {
|
2933 | element = preTransforms[i](element, options) || element;
|
2934 | }
|
2935 |
|
2936 | if (!inVPre) {
|
2937 | processPre(element);
|
2938 | if (element.pre) {
|
2939 | inVPre = true;
|
2940 | }
|
2941 | }
|
2942 | if (platformIsPreTag(element.tag)) {
|
2943 | inPre = true;
|
2944 | }
|
2945 | if (inVPre) {
|
2946 | processRawAttrs(element);
|
2947 | } else if (!element.processed) {
|
2948 |
|
2949 | processFor(element);
|
2950 | processIf(element);
|
2951 | processOnce(element);
|
2952 | }
|
2953 |
|
2954 | if (!root) {
|
2955 | root = element;
|
2956 | if (process.env.NODE_ENV !== 'production') {
|
2957 | checkRootConstraints(root);
|
2958 | }
|
2959 | }
|
2960 |
|
2961 | if (!unary) {
|
2962 | currentParent = element;
|
2963 | stack.push(element);
|
2964 | } else {
|
2965 | closeElement(element);
|
2966 | }
|
2967 | },
|
2968 |
|
2969 | end: function end (tag, start, end$1) {
|
2970 | var element = stack[stack.length - 1];
|
2971 |
|
2972 | stack.length -= 1;
|
2973 | currentParent = stack[stack.length - 1];
|
2974 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
2975 | element.end = end$1;
|
2976 | }
|
2977 | closeElement(element);
|
2978 | },
|
2979 |
|
2980 | chars: function chars (text, start, end) {
|
2981 | if (!currentParent) {
|
2982 | if (process.env.NODE_ENV !== 'production') {
|
2983 | if (text === template) {
|
2984 | warnOnce(
|
2985 | 'Component template requires a root element, rather than just text.',
|
2986 | { start: start }
|
2987 | );
|
2988 | } else if ((text = text.trim())) {
|
2989 | warnOnce(
|
2990 | ("text \"" + text + "\" outside root element will be ignored."),
|
2991 | { start: start }
|
2992 | );
|
2993 | }
|
2994 | }
|
2995 | return
|
2996 | }
|
2997 |
|
2998 |
|
2999 | if (isIE &&
|
3000 | currentParent.tag === 'textarea' &&
|
3001 | currentParent.attrsMap.placeholder === text
|
3002 | ) {
|
3003 | return
|
3004 | }
|
3005 | var children = currentParent.children;
|
3006 | if (inPre || text.trim()) {
|
3007 | text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
3008 | } else if (!children.length) {
|
3009 |
|
3010 | text = '';
|
3011 | } else if (whitespaceOption) {
|
3012 | if (whitespaceOption === 'condense') {
|
3013 |
|
3014 |
|
3015 | text = lineBreakRE.test(text) ? '' : ' ';
|
3016 | } else {
|
3017 | text = ' ';
|
3018 | }
|
3019 | } else {
|
3020 | text = preserveWhitespace ? ' ' : '';
|
3021 | }
|
3022 | if (text) {
|
3023 | if (whitespaceOption === 'condense') {
|
3024 |
|
3025 | text = text.replace(whitespaceRE, ' ');
|
3026 | }
|
3027 | var res;
|
3028 | var child;
|
3029 | if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
3030 | child = {
|
3031 | type: 2,
|
3032 | expression: res.expression,
|
3033 | tokens: res.tokens,
|
3034 | text: text
|
3035 | };
|
3036 | } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
3037 | child = {
|
3038 | type: 3,
|
3039 | text: text
|
3040 | };
|
3041 | }
|
3042 | if (child) {
|
3043 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
3044 | child.start = start;
|
3045 | child.end = end;
|
3046 | }
|
3047 | children.push(child);
|
3048 | }
|
3049 | }
|
3050 | },
|
3051 | comment: function comment (text, start, end) {
|
3052 |
|
3053 |
|
3054 | if (currentParent) {
|
3055 | var child = {
|
3056 | type: 3,
|
3057 | text: text,
|
3058 | isComment: true
|
3059 | };
|
3060 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
3061 | child.start = start;
|
3062 | child.end = end;
|
3063 | }
|
3064 | currentParent.children.push(child);
|
3065 | }
|
3066 | }
|
3067 | });
|
3068 | return root
|
3069 | }
|
3070 |
|
3071 | function processPre (el) {
|
3072 | if (getAndRemoveAttr(el, 'v-pre') != null) {
|
3073 | el.pre = true;
|
3074 | }
|
3075 | }
|
3076 |
|
3077 | function processRawAttrs (el) {
|
3078 | var list = el.attrsList;
|
3079 | var len = list.length;
|
3080 | if (len) {
|
3081 | var attrs = el.attrs = new Array(len);
|
3082 | for (var i = 0; i < len; i++) {
|
3083 | attrs[i] = {
|
3084 | name: list[i].name,
|
3085 | value: JSON.stringify(list[i].value)
|
3086 | };
|
3087 | if (list[i].start != null) {
|
3088 | attrs[i].start = list[i].start;
|
3089 | attrs[i].end = list[i].end;
|
3090 | }
|
3091 | }
|
3092 | } else if (!el.pre) {
|
3093 |
|
3094 | el.plain = true;
|
3095 | }
|
3096 | }
|
3097 |
|
3098 | function processElement (
|
3099 | element,
|
3100 | options
|
3101 | ) {
|
3102 | processKey(element);
|
3103 |
|
3104 |
|
3105 |
|
3106 | element.plain = (
|
3107 | !element.key &&
|
3108 | !element.scopedSlots &&
|
3109 | !element.attrsList.length
|
3110 | );
|
3111 |
|
3112 | processRef(element);
|
3113 | processSlotContent(element);
|
3114 | processSlotOutlet(element);
|
3115 | processComponent(element);
|
3116 | for (var i = 0; i < transforms.length; i++) {
|
3117 | element = transforms[i](element, options) || element;
|
3118 | }
|
3119 | processAttrs(element);
|
3120 | return element
|
3121 | }
|
3122 |
|
3123 | function processKey (el) {
|
3124 | var exp = getBindingAttr(el, 'key');
|
3125 | if (exp) {
|
3126 | if (process.env.NODE_ENV !== 'production') {
|
3127 | if (el.tag === 'template') {
|
3128 | warn$2(
|
3129 | "<template> cannot be keyed. Place the key on real elements instead.",
|
3130 | getRawBindingAttr(el, 'key')
|
3131 | );
|
3132 | }
|
3133 | if (el.for) {
|
3134 | var iterator = el.iterator2 || el.iterator1;
|
3135 | var parent = el.parent;
|
3136 | if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
3137 | warn$2(
|
3138 | "Do not use v-for index as key on <transition-group> children, " +
|
3139 | "this is the same as not using keys.",
|
3140 | getRawBindingAttr(el, 'key'),
|
3141 | true
|
3142 | );
|
3143 | }
|
3144 | }
|
3145 | }
|
3146 | el.key = exp;
|
3147 | }
|
3148 | }
|
3149 |
|
3150 | function processRef (el) {
|
3151 | var ref = getBindingAttr(el, 'ref');
|
3152 | if (ref) {
|
3153 | el.ref = ref;
|
3154 | el.refInFor = checkInFor(el);
|
3155 | }
|
3156 | }
|
3157 |
|
3158 | function processFor (el) {
|
3159 | var exp;
|
3160 | if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
3161 | var res = parseFor(exp);
|
3162 | if (res) {
|
3163 | extend(el, res);
|
3164 | } else if (process.env.NODE_ENV !== 'production') {
|
3165 | warn$2(
|
3166 | ("Invalid v-for expression: " + exp),
|
3167 | el.rawAttrsMap['v-for']
|
3168 | );
|
3169 | }
|
3170 | }
|
3171 | }
|
3172 |
|
3173 |
|
3174 |
|
3175 | function parseFor (exp) {
|
3176 | var inMatch = exp.match(forAliasRE);
|
3177 | if (!inMatch) { return }
|
3178 | var res = {};
|
3179 | res.for = inMatch[2].trim();
|
3180 | var alias = inMatch[1].trim().replace(stripParensRE, '');
|
3181 | var iteratorMatch = alias.match(forIteratorRE);
|
3182 | if (iteratorMatch) {
|
3183 | res.alias = alias.replace(forIteratorRE, '').trim();
|
3184 | res.iterator1 = iteratorMatch[1].trim();
|
3185 | if (iteratorMatch[2]) {
|
3186 | res.iterator2 = iteratorMatch[2].trim();
|
3187 | }
|
3188 | } else {
|
3189 | res.alias = alias;
|
3190 | }
|
3191 | return res
|
3192 | }
|
3193 |
|
3194 | function processIf (el) {
|
3195 | var exp = getAndRemoveAttr(el, 'v-if');
|
3196 | if (exp) {
|
3197 | el.if = exp;
|
3198 | addIfCondition(el, {
|
3199 | exp: exp,
|
3200 | block: el
|
3201 | });
|
3202 | } else {
|
3203 | if (getAndRemoveAttr(el, 'v-else') != null) {
|
3204 | el.else = true;
|
3205 | }
|
3206 | var elseif = getAndRemoveAttr(el, 'v-else-if');
|
3207 | if (elseif) {
|
3208 | el.elseif = elseif;
|
3209 | }
|
3210 | }
|
3211 | }
|
3212 |
|
3213 | function processIfConditions (el, parent) {
|
3214 | var prev = findPrevElement(parent.children);
|
3215 | if (prev && prev.if) {
|
3216 | addIfCondition(prev, {
|
3217 | exp: el.elseif,
|
3218 | block: el
|
3219 | });
|
3220 | } else if (process.env.NODE_ENV !== 'production') {
|
3221 | warn$2(
|
3222 | "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
3223 | "used on element <" + (el.tag) + "> without corresponding v-if.",
|
3224 | el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
3225 | );
|
3226 | }
|
3227 | }
|
3228 |
|
3229 | function findPrevElement (children) {
|
3230 | var i = children.length;
|
3231 | while (i--) {
|
3232 | if (children[i].type === 1) {
|
3233 | return children[i]
|
3234 | } else {
|
3235 | if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
|
3236 | warn$2(
|
3237 | "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
3238 | "will be ignored.",
|
3239 | children[i]
|
3240 | );
|
3241 | }
|
3242 | children.pop();
|
3243 | }
|
3244 | }
|
3245 | }
|
3246 |
|
3247 | function addIfCondition (el, condition) {
|
3248 | if (!el.ifConditions) {
|
3249 | el.ifConditions = [];
|
3250 | }
|
3251 | el.ifConditions.push(condition);
|
3252 | }
|
3253 |
|
3254 | function processOnce (el) {
|
3255 | var once$$1 = getAndRemoveAttr(el, 'v-once');
|
3256 | if (once$$1 != null) {
|
3257 | el.once = true;
|
3258 | }
|
3259 | }
|
3260 |
|
3261 |
|
3262 |
|
3263 | function processSlotContent (el) {
|
3264 | var slotScope;
|
3265 | if (el.tag === 'template') {
|
3266 | slotScope = getAndRemoveAttr(el, 'scope');
|
3267 |
|
3268 | if (process.env.NODE_ENV !== 'production' && slotScope) {
|
3269 | warn$2(
|
3270 | "the \"scope\" attribute for scoped slots have been deprecated and " +
|
3271 | "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
3272 | "can also be used on plain elements in addition to <template> to " +
|
3273 | "denote scoped slots.",
|
3274 | el.rawAttrsMap['scope'],
|
3275 | true
|
3276 | );
|
3277 | }
|
3278 | el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
3279 | } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
3280 |
|
3281 | if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
|
3282 | warn$2(
|
3283 | "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
3284 | "(v-for takes higher priority). Use a wrapper <template> for the " +
|
3285 | "scoped slot to make it clearer.",
|
3286 | el.rawAttrsMap['slot-scope'],
|
3287 | true
|
3288 | );
|
3289 | }
|
3290 | el.slotScope = slotScope;
|
3291 | }
|
3292 |
|
3293 |
|
3294 | var slotTarget = getBindingAttr(el, 'slot');
|
3295 | if (slotTarget) {
|
3296 | el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
3297 | el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
3298 |
|
3299 |
|
3300 | if (el.tag !== 'template' && !el.slotScope) {
|
3301 | addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
3302 | }
|
3303 | }
|
3304 |
|
3305 |
|
3306 | {
|
3307 | if (el.tag === 'template') {
|
3308 |
|
3309 | var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
3310 | if (slotBinding) {
|
3311 | if (process.env.NODE_ENV !== 'production') {
|
3312 | if (el.slotTarget || el.slotScope) {
|
3313 | warn$2(
|
3314 | "Unexpected mixed usage of different slot syntaxes.",
|
3315 | el
|
3316 | );
|
3317 | }
|
3318 | if (el.parent && !maybeComponent(el.parent)) {
|
3319 | warn$2(
|
3320 | "<template v-slot> can only appear at the root level inside " +
|
3321 | "the receiving the component",
|
3322 | el
|
3323 | );
|
3324 | }
|
3325 | }
|
3326 | var ref = getSlotName(slotBinding);
|
3327 | var name = ref.name;
|
3328 | var dynamic = ref.dynamic;
|
3329 | el.slotTarget = name;
|
3330 | el.slotTargetDynamic = dynamic;
|
3331 | el.slotScope = slotBinding.value || emptySlotScopeToken;
|
3332 | }
|
3333 | } else {
|
3334 |
|
3335 | var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
3336 | if (slotBinding$1) {
|
3337 | if (process.env.NODE_ENV !== 'production') {
|
3338 | if (!maybeComponent(el)) {
|
3339 | warn$2(
|
3340 | "v-slot can only be used on components or <template>.",
|
3341 | slotBinding$1
|
3342 | );
|
3343 | }
|
3344 | if (el.slotScope || el.slotTarget) {
|
3345 | warn$2(
|
3346 | "Unexpected mixed usage of different slot syntaxes.",
|
3347 | el
|
3348 | );
|
3349 | }
|
3350 | if (el.scopedSlots) {
|
3351 | warn$2(
|
3352 | "To avoid scope ambiguity, the default slot should also use " +
|
3353 | "<template> syntax when there are other named slots.",
|
3354 | slotBinding$1
|
3355 | );
|
3356 | }
|
3357 | }
|
3358 |
|
3359 | var slots = el.scopedSlots || (el.scopedSlots = {});
|
3360 | var ref$1 = getSlotName(slotBinding$1);
|
3361 | var name$1 = ref$1.name;
|
3362 | var dynamic$1 = ref$1.dynamic;
|
3363 | var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
3364 | slotContainer.slotTarget = name$1;
|
3365 | slotContainer.slotTargetDynamic = dynamic$1;
|
3366 | slotContainer.children = el.children.filter(function (c) {
|
3367 | if (!c.slotScope) {
|
3368 | c.parent = slotContainer;
|
3369 | return true
|
3370 | }
|
3371 | });
|
3372 | slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
3373 |
|
3374 | el.children = [];
|
3375 |
|
3376 | el.plain = false;
|
3377 | }
|
3378 | }
|
3379 | }
|
3380 | }
|
3381 |
|
3382 | function getSlotName (binding) {
|
3383 | var name = binding.name.replace(slotRE, '');
|
3384 | if (!name) {
|
3385 | if (binding.name[0] !== '#') {
|
3386 | name = 'default';
|
3387 | } else if (process.env.NODE_ENV !== 'production') {
|
3388 | warn$2(
|
3389 | "v-slot shorthand syntax requires a slot name.",
|
3390 | binding
|
3391 | );
|
3392 | }
|
3393 | }
|
3394 | return dynamicArgRE.test(name)
|
3395 |
|
3396 | ? { name: name.slice(1, -1), dynamic: true }
|
3397 |
|
3398 | : { name: ("\"" + name + "\""), dynamic: false }
|
3399 | }
|
3400 |
|
3401 |
|
3402 | function processSlotOutlet (el) {
|
3403 | if (el.tag === 'slot') {
|
3404 | el.slotName = getBindingAttr(el, 'name');
|
3405 | if (process.env.NODE_ENV !== 'production' && el.key) {
|
3406 | warn$2(
|
3407 | "`key` does not work on <slot> because slots are abstract outlets " +
|
3408 | "and can possibly expand into multiple elements. " +
|
3409 | "Use the key on a wrapping element instead.",
|
3410 | getRawBindingAttr(el, 'key')
|
3411 | );
|
3412 | }
|
3413 | }
|
3414 | }
|
3415 |
|
3416 | function processComponent (el) {
|
3417 | var binding;
|
3418 | if ((binding = getBindingAttr(el, 'is'))) {
|
3419 | el.component = binding;
|
3420 | }
|
3421 | if (getAndRemoveAttr(el, 'inline-template') != null) {
|
3422 | el.inlineTemplate = true;
|
3423 | }
|
3424 | }
|
3425 |
|
3426 | function processAttrs (el) {
|
3427 | var list = el.attrsList;
|
3428 | var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
3429 | for (i = 0, l = list.length; i < l; i++) {
|
3430 | name = rawName = list[i].name;
|
3431 | value = list[i].value;
|
3432 | if (dirRE.test(name)) {
|
3433 |
|
3434 | el.hasBindings = true;
|
3435 |
|
3436 | modifiers = parseModifiers(name.replace(dirRE, ''));
|
3437 |
|
3438 | if (modifiers) {
|
3439 | name = name.replace(modifierRE, '');
|
3440 | }
|
3441 | if (bindRE.test(name)) {
|
3442 | name = name.replace(bindRE, '');
|
3443 | value = parseFilters(value);
|
3444 | isDynamic = dynamicArgRE.test(name);
|
3445 | if (isDynamic) {
|
3446 | name = name.slice(1, -1);
|
3447 | }
|
3448 | if (
|
3449 | process.env.NODE_ENV !== 'production' &&
|
3450 | value.trim().length === 0
|
3451 | ) {
|
3452 | warn$2(
|
3453 | ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
3454 | );
|
3455 | }
|
3456 | if (modifiers) {
|
3457 | if (modifiers.prop && !isDynamic) {
|
3458 | name = camelize(name);
|
3459 | if (name === 'innerHtml') { name = 'innerHTML'; }
|
3460 | }
|
3461 | if (modifiers.camel && !isDynamic) {
|
3462 | name = camelize(name);
|
3463 | }
|
3464 | if (modifiers.sync) {
|
3465 | syncGen = genAssignmentCode(value, "$event");
|
3466 | if (!isDynamic) {
|
3467 | addHandler(
|
3468 | el,
|
3469 | ("update:" + (camelize(name))),
|
3470 | syncGen,
|
3471 | null,
|
3472 | false,
|
3473 | warn$2,
|
3474 | list[i]
|
3475 | );
|
3476 | if (hyphenate(name) !== camelize(name)) {
|
3477 | addHandler(
|
3478 | el,
|
3479 | ("update:" + (hyphenate(name))),
|
3480 | syncGen,
|
3481 | null,
|
3482 | false,
|
3483 | warn$2,
|
3484 | list[i]
|
3485 | );
|
3486 | }
|
3487 | } else {
|
3488 |
|
3489 | addHandler(
|
3490 | el,
|
3491 | ("\"update:\"+(" + name + ")"),
|
3492 | syncGen,
|
3493 | null,
|
3494 | false,
|
3495 | warn$2,
|
3496 | list[i],
|
3497 | true
|
3498 | );
|
3499 | }
|
3500 | }
|
3501 | }
|
3502 | if ((modifiers && modifiers.prop) || (
|
3503 | !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
3504 | )) {
|
3505 | addProp(el, name, value, list[i], isDynamic);
|
3506 | } else {
|
3507 | addAttr(el, name, value, list[i], isDynamic);
|
3508 | }
|
3509 | } else if (onRE.test(name)) {
|
3510 | name = name.replace(onRE, '');
|
3511 | isDynamic = dynamicArgRE.test(name);
|
3512 | if (isDynamic) {
|
3513 | name = name.slice(1, -1);
|
3514 | }
|
3515 | addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
3516 | } else {
|
3517 | name = name.replace(dirRE, '');
|
3518 |
|
3519 | var argMatch = name.match(argRE);
|
3520 | var arg = argMatch && argMatch[1];
|
3521 | isDynamic = false;
|
3522 | if (arg) {
|
3523 | name = name.slice(0, -(arg.length + 1));
|
3524 | if (dynamicArgRE.test(arg)) {
|
3525 | arg = arg.slice(1, -1);
|
3526 | isDynamic = true;
|
3527 | }
|
3528 | }
|
3529 | addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
3530 | if (process.env.NODE_ENV !== 'production' && name === 'model') {
|
3531 | checkForAliasModel(el, value);
|
3532 | }
|
3533 | }
|
3534 | } else {
|
3535 |
|
3536 | if (process.env.NODE_ENV !== 'production') {
|
3537 | var res = parseText(value, delimiters);
|
3538 | if (res) {
|
3539 | warn$2(
|
3540 | name + "=\"" + value + "\": " +
|
3541 | 'Interpolation inside attributes has been removed. ' +
|
3542 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
3543 | 'instead of <div id="{{ val }}">, use <div :id="val">.',
|
3544 | list[i]
|
3545 | );
|
3546 | }
|
3547 | }
|
3548 | addAttr(el, name, JSON.stringify(value), list[i]);
|
3549 |
|
3550 |
|
3551 | if (!el.component &&
|
3552 | name === 'muted' &&
|
3553 | platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
3554 | addProp(el, name, 'true', list[i]);
|
3555 | }
|
3556 | }
|
3557 | }
|
3558 | }
|
3559 |
|
3560 | function checkInFor (el) {
|
3561 | var parent = el;
|
3562 | while (parent) {
|
3563 | if (parent.for !== undefined) {
|
3564 | return true
|
3565 | }
|
3566 | parent = parent.parent;
|
3567 | }
|
3568 | return false
|
3569 | }
|
3570 |
|
3571 | function parseModifiers (name) {
|
3572 | var match = name.match(modifierRE);
|
3573 | if (match) {
|
3574 | var ret = {};
|
3575 | match.forEach(function (m) { ret[m.slice(1)] = true; });
|
3576 | return ret
|
3577 | }
|
3578 | }
|
3579 |
|
3580 | function makeAttrsMap (attrs) {
|
3581 | var map = {};
|
3582 | for (var i = 0, l = attrs.length; i < l; i++) {
|
3583 | if (
|
3584 | process.env.NODE_ENV !== 'production' &&
|
3585 | map[attrs[i].name] && !isIE && !isEdge
|
3586 | ) {
|
3587 | warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
3588 | }
|
3589 | map[attrs[i].name] = attrs[i].value;
|
3590 | }
|
3591 | return map
|
3592 | }
|
3593 |
|
3594 |
|
3595 | function isTextTag (el) {
|
3596 | return el.tag === 'script' || el.tag === 'style'
|
3597 | }
|
3598 |
|
3599 | function isForbiddenTag (el) {
|
3600 | return (
|
3601 | el.tag === 'style' ||
|
3602 | (el.tag === 'script' && (
|
3603 | !el.attrsMap.type ||
|
3604 | el.attrsMap.type === 'text/javascript'
|
3605 | ))
|
3606 | )
|
3607 | }
|
3608 |
|
3609 | var ieNSBug = /^xmlns:NS\d+/;
|
3610 | var ieNSPrefix = /^NS\d+:/;
|
3611 |
|
3612 |
|
3613 | function guardIESVGBug (attrs) {
|
3614 | var res = [];
|
3615 | for (var i = 0; i < attrs.length; i++) {
|
3616 | var attr = attrs[i];
|
3617 | if (!ieNSBug.test(attr.name)) {
|
3618 | attr.name = attr.name.replace(ieNSPrefix, '');
|
3619 | res.push(attr);
|
3620 | }
|
3621 | }
|
3622 | return res
|
3623 | }
|
3624 |
|
3625 | function checkForAliasModel (el, value) {
|
3626 | var _el = el;
|
3627 | while (_el) {
|
3628 | if (_el.for && _el.alias === value) {
|
3629 | warn$2(
|
3630 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
3631 | "You are binding v-model directly to a v-for iteration alias. " +
|
3632 | "This will not be able to modify the v-for source array because " +
|
3633 | "writing to the alias is like modifying a function local variable. " +
|
3634 | "Consider using an array of objects and use v-model on an object property instead.",
|
3635 | el.rawAttrsMap['v-model']
|
3636 | );
|
3637 | }
|
3638 | _el = _el.parent;
|
3639 | }
|
3640 | }
|
3641 |
|
3642 |
|
3643 |
|
3644 | var isStaticKey;
|
3645 | var isPlatformReservedTag;
|
3646 |
|
3647 | var genStaticKeysCached = cached(genStaticKeys$1);
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 | function optimize (root, options) {
|
3661 | if (!root) { return }
|
3662 | isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
3663 | isPlatformReservedTag = options.isReservedTag || no;
|
3664 |
|
3665 | markStatic(root);
|
3666 |
|
3667 | markStaticRoots(root, false);
|
3668 | }
|
3669 |
|
3670 | function genStaticKeys$1 (keys) {
|
3671 | return makeMap(
|
3672 | 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
3673 | (keys ? ',' + keys : '')
|
3674 | )
|
3675 | }
|
3676 |
|
3677 | function markStatic (node) {
|
3678 | node.static = isStatic(node);
|
3679 | if (node.type === 1) {
|
3680 |
|
3681 |
|
3682 |
|
3683 | if (
|
3684 | !isPlatformReservedTag(node.tag) &&
|
3685 | node.tag !== 'slot' &&
|
3686 | node.attrsMap['inline-template'] == null
|
3687 | ) {
|
3688 | return
|
3689 | }
|
3690 | for (var i = 0, l = node.children.length; i < l; i++) {
|
3691 | var child = node.children[i];
|
3692 | markStatic(child);
|
3693 | if (!child.static) {
|
3694 | node.static = false;
|
3695 | }
|
3696 | }
|
3697 | if (node.ifConditions) {
|
3698 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
3699 | var block = node.ifConditions[i$1].block;
|
3700 | markStatic(block);
|
3701 | if (!block.static) {
|
3702 | node.static = false;
|
3703 | }
|
3704 | }
|
3705 | }
|
3706 | }
|
3707 | }
|
3708 |
|
3709 | function markStaticRoots (node, isInFor) {
|
3710 | if (node.type === 1) {
|
3711 | if (node.static || node.once) {
|
3712 | node.staticInFor = isInFor;
|
3713 | }
|
3714 |
|
3715 |
|
3716 |
|
3717 | if (node.static && node.children.length && !(
|
3718 | node.children.length === 1 &&
|
3719 | node.children[0].type === 3
|
3720 | )) {
|
3721 | node.staticRoot = true;
|
3722 | return
|
3723 | } else {
|
3724 | node.staticRoot = false;
|
3725 | }
|
3726 | if (node.children) {
|
3727 | for (var i = 0, l = node.children.length; i < l; i++) {
|
3728 | markStaticRoots(node.children[i], isInFor || !!node.for);
|
3729 | }
|
3730 | }
|
3731 | if (node.ifConditions) {
|
3732 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
3733 | markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
3734 | }
|
3735 | }
|
3736 | }
|
3737 | }
|
3738 |
|
3739 | function isStatic (node) {
|
3740 | if (node.type === 2) {
|
3741 | return false
|
3742 | }
|
3743 | if (node.type === 3) {
|
3744 | return true
|
3745 | }
|
3746 | return !!(node.pre || (
|
3747 | !node.hasBindings &&
|
3748 | !node.if && !node.for &&
|
3749 | !isBuiltInTag(node.tag) &&
|
3750 | isPlatformReservedTag(node.tag) &&
|
3751 | !isDirectChildOfTemplateFor(node) &&
|
3752 | Object.keys(node).every(isStaticKey)
|
3753 | ))
|
3754 | }
|
3755 |
|
3756 | function isDirectChildOfTemplateFor (node) {
|
3757 | while (node.parent) {
|
3758 | node = node.parent;
|
3759 | if (node.tag !== 'template') {
|
3760 | return false
|
3761 | }
|
3762 | if (node.for) {
|
3763 | return true
|
3764 | }
|
3765 | }
|
3766 | return false
|
3767 | }
|
3768 |
|
3769 |
|
3770 |
|
3771 | var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
3772 | var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
3773 |
|
3774 |
|
3775 | var keyCodes = {
|
3776 | esc: 27,
|
3777 | tab: 9,
|
3778 | enter: 13,
|
3779 | space: 32,
|
3780 | up: 38,
|
3781 | left: 37,
|
3782 | right: 39,
|
3783 | down: 40,
|
3784 | 'delete': [8, 46]
|
3785 | };
|
3786 |
|
3787 |
|
3788 | var keyNames = {
|
3789 | esc: 'Escape',
|
3790 | tab: 'Tab',
|
3791 | enter: 'Enter',
|
3792 | space: ' ',
|
3793 |
|
3794 | up: ['Up', 'ArrowUp'],
|
3795 | left: ['Left', 'ArrowLeft'],
|
3796 | right: ['Right', 'ArrowRight'],
|
3797 | down: ['Down', 'ArrowDown'],
|
3798 | 'delete': ['Backspace', 'Delete']
|
3799 | };
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 | var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
3805 |
|
3806 | var modifierCode = {
|
3807 |
|
3808 |
|
3809 |
|
3810 | self: genGuard("$event.target.dataset.hid !== $event.currentTarget.dataset.hid")
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 | };
|
3819 |
|
3820 | function genHandlers (
|
3821 | events,
|
3822 | isNative,
|
3823 | warn
|
3824 | ) {
|
3825 | var res = isNative ? 'nativeOn:{' : 'on:{';
|
3826 | for (var name in events) {
|
3827 | res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
3828 | }
|
3829 | return res.slice(0, -1) + '}'
|
3830 | }
|
3831 |
|
3832 | function genHandler (
|
3833 | name,
|
3834 | handler
|
3835 | ) {
|
3836 |
|
3837 | if (!handler) {
|
3838 | return 'function(){}'
|
3839 | }
|
3840 |
|
3841 | if (Array.isArray(handler)) {
|
3842 | return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
3843 | }
|
3844 |
|
3845 | var isMethodPath = simplePathRE.test(handler.value);
|
3846 | var isFunctionExpression = fnExpRE.test(handler.value);
|
3847 |
|
3848 | if (!handler.modifiers) {
|
3849 | if (isMethodPath || isFunctionExpression) {
|
3850 | return handler.value
|
3851 | }
|
3852 | return ("function($event){" + (handler.value) + "}")
|
3853 | } else {
|
3854 | var code = '';
|
3855 | var genModifierCode = '';
|
3856 | var keys = [];
|
3857 | for (var key in handler.modifiers) {
|
3858 | if (modifierCode[key]) {
|
3859 | genModifierCode += modifierCode[key];
|
3860 |
|
3861 |
|
3862 | if (keyCodes[key]) {
|
3863 | keys.push(key);
|
3864 | }
|
3865 | } else if (key === 'exact') {
|
3866 | var modifiers = (handler.modifiers);
|
3867 | genModifierCode += genGuard(
|
3868 | ['ctrl', 'shift', 'alt', 'meta']
|
3869 | .filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
3870 | .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
3871 | .join('||')
|
3872 | );
|
3873 | } else {
|
3874 | keys.push(key);
|
3875 | }
|
3876 | }
|
3877 | if (keys.length) {
|
3878 | code += genKeyFilter(keys);
|
3879 | }
|
3880 |
|
3881 | if (genModifierCode) {
|
3882 | code += genModifierCode;
|
3883 | }
|
3884 | var handlerCode = isMethodPath
|
3885 | ? ("return " + (handler.value) + "($event)")
|
3886 | : isFunctionExpression
|
3887 | ? ("return (" + (handler.value) + ")($event)")
|
3888 | : handler.value;
|
3889 | return ("function($event){" + code + handlerCode + "}")
|
3890 | }
|
3891 | }
|
3892 |
|
3893 |
|
3894 | function genKeyFilter (keys) {
|
3895 | return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
3896 | }
|
3897 |
|
3898 |
|
3899 | function genFilterCode (key) {
|
3900 | var keyVal = parseInt(key, 10);
|
3901 | if (keyVal) {
|
3902 | return ("$event.keyCode!==" + keyVal)
|
3903 | }
|
3904 | var keyCode = keyCodes[key];
|
3905 | var keyName = keyNames[key];
|
3906 | return (
|
3907 | "_k($event.keyCode," +
|
3908 | (JSON.stringify(key)) + "," +
|
3909 | (JSON.stringify(keyCode)) + "," +
|
3910 | "$event.key," +
|
3911 | "" + (JSON.stringify(keyName)) +
|
3912 | ")"
|
3913 | )
|
3914 | }
|
3915 |
|
3916 |
|
3917 |
|
3918 | function on (el, dir) {
|
3919 | if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
|
3920 | warn("v-on without argument does not support modifiers.");
|
3921 | }
|
3922 | el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
3923 | }
|
3924 |
|
3925 |
|
3926 |
|
3927 | function bind$1 (el, dir) {
|
3928 | el.wrapData = function (code) {
|
3929 | return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
3930 | };
|
3931 | }
|
3932 |
|
3933 |
|
3934 |
|
3935 | var baseDirectives = {
|
3936 | on: on,
|
3937 | bind: bind$1,
|
3938 | cloak: noop
|
3939 | };
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 | var CodegenState = function CodegenState (options) {
|
3948 | this.options = options;
|
3949 | this.warn = options.warn || baseWarn;
|
3950 | this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
3951 | this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
3952 | this.directives = extend(extend({}, baseDirectives), options.directives);
|
3953 | var isReservedTag = options.isReservedTag || no;
|
3954 | this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
3955 | this.onceId = 0;
|
3956 | this.staticRenderFns = [];
|
3957 | this.pre = false;
|
3958 | };
|
3959 |
|
3960 |
|
3961 |
|
3962 | function generate (
|
3963 | ast,
|
3964 | options
|
3965 | ) {
|
3966 | var state = new CodegenState(options);
|
3967 | var code = ast ? genElement(ast, state) : '_c("div")';
|
3968 | return {
|
3969 | render: ("with(this){return " + code + "}"),
|
3970 | staticRenderFns: state.staticRenderFns
|
3971 | }
|
3972 | }
|
3973 |
|
3974 | function genElement (el, state) {
|
3975 | if (el.parent) {
|
3976 | el.pre = el.pre || el.parent.pre;
|
3977 | }
|
3978 |
|
3979 | if (el.staticRoot && !el.staticProcessed) {
|
3980 | return genStatic(el, state)
|
3981 | } else if (el.once && !el.onceProcessed) {
|
3982 | return genOnce(el, state)
|
3983 | } else if (el.for && !el.forProcessed) {
|
3984 | return genFor(el, state)
|
3985 | } else if (el.if && !el.ifProcessed) {
|
3986 | return genIf(el, state)
|
3987 | } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
3988 | return genChildren(el, state) || 'void 0'
|
3989 | } else if (el.tag === 'slot') {
|
3990 | return genSlot(el, state)
|
3991 | } else {
|
3992 |
|
3993 | var code;
|
3994 | if (el.component) {
|
3995 | code = genComponent(el.component, el, state);
|
3996 | } else {
|
3997 | var data;
|
3998 | if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
3999 | data = genData$2(el, state);
|
4000 | }
|
4001 |
|
4002 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
4003 | code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
4004 | }
|
4005 |
|
4006 | for (var i = 0; i < state.transforms.length; i++) {
|
4007 | code = state.transforms[i](el, code);
|
4008 | }
|
4009 | return code
|
4010 | }
|
4011 | }
|
4012 |
|
4013 |
|
4014 | function genStatic (el, state) {
|
4015 | el.staticProcessed = true;
|
4016 |
|
4017 |
|
4018 |
|
4019 | var originalPreState = state.pre;
|
4020 | if (el.pre) {
|
4021 | state.pre = el.pre;
|
4022 | }
|
4023 | state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
4024 | state.pre = originalPreState;
|
4025 | return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
4026 | }
|
4027 |
|
4028 |
|
4029 | function genOnce (el, state) /* istanbul ignore next */ {
|
4030 | el.onceProcessed = true;
|
4031 | if (el.if && !el.ifProcessed) {
|
4032 | return genIf(el, state)
|
4033 | } else if (el.staticInFor) {
|
4034 | var key = '';
|
4035 | var parent = el.parent;
|
4036 | while (parent) {
|
4037 | if (parent.for) {
|
4038 | key = parent.key;
|
4039 | break
|
4040 | }
|
4041 | parent = parent.parent;
|
4042 | }
|
4043 | if (!key) {
|
4044 | process.env.NODE_ENV !== 'production' && state.warn(
|
4045 | "v-once can only be used inside v-for that is keyed. ",
|
4046 | el.rawAttrsMap['v-once']
|
4047 | );
|
4048 | return genElement(el, state)
|
4049 | }
|
4050 | return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
4051 | } else {
|
4052 | return genStatic(el, state)
|
4053 | }
|
4054 | }
|
4055 |
|
4056 | function genIf (
|
4057 | el,
|
4058 | state,
|
4059 | altGen,
|
4060 | altEmpty
|
4061 | ) {
|
4062 | el.ifProcessed = true;
|
4063 | var conditions = el.ifConditions.slice();
|
4064 | conditions.__extratExpression = el.ifConditions.__extratExpression;
|
4065 | return genIfConditions(conditions, state, altGen, altEmpty)
|
4066 | }
|
4067 |
|
4068 | function genIfConditions (
|
4069 | conditions,
|
4070 | state,
|
4071 | altGen,
|
4072 | altEmpty
|
4073 | ) {
|
4074 | if (!conditions.length) {
|
4075 | if (conditions.__extratExpression) {
|
4076 | return ("_c(\"a\", {attrs: {i_:[" + (conditions.__extratExpression.join(',')) + "]}})")
|
4077 | }
|
4078 | return altEmpty || '_e()'
|
4079 | }
|
4080 | var condition = conditions.shift();
|
4081 | if (condition.exp) {
|
4082 | return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
4083 | } else {
|
4084 | return ("" + (genTernaryExp(condition.block)))
|
4085 | }
|
4086 |
|
4087 |
|
4088 | function genTernaryExp (el) {
|
4089 | return altGen
|
4090 | ? altGen(el, state)
|
4091 | : el.once
|
4092 | ? genOnce(el, state)
|
4093 | : genElement(el, state)
|
4094 | }
|
4095 | }
|
4096 |
|
4097 | function genFor (
|
4098 | el,
|
4099 | state,
|
4100 | altGen,
|
4101 | altHelper
|
4102 | ) {
|
4103 | var exp = el.for;
|
4104 | var alias = el.alias;
|
4105 | var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
4106 | var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
4107 |
|
4108 | if (process.env.NODE_ENV !== 'production' &&
|
4109 | state.maybeComponent(el) &&
|
4110 | el.tag !== 'slot' &&
|
4111 | el.tag !== 'template' &&
|
4112 | !el.key
|
4113 | ) {
|
4114 | state.warn(
|
4115 | "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
4116 | "v-for should have explicit keys. " +
|
4117 | "See https://vuejs.org/guide/list.html#key for more info.",
|
4118 | el.rawAttrsMap['v-for'],
|
4119 | true
|
4120 | );
|
4121 | }
|
4122 | var _forInfo = el._forInfo;
|
4123 | var f_ = el.f_;
|
4124 | el.forProcessed = true;
|
4125 | var tailStr = _forInfo.h_ + (isDef(_forInfo.f_) ? (", " + (_forInfo.f_)) : '');
|
4126 | return (altHelper || '_l') + "((" + exp + ")," +
|
4127 | "function(" + alias + iterator1 + iterator2 + "){" +
|
4128 | "var f_ = " + f_ + ";" +
|
4129 | "return " + ((altGen || genElement)(el, state)) +
|
4130 | "},[" + tailStr + "],_self)"
|
4131 | }
|
4132 |
|
4133 | function genData$2 (el, state) {
|
4134 | var data = '{';
|
4135 |
|
4136 |
|
4137 |
|
4138 | var dirs = genDirectives(el, state);
|
4139 | if (dirs) { data += dirs + ','; }
|
4140 |
|
4141 |
|
4142 | if (el.key) {
|
4143 | data += "key:" + (el.key) + ",";
|
4144 | }
|
4145 |
|
4146 | if (el.ref) {
|
4147 | data += "ref:" + (el.ref) + ",";
|
4148 | }
|
4149 | if (el.refInFor) {
|
4150 | data += "refInFor:true,";
|
4151 | }
|
4152 |
|
4153 | if (el.pre) {
|
4154 | data += "pre:true,";
|
4155 | }
|
4156 |
|
4157 | if (el.component) {
|
4158 | data += "tag:\"" + (el.tag) + "\",";
|
4159 | }
|
4160 |
|
4161 | for (var i = 0; i < state.dataGenFns.length; i++) {
|
4162 | data += state.dataGenFns[i](el);
|
4163 | }
|
4164 |
|
4165 | if (el.attrs) {
|
4166 | data += "attrs:" + (genProps(el.attrs, 'attr')) + ",";
|
4167 | }
|
4168 |
|
4169 | if (el.props) {
|
4170 | data += "domProps:" + (genProps(el.props)) + ",";
|
4171 | }
|
4172 |
|
4173 | if (el.events) {
|
4174 | data += (genHandlers(el.events, false)) + ",";
|
4175 | }
|
4176 |
|
4177 |
|
4178 | if (el.nativeEvents) {
|
4179 | data += (genHandlers(el.nativeEvents, true)) + ",";
|
4180 | }
|
4181 |
|
4182 |
|
4183 | if (el.slotTarget && !el.slotScope) {
|
4184 | data += "slot:" + (el.slotTarget) + ",";
|
4185 | }
|
4186 |
|
4187 |
|
4188 | if (el.scopedSlots) {
|
4189 | data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
4190 | }
|
4191 |
|
4192 | if (el.model) {
|
4193 | data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
4194 | }
|
4195 |
|
4196 |
|
4197 | if (el.inlineTemplate) {
|
4198 | var inlineTemplate = genInlineTemplate(el, state);
|
4199 | if (inlineTemplate) {
|
4200 | data += inlineTemplate + ",";
|
4201 | }
|
4202 | }
|
4203 | data = data.replace(/,$/, '') + '}';
|
4204 |
|
4205 |
|
4206 |
|
4207 | if (el.dynamicAttrs) {
|
4208 | data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
4209 | }
|
4210 |
|
4211 | if (el.wrapData) {
|
4212 | data = el.wrapData(data);
|
4213 | }
|
4214 |
|
4215 | if (el.wrapListeners) {
|
4216 | data = el.wrapListeners(data);
|
4217 | }
|
4218 | return data
|
4219 | }
|
4220 |
|
4221 | function genDirectives (el, state) {
|
4222 | var dirs = el.directives;
|
4223 | if (!dirs) { return }
|
4224 | var res = 'directives:[';
|
4225 | var hasRuntime = false;
|
4226 | var i, l, dir, needRuntime;
|
4227 | for (i = 0, l = dirs.length; i < l; i++) {
|
4228 | dir = dirs[i];
|
4229 | needRuntime = true;
|
4230 | var gen = state.directives[dir.name];
|
4231 | if (gen) {
|
4232 |
|
4233 |
|
4234 | needRuntime = !!gen(el, dir, state.warn);
|
4235 | }
|
4236 | if (needRuntime) {
|
4237 | hasRuntime = true;
|
4238 | res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
4239 | }
|
4240 | }
|
4241 | if (hasRuntime) {
|
4242 | return res.slice(0, -1) + ']'
|
4243 | }
|
4244 | }
|
4245 |
|
4246 |
|
4247 | function genInlineTemplate (el, state) {
|
4248 | var ast = el.children[0];
|
4249 | if (process.env.NODE_ENV !== 'production' && (
|
4250 | el.children.length !== 1 || ast.type !== 1
|
4251 | )) {
|
4252 | state.warn(
|
4253 | 'Inline-template components must have exactly one child element.',
|
4254 | { start: el.start }
|
4255 | );
|
4256 | }
|
4257 | if (ast && ast.type === 1) {
|
4258 | var inlineRenderFns = generate(ast, state.options);
|
4259 | return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
4260 | }
|
4261 | }
|
4262 |
|
4263 | function genScopedSlots (
|
4264 | el,
|
4265 | slots,
|
4266 | state
|
4267 | ) {
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 | var needsForceUpdate = Object.keys(slots).some(function (key) {
|
4273 | var slot = slots[key];
|
4274 | return (
|
4275 | slot.slotTargetDynamic ||
|
4276 | slot.if ||
|
4277 | slot.for ||
|
4278 | containsSlotChild(slot)
|
4279 | )
|
4280 | });
|
4281 |
|
4282 |
|
4283 | if (!needsForceUpdate) {
|
4284 | var parent = el.parent;
|
4285 | while (parent) {
|
4286 | if (
|
4287 | (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
4288 | parent.for
|
4289 | ) {
|
4290 | needsForceUpdate = true;
|
4291 | break
|
4292 | }
|
4293 | parent = parent.parent;
|
4294 | }
|
4295 | }
|
4296 |
|
4297 | return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
4298 | return genScopedSlot(slots[key], state)
|
4299 | }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")")
|
4300 | }
|
4301 |
|
4302 | function containsSlotChild (el) {
|
4303 | if (el.type === 1) {
|
4304 | if (el.tag === 'slot') {
|
4305 | return true
|
4306 | }
|
4307 | return el.children.some(containsSlotChild)
|
4308 | }
|
4309 | return false
|
4310 | }
|
4311 |
|
4312 | function genScopedSlot (
|
4313 | el,
|
4314 | state
|
4315 | ) {
|
4316 | var isLegacySyntax = el.attrsMap['slot-scope'];
|
4317 | if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
4318 | return genIf(el, state, genScopedSlot, "null")
|
4319 | }
|
4320 | if (el.for && !el.forProcessed) {
|
4321 | return genFor(el, state, genScopedSlot)
|
4322 | }
|
4323 | var slotScope = el.slotScope === emptySlotScopeToken
|
4324 | ? ""
|
4325 | : String(el.slotScope);
|
4326 | var fn = "function(" + slotScope + "){" +
|
4327 | "return " + (el.tag === 'template'
|
4328 | ? el.if && isLegacySyntax
|
4329 | ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
4330 | : genChildren(el, state) || 'undefined'
|
4331 | : genElement(el, state)) + "}";
|
4332 |
|
4333 | var reverseProxy = slotScope ? "" : ",proxy:true";
|
4334 | return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
4335 | }
|
4336 |
|
4337 | function genChildren (
|
4338 | el,
|
4339 | state,
|
4340 | checkSkip,
|
4341 | altGenElement,
|
4342 | altGenNode
|
4343 | ) {
|
4344 | var children = el.children;
|
4345 | if (children.length) {
|
4346 | var el$1 = children[0];
|
4347 |
|
4348 | if (children.length === 1 &&
|
4349 | el$1.for &&
|
4350 | el$1.tag !== 'template' &&
|
4351 | el$1.tag !== 'slot'
|
4352 | ) {
|
4353 | var normalizationType = checkSkip
|
4354 | ? state.maybeComponent(el$1) ? ",1" : ",0"
|
4355 | : "";
|
4356 | return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
4357 | }
|
4358 | var normalizationType$1 = checkSkip
|
4359 | ? getNormalizationType(children, state.maybeComponent)
|
4360 | : 0;
|
4361 | var gen = altGenNode || genNode;
|
4362 | return ("[" + (children.map(function (c) { return gen(c, state); }).filter(function (c) { return c; }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
4363 | }
|
4364 | }
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 | function getNormalizationType (
|
4371 | children,
|
4372 | maybeComponent
|
4373 | ) {
|
4374 | var res = 0;
|
4375 | for (var i = 0; i < children.length; i++) {
|
4376 | var el = children[i];
|
4377 | if (el.type !== 1) {
|
4378 | continue
|
4379 | }
|
4380 |
|
4381 |
|
4382 |
|
4383 | if (needsNormalization(el) ||
|
4384 | (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
4385 |
|
4386 | res = 1;
|
4387 | break
|
4388 | }
|
4389 | if (maybeComponent(el) ||
|
4390 | (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
4391 | res = 1;
|
4392 | }
|
4393 | }
|
4394 | return res
|
4395 | }
|
4396 |
|
4397 | function needsNormalization (el) {
|
4398 | return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
4399 | }
|
4400 |
|
4401 | function genNode (node, state) {
|
4402 | if (node.mpNotGenRenderFn) {
|
4403 | return ''
|
4404 | } else if (node.type === 1) {
|
4405 | return genElement(node, state)
|
4406 | } if (node.type === 3 && node.isComment) {
|
4407 |
|
4408 | return genComment(node)
|
4409 | } else {
|
4410 | return genText(node)
|
4411 | }
|
4412 | }
|
4413 |
|
4414 | function genText (text) {
|
4415 | return ("_v(" + (text.type === 2
|
4416 | ? text.expression
|
4417 | : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
4418 | }
|
4419 |
|
4420 | function genComment (comment) /* istanbul ignore next */{
|
4421 | return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
4422 | }
|
4423 |
|
4424 | function genSlot (el, state) {
|
4425 | var slotName = el.slotName || '"default"';
|
4426 | var children = genChildren(el, state);
|
4427 | var res = "_t(" + slotName + (children ? ("," + children) : '');
|
4428 | var attrs = el.attrs || el.dynamicAttrs
|
4429 | ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
4430 |
|
4431 | name: camelize(attr.name),
|
4432 | value: attr.value,
|
4433 | dynamic: attr.dynamic
|
4434 | }); }))
|
4435 | : null;
|
4436 | var bind$$1 = el.attrsMap['v-bind'];
|
4437 | if ((attrs || bind$$1) && !children) {
|
4438 | res += ",null";
|
4439 | }
|
4440 | if (attrs) {
|
4441 | res += "," + attrs;
|
4442 | }
|
4443 | if (bind$$1) {
|
4444 | res += (attrs ? '' : ',null') + "," + bind$$1;
|
4445 | }
|
4446 | return res + ')'
|
4447 | }
|
4448 |
|
4449 |
|
4450 | function genComponent (
|
4451 | componentName,
|
4452 | el,
|
4453 | state
|
4454 | ) {
|
4455 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
4456 | return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
4457 | }
|
4458 |
|
4459 | var propKeys = ['h_', 'f_', 'k_', 'c_', 'slot', 'i_', 'sc_', 'textContent'];
|
4460 |
|
4461 | function genProps (props, mode) {
|
4462 | var staticProps = "";
|
4463 | var dynamicProps = "";
|
4464 | var bindingProp = props.filter(function (e) { return e.name === 'b_'; })[0] || {};
|
4465 | var isComponent = !!props.filter(function (e) { return e.name === 'c_'; })[0];
|
4466 | var bindings = [].concat(propKeys);
|
4467 | if (bindingProp.value) {
|
4468 | bindings = bindings.concat(bindingProp.value.replace(/"/g, '').split(','));
|
4469 | }
|
4470 |
|
4471 | for (var i = 0; i < props.length; i++) {
|
4472 | var prop = props[i];
|
4473 | var value = transformSpecialNewlines(prop.value);
|
4474 |
|
4475 | if (
|
4476 | (mode === 'attr' && !isComponent && bindings.indexOf(prop.name) === -1)
|
4477 | || prop.name === 'b_'
|
4478 | ) {
|
4479 | continue
|
4480 | }
|
4481 |
|
4482 | if (prop.dynamic) {
|
4483 | dynamicProps += (prop.name) + "," + value + ",";
|
4484 | } else {
|
4485 | staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
4486 | }
|
4487 | }
|
4488 | staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
4489 | if (dynamicProps) {
|
4490 | return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
4491 | } else {
|
4492 | return staticProps
|
4493 | }
|
4494 | }
|
4495 |
|
4496 |
|
4497 | function transformSpecialNewlines (text) {
|
4498 | return text
|
4499 | .replace(/\u2028/g, '\\u2028')
|
4500 | .replace(/\u2029/g, '\\u2029')
|
4501 | }
|
4502 |
|
4503 |
|
4504 |
|
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 | var prohibitedKeywordRE = new RegExp('\\b' + (
|
4510 | 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
4511 | 'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
4512 | 'extends,finally,continue,debugger,function,arguments'
|
4513 | ).split(',').join('\\b|\\b') + '\\b');
|
4514 |
|
4515 |
|
4516 | var unaryOperatorsRE = new RegExp('\\b' + (
|
4517 | 'delete,typeof,void'
|
4518 | ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
4519 |
|
4520 |
|
4521 | var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
4522 |
|
4523 |
|
4524 | function detectErrors (ast, warn) {
|
4525 | if (ast) {
|
4526 | checkNode(ast, warn);
|
4527 | }
|
4528 | }
|
4529 |
|
4530 | function checkNode (node, warn) {
|
4531 | if (node.type === 1) {
|
4532 | for (var name in node.attrsMap) {
|
4533 | if (dirRE.test(name)) {
|
4534 | var value = node.attrsMap[name];
|
4535 | if (value) {
|
4536 | var range = node.rawAttrsMap[name];
|
4537 | if (name === 'v-for') {
|
4538 | checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
4539 | } else if (onRE.test(name)) {
|
4540 | checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
4541 | } else {
|
4542 | checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
4543 | }
|
4544 | }
|
4545 | }
|
4546 | }
|
4547 | if (node.children) {
|
4548 | for (var i = 0; i < node.children.length; i++) {
|
4549 | checkNode(node.children[i], warn);
|
4550 | }
|
4551 | }
|
4552 | } else if (node.type === 2) {
|
4553 | checkExpression(node.expression, node.text, warn, node);
|
4554 | }
|
4555 | }
|
4556 |
|
4557 | function checkEvent (exp, text, warn, range) {
|
4558 | var stipped = exp.replace(stripStringRE, '');
|
4559 | var keywordMatch = stipped.match(unaryOperatorsRE);
|
4560 | if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
4561 | warn(
|
4562 | "avoid using JavaScript unary operator as property name: " +
|
4563 | "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
4564 | range
|
4565 | );
|
4566 | }
|
4567 | checkExpression(exp, text, warn, range);
|
4568 | }
|
4569 |
|
4570 | function checkFor (node, text, warn, range) {
|
4571 | checkExpression(node.for || '', text, warn, range);
|
4572 | checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
4573 | checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
4574 | checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
4575 | }
|
4576 |
|
4577 | function checkIdentifier (
|
4578 | ident,
|
4579 | type,
|
4580 | text,
|
4581 | warn,
|
4582 | range
|
4583 | ) {
|
4584 | if (typeof ident === 'string') {
|
4585 | try {
|
4586 | new Function(("var " + ident + "=_"));
|
4587 | } catch (e) {
|
4588 | warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
4589 | }
|
4590 | }
|
4591 | }
|
4592 |
|
4593 | function checkExpression (exp, text, warn, range) {
|
4594 | try {
|
4595 | new Function(("return " + exp));
|
4596 | } catch (e) {
|
4597 | var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
4598 | if (keywordMatch) {
|
4599 | warn(
|
4600 | "avoid using JavaScript keyword as property name: " +
|
4601 | "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
4602 | range
|
4603 | );
|
4604 | } else {
|
4605 | warn(
|
4606 | "invalid expression: " + (e.message) + " in\n\n" +
|
4607 | " " + exp + "\n\n" +
|
4608 | " Raw expression: " + (text.trim()) + "\n",
|
4609 | range
|
4610 | );
|
4611 | }
|
4612 | }
|
4613 | }
|
4614 |
|
4615 |
|
4616 |
|
4617 | var range = 2;
|
4618 |
|
4619 | function generateCodeFrame (
|
4620 | source,
|
4621 | start,
|
4622 | end
|
4623 | ) {
|
4624 | if ( start === void 0 ) start = 0;
|
4625 | if ( end === void 0 ) end = source.length;
|
4626 |
|
4627 | var lines = source.split(/\r?\n/);
|
4628 | var count = 0;
|
4629 | var res = [];
|
4630 | for (var i = 0; i < lines.length; i++) {
|
4631 | count += lines[i].length + 1;
|
4632 | if (count >= start) {
|
4633 | for (var j = i - range; j <= i + range || end > count; j++) {
|
4634 | if (j < 0 || j >= lines.length) { continue }
|
4635 | res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
4636 | var lineLength = lines[j].length;
|
4637 | if (j === i) {
|
4638 |
|
4639 | var pad = start - (count - lineLength) + 1;
|
4640 | var length = end > count ? lineLength - pad : end - start;
|
4641 | res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
4642 | } else if (j > i) {
|
4643 | if (end > count) {
|
4644 | var length$1 = Math.min(end - count, lineLength);
|
4645 | res.push(" | " + repeat$1("^", length$1));
|
4646 | }
|
4647 | count += lineLength + 1;
|
4648 | }
|
4649 | }
|
4650 | break
|
4651 | }
|
4652 | }
|
4653 | return res.join('\n')
|
4654 | }
|
4655 |
|
4656 | function repeat$1 (str, n) {
|
4657 | var result = '';
|
4658 | while (true) {
|
4659 | if (n & 1) { result += str; }
|
4660 | n >>>= 1;
|
4661 | if (n <= 0) { break }
|
4662 | str += str;
|
4663 | }
|
4664 | return result
|
4665 | }
|
4666 |
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 | function createFunction (code, errors) {
|
4672 | try {
|
4673 | return new Function(code)
|
4674 | } catch (err) {
|
4675 | errors.push({ err: err, code: code });
|
4676 | return noop
|
4677 | }
|
4678 | }
|
4679 |
|
4680 | function createCompileToFunctionFn (compile) {
|
4681 | var cache = Object.create(null);
|
4682 |
|
4683 | return function compileToFunctions (
|
4684 | template,
|
4685 | options,
|
4686 | vm
|
4687 | ) {
|
4688 | options = extend({}, options);
|
4689 | var warn$$1 = options.warn || warn;
|
4690 | delete options.warn;
|
4691 |
|
4692 |
|
4693 | if (process.env.NODE_ENV !== 'production') {
|
4694 |
|
4695 | try {
|
4696 | new Function('return 1');
|
4697 | } catch (e) {
|
4698 | if (e.toString().match(/unsafe-eval|CSP/)) {
|
4699 | warn$$1(
|
4700 | 'It seems you are using the standalone build of Vue.js in an ' +
|
4701 | 'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
4702 | 'The template compiler cannot work in this environment. Consider ' +
|
4703 | 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
4704 | 'templates into render functions.'
|
4705 | );
|
4706 | }
|
4707 | }
|
4708 | }
|
4709 |
|
4710 |
|
4711 | var key = options.delimiters
|
4712 | ? String(options.delimiters) + template
|
4713 | : template;
|
4714 | if (cache[key]) {
|
4715 | return cache[key]
|
4716 | }
|
4717 |
|
4718 |
|
4719 | var compiled = compile(template, options);
|
4720 |
|
4721 |
|
4722 | if (process.env.NODE_ENV !== 'production') {
|
4723 | if (compiled.errors && compiled.errors.length) {
|
4724 | if (options.outputSourceRange) {
|
4725 | compiled.errors.forEach(function (e) {
|
4726 | warn$$1(
|
4727 | "Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
4728 | generateCodeFrame(template, e.start, e.end),
|
4729 | vm
|
4730 | );
|
4731 | });
|
4732 | } else {
|
4733 | warn$$1(
|
4734 | "Error compiling template:\n\n" + template + "\n\n" +
|
4735 | compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
4736 | vm
|
4737 | );
|
4738 | }
|
4739 | }
|
4740 | if (compiled.tips && compiled.tips.length) {
|
4741 | if (options.outputSourceRange) {
|
4742 | compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
4743 | } else {
|
4744 | compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
4745 | }
|
4746 | }
|
4747 | }
|
4748 |
|
4749 |
|
4750 | var res = {};
|
4751 | var fnGenErrors = [];
|
4752 | res.render = createFunction(compiled.render, fnGenErrors);
|
4753 | res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
4754 | return createFunction(code, fnGenErrors)
|
4755 | });
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 | if (process.env.NODE_ENV !== 'production') {
|
4762 | if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
4763 | warn$$1(
|
4764 | "Failed to generate render function:\n\n" +
|
4765 | fnGenErrors.map(function (ref) {
|
4766 | var err = ref.err;
|
4767 | var code = ref.code;
|
4768 |
|
4769 | return ((err.toString()) + " in\n\n" + code + "\n");
|
4770 | }).join('\n'),
|
4771 | vm
|
4772 | );
|
4773 | }
|
4774 | }
|
4775 |
|
4776 | return (cache[key] = res)
|
4777 | }
|
4778 | }
|
4779 |
|
4780 |
|
4781 |
|
4782 | function createCompilerCreator (baseCompile) {
|
4783 | return function createCompiler (baseOptions) {
|
4784 | function compile (
|
4785 | template,
|
4786 | options
|
4787 | ) {
|
4788 | var finalOptions = Object.create(baseOptions);
|
4789 | var errors = [];
|
4790 | var tips = [];
|
4791 |
|
4792 | var warn = function (msg, range, tip) {
|
4793 | (tip ? tips : errors).push(msg);
|
4794 | };
|
4795 |
|
4796 | if (options) {
|
4797 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
4798 |
|
4799 | var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
4800 |
|
4801 | warn = function (msg, range, tip) {
|
4802 | var data = { msg: msg };
|
4803 | if (range) {
|
4804 | if (range.start != null) {
|
4805 | data.start = range.start + leadingSpaceLength;
|
4806 | }
|
4807 | if (range.end != null) {
|
4808 | data.end = range.end + leadingSpaceLength;
|
4809 | }
|
4810 | }
|
4811 | (tip ? tips : errors).push(data);
|
4812 | };
|
4813 | }
|
4814 |
|
4815 | if (options.modules) {
|
4816 | finalOptions.modules =
|
4817 | (baseOptions.modules || []).concat(options.modules);
|
4818 | }
|
4819 |
|
4820 | if (options.directives) {
|
4821 | finalOptions.directives = extend(
|
4822 | Object.create(baseOptions.directives || null),
|
4823 | options.directives
|
4824 | );
|
4825 | }
|
4826 |
|
4827 | for (var key in options) {
|
4828 | if (key !== 'modules' && key !== 'directives') {
|
4829 | finalOptions[key] = options[key];
|
4830 | }
|
4831 | }
|
4832 | }
|
4833 |
|
4834 | finalOptions.warn = warn;
|
4835 |
|
4836 | var compiled = baseCompile(template.trim(), finalOptions);
|
4837 | if (process.env.NODE_ENV !== 'production') {
|
4838 | detectErrors(compiled.ast, warn);
|
4839 | }
|
4840 | compiled.errors = errors;
|
4841 | compiled.tips = tips;
|
4842 | return compiled
|
4843 | }
|
4844 |
|
4845 | return {
|
4846 | compile: compile,
|
4847 | compileToFunctions: createCompileToFunctionFn(compile)
|
4848 | }
|
4849 | }
|
4850 | }
|
4851 |
|
4852 | function createFindEventTypeFn (eventTypeMap) {
|
4853 | return function findEventType (type) {
|
4854 | var res = '';
|
4855 | Object.keys(eventTypeMap)
|
4856 | .some(function (mpType) {
|
4857 | if (eventTypeMap[ mpType ].indexOf(type) > -1) {
|
4858 | res = mpType;
|
4859 | return true
|
4860 | }
|
4861 | });
|
4862 | return res
|
4863 | }
|
4864 | }
|
4865 |
|
4866 | function mergePreset (presetA, presetB) {
|
4867 | var res = Object.assign({}, presetA, presetB);
|
4868 | var aVisitors = presetA.visitors || {};
|
4869 | var bVisitors = presetB.visitors || {};
|
4870 | var mergeVisitors = Object.assign({}, aVisitors, bVisitors);
|
4871 | Object.assign(res, {
|
4872 | visitors: mergeVisitors
|
4873 | });
|
4874 |
|
4875 | return res
|
4876 | }
|
4877 |
|
4878 | function alterAttrName (el, oldName, newName) {
|
4879 | var attrsMap = el.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
4880 | var attrsList = el.attrsList; if ( attrsList === void 0 ) attrsList = [];
|
4881 | var attrs = el.attrs; if ( attrs === void 0 ) attrs = [];
|
4882 | var indexInAttrs = -1;
|
4883 | var indexInAttrsList = -1;
|
4884 |
|
4885 | attrs.some(function (attr, i) {
|
4886 | if (isSameAttrName(attr.name, oldName)) {
|
4887 | indexInAttrs = i;
|
4888 | return true
|
4889 | }
|
4890 | });
|
4891 |
|
4892 | attrsList.some(function (attr, i) {
|
4893 | if (isSameAttrName(attr.name, oldName)) {
|
4894 | indexInAttrsList = i;
|
4895 | return true
|
4896 | }
|
4897 | });
|
4898 |
|
4899 | if (indexInAttrs > -1) {
|
4900 | var rawOldName = attrsList[indexInAttrsList].name;
|
4901 | var rawNewName = rawOldName.replace(oldName, newName);
|
4902 | attrs[indexInAttrs].name = newName;
|
4903 | attrsList[indexInAttrsList].name = rawNewName;
|
4904 |
|
4905 | var mapValue = attrsMap[rawOldName];
|
4906 | delete attrsMap[rawOldName];
|
4907 | attrsMap[rawNewName] = mapValue;
|
4908 | }
|
4909 | }
|
4910 |
|
4911 | function isSameAttrName (oldName, newName) {
|
4912 | if ( oldName === void 0 ) oldName = '';
|
4913 | if ( newName === void 0 ) newName = '';
|
4914 |
|
4915 | return (
|
4916 | oldName === newName ||
|
4917 | oldName.replace(/:/, '') === newName.replace(/:/, '')
|
4918 | )
|
4919 | }
|
4920 |
|
4921 | var basePrest = {
|
4922 | visitors: {
|
4923 | a: function a (el) {
|
4924 | alterAttrName(el, 'href', 'url');
|
4925 | }
|
4926 | }
|
4927 | };
|
4928 |
|
4929 | var prefix = "wx:";
|
4930 |
|
4931 | var eventTypeMap$1 = {
|
4932 | tap: ['tap', 'click'],
|
4933 | touchstart: ['touchstart'],
|
4934 | touchmove: ['touchmove'],
|
4935 | touchcancel: ['touchcancel'],
|
4936 | touchend: ['touchend'],
|
4937 | longtap: ['longtap'],
|
4938 | input: ['input'],
|
4939 | blur: ['change', 'blur'],
|
4940 | submit: ['submit'],
|
4941 | focus: ['focus'],
|
4942 | scrolltoupper: ['scrolltoupper'],
|
4943 | scrolltolower: ['scrolltolower'],
|
4944 | scroll: ['scroll']
|
4945 | };
|
4946 |
|
4947 | var findEventType = createFindEventTypeFn(eventTypeMap$1);
|
4948 |
|
4949 | var wechat = mergePreset(basePrest, {
|
4950 | prefix: prefix,
|
4951 | ext: "wxml",
|
4952 | directives: {
|
4953 | if: (prefix + "if"),
|
4954 | elseif: (prefix + "elif"),
|
4955 | else: (prefix + "else"),
|
4956 | for: (prefix + "for"),
|
4957 | forItem: (prefix + "for-item"),
|
4958 | forIndex: (prefix + "for-index"),
|
4959 | forKey: (prefix + "key"),
|
4960 | on: "bind",
|
4961 | onStop: "catch",
|
4962 | capture: "capture"
|
4963 | },
|
4964 | eventTypeMap: eventTypeMap$1,
|
4965 | findEventType: findEventType,
|
4966 | genBind: function genBind (event, type, tag) {
|
4967 | var modifiers = event.modifiers; if ( modifiers === void 0 ) modifiers = {};
|
4968 | var isCapture = /!/.test(type);
|
4969 | var realType = type.replace(/^[~|!]/, '');
|
4970 | var stop = modifiers.stop;
|
4971 | var mpType = realType;
|
4972 | var binder = stop ? 'catch' : 'bind';
|
4973 | binder = isCapture ? ("capture-" + binder) : binder;
|
4974 |
|
4975 | if (binder !== 'bind') {
|
4976 | binder = binder + ":";
|
4977 | }
|
4978 |
|
4979 | if (type === 'change' && (tag === 'input' || tag === 'textarea')) {
|
4980 | mpType = 'blur';
|
4981 | } else {
|
4982 | mpType = mpType === 'click' ? 'tap' : mpType;
|
4983 | }
|
4984 | return ("" + binder + mpType)
|
4985 | }
|
4986 | });
|
4987 |
|
4988 | var prefix$1 = "a:";
|
4989 |
|
4990 | var eventTypeMap$2 = {
|
4991 | Tap: ['tap', 'click'],
|
4992 | TouchStart: ['touchstart'],
|
4993 | TouchMove: ['touchmove'],
|
4994 | TouchCancel: ['touchcancel'],
|
4995 | TouchEnd: ['touchend'],
|
4996 | LongTap: ['longtap'],
|
4997 | Input: ['input'],
|
4998 | Change: ['change'],
|
4999 | Changing: ['changing'],
|
5000 | Blur: ['change', 'blur'],
|
5001 | Clear: ['clear'],
|
5002 | Submit: ['submit'],
|
5003 | Focus: ['focus'],
|
5004 | ScrollToUpper: ['scrolltoupper'],
|
5005 | ScrollToLower: ['scrolltolower'],
|
5006 | Scroll: ['scroll'],
|
5007 | TransitionEnd: ['transitionend'],
|
5008 | AnimationStart: ['animationstart'],
|
5009 | AnimationIteration: ['animationiteration'],
|
5010 | AnimationEnd: ['animationend'],
|
5011 | Appear: ['appear'],
|
5012 | Disappear: ['disappear'],
|
5013 | FirstAppear: ['firstappear'],
|
5014 | Reset: ['reset'],
|
5015 | Confirm: ['confirm'],
|
5016 | Load: ['load'],
|
5017 | Error: ['error'],
|
5018 | MarkerTap: ['markertap'],
|
5019 | CalloutTap: ['callouttap'],
|
5020 | ControlTap: ['controltap'],
|
5021 | RegionChange: ['regionchange'],
|
5022 | Messag: ['message'],
|
5023 | PlusClick: ['plusclick'],
|
5024 | TabClick: ['tabclick'],
|
5025 | CardClick: ['cardclick'],
|
5026 | GridItemClick: ['griditemclick'],
|
5027 | ModalClick: ['modalclick'],
|
5028 | ModalClose: ['modalclose'],
|
5029 | TapMain: ['tapmain'],
|
5030 | TapSub: ['tapsub'],
|
5031 | CloseTap: ['closetap'],
|
5032 | ButtonClick: ['buttonclick'],
|
5033 | RightItemClick: ['rightitemclick'],
|
5034 | Select: ['select'],
|
5035 | MonthChange: ['monthchange']
|
5036 | };
|
5037 |
|
5038 | var findEventType$1 = createFindEventTypeFn(eventTypeMap$2);
|
5039 |
|
5040 | var alipay = mergePreset(basePrest, {
|
5041 | prefix: prefix$1,
|
5042 | ext: "axml",
|
5043 | directives: {
|
5044 | if: (prefix$1 + "if"),
|
5045 | elseif: (prefix$1 + "elif"),
|
5046 | else: (prefix$1 + "else"),
|
5047 | for: (prefix$1 + "for"),
|
5048 | forItem: (prefix$1 + "for-item"),
|
5049 | forIndex: (prefix$1 + "for-index"),
|
5050 | forKey: (prefix$1 + "key"),
|
5051 | on: "bind",
|
5052 | onStop: "catch",
|
5053 | capture: "capture"
|
5054 | },
|
5055 | eventTypeMap: eventTypeMap$2,
|
5056 | findEventType: findEventType$1,
|
5057 | genBind: function genBind (event, type, tag) {
|
5058 | var modifiers = event.modifiers; if ( modifiers === void 0 ) modifiers = {};
|
5059 |
|
5060 | var realType = type.replace(/^[~|!]/, '');
|
5061 | var stop = modifiers.stop;
|
5062 | var mpType = findEventType$1(realType) || realType;
|
5063 | var binder = stop ? 'catch' : 'on';
|
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 | if (type === 'change' && (tag === 'input' || tag === 'textarea')) {
|
5069 | mpType = 'blur';
|
5070 | }
|
5071 |
|
5072 | return ("" + binder + (capitalize(mpType)))
|
5073 | }
|
5074 | });
|
5075 |
|
5076 | var prefix$2 = "s-";
|
5077 |
|
5078 | var eventTypeMap$3 = {
|
5079 | tap: ['tap', 'click'],
|
5080 | touchstart: ['touchstart'],
|
5081 | touchmove: ['touchmove'],
|
5082 | touchcancel: ['touchcancel'],
|
5083 | touchend: ['touchend'],
|
5084 | longtap: ['longtap'],
|
5085 | input: ['input'],
|
5086 | blur: ['change', 'blur'],
|
5087 | submit: ['submit'],
|
5088 | focus: ['focus'],
|
5089 | scrolltoupper: ['scrolltoupper'],
|
5090 | scrolltolower: ['scrolltolower'],
|
5091 | scroll: ['scroll']
|
5092 | };
|
5093 |
|
5094 | var findEventType$2 = createFindEventTypeFn(eventTypeMap$3);
|
5095 |
|
5096 | var swan$1 = mergePreset(basePrest, {
|
5097 | prefix: prefix$2,
|
5098 | ext: "swan",
|
5099 | directives: {
|
5100 | if: (prefix$2 + "if"),
|
5101 | elseif: (prefix$2 + "elif"),
|
5102 | else: (prefix$2 + "else"),
|
5103 | for: (prefix$2 + "for"),
|
5104 | forItem: (prefix$2 + "for-item"),
|
5105 | forIndex: (prefix$2 + "for-index"),
|
5106 | forKey: (prefix$2 + "key"),
|
5107 | on: "bind",
|
5108 | onStop: "catch",
|
5109 | capture: "capture"
|
5110 | },
|
5111 | eventTypeMap: eventTypeMap$3,
|
5112 | findEventType: findEventType$2,
|
5113 | genBind: function genBind (event, type, tag) {
|
5114 | var modifiers = event.modifiers; if ( modifiers === void 0 ) modifiers = {};
|
5115 | var isCapture = /!/.test(type);
|
5116 | var realType = type.replace(/^[~|!]/, '');
|
5117 | var stop = modifiers.stop;
|
5118 | var mpType = realType;
|
5119 | var binder = stop ? 'catch' : 'bind';
|
5120 | binder = isCapture ? ("capture-" + binder) : binder;
|
5121 |
|
5122 | if (binder !== 'bind') {
|
5123 | binder = binder + ":";
|
5124 | }
|
5125 |
|
5126 | if (type === 'change' && (tag === 'input' || tag === 'textarea')) {
|
5127 | mpType = 'blur';
|
5128 | } else {
|
5129 | mpType = mpType === 'click' ? 'tap' : mpType;
|
5130 | }
|
5131 | return ("" + binder + mpType)
|
5132 | },
|
5133 | visitors: {
|
5134 | all: function all (el) {
|
5135 | if (el.tag === 'input') {
|
5136 | el.isSelfCloseTag = true;
|
5137 | }
|
5138 | }
|
5139 | }
|
5140 | });
|
5141 |
|
5142 | var presets = {
|
5143 | wechat: wechat,
|
5144 | alipay: alipay,
|
5145 | swan: swan$1
|
5146 | };
|
5147 |
|
5148 | var vbindReg = /^(v-bind:?|:)/;
|
5149 | var iteratorUid = createUidFn('item');
|
5150 |
|
5151 | var TYPE = {
|
5152 | ELEMENT: 1,
|
5153 | TEXT: 2,
|
5154 | STATIC_TEXT: 3
|
5155 | };
|
5156 |
|
5157 | var sep = "'" + (LIST_TAIL_SEPS.wechat) + "'";
|
5158 |
|
5159 |
|
5160 | function mpify (node, options) {
|
5161 | var target = options.target; if ( target === void 0 ) target = 'wechat';
|
5162 | var imports = options.imports; if ( imports === void 0 ) imports = {};
|
5163 | var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {};
|
5164 | var scopeId = options.scopeId; if ( scopeId === void 0 ) scopeId = '';
|
5165 | sep = "'" + (LIST_TAIL_SEPS[target]) + "'";
|
5166 | var preset = presets[target];
|
5167 | var state = new State({
|
5168 | rootNode: node,
|
5169 | target: target,
|
5170 | preset: preset,
|
5171 | imports: imports,
|
5172 | transformAssetUrls: transformAssetUrls,
|
5173 | scopeId: scopeId
|
5174 | });
|
5175 | if (scopeId) {
|
5176 | addAttr$1(node, 'sc_', ("\"" + scopeId + "\""));
|
5177 | }
|
5178 | walk(node, state);
|
5179 | }
|
5180 |
|
5181 | function visit (node, state) {
|
5182 | var ref = state.preset;
|
5183 | var visitors = ref.visitors; if ( visitors === void 0 ) visitors = {};
|
5184 |
|
5185 | if (visitors.all) {
|
5186 | visitors.all(node);
|
5187 | }
|
5188 |
|
5189 | if (visitors[node.tag]) {
|
5190 | visitors[node.tag](node);
|
5191 | }
|
5192 | }
|
5193 |
|
5194 | function walk (node, state) {
|
5195 | visit(node, state);
|
5196 |
|
5197 | if (node.for && !node.mpForWalked) {
|
5198 | return walkFor(node, state)
|
5199 | }
|
5200 |
|
5201 | state.resolveHolder(node);
|
5202 |
|
5203 | if (node.ifConditions && !node.mpIfWalked) {
|
5204 | return walkIf(node, state)
|
5205 | }
|
5206 |
|
5207 |
|
5208 | if (node.type === TYPE.ELEMENT) {
|
5209 | walkElem(node, state);
|
5210 | } else if (
|
5211 | node.type === TYPE.TEXT || node.type === TYPE.STATIC_TEXT
|
5212 | ) {
|
5213 | walkText(node, state);
|
5214 | }
|
5215 | }
|
5216 |
|
5217 | function walkFor (node, state) {
|
5218 | var _for = node.for;
|
5219 | var key = node.key;
|
5220 | var alias = node.alias;
|
5221 | var prefix = /{/.test(alias) ? ("" + (iteratorUid())) : alias;
|
5222 |
|
5223 |
|
5224 | var iterator1 = node.iterator1; if ( iterator1 === void 0 ) iterator1 = prefix + "_i1";
|
5225 | var iterator2 = node.iterator2; if ( iterator2 === void 0 ) iterator2 = prefix + "_i2";
|
5226 | Object.assign(node, {
|
5227 | mpForWalked: true,
|
5228 | iterator1: iterator1,
|
5229 | iterator2: iterator2
|
5230 | });
|
5231 |
|
5232 | state.pushListState({
|
5233 | iterator1: iterator1,
|
5234 | iterator2: iterator2,
|
5235 | _for: _for,
|
5236 | key: key,
|
5237 | node: node,
|
5238 | alias: alias
|
5239 | });
|
5240 |
|
5241 | state.resolveHolder(node);
|
5242 | state.resolveForHolder(node);
|
5243 |
|
5244 | walk(node, state);
|
5245 |
|
5246 | state.popListState();
|
5247 | }
|
5248 |
|
5249 | function walkElem (node, state) {
|
5250 | processAttrs$1(node, state);
|
5251 | if (node.key) {
|
5252 | var key = node.key.replace(/^\w*\./, '');
|
5253 | addAttr$1(node, 'k_', ("\"" + key + "\""));
|
5254 | }
|
5255 |
|
5256 |
|
5257 | if (state.isComponent(node)) {
|
5258 | return walkComponent(node, state)
|
5259 | }
|
5260 |
|
5261 | walkChildren(node, state);
|
5262 | }
|
5263 |
|
5264 | function walkComponent (node, state) {
|
5265 |
|
5266 | var c_ = state.getCId();
|
5267 |
|
5268 |
|
5269 | state.pushComp();
|
5270 |
|
5271 | Object.assign(node, { c_: c_ });
|
5272 | addAttr$1(node, 'c_', c_);
|
5273 |
|
5274 | walkChildren(node, state);
|
5275 | state.popComp();
|
5276 | }
|
5277 |
|
5278 | function walkText (node) {
|
5279 | var expression = node.expression;
|
5280 | var type = node.type;
|
5281 | var h_ = node.h_;
|
5282 | var f_ = node.f_;
|
5283 | if (type === TYPE.STATIC_TEXT) {
|
5284 | node.mpNotGenRenderFn = true;
|
5285 | } else if (f_) {
|
5286 | node.expression = expression + "," + h_ + ",f_";
|
5287 | } else {
|
5288 | node.expression = expression + "," + h_;
|
5289 | }
|
5290 | }
|
5291 |
|
5292 | function walkIf (node, state) {
|
5293 | var conditions = node.ifConditions;
|
5294 |
|
5295 | node.mpIfWalked = true;
|
5296 |
|
5297 | conditions.forEach(function (condition) {
|
5298 | var block = condition.block;
|
5299 | var exp = condition.exp;
|
5300 |
|
5301 | walk(block, state);
|
5302 |
|
5303 | if (state.isInSlot()) {
|
5304 | condition.__isInSlot = true;
|
5305 | if (!conditions.__extratExpression) {
|
5306 | conditions.__extratExpression = [];
|
5307 | }
|
5308 | if (exp) {
|
5309 | var extratExpression = "!!(" + exp + "), " + (block.h_) + ", " + (block.f_ || null);
|
5310 | conditions.__extratExpression.push(extratExpression);
|
5311 | }
|
5312 | }
|
5313 |
|
5314 | if (exp) {
|
5315 | condition.rawexp = exp;
|
5316 | if (block.f_) {
|
5317 | condition.exp = "_ri(!!(" + exp + "), " + (block.h_) + ", " + (block.f_) + ")";
|
5318 | } else {
|
5319 | condition.exp = "_ri(!!(" + exp + "), " + (block.h_) + ")";
|
5320 | }
|
5321 | }
|
5322 | });
|
5323 |
|
5324 | if (conditions.__extratExpression) {
|
5325 | conditions.forEach(function (condition) {
|
5326 | var block = condition.block;
|
5327 | var noneTemplateBlock = findFirstNoneTemplateNode(block);
|
5328 | addAttr$1(noneTemplateBlock, 'i_', ("[ " + (conditions.__extratExpression.join(',')) + " ]"));
|
5329 | });
|
5330 | }
|
5331 | }
|
5332 |
|
5333 | function walkChildren (node, state) {
|
5334 | var children = node.children;
|
5335 | var scopedSlots = node.scopedSlots;
|
5336 | if (children && children.length) {
|
5337 | children.forEach(function (n) {
|
5338 | walk(n, state);
|
5339 | });
|
5340 | }
|
5341 |
|
5342 | if (scopedSlots) {
|
5343 | Object.keys(scopedSlots).forEach(function (k) {
|
5344 | var slot = scopedSlots[k];
|
5345 | walk(slot, state);
|
5346 | });
|
5347 | }
|
5348 | }
|
5349 |
|
5350 | function processAttrs$1 (node, state) {
|
5351 | var attrsList = node.attrsList; if ( attrsList === void 0 ) attrsList = [];
|
5352 | var attrs = node.attrs; if ( attrs === void 0 ) attrs = [];
|
5353 | var attrsMap = node.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
5354 | var bindingAttrs = [];
|
5355 |
|
5356 | attrsList.forEach(function (attr) {
|
5357 | var name = attr.name;
|
5358 | if (/^:?mp:/.test(name)) {
|
5359 | var realName = attr.name.replace(/mp:/, '');
|
5360 | renameObjectPropName(attrsMap, name, realName);
|
5361 | modifyAttrName(attrs, name, realName);
|
5362 | attr.name = realName;
|
5363 | name = realName;
|
5364 | }
|
5365 |
|
5366 | if (!vbindReg.test(name)) {
|
5367 |
|
5368 | if (attr.value === '') {
|
5369 | attr.value = 'true';
|
5370 | attrsMap[name] = 'true';
|
5371 | modifyAttr(attrs, name, '"true"');
|
5372 | }
|
5373 | } else {
|
5374 |
|
5375 | var bindingName = name.replace(vbindReg, '') || 'value';
|
5376 | bindingAttrs.push(bindingName);
|
5377 | }
|
5378 |
|
5379 |
|
5380 | if (!/https?/.test(attr.value) && state.isTransformAssetUrl(node, name)) {
|
5381 | bindingAttrs.push(name);
|
5382 | }
|
5383 | });
|
5384 |
|
5385 | if (bindingAttrs.length) {
|
5386 | addAttr$1(node, 'b_', ("\"" + (bindingAttrs.join(',')) + "\""));
|
5387 | }
|
5388 | }
|
5389 |
|
5390 | function addAttr$1 (node, name, value) {
|
5391 |
|
5392 | node.plain = false;
|
5393 | var attrs = node.attrs; if ( attrs === void 0 ) attrs = [];
|
5394 | var attrsMap = node.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
5395 | var attr = attrs.filter(function (attr) { return attr.name === name; })[0];
|
5396 | var attrIndex = attrs.indexOf(attr);
|
5397 |
|
5398 | attrIndex = attrIndex !== -1 ? attrIndex : attrs.length;
|
5399 | attrs[attrIndex] = {
|
5400 | name: name,
|
5401 | value: ("" + value)
|
5402 | };
|
5403 | attrsMap[name] = "" + value;
|
5404 |
|
5405 | Object.assign(node, { attrs: attrs, attrsMap: attrsMap });
|
5406 | }
|
5407 |
|
5408 | var State = function State (options) {
|
5409 | if ( options === void 0 ) options = {};
|
5410 |
|
5411 | this.transformAssetUrls = options.transformAssetUrls;
|
5412 | this.imports = options.imports;
|
5413 | this.rootNode = options.rootNode;
|
5414 | this.compCount = -1;
|
5415 | this.elemCount = -1;
|
5416 | this.compStack = new Stack();
|
5417 | this.sep = options.sep || '-';
|
5418 | this.preset = options.preset;
|
5419 |
|
5420 | this.pushComp();
|
5421 | };
|
5422 | State.prototype.pushComp = function pushComp () {
|
5423 | this.compStack.push({
|
5424 | id: ++this.compCount,
|
5425 | elems: 0,
|
5426 | listStates: new Stack()
|
5427 | });
|
5428 | };
|
5429 | State.prototype.popComp = function popComp () {
|
5430 | this.compStack.pop();
|
5431 | };
|
5432 | State.prototype.pushElem = function pushElem () {
|
5433 | this.elemCount++;
|
5434 | };
|
5435 | State.prototype.popListState = function popListState () {
|
5436 | return this.getCurrentComp().listStates.pop()
|
5437 | };
|
5438 | State.prototype.pushListState = function pushListState (state) {
|
5439 | var currentStates = this.getCurrentListState();
|
5440 | var newStates = [];
|
5441 | if (currentStates && currentStates.length) {
|
5442 | newStates = [].concat(currentStates);
|
5443 | }
|
5444 |
|
5445 | newStates.push(state);
|
5446 | this.getCurrentComp().listStates.push(newStates);
|
5447 | };
|
5448 | State.prototype.getCurrentListState = function getCurrentListState () {
|
5449 | return this.getCurrentComp().listStates.top
|
5450 | };
|
5451 | State.prototype.getCurrentComp = function getCurrentComp () {
|
5452 | return this.compStack.top
|
5453 | };
|
5454 | State.prototype.getCurrentCompIndex = function getCurrentCompIndex () {
|
5455 | return ("" + (this.compCount))
|
5456 | };
|
5457 | State.prototype.getCurrentElemIndex = function getCurrentElemIndex () {
|
5458 | return this.elemCount
|
5459 | };
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 | State.prototype.getHId = function getHId () {
|
5465 | this.pushElem();
|
5466 | var h_ = "" + (this.getCurrentElemIndex());
|
5467 | return ("" + h_)
|
5468 | };
|
5469 | State.prototype.getCId = function getCId () {
|
5470 | this.pushElem();
|
5471 | var c_ = "" + (this.getCurrentCompIndex());
|
5472 | return ("" + c_)
|
5473 | };
|
5474 | State.prototype.getFid = function getFid () {
|
5475 | var currentListState = this.getCurrentListState() || [];
|
5476 | var f_ = currentListState.map(function (s) { return ("(" + (s.iterator2) + " !== undefined ? " + (s.iterator2) + " : " + (s.iterator1) + ")"); }).join((" + " + sep + " + "));
|
5477 | return f_
|
5478 | };
|
5479 | State.prototype.isInSlot = function isInSlot () {
|
5480 | return this.getCurrentComp().id !== 0
|
5481 | };
|
5482 | State.prototype.assignHId = function assignHId (node) {
|
5483 | var h_ = this.getHId(node);
|
5484 |
|
5485 | if (this.isInSlot()) {
|
5486 | h_ = "'s" + h_ + "'";
|
5487 | }
|
5488 |
|
5489 | Object.assign(node, { h_: h_ });
|
5490 | };
|
5491 | State.prototype.resolveForHolder = function resolveForHolder (node) {
|
5492 | var h_ = node.h_;
|
5493 | var f_ = node.f_;
|
5494 | var currentListState = this.getCurrentListState() || [];
|
5495 | var tail = '';
|
5496 |
|
5497 |
|
5498 |
|
5499 | node._forInfo = { h_: h_ };
|
5500 |
|
5501 |
|
5502 | if (f_) {
|
5503 | tail = currentListState.slice(0, -1).map(function (s) { return ("(" + (s.iterator2) + " !== undefined ? " + (s.iterator2) + " : " + (s.iterator1) + ")"); }).join((" + " + sep + " + "));
|
5504 | node._forInfo.f_ = ("" + tail) || undefined;
|
5505 | }
|
5506 | };
|
5507 | State.prototype.resolveHolder = function resolveHolder (node) {
|
5508 | if (node.h_ === undefined) {
|
5509 |
|
5510 | this.assignHId(node);
|
5511 | addAttr$1(node, 'h_', node.h_);
|
5512 |
|
5513 |
|
5514 | var f_ = this.getFid(node);
|
5515 | if (f_) {
|
5516 | Object.assign(node, { f_: f_ });
|
5517 | addAttr$1(node, 'f_', 'f_');
|
5518 | }
|
5519 | }
|
5520 | };
|
5521 |
|
5522 | State.prototype.isComponent = function isComponent (node) {
|
5523 | var tag = node.tag;
|
5524 | return !!getComponentInfo(tag, this.imports)
|
5525 | };
|
5526 |
|
5527 | State.prototype.isTransformAssetUrl = function isTransformAssetUrl (node, name) {
|
5528 | return this.transformAssetUrls[node.tag] === name
|
5529 | };
|
5530 |
|
5531 | function findFirstNoneTemplateNode (node) {
|
5532 | var res = null;
|
5533 | if (node.tag !== 'template') {
|
5534 | return node
|
5535 | }
|
5536 |
|
5537 |
|
5538 | if (node.children) {
|
5539 | node.children.some(function (c) {
|
5540 | var found = findFirstNoneTemplateNode(c);
|
5541 |
|
5542 | if (found) {
|
5543 | res = found;
|
5544 | return true
|
5545 | }
|
5546 | });
|
5547 | }
|
5548 |
|
5549 | return res
|
5550 | }
|
5551 |
|
5552 | function renameObjectPropName (obj, from, to) {
|
5553 |
|
5554 | if (obj.hasOwnProperty(from)) {
|
5555 | obj[to] = obj[from];
|
5556 | delete obj[from];
|
5557 | }
|
5558 | }
|
5559 |
|
5560 | function modifyAttr (attrs, name, value) {
|
5561 | attrs.some(function (attr) {
|
5562 |
|
5563 | if (attr.name === name) {
|
5564 | attr.value = value;
|
5565 | return true
|
5566 | }
|
5567 | });
|
5568 | }
|
5569 |
|
5570 | function modifyAttrName (attrs, name, newName) {
|
5571 | var realName = name.replace(/^:/, '');
|
5572 | var realNewName = newName.replace(/^:/, '');
|
5573 | attrs.some(function (attr) {
|
5574 |
|
5575 | if (attr.name === realName) {
|
5576 | attr.name = realNewName;
|
5577 | return true
|
5578 | }
|
5579 | });
|
5580 | }
|
5581 |
|
5582 |
|
5583 |
|
5584 | var templateCache = {};
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 | var createCompiler = createCompilerCreator(function baseCompile (
|
5590 | template,
|
5591 | options
|
5592 | ) {
|
5593 | var realResourcePath = options.realResourcePath;
|
5594 | var md5 = options.md5;
|
5595 | var templateTrimed = template.trim();
|
5596 |
|
5597 | var cache = templateCache[realResourcePath];
|
5598 | if (md5 && cache && cache.md5 === md5) {
|
5599 | return cache.data
|
5600 | }
|
5601 |
|
5602 | var ast = parse(templateTrimed, options);
|
5603 | optimize(ast, options);
|
5604 | mpify(ast, options);
|
5605 | var code = generate(ast, options);
|
5606 | var data = {
|
5607 | ast: ast,
|
5608 | render: code.render,
|
5609 | staticRenderFns: code.staticRenderFns
|
5610 | };
|
5611 |
|
5612 | if (md5 && realResourcePath) {
|
5613 | templateCache[realResourcePath] = {
|
5614 | data: data,
|
5615 | md5: md5
|
5616 | };
|
5617 | }
|
5618 |
|
5619 | return data
|
5620 | });
|
5621 |
|
5622 | var TAG_MAP = {
|
5623 | 'template': 'block',
|
5624 | 'br': 'view',
|
5625 | 'hr': 'view',
|
5626 |
|
5627 | 'p': 'view',
|
5628 | 'h1': 'view',
|
5629 | 'h2': 'view',
|
5630 | 'h3': 'view',
|
5631 | 'h4': 'view',
|
5632 | 'h5': 'view',
|
5633 | 'h6': 'view',
|
5634 | 'abbr': 'view',
|
5635 | 'address': 'view',
|
5636 | 'b': 'view',
|
5637 | 'bdi': 'view',
|
5638 | 'bdo': 'view',
|
5639 | 'blockquote': 'view',
|
5640 | 'cite': 'view',
|
5641 | 'code': 'view',
|
5642 | 'del': 'view',
|
5643 | 'ins': 'view',
|
5644 | 'dfn': 'view',
|
5645 | 'em': 'view',
|
5646 | 'strong': 'view',
|
5647 | 'samp': 'view',
|
5648 | 'kbd': 'view',
|
5649 | 'var': 'view',
|
5650 | 'i': 'view',
|
5651 | 'mark': 'view',
|
5652 | 'pre': 'view',
|
5653 | 'q': 'view',
|
5654 | 'ruby': 'view',
|
5655 | 'rp': 'view',
|
5656 | 'rt': 'view',
|
5657 | 's': 'view',
|
5658 | 'small': 'view',
|
5659 | 'sub': 'view',
|
5660 | 'sup': 'view',
|
5661 | 'time': 'view',
|
5662 | 'u': 'view',
|
5663 | 'wbr': 'view',
|
5664 |
|
5665 |
|
5666 | 'form': 'form',
|
5667 | 'input': 'input',
|
5668 | 'textarea': 'textarea',
|
5669 | 'button': 'button',
|
5670 | 'select': 'picker',
|
5671 | 'option': 'view',
|
5672 | 'optgroup': 'view',
|
5673 | 'label': 'label',
|
5674 | 'fieldset': 'view',
|
5675 | 'datalist': 'picker',
|
5676 | 'legend': 'view',
|
5677 | 'output': 'view',
|
5678 |
|
5679 |
|
5680 | 'iframe': 'view',
|
5681 |
|
5682 | 'img': 'image',
|
5683 | 'canvas': 'canvas',
|
5684 | 'figure': 'view',
|
5685 | 'figcaption': 'view',
|
5686 |
|
5687 |
|
5688 | 'audio': 'audio',
|
5689 | 'source': 'audio',
|
5690 | 'video': 'video',
|
5691 | 'track': 'video',
|
5692 |
|
5693 | 'a': 'navigator',
|
5694 | 'nav': 'view',
|
5695 | 'link': 'navigator',
|
5696 |
|
5697 | 'ul': 'view',
|
5698 | 'ol': 'view',
|
5699 | 'li': 'view',
|
5700 | 'dl': 'view',
|
5701 | 'dt': 'view',
|
5702 | 'dd': 'view',
|
5703 | 'menu': 'view',
|
5704 | 'command': 'view',
|
5705 |
|
5706 |
|
5707 | 'table': 'view',
|
5708 | 'caption': 'view',
|
5709 | 'th': 'view',
|
5710 | 'td': 'view',
|
5711 | 'tr': 'view',
|
5712 | 'thead': 'view',
|
5713 | 'tbody': 'view',
|
5714 | 'tfoot': 'view',
|
5715 | 'col': 'view',
|
5716 | 'colgroup': 'view',
|
5717 |
|
5718 |
|
5719 | 'div': 'view',
|
5720 | 'main': 'view',
|
5721 | 'span': 'label',
|
5722 | 'header': 'view',
|
5723 | 'footer': 'view',
|
5724 | 'section': 'view',
|
5725 | 'article': 'view',
|
5726 | 'aside': 'view',
|
5727 | 'details': 'view',
|
5728 | 'dialog': 'view',
|
5729 | 'summary': 'view',
|
5730 |
|
5731 | 'progress': 'progress',
|
5732 | 'meter': 'progress',
|
5733 | 'head': 'view',
|
5734 | 'meta': 'view',
|
5735 | 'base': 'text',
|
5736 | 'area': 'navigator',
|
5737 |
|
5738 | 'script': 'view',
|
5739 | 'noscript': 'view',
|
5740 | 'embed': 'view',
|
5741 | 'object': 'view',
|
5742 | 'param': 'view',
|
5743 |
|
5744 | 'view': 'view',
|
5745 | 'scroll-view': 'scroll-view',
|
5746 | 'swiper': 'swiper',
|
5747 | 'swiper-item': 'swiper-item',
|
5748 | 'rich-text': 'rich-text',
|
5749 | 'movable-view': 'movable-view',
|
5750 | 'cover-view': 'cover-view',
|
5751 | 'icon': 'icon',
|
5752 | 'text': 'text',
|
5753 | 'checkbox': 'checkbox',
|
5754 | 'checkbox-group': 'checkbox-group',
|
5755 | 'radio': 'radio',
|
5756 | 'radio-group': 'radio-group',
|
5757 | 'picker': 'picker',
|
5758 | 'picker-view': 'picker-view',
|
5759 | 'slider': 'slider',
|
5760 | 'switch': 'switch',
|
5761 | 'navigator': 'navigator',
|
5762 | 'image': 'image',
|
5763 | 'map': 'map',
|
5764 | 'contact-button': 'contact-button',
|
5765 | 'block': 'block',
|
5766 | 'live-player': 'live-player',
|
5767 | 'live-pusher': 'live-pusher',
|
5768 | 'web-view': 'web-view',
|
5769 | 'open-data': 'open-data',
|
5770 | 'official-account': 'official-account'
|
5771 | };
|
5772 |
|
5773 |
|
5774 |
|
5775 | var vbindReg$1 = /^(v-bind)?:/;
|
5776 | var vonReg = /^v-on:|@/;
|
5777 | var vmodelReg = /^v-model/;
|
5778 | var vtextReg = /^v-text/;
|
5779 |
|
5780 | var sep$1 = "'" + (LIST_TAIL_SEPS.wechat) + "'";
|
5781 |
|
5782 | function compileToTemplate (ast, options) {
|
5783 | if ( options === void 0 ) options = {};
|
5784 |
|
5785 | var templateGenerator = new TemplateGenerator(options);
|
5786 |
|
5787 | return templateGenerator.generate(ast)
|
5788 | }
|
5789 |
|
5790 | var TemplateGenerator = function TemplateGenerator (options) {
|
5791 | if ( options === void 0 ) options = {};
|
5792 |
|
5793 | var target = options.target; if ( target === void 0 ) target = 'wechat';
|
5794 | var name = options.name; if ( name === void 0 ) name = 'defaultName';
|
5795 | var scopeId = options.scopeId; if ( scopeId === void 0 ) scopeId = '';
|
5796 | var imports = options.imports; if ( imports === void 0 ) imports = {};
|
5797 | var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {};
|
5798 | var slots = options.slots; if ( slots === void 0 ) slots = [];
|
5799 | var warn = options.warn; if ( warn === void 0 ) warn = baseWarn;
|
5800 | var htmlParse = options.htmlParse; if ( htmlParse === void 0 ) htmlParse = {};
|
5801 |
|
5802 | var preset = presets[target];
|
5803 | sep$1 = LIST_TAIL_SEPS[target] ? ("'" + (LIST_TAIL_SEPS[target]) + "'") : sep$1;
|
5804 |
|
5805 | Object.assign(this, {
|
5806 | name: name,
|
5807 | target: target,
|
5808 | scopeId: scopeId,
|
5809 | imports: imports,
|
5810 | transformAssetUrls: transformAssetUrls,
|
5811 | slots: slots,
|
5812 | preset: preset,
|
5813 | warn: warn,
|
5814 | needHtmlParse: false,
|
5815 | htmlParse: htmlParse,
|
5816 | options: options,
|
5817 | errors: []
|
5818 | });
|
5819 |
|
5820 | this.slotSnippetBuffer = [];
|
5821 | this.fallbackSlot = 0;
|
5822 | this.children = [];
|
5823 | this.componentsStack = [];
|
5824 | };
|
5825 |
|
5826 | TemplateGenerator.prototype.generate = function generate (ast) {
|
5827 | try {
|
5828 | var clonedAST = cloneAST(ast);
|
5829 | var code = this.genElement(clonedAST);
|
5830 | var body = [
|
5831 |
|
5832 | ("<template name=\"" + (this.name) + "\">" + code + "</template>")
|
5833 | ].join('');
|
5834 |
|
5835 | var ref = this;
|
5836 | var needHtmlParse = ref.needHtmlParse;
|
5837 | return {
|
5838 | body: body,
|
5839 | slots: this.slots,
|
5840 | needHtmlParse: needHtmlParse,
|
5841 | errors: this.errors,
|
5842 | children: this.children
|
5843 | }
|
5844 | } catch (err) {
|
5845 | console.error('[compile template error]', err);
|
5846 | this.errors.push(err);
|
5847 |
|
5848 | return {
|
5849 | body: this.genError(err),
|
5850 | slots: this.slots
|
5851 | }
|
5852 | }
|
5853 | };
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 | TemplateGenerator.prototype.genElement = function genElement (el) {
|
5863 | if (el.ifConditions && !el.ifConditionsGenerated) {
|
5864 | return this.genIfConditions(el)
|
5865 | } else if (this.isVHtml(el)) {
|
5866 | this.needHtmlParse = true;
|
5867 | return this.genVHtml(el)
|
5868 | } else if (this.isSlot(el)) {
|
5869 | return this.genSlot(el)
|
5870 | } else if (this.isComponent(el)) {
|
5871 | return this.genComponent(el)
|
5872 | } else if (el.type === 1) {
|
5873 | return this.genTag(el)
|
5874 | } else {
|
5875 | return this.genText(el)
|
5876 | }
|
5877 | };
|
5878 |
|
5879 |
|
5880 | TemplateGenerator.prototype.genComponent = function genComponent (el) {
|
5881 | var c_ = el.c_;
|
5882 | var tag = el.tag;
|
5883 | var f_ = el.f_;
|
5884 | var compInfo = this.getComponent(tag);
|
5885 | this.enterComponent(compInfo);
|
5886 |
|
5887 | var compName = compInfo.name;
|
5888 | var slots = this.genSlotSnippets(el);
|
5889 | var slotsNames = slots.map(function (sl) {
|
5890 | var name = sl.name;
|
5891 | var slotName = sl.slotName;
|
5892 | var ifHolder = sl.ifHolder;
|
5893 | if (ifHolder) {
|
5894 | return ("s_" + name + ":" + ifHolder + "?'" + slotName + "':''")
|
5895 | } else {
|
5896 | return ("s_" + name + ": '" + slotName + "'")
|
5897 | }
|
5898 | });
|
5899 | var cid = c_;
|
5900 | var scope = '';
|
5901 | var tail = ", " + FOR_TAIL_VAR + ": _t || ''";
|
5902 |
|
5903 |
|
5904 | if (this.scopeId && !this.isInSlotSnippet()) {
|
5905 | scope = "," + PARENT_SCOPE_ID_VAR + ":(" + PARENT_SCOPE_ID_VAR + "||'')+' " + (this.scopeId) + "'";
|
5906 | } else {
|
5907 | scope = "," + PARENT_SCOPE_ID_VAR + ":" + PARENT_SCOPE_ID_VAR + "||''";
|
5908 | }
|
5909 |
|
5910 |
|
5911 |
|
5912 | if (isDef(f_)) {
|
5913 | cid = c_ + " + (_t || '') + " + sep$1 + " + " + f_;
|
5914 | tail = ", " + FOR_TAIL_VAR + ": (" + FOR_TAIL_VAR + " || '') + " + sep$1 + " + " + f_;
|
5915 | } else {
|
5916 | cid = c_ + " + (_t || '')";
|
5917 | tail = ", " + FOR_TAIL_VAR + ": " + FOR_TAIL_VAR + " || ''";
|
5918 | }
|
5919 |
|
5920 | var data = [
|
5921 | ("..." + ROOT_DATA_VAR + "[ " + VM_ID_PREFIX + " + " + cid + " ]"),
|
5922 | ("" + ROOT_DATA_VAR) ].concat( slotsNames
|
5923 | ).join(', ');
|
5924 |
|
5925 | var attrs = [
|
5926 | (" is=\"" + compName + "\""),
|
5927 | " data=\"" + this.wrapTemplateData(("" + data + tail + scope)) + "\"",
|
5928 | this.genIf(el),
|
5929 | this.genFor(el)
|
5930 | ].filter(notEmpty).join('');
|
5931 |
|
5932 | var currentComponent = this.getCurrentCompoent();
|
5933 | currentComponent.slots = slots;
|
5934 |
|
5935 | this.leaveComponent();
|
5936 |
|
5937 | return ("<template" + attrs + " />")
|
5938 | };
|
5939 |
|
5940 |
|
5941 | TemplateGenerator.prototype.genSlotSnippets = function genSlotSnippets (el) {
|
5942 | var this$1 = this;
|
5943 |
|
5944 | var self = this;
|
5945 | var root = el;
|
5946 | var slots = {};
|
5947 | var scopedSlots = el.scopedSlots;
|
5948 |
|
5949 | if (scopedSlots) {
|
5950 | Object.keys(scopedSlots)
|
5951 | .forEach(function (k) {
|
5952 | var slot = scopedSlots[k] || {};
|
5953 | var slotAst = [];
|
5954 | if (slot.tag === 'template') {
|
5955 | slotAst = slot.children || [];
|
5956 | } else {
|
5957 | slotAst = [slot];
|
5958 | }
|
5959 | var slotName = removeQuotes(k);
|
5960 | addSlotAst.apply(void 0, [ slotName ].concat( slotAst ));
|
5961 | slots[slotName].scoped = true;
|
5962 | if (slot.if) {
|
5963 | slots[slotName].ifHolder = this$1.genHolder(slot, 'if');
|
5964 | }
|
5965 | });
|
5966 | }
|
5967 |
|
5968 | walk(root);
|
5969 |
|
5970 | var slotsArr = Object.keys(slots)
|
5971 | .map(function (name) {
|
5972 | var slot = slots[name];
|
5973 | var ast = slot.ast;
|
5974 | var ifHolder = slot.ifHolder;
|
5975 | if (ast.length <= 0) {
|
5976 | return null
|
5977 | }
|
5978 |
|
5979 | if (!ifHolder && ast[0].if) {
|
5980 | ifHolder = this$1.genHolder(ast[0], 'if');
|
5981 | }
|
5982 |
|
5983 | this$1.enterSlotSnippet(slot);
|
5984 | var parts = slot.ast.map(function (e) { return this$1.genElement(e); });
|
5985 | this$1.leaveSlotSnippet(slot);
|
5986 |
|
5987 | var dependencies = slot.ast.reduce(function (res, e) { return res.concat(this$1.collectDependencies(e)); }, []);
|
5988 | var slotName = name + "_" + (uid$1());
|
5989 | var body = [
|
5990 | ("<template name=\"" + slotName + "\" parent=\"" + (this$1.name) + "\">") ].concat( parts,
|
5991 | ["</template>"]
|
5992 | ).join('');
|
5993 |
|
5994 | return {
|
5995 | name: name,
|
5996 | slotName: slotName,
|
5997 | dependencies: dependencies,
|
5998 | body: body,
|
5999 | ast: ast,
|
6000 | ifHolder: ifHolder
|
6001 | }
|
6002 | })
|
6003 | .filter(notEmpty);
|
6004 |
|
6005 | this.slots = this.slots.concat(slotsArr);
|
6006 |
|
6007 | return slotsArr
|
6008 |
|
6009 | function walk (el, parent) {
|
6010 | if (self.isNamedSlotDefinition(el)) {
|
6011 | var name = removeQuotes(el.slotTarget);
|
6012 | if (parent === root) {
|
6013 | addSlotAst(name, el);
|
6014 | }
|
6015 |
|
6016 |
|
6017 | if (parent && parent.children && parent.children.length) {
|
6018 | parent.children = parent.children.filter(function (e) { return e !== el; });
|
6019 | }
|
6020 | return
|
6021 | }
|
6022 | if (el.children) {
|
6023 | if (!parent ||
|
6024 |
|
6025 | !self.isComponent(el)
|
6026 | ) {
|
6027 | el.children.forEach(function (e) {
|
6028 | walk(e, el);
|
6029 | });
|
6030 | }
|
6031 | }
|
6032 | if (parent === root) {
|
6033 | addSlotAst('default', el);
|
6034 | }
|
6035 | }
|
6036 |
|
6037 | function addSlotAst (name) {
|
6038 | var asts = [], len = arguments.length - 1;
|
6039 | while ( len-- > 0 ) asts[ len ] = arguments[ len + 1 ];
|
6040 |
|
6041 | if (!slots[name]) {
|
6042 | slots[name] = {
|
6043 | ast: [],
|
6044 | dependencies: [],
|
6045 | template: ''
|
6046 | };
|
6047 | }
|
6048 | var slot = slots[name];
|
6049 | if (slot.scoped) { return }
|
6050 | asts = asts.filter(function (el) {
|
6051 |
|
6052 | if (!el) { return false }
|
6053 | if (el.tag) { return true }
|
6054 |
|
6055 | var text = (el.text || '').trim();
|
6056 | return text !== ''
|
6057 | });
|
6058 | slot.ast = slot.ast.concat(asts);
|
6059 | }
|
6060 | };
|
6061 |
|
6062 | TemplateGenerator.prototype.genTag = function genTag (el) {
|
6063 | var children = this.isVText(el) ? this.genVText(el) : this.genChildren(el);
|
6064 | if (this.isPlainTemplate(el)) {
|
6065 | return children
|
6066 | }
|
6067 |
|
6068 | var tag = el.tag;
|
6069 | var isSelfCloseTag = el.isSelfCloseTag;
|
6070 | var mpTag = TAG_MAP[tag] || tag;
|
6071 | var attrs = this.isTemplate(el) ? [] : [
|
6072 | this.genVShow(el),
|
6073 | this.genClass(el),
|
6074 | this.genStyle(el),
|
6075 | this.genAttrs(el),
|
6076 | this.genEvents(el),
|
6077 | this.genNativeSlotName(el)
|
6078 | ];
|
6079 |
|
6080 | var startTag = "<" + ([
|
6081 | mpTag,
|
6082 | this.genIf(el),
|
6083 | this.genFor(el) ].concat( attrs
|
6084 | ).join('')) + (isSelfCloseTag ? "/>" : ">");
|
6085 |
|
6086 | var endTag = isSelfCloseTag ? "" : ("</" + mpTag + ">");
|
6087 |
|
6088 | return [startTag, children, endTag].join('')
|
6089 | };
|
6090 |
|
6091 | TemplateGenerator.prototype.genClass = function genClass (el) {
|
6092 | var tag = el.tag;
|
6093 | var classBinding = el.classBinding;
|
6094 | var h_ = el.h_;
|
6095 | var staticClass = el.staticClass; if ( staticClass === void 0 ) staticClass = '';
|
6096 | var klass = [];
|
6097 | staticClass = removeQuotes(staticClass);
|
6098 | if (staticClass) {
|
6099 | klass.push(staticClass);
|
6100 | }
|
6101 | if (classBinding) {
|
6102 | klass.push(("{{ " + (this.genHolder(el, 'class')) + " }}"));
|
6103 | }
|
6104 | if (h_ === '0') {
|
6105 | klass.push(("{{ " + (this.genHolder(el, 'rootClass')) + " }}"));
|
6106 | }
|
6107 |
|
6108 |
|
6109 | klass.push(("{{" + PARENT_SCOPE_ID_VAR + "}}"));
|
6110 |
|
6111 |
|
6112 | if (this.scopeId && !this.isInSlotSnippet()) {
|
6113 | klass.push(("" + (this.scopeId)));
|
6114 | }
|
6115 |
|
6116 | klass.unshift(("_" + tag));
|
6117 | klass = klass.filter(notEmpty).join(' ');
|
6118 | return (" class=\"" + klass + "\"")
|
6119 | };
|
6120 |
|
6121 | TemplateGenerator.prototype.genStyle = function genStyle (el) {
|
6122 | var styleBinding = el.styleBinding;
|
6123 | var staticStyle = el.staticStyle; if ( staticStyle === void 0 ) staticStyle = '';
|
6124 | var style = [];
|
6125 | staticStyle = staticStyle.replace(/"|{|}/g, '').split(',').join('; ');
|
6126 | if (staticStyle) {
|
6127 | style.push(staticStyle);
|
6128 | }
|
6129 | if (styleBinding) {
|
6130 | style.push(("{{ " + (this.genHolder(el, 'style')) + " }}"));
|
6131 | }
|
6132 | style = style.filter(notEmpty).join('; ');
|
6133 | return style ? (" style=\"" + style + "\"") : ''
|
6134 | };
|
6135 |
|
6136 | TemplateGenerator.prototype.genVShow = function genVShow (el) {
|
6137 | var attrsMap = el.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
6138 | if (!attrsMap['v-show']) {
|
6139 | return ''
|
6140 | }
|
6141 | return (" hidden=\"{{ " + (this.genHolder(el, 'vshow')) + " }}\"")
|
6142 | };
|
6143 |
|
6144 | TemplateGenerator.prototype.genAttrs = function genAttrs (el) {
|
6145 | var this$1 = this;
|
6146 |
|
6147 | var attrsList = el.attrsList; if ( attrsList === void 0 ) attrsList = [];
|
6148 | var hasVModel = this.hasVModel(el);
|
6149 |
|
6150 | var attrs = attrsList.map(function (attr) {
|
6151 | var name = attr.name;
|
6152 | var value = attr.value;
|
6153 | if (
|
6154 | vtextReg.test(name) ||
|
6155 | vonReg.test(name) ||
|
6156 | (name === 'value' && hasVModel) ||
|
6157 | name === 'v-show' ||
|
6158 | name === 'v-html'
|
6159 | ) {
|
6160 | return ''
|
6161 | } else if (vmodelReg.test(name)) {
|
6162 | return ("value=\"{{ " + (this$1.genHolder(el, 'value')) + " }}\"")
|
6163 |
|
6164 | } else if (vbindReg$1.test(name)) {
|
6165 | var realName = name.replace(vbindReg$1, '');
|
6166 | var camelizedName = camelize(realName);
|
6167 | return (realName + "=\"{{ " + (this$1.genHolderVar()) + "[ " + (this$1.genHid(el)) + " ]." + camelizedName + " }}\"")
|
6168 |
|
6169 | } else if (!/^https?|data:/.test(value) && this$1.isTransformAssetUrl(el, name)) {
|
6170 | return (name + "=\"{{ " + (this$1.genHolderVar()) + "[ " + (this$1.genHid(el)) + " ][ '" + name + "' ] }}\"")
|
6171 | } else {
|
6172 | return (name + "=\"" + value + "\"")
|
6173 | }
|
6174 | });
|
6175 | attrs = attrs.filter(notEmpty).join(' ');
|
6176 | return attrs ? (" " + attrs) : ''
|
6177 | };
|
6178 |
|
6179 | TemplateGenerator.prototype.genEvents = function genEvents (el) {
|
6180 | var this$1 = this;
|
6181 |
|
6182 | var events = el.events;
|
6183 | var tag = el.tag;
|
6184 | if (!events) {
|
6185 | return ''
|
6186 | }
|
6187 |
|
6188 | var cid = 'c';
|
6189 |
|
6190 | var eventAttrs = Object.keys(events).map(function (type) {
|
6191 | var event = events[type];
|
6192 | var binder = this$1.preset.genBind(event, type, tag);
|
6193 | return (binder + "=\"_pe\"")
|
6194 | });
|
6195 | eventAttrs = eventAttrs.join(' ');
|
6196 |
|
6197 | |
6198 |
|
6199 |
|
6200 |
|
6201 | return (" data-cid=\"{{ _c || " + cid + " }}\" data-hid=\"{{ " + (this.genHid(el)) + " }}\" " + eventAttrs)
|
6202 | };
|
6203 |
|
6204 | TemplateGenerator.prototype.genIfConditions = function genIfConditions (el) {
|
6205 | var this$1 = this;
|
6206 |
|
6207 | el.ifConditionsGenerated = true;
|
6208 |
|
6209 | if (!el.ifConditions) {
|
6210 | return ''
|
6211 | }
|
6212 | return el.ifConditions
|
6213 | .map(function (cond) {
|
6214 | var block = cond.block;
|
6215 | return this$1.genElement(block)
|
6216 | })
|
6217 | .filter(notEmpty)
|
6218 | .join('')
|
6219 | };
|
6220 |
|
6221 | TemplateGenerator.prototype.genIf = function genIf (el) {
|
6222 | var IF = this.directive('if');
|
6223 | var ELSE_IF = this.directive('elseif');
|
6224 | var ELSE = this.directive('else');
|
6225 |
|
6226 | if (el.if) {
|
6227 | return (" " + IF + "=\"{{ " + (this.genHolder(el, 'if')) + " }}\"")
|
6228 | } else if (el.elseif) {
|
6229 | return (" " + ELSE_IF + "=\"{{ " + (this.genHolder(el, 'if')) + " }}\"")
|
6230 | } else if (el.else) {
|
6231 | return (" " + ELSE)
|
6232 | }
|
6233 | return ''
|
6234 | };
|
6235 |
|
6236 | TemplateGenerator.prototype.genFor = function genFor (el) {
|
6237 | if (!el.for) {
|
6238 | return this.genForKey(el)
|
6239 | }
|
6240 | var iterator1 = el.iterator1;
|
6241 | var alias = el.alias;
|
6242 | var _forInfo = el._forInfo; if ( _forInfo === void 0 ) _forInfo = {};
|
6243 | var FOR = this.directive('for');
|
6244 | var FOR_ITEM = this.directive('forItem');
|
6245 | var FOR_INDEX = this.directive('forIndex');
|
6246 | var forHid = _forInfo.h_;
|
6247 | var forFid = _forInfo.f_;
|
6248 |
|
6249 | var forHolderId = '';
|
6250 |
|
6251 | if (this.isInSlotSnippet()) {
|
6252 | forHolderId =
|
6253 | isDef(forFid)
|
6254 | ? (forHid + " + (" + FOR_TAIL_VAR + " || '') + " + sep$1 + " + " + forFid)
|
6255 | : (forHid + " + (" + FOR_TAIL_VAR + " || '')");
|
6256 | } else {
|
6257 | forHolderId = isDef(forFid) ? (forHid + " + " + sep$1 + " + " + forFid) : forHid;
|
6258 | }
|
6259 |
|
6260 | var _for = [
|
6261 | (" " + FOR + "=\"{{ " + (this.genHolder(forHolderId, 'for')) + " }}\""),
|
6262 | this.genForKey(el),
|
6263 | alias ? (" " + FOR_ITEM + "=\"" + alias + "\"") : ''
|
6264 | ];
|
6265 | iterator1 && _for.push((" " + FOR_INDEX + "=\"" + iterator1 + "\""));
|
6266 |
|
6267 | return _for.filter(notEmpty).join('')
|
6268 | };
|
6269 |
|
6270 | TemplateGenerator.prototype.genForKey = function genForKey (el) {
|
6271 | if (!el.key) {
|
6272 | return ''
|
6273 | }
|
6274 | var FOR_KEY = this.directive('forKey');
|
6275 |
|
6276 | var keyName = el.key.replace(/^\w*\./, '').replace(/\./g, '_');
|
6277 | return keyName ? (" " + FOR_KEY + "=\"" + keyName + "\"") : ''
|
6278 | };
|
6279 |
|
6280 | TemplateGenerator.prototype.genText = function genText (el) {
|
6281 | var text = el.text; if ( text === void 0 ) text = '';
|
6282 | if (el.expression) {
|
6283 | return ("{{ " + (this.genHolder(el, 'text')) + " }}")
|
6284 | }
|
6285 | return escapeText(text) || ''
|
6286 | };
|
6287 |
|
6288 | TemplateGenerator.prototype.genSlot = function genSlot (el) {
|
6289 | var f_ = el.f_;
|
6290 | var slotName = el.slotName; if ( slotName === void 0 ) slotName = 'default';
|
6291 | slotName = slotName.replace(/"/g, '');
|
6292 | var fallbackSlotName = slotName + "$" + (uid$1());
|
6293 | this.enterFallbackSlot();
|
6294 | var fallbackSlotBody = this.genChildren(el);
|
6295 | this.leaveFallbackSlot();
|
6296 | var fallbackSlot = "<template name=\"" + fallbackSlotName + "\">" + (fallbackSlotBody || '') + "</template>";
|
6297 | var tail = ", " + FOR_TAIL_VAR + ": " + FOR_TAIL_VAR + " || ''";
|
6298 | if (isDef(f_)) {
|
6299 | tail = ", " + FOR_TAIL_VAR + ": (" + FOR_TAIL_VAR + " || '') + " + sep$1 + " + " + f_;
|
6300 | }
|
6301 |
|
6302 | var scope = '';
|
6303 | if (this.scopeId) {
|
6304 | scope = "," + PARENT_SCOPE_ID_VAR + ":(" + PARENT_SCOPE_ID_VAR + "||'')+' " + (this.scopeId) + "'";
|
6305 | } else {
|
6306 | scope = "," + PARENT_SCOPE_ID_VAR + ":" + PARENT_SCOPE_ID_VAR + "||''";
|
6307 | }
|
6308 |
|
6309 | var directives = [
|
6310 | ("" + (this.genIf(el))),
|
6311 | ("" + (this.genFor(el)))
|
6312 | ].filter(notEmpty).join(' ');
|
6313 |
|
6314 | |
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 | if (this.target === 'swan') {
|
6321 | return [
|
6322 |
|
6323 | ("" + fallbackSlot),
|
6324 | ("<block s-if=\"s_" + slotName + "\">"),
|
6325 | "<template ",
|
6326 | ("is=\"{{ s_" + slotName + " }}\" "),
|
6327 | "data=\"",
|
6328 | this.wrapTemplateData(("..." + ROOT_DATA_VAR + "[ c ], " + ROOT_DATA_VAR + tail + ", _c: c")),
|
6329 | ("\"" + directives + "/>"),
|
6330 | "</block>",
|
6331 |
|
6332 |
|
6333 | "<block s-else>",
|
6334 | "<template ",
|
6335 | ("is=\"{{ '" + fallbackSlotName + "' }}\" "),
|
6336 | "data=\"",
|
6337 | this.wrapTemplateData(("..." + ROOT_DATA_VAR + "[ c ], " + ROOT_DATA_VAR + tail + ", _c: c")),
|
6338 | ("\"" + (this.genFor(el)) + "/>"),
|
6339 | "</block>"
|
6340 | ].join('')
|
6341 | }
|
6342 |
|
6343 | return [
|
6344 | ("" + fallbackSlot),
|
6345 | "<template ",
|
6346 | ("is=\"{{ s_" + slotName + " || '" + fallbackSlotName + "' }}\" "),
|
6347 | "data=\"",
|
6348 | this.wrapTemplateData(("..." + ROOT_DATA_VAR + "[ c ], " + ROOT_DATA_VAR + tail + scope + ", _c: c")),
|
6349 | ("\"" + directives + "/>")
|
6350 | ].join('')
|
6351 | };
|
6352 |
|
6353 | TemplateGenerator.prototype.genChildren = function genChildren (el) {
|
6354 | var this$1 = this;
|
6355 |
|
6356 | if (!el || !el.children || !el.children.length) {
|
6357 | return ''
|
6358 | }
|
6359 | return el.children.map(function (child) { return this$1.genElement(child); }).join('')
|
6360 | };
|
6361 |
|
6362 | TemplateGenerator.prototype.genHolderVar = function genHolderVar () {
|
6363 | if (this.isInSlotSnippet() || this.isInFallbackSlot()) {
|
6364 | return SLOT_HOLDER_VAR
|
6365 | }
|
6366 | return HOLDER_VAR
|
6367 | };
|
6368 |
|
6369 | TemplateGenerator.prototype.genHolder = function genHolder (el, type) {
|
6370 | var varName = HOLDER_TYPE_VARS[type];
|
6371 | var hid = typeof el === 'string' ? el : this.genHid(el);
|
6372 |
|
6373 | if (!varName) {
|
6374 | throw new Error((type + " holder HOLDER_TYPE_VARS not found"))
|
6375 | }
|
6376 | return ((this.genHolderVar()) + "[ " + hid + " ]." + varName)
|
6377 | };
|
6378 |
|
6379 |
|
6380 | TemplateGenerator.prototype.genError = function genError (err) {
|
6381 | return ("<template name=\"" + (this.name) + "\">compile error: " + (err.toString()) + "\n" + (err.stack) + "</template>")
|
6382 | };
|
6383 |
|
6384 | TemplateGenerator.prototype.collectDependencies = function collectDependencies (el) {
|
6385 | var this$1 = this;
|
6386 |
|
6387 | var deps = [];
|
6388 | var tag = el.tag;
|
6389 | var children = el.children;
|
6390 | if (this.isComponent(el)) {
|
6391 | deps.push(this.getComponentName(tag));
|
6392 | }
|
6393 | if (children) {
|
6394 | children.forEach(function (c) {
|
6395 | deps = deps.concat(this$1.collectDependencies(c));
|
6396 | });
|
6397 | }
|
6398 | return deps
|
6399 | };
|
6400 |
|
6401 | TemplateGenerator.prototype.genVHtml = function genVHtml (el) {
|
6402 | var ref = this;
|
6403 | var htmlParse = ref.htmlParse;
|
6404 | var children = "<template is=\"" + (htmlParse.templateName) + "\" data=\"" + (this.wrapTemplateData(("nodes: " + (this.genHolder(el, 'vhtml'))))) + "\"/>";
|
6405 |
|
6406 | if (this.isPlainTemplate(el)) {
|
6407 | return children
|
6408 | }
|
6409 |
|
6410 | var tag = el.tag;
|
6411 | var mpTag = TAG_MAP[tag] || tag;
|
6412 | var attrs = this.isTemplate(el) ? [] : [
|
6413 | this.genVShow(el),
|
6414 | this.genClass(el),
|
6415 | this.genStyle(el),
|
6416 | this.genAttrs(el),
|
6417 | this.genEvents(el),
|
6418 | this.genNativeSlotName(el)
|
6419 | ];
|
6420 | var startTag = "<" + ([
|
6421 | mpTag,
|
6422 | this.genIf(el),
|
6423 | this.genFor(el) ].concat( attrs
|
6424 | ).join('')) + ">";
|
6425 | var endTag = "</" + mpTag + ">";
|
6426 |
|
6427 | return [startTag, children, endTag].join('')
|
6428 | };
|
6429 |
|
6430 | TemplateGenerator.prototype.genNativeSlotName = function genNativeSlotName (el) {
|
6431 | var slotTarget = el.slotTarget;
|
6432 | if (!slotTarget || this.isComponent(el.parent)) {
|
6433 | return ''
|
6434 | }
|
6435 | var isDynamicSlot = !/"/.test(slotTarget);
|
6436 | var slotName = isDynamicSlot ? ("\"{{ " + (this.genHolder(el, 'slot')) + " }}\"") : slotTarget;
|
6437 |
|
6438 | return (" slot=" + slotName)
|
6439 | };
|
6440 |
|
6441 | TemplateGenerator.prototype.genVText = function genVText (el) {
|
6442 | if ( el === void 0 ) el = {};
|
6443 |
|
6444 | return ("{{ " + (this.genHolder(el, 'vtext')) + " }}")
|
6445 | };
|
6446 |
|
6447 | TemplateGenerator.prototype.isVHtml = function isVHtml (el) {
|
6448 | if ( el === void 0 ) el = {};
|
6449 |
|
6450 | var attrsMap = el.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
6451 | return attrsMap['v-html'] !== undefined
|
6452 | };
|
6453 |
|
6454 | TemplateGenerator.prototype.isPlainTemplate = function isPlainTemplate (el) {
|
6455 | return el &&
|
6456 | this.isTemplate(el) &&
|
6457 | !el.iterator1 &&
|
6458 | !el.if && !el.elseif && !el.else
|
6459 | };
|
6460 |
|
6461 | TemplateGenerator.prototype.isTemplate = function isTemplate (el) {
|
6462 | return el && el.tag === 'template'
|
6463 | };
|
6464 |
|
6465 | TemplateGenerator.prototype.isSlot = function isSlot (el) {
|
6466 | return el && el.tag === 'slot'
|
6467 | };
|
6468 |
|
6469 | TemplateGenerator.prototype.isNamedSlotDefinition = function isNamedSlotDefinition (el) {
|
6470 | var slotTarget = el.slotTarget;
|
6471 | return slotTarget
|
6472 | };
|
6473 |
|
6474 | TemplateGenerator.prototype.isComponent = function isComponent (el) {
|
6475 | if ( el === void 0 ) el = {};
|
6476 |
|
6477 | var tag = el.tag;
|
6478 | var c_ = el.c_;
|
6479 | if (c_) {
|
6480 | return !!this.getComponent(tag)
|
6481 | }
|
6482 | return false
|
6483 | };
|
6484 |
|
6485 | TemplateGenerator.prototype.getComponentName = function getComponentName (name) {
|
6486 | var info = this.getComponent(name);
|
6487 | if (info) {
|
6488 | return info.name
|
6489 | } else {
|
6490 | return ''
|
6491 | }
|
6492 | };
|
6493 |
|
6494 | TemplateGenerator.prototype.getComponent = function getComponent (name) {
|
6495 | return getComponentInfo(name, this.imports)
|
6496 | };
|
6497 |
|
6498 | TemplateGenerator.prototype.isVText = function isVText (el) {
|
6499 | if ( el === void 0 ) el = {};
|
6500 |
|
6501 | var attrsMap = el.attrsMap; if ( attrsMap === void 0 ) attrsMap = {};
|
6502 | return attrsMap.hasOwnProperty('v-text')
|
6503 | };
|
6504 |
|
6505 | TemplateGenerator.prototype.hasVModel = function hasVModel (el) {
|
6506 | var attrsList = el.attrsList; if ( attrsList === void 0 ) attrsList = [];
|
6507 | return attrsList.some(function (attr) { return vmodelReg.test(attr.name); })
|
6508 | };
|
6509 | TemplateGenerator.prototype.directive = function directive (grammar) {
|
6510 | return this.preset.directives[grammar] || ''
|
6511 | };
|
6512 |
|
6513 | TemplateGenerator.prototype.genHid = function genHid (el) {
|
6514 | var h_ = el.h_;
|
6515 | var f_ = el.f_;
|
6516 | var tail = '';
|
6517 | var hid = h_;
|
6518 | if (this.isInSlotSnippet()) {
|
6519 | tail = " + " + FOR_TAIL_VAR;
|
6520 | }
|
6521 | if (f_) {
|
6522 | return ("" + h_ + tail + " + " + sep$1 + " + " + f_)
|
6523 | } else {
|
6524 | return ("" + hid + tail)
|
6525 | }
|
6526 | };
|
6527 | TemplateGenerator.prototype.enterSlotSnippet = function enterSlotSnippet (slot) {
|
6528 | this.slotSnippetBuffer.push(slot);
|
6529 | };
|
6530 |
|
6531 | TemplateGenerator.prototype.enterFallbackSlot = function enterFallbackSlot () {
|
6532 | this.fallbackSlot++;
|
6533 | };
|
6534 |
|
6535 | TemplateGenerator.prototype.leaveSlotSnippet = function leaveSlotSnippet () {
|
6536 | this.slotSnippetBuffer.pop();
|
6537 | };
|
6538 |
|
6539 | TemplateGenerator.prototype.leaveFallbackSlot = function leaveFallbackSlot () {
|
6540 | this.fallbackSlot--;
|
6541 | };
|
6542 |
|
6543 | TemplateGenerator.prototype.isInSlotSnippet = function isInSlotSnippet () {
|
6544 | return this.slotSnippetBuffer.length > 0
|
6545 | };
|
6546 |
|
6547 | TemplateGenerator.prototype.isInFallbackSlot = function isInFallbackSlot () {
|
6548 | return this.fallbackSlot > 0
|
6549 | };
|
6550 |
|
6551 |
|
6552 |
|
6553 |
|
6554 |
|
6555 |
|
6556 |
|
6557 |
|
6558 |
|
6559 | TemplateGenerator.prototype.wrapTemplateData = function wrapTemplateData (str) {
|
6560 | return this.target === 'swan' ? ("{{{ " + str + " }}}") : ("{{ " + str + " }}")
|
6561 | };
|
6562 |
|
6563 | TemplateGenerator.prototype.isTransformAssetUrl = function isTransformAssetUrl (node, name) {
|
6564 | return this.transformAssetUrls[node.tag] === name
|
6565 | };
|
6566 |
|
6567 | TemplateGenerator.prototype.enterComponent = function enterComponent (compInfo) {
|
6568 | var newComp = {
|
6569 | name: compInfo.name,
|
6570 | slots: [],
|
6571 | children: []
|
6572 | };
|
6573 | this.getCurrentCompoent().children.push(newComp);
|
6574 | this.componentsStack.push(newComp);
|
6575 | };
|
6576 |
|
6577 | TemplateGenerator.prototype.leaveComponent = function leaveComponent () {
|
6578 | this.componentsStack.pop();
|
6579 | };
|
6580 |
|
6581 | TemplateGenerator.prototype.getCurrentCompoent = function getCurrentCompoent () {
|
6582 | return this.componentsStack[this.componentsStack.length - 1] || this
|
6583 | };
|
6584 |
|
6585 |
|
6586 |
|
6587 | var ref = createCompiler(baseOptions);
|
6588 | var compile = ref.compile;
|
6589 | var compileToFunctions = ref.compileToFunctions;
|
6590 |
|
6591 | function compileToTemplate$1 (template, options) {
|
6592 | var compiled = compile(template, options);
|
6593 | var result = compileToTemplate(compiled.ast, options);
|
6594 | return result
|
6595 | }
|
6596 |
|
6597 |
|
6598 |
|
6599 | exports.parseComponent = parseComponent;
|
6600 | exports.compile = compile;
|
6601 | exports.compileToFunctions = compileToFunctions;
|
6602 | exports.compileToTemplate = compileToTemplate$1;
|
6603 | exports.generateCodeFrame = generateCodeFrame;
|