runtime-dom.esm-bundler.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271
  1. import { camelize, warn, callWithAsyncErrorHandling, getCurrentInstance, onMounted, watchEffect, onUpdated, Fragment, h, BaseTransition, useTransitionState, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createVNode, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
  2. export * from '@vue/runtime-core';
  3. import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, isOn, isModelListener, isFunction, EMPTY_OBJ, extend, isObject, toNumber, invokeArrayFns, looseIndexOf, isSet, looseEqual, isHTMLTag, isSVGTag } from '@vue/shared';
  4. const svgNS = 'http://www.w3.org/2000/svg';
  5. const doc = (typeof document !== 'undefined' ? document : null);
  6. let tempContainer;
  7. let tempSVGContainer;
  8. const nodeOps = {
  9. insert: (child, parent, anchor) => {
  10. parent.insertBefore(child, anchor || null);
  11. },
  12. remove: child => {
  13. const parent = child.parentNode;
  14. if (parent) {
  15. parent.removeChild(child);
  16. }
  17. },
  18. createElement: (tag, isSVG, is) => isSVG
  19. ? doc.createElementNS(svgNS, tag)
  20. : doc.createElement(tag, is ? { is } : undefined),
  21. createText: text => doc.createTextNode(text),
  22. createComment: text => doc.createComment(text),
  23. setText: (node, text) => {
  24. node.nodeValue = text;
  25. },
  26. setElementText: (el, text) => {
  27. el.textContent = text;
  28. },
  29. parentNode: node => node.parentNode,
  30. nextSibling: node => node.nextSibling,
  31. querySelector: selector => doc.querySelector(selector),
  32. setScopeId(el, id) {
  33. el.setAttribute(id, '');
  34. },
  35. cloneNode(el) {
  36. return el.cloneNode(true);
  37. },
  38. // __UNSAFE__
  39. // Reason: innerHTML.
  40. // Static content here can only come from compiled templates.
  41. // As long as the user only uses trusted templates, this is safe.
  42. insertStaticContent(content, parent, anchor, isSVG) {
  43. const temp = isSVG
  44. ? tempSVGContainer ||
  45. (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
  46. : tempContainer || (tempContainer = doc.createElement('div'));
  47. temp.innerHTML = content;
  48. const first = temp.firstChild;
  49. let node = first;
  50. let last = node;
  51. while (node) {
  52. last = node;
  53. nodeOps.insert(node, parent, anchor);
  54. node = temp.firstChild;
  55. }
  56. return [first, last];
  57. }
  58. };
  59. // compiler should normalize class + :class bindings on the same element
  60. // into a single binding ['staticClass', dynamic]
  61. function patchClass(el, value, isSVG) {
  62. if (value == null) {
  63. value = '';
  64. }
  65. if (isSVG) {
  66. el.setAttribute('class', value);
  67. }
  68. else {
  69. // directly setting className should be faster than setAttribute in theory
  70. // if this is an element during a transition, take the temporary transition
  71. // classes into account.
  72. const transitionClasses = el._vtc;
  73. if (transitionClasses) {
  74. value = (value
  75. ? [value, ...transitionClasses]
  76. : [...transitionClasses]).join(' ');
  77. }
  78. el.className = value;
  79. }
  80. }
  81. function patchStyle(el, prev, next) {
  82. const style = el.style;
  83. if (!next) {
  84. el.removeAttribute('style');
  85. }
  86. else if (isString(next)) {
  87. if (prev !== next) {
  88. style.cssText = next;
  89. }
  90. }
  91. else {
  92. for (const key in next) {
  93. setStyle(style, key, next[key]);
  94. }
  95. if (prev && !isString(prev)) {
  96. for (const key in prev) {
  97. if (next[key] == null) {
  98. setStyle(style, key, '');
  99. }
  100. }
  101. }
  102. }
  103. }
  104. const importantRE = /\s*!important$/;
  105. function setStyle(style, name, val) {
  106. if (isArray(val)) {
  107. val.forEach(v => setStyle(style, name, v));
  108. }
  109. else {
  110. if (name.startsWith('--')) {
  111. // custom property definition
  112. style.setProperty(name, val);
  113. }
  114. else {
  115. const prefixed = autoPrefix(style, name);
  116. if (importantRE.test(val)) {
  117. // !important
  118. style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
  119. }
  120. else {
  121. style[prefixed] = val;
  122. }
  123. }
  124. }
  125. }
  126. const prefixes = ['Webkit', 'Moz', 'ms'];
  127. const prefixCache = {};
  128. function autoPrefix(style, rawName) {
  129. const cached = prefixCache[rawName];
  130. if (cached) {
  131. return cached;
  132. }
  133. let name = camelize(rawName);
  134. if (name !== 'filter' && name in style) {
  135. return (prefixCache[rawName] = name);
  136. }
  137. name = capitalize(name);
  138. for (let i = 0; i < prefixes.length; i++) {
  139. const prefixed = prefixes[i] + name;
  140. if (prefixed in style) {
  141. return (prefixCache[rawName] = prefixed);
  142. }
  143. }
  144. return rawName;
  145. }
  146. const xlinkNS = 'http://www.w3.org/1999/xlink';
  147. function patchAttr(el, key, value, isSVG) {
  148. if (isSVG && key.startsWith('xlink:')) {
  149. if (value == null) {
  150. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  151. }
  152. else {
  153. el.setAttributeNS(xlinkNS, key, value);
  154. }
  155. }
  156. else {
  157. // note we are only checking boolean attributes that don't have a
  158. // corresponding dom prop of the same name here.
  159. const isBoolean = isSpecialBooleanAttr(key);
  160. if (value == null || (isBoolean && value === false)) {
  161. el.removeAttribute(key);
  162. }
  163. else {
  164. el.setAttribute(key, isBoolean ? '' : value);
  165. }
  166. }
  167. }
  168. // __UNSAFE__
  169. // functions. The user is responsible for using them with only trusted content.
  170. function patchDOMProp(el, key, value,
  171. // the following args are passed only due to potential innerHTML/textContent
  172. // overriding existing VNodes, in which case the old tree must be properly
  173. // unmounted.
  174. prevChildren, parentComponent, parentSuspense, unmountChildren) {
  175. if (key === 'innerHTML' || key === 'textContent') {
  176. if (prevChildren) {
  177. unmountChildren(prevChildren, parentComponent, parentSuspense);
  178. }
  179. el[key] = value == null ? '' : value;
  180. return;
  181. }
  182. if (key === 'value' && el.tagName !== 'PROGRESS') {
  183. // store value as _value as well since
  184. // non-string values will be stringified.
  185. el._value = value;
  186. const newValue = value == null ? '' : value;
  187. if (el.value !== newValue) {
  188. el.value = newValue;
  189. }
  190. return;
  191. }
  192. if (value === '' || value == null) {
  193. const type = typeof el[key];
  194. if (value === '' && type === 'boolean') {
  195. // e.g. <select multiple> compiles to { multiple: '' }
  196. el[key] = true;
  197. return;
  198. }
  199. else if (value == null && type === 'string') {
  200. // e.g. <div :id="null">
  201. el[key] = '';
  202. el.removeAttribute(key);
  203. return;
  204. }
  205. else if (type === 'number') {
  206. // e.g. <img :width="null">
  207. el[key] = 0;
  208. el.removeAttribute(key);
  209. return;
  210. }
  211. }
  212. // some properties perform value validation and throw
  213. try {
  214. el[key] = value;
  215. }
  216. catch (e) {
  217. if ((process.env.NODE_ENV !== 'production')) {
  218. warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
  219. `value ${value} is invalid.`, e);
  220. }
  221. }
  222. }
  223. // Async edge case fix requires storing an event listener's attach timestamp.
  224. let _getNow = Date.now;
  225. // Determine what event timestamp the browser is using. Annoyingly, the
  226. // timestamp can either be hi-res (relative to page load) or low-res
  227. // (relative to UNIX epoch), so in order to compare time we have to use the
  228. // same timestamp type when saving the flush timestamp.
  229. if (typeof document !== 'undefined' &&
  230. _getNow() > document.createEvent('Event').timeStamp) {
  231. // if the low-res timestamp which is bigger than the event timestamp
  232. // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
  233. // and we need to use the hi-res version for event listeners as well.
  234. _getNow = () => performance.now();
  235. }
  236. // To avoid the overhead of repeatedly calling performance.now(), we cache
  237. // and use the same timestamp for all event listeners attached in the same tick.
  238. let cachedNow = 0;
  239. const p = Promise.resolve();
  240. const reset = () => {
  241. cachedNow = 0;
  242. };
  243. const getNow = () => cachedNow || (p.then(reset), (cachedNow = _getNow()));
  244. function addEventListener(el, event, handler, options) {
  245. el.addEventListener(event, handler, options);
  246. }
  247. function removeEventListener(el, event, handler, options) {
  248. el.removeEventListener(event, handler, options);
  249. }
  250. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  251. // vei = vue event invokers
  252. const invokers = el._vei || (el._vei = {});
  253. const existingInvoker = invokers[rawName];
  254. if (nextValue && existingInvoker) {
  255. // patch
  256. existingInvoker.value = nextValue;
  257. }
  258. else {
  259. const [name, options] = parseName(rawName);
  260. if (nextValue) {
  261. // add
  262. const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
  263. addEventListener(el, name, invoker, options);
  264. }
  265. else if (existingInvoker) {
  266. // remove
  267. removeEventListener(el, name, existingInvoker, options);
  268. invokers[rawName] = undefined;
  269. }
  270. }
  271. }
  272. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  273. function parseName(name) {
  274. let options;
  275. if (optionsModifierRE.test(name)) {
  276. options = {};
  277. let m;
  278. while ((m = name.match(optionsModifierRE))) {
  279. name = name.slice(0, name.length - m[0].length);
  280. options[m[0].toLowerCase()] = true;
  281. }
  282. }
  283. return [hyphenate(name.slice(2)), options];
  284. }
  285. function createInvoker(initialValue, instance) {
  286. const invoker = (e) => {
  287. // async edge case #6566: inner click event triggers patch, event handler
  288. // attached to outer element during patch, and triggered again. This
  289. // happens because browsers fire microtask ticks between event propagation.
  290. // the solution is simple: we save the timestamp when a handler is attached,
  291. // and the handler would only fire if the event passed to it was fired
  292. // AFTER it was attached.
  293. const timeStamp = e.timeStamp || _getNow();
  294. if (timeStamp >= invoker.attached - 1) {
  295. callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
  296. }
  297. };
  298. invoker.value = initialValue;
  299. invoker.attached = getNow();
  300. return invoker;
  301. }
  302. function patchStopImmediatePropagation(e, value) {
  303. if (isArray(value)) {
  304. const originalStop = e.stopImmediatePropagation;
  305. e.stopImmediatePropagation = () => {
  306. originalStop.call(e);
  307. e._stopped = true;
  308. };
  309. return value.map(fn => (e) => !e._stopped && fn(e));
  310. }
  311. else {
  312. return value;
  313. }
  314. }
  315. const nativeOnRE = /^on[a-z]/;
  316. const forcePatchProp = (_, key) => key === 'value';
  317. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  318. switch (key) {
  319. // special
  320. case 'class':
  321. patchClass(el, nextValue, isSVG);
  322. break;
  323. case 'style':
  324. patchStyle(el, prevValue, nextValue);
  325. break;
  326. default:
  327. if (isOn(key)) {
  328. // ignore v-model listeners
  329. if (!isModelListener(key)) {
  330. patchEvent(el, key, prevValue, nextValue, parentComponent);
  331. }
  332. }
  333. else if (shouldSetAsProp(el, key, nextValue, isSVG)) {
  334. patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
  335. }
  336. else {
  337. // special case for <input v-model type="checkbox"> with
  338. // :true-value & :false-value
  339. // store value as dom properties since non-string values will be
  340. // stringified.
  341. if (key === 'true-value') {
  342. el._trueValue = nextValue;
  343. }
  344. else if (key === 'false-value') {
  345. el._falseValue = nextValue;
  346. }
  347. patchAttr(el, key, nextValue, isSVG);
  348. }
  349. break;
  350. }
  351. };
  352. function shouldSetAsProp(el, key, value, isSVG) {
  353. if (isSVG) {
  354. // most keys must be set as attribute on svg elements to work
  355. // ...except innerHTML
  356. if (key === 'innerHTML') {
  357. return true;
  358. }
  359. // or native onclick with function values
  360. if (key in el && nativeOnRE.test(key) && isFunction(value)) {
  361. return true;
  362. }
  363. return false;
  364. }
  365. // spellcheck and draggable are numerated attrs, however their
  366. // corresponding DOM properties are actually booleans - this leads to
  367. // setting it with a string "false" value leading it to be coerced to
  368. // `true`, so we need to always treat them as attributes.
  369. // Note that `contentEditable` doesn't have this problem: its DOM
  370. // property is also enumerated string values.
  371. if (key === 'spellcheck' || key === 'draggable') {
  372. return false;
  373. }
  374. // #1787, #2840 form property on form elements is readonly and must be set as
  375. // attribute.
  376. if (key === 'form') {
  377. return false;
  378. }
  379. // #1526 <input list> must be set as attribute
  380. if (key === 'list' && el.tagName === 'INPUT') {
  381. return false;
  382. }
  383. // #2766 <textarea type> must be set as attribute
  384. if (key === 'type' && el.tagName === 'TEXTAREA') {
  385. return false;
  386. }
  387. // native onclick with string value, must be set as attribute
  388. if (nativeOnRE.test(key) && isString(value)) {
  389. return false;
  390. }
  391. return key in el;
  392. }
  393. function useCssModule(name = '$style') {
  394. /* istanbul ignore else */
  395. {
  396. const instance = getCurrentInstance();
  397. if (!instance) {
  398. (process.env.NODE_ENV !== 'production') && warn(`useCssModule must be called inside setup()`);
  399. return EMPTY_OBJ;
  400. }
  401. const modules = instance.type.__cssModules;
  402. if (!modules) {
  403. (process.env.NODE_ENV !== 'production') && warn(`Current instance does not have CSS modules injected.`);
  404. return EMPTY_OBJ;
  405. }
  406. const mod = modules[name];
  407. if (!mod) {
  408. (process.env.NODE_ENV !== 'production') &&
  409. warn(`Current instance does not have CSS module named "${name}".`);
  410. return EMPTY_OBJ;
  411. }
  412. return mod;
  413. }
  414. }
  415. /**
  416. * Runtime helper for SFC's CSS variable injection feature.
  417. * @private
  418. */
  419. function useCssVars(getter) {
  420. const instance = getCurrentInstance();
  421. /* istanbul ignore next */
  422. if (!instance) {
  423. (process.env.NODE_ENV !== 'production') &&
  424. warn(`useCssVars is called without current active component instance.`);
  425. return;
  426. }
  427. const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
  428. onMounted(() => watchEffect(setVars, { flush: 'post' }));
  429. onUpdated(setVars);
  430. }
  431. function setVarsOnVNode(vnode, vars) {
  432. if (vnode.shapeFlag & 128 /* SUSPENSE */) {
  433. const suspense = vnode.suspense;
  434. vnode = suspense.activeBranch;
  435. if (suspense.pendingBranch && !suspense.isHydrating) {
  436. suspense.effects.push(() => {
  437. setVarsOnVNode(suspense.activeBranch, vars);
  438. });
  439. }
  440. }
  441. // drill down HOCs until it's a non-component vnode
  442. while (vnode.component) {
  443. vnode = vnode.component.subTree;
  444. }
  445. if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
  446. const style = vnode.el.style;
  447. for (const key in vars) {
  448. style.setProperty(`--${key}`, vars[key]);
  449. }
  450. }
  451. else if (vnode.type === Fragment) {
  452. vnode.children.forEach(c => setVarsOnVNode(c, vars));
  453. }
  454. }
  455. const TRANSITION = 'transition';
  456. const ANIMATION = 'animation';
  457. // DOM Transition is a higher-order-component based on the platform-agnostic
  458. // base Transition component, with DOM-specific logic.
  459. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  460. Transition.displayName = 'Transition';
  461. const DOMTransitionPropsValidators = {
  462. name: String,
  463. type: String,
  464. css: {
  465. type: Boolean,
  466. default: true
  467. },
  468. duration: [String, Number, Object],
  469. enterFromClass: String,
  470. enterActiveClass: String,
  471. enterToClass: String,
  472. appearFromClass: String,
  473. appearActiveClass: String,
  474. appearToClass: String,
  475. leaveFromClass: String,
  476. leaveActiveClass: String,
  477. leaveToClass: String
  478. };
  479. const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend({}, BaseTransition.props, DOMTransitionPropsValidators));
  480. function resolveTransitionProps(rawProps) {
  481. let { name = 'v', type, css = true, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
  482. const baseProps = {};
  483. for (const key in rawProps) {
  484. if (!(key in DOMTransitionPropsValidators)) {
  485. baseProps[key] = rawProps[key];
  486. }
  487. }
  488. if (!css) {
  489. return baseProps;
  490. }
  491. const durations = normalizeDuration(duration);
  492. const enterDuration = durations && durations[0];
  493. const leaveDuration = durations && durations[1];
  494. const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
  495. const finishEnter = (el, isAppear, done) => {
  496. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  497. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  498. done && done();
  499. };
  500. const finishLeave = (el, done) => {
  501. removeTransitionClass(el, leaveToClass);
  502. removeTransitionClass(el, leaveActiveClass);
  503. done && done();
  504. };
  505. const makeEnterHook = (isAppear) => {
  506. return (el, done) => {
  507. const hook = isAppear ? onAppear : onEnter;
  508. const resolve = () => finishEnter(el, isAppear, done);
  509. hook && hook(el, resolve);
  510. nextFrame(() => {
  511. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  512. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  513. if (!(hook && hook.length > 1)) {
  514. whenTransitionEnds(el, type, enterDuration, resolve);
  515. }
  516. });
  517. };
  518. };
  519. return extend(baseProps, {
  520. onBeforeEnter(el) {
  521. onBeforeEnter && onBeforeEnter(el);
  522. addTransitionClass(el, enterFromClass);
  523. addTransitionClass(el, enterActiveClass);
  524. },
  525. onBeforeAppear(el) {
  526. onBeforeAppear && onBeforeAppear(el);
  527. addTransitionClass(el, appearFromClass);
  528. addTransitionClass(el, appearActiveClass);
  529. },
  530. onEnter: makeEnterHook(false),
  531. onAppear: makeEnterHook(true),
  532. onLeave(el, done) {
  533. const resolve = () => finishLeave(el, done);
  534. addTransitionClass(el, leaveFromClass);
  535. // force reflow so *-leave-from classes immediately take effect (#2593)
  536. forceReflow();
  537. addTransitionClass(el, leaveActiveClass);
  538. nextFrame(() => {
  539. removeTransitionClass(el, leaveFromClass);
  540. addTransitionClass(el, leaveToClass);
  541. if (!(onLeave && onLeave.length > 1)) {
  542. whenTransitionEnds(el, type, leaveDuration, resolve);
  543. }
  544. });
  545. onLeave && onLeave(el, resolve);
  546. },
  547. onEnterCancelled(el) {
  548. finishEnter(el, false);
  549. onEnterCancelled && onEnterCancelled(el);
  550. },
  551. onAppearCancelled(el) {
  552. finishEnter(el, true);
  553. onAppearCancelled && onAppearCancelled(el);
  554. },
  555. onLeaveCancelled(el) {
  556. finishLeave(el);
  557. onLeaveCancelled && onLeaveCancelled(el);
  558. }
  559. });
  560. }
  561. function normalizeDuration(duration) {
  562. if (duration == null) {
  563. return null;
  564. }
  565. else if (isObject(duration)) {
  566. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  567. }
  568. else {
  569. const n = NumberOf(duration);
  570. return [n, n];
  571. }
  572. }
  573. function NumberOf(val) {
  574. const res = toNumber(val);
  575. if ((process.env.NODE_ENV !== 'production'))
  576. validateDuration(res);
  577. return res;
  578. }
  579. function validateDuration(val) {
  580. if (typeof val !== 'number') {
  581. warn(`<transition> explicit duration is not a valid number - ` +
  582. `got ${JSON.stringify(val)}.`);
  583. }
  584. else if (isNaN(val)) {
  585. warn(`<transition> explicit duration is NaN - ` +
  586. 'the duration expression might be incorrect.');
  587. }
  588. }
  589. function addTransitionClass(el, cls) {
  590. cls.split(/\s+/).forEach(c => c && el.classList.add(c));
  591. (el._vtc ||
  592. (el._vtc = new Set())).add(cls);
  593. }
  594. function removeTransitionClass(el, cls) {
  595. cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
  596. const { _vtc } = el;
  597. if (_vtc) {
  598. _vtc.delete(cls);
  599. if (!_vtc.size) {
  600. el._vtc = undefined;
  601. }
  602. }
  603. }
  604. function nextFrame(cb) {
  605. requestAnimationFrame(() => {
  606. requestAnimationFrame(cb);
  607. });
  608. }
  609. let endId = 0;
  610. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  611. const id = (el._endId = ++endId);
  612. const resolveIfNotStale = () => {
  613. if (id === el._endId) {
  614. resolve();
  615. }
  616. };
  617. if (explicitTimeout) {
  618. return setTimeout(resolveIfNotStale, explicitTimeout);
  619. }
  620. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  621. if (!type) {
  622. return resolve();
  623. }
  624. const endEvent = type + 'end';
  625. let ended = 0;
  626. const end = () => {
  627. el.removeEventListener(endEvent, onEnd);
  628. resolveIfNotStale();
  629. };
  630. const onEnd = (e) => {
  631. if (e.target === el && ++ended >= propCount) {
  632. end();
  633. }
  634. };
  635. setTimeout(() => {
  636. if (ended < propCount) {
  637. end();
  638. }
  639. }, timeout + 1);
  640. el.addEventListener(endEvent, onEnd);
  641. }
  642. function getTransitionInfo(el, expectedType) {
  643. const styles = window.getComputedStyle(el);
  644. // JSDOM may return undefined for transition properties
  645. const getStyleProperties = (key) => (styles[key] || '').split(', ');
  646. const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
  647. const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
  648. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  649. const animationDelays = getStyleProperties(ANIMATION + 'Delay');
  650. const animationDurations = getStyleProperties(ANIMATION + 'Duration');
  651. const animationTimeout = getTimeout(animationDelays, animationDurations);
  652. let type = null;
  653. let timeout = 0;
  654. let propCount = 0;
  655. /* istanbul ignore if */
  656. if (expectedType === TRANSITION) {
  657. if (transitionTimeout > 0) {
  658. type = TRANSITION;
  659. timeout = transitionTimeout;
  660. propCount = transitionDurations.length;
  661. }
  662. }
  663. else if (expectedType === ANIMATION) {
  664. if (animationTimeout > 0) {
  665. type = ANIMATION;
  666. timeout = animationTimeout;
  667. propCount = animationDurations.length;
  668. }
  669. }
  670. else {
  671. timeout = Math.max(transitionTimeout, animationTimeout);
  672. type =
  673. timeout > 0
  674. ? transitionTimeout > animationTimeout
  675. ? TRANSITION
  676. : ANIMATION
  677. : null;
  678. propCount = type
  679. ? type === TRANSITION
  680. ? transitionDurations.length
  681. : animationDurations.length
  682. : 0;
  683. }
  684. const hasTransform = type === TRANSITION &&
  685. /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
  686. return {
  687. type,
  688. timeout,
  689. propCount,
  690. hasTransform
  691. };
  692. }
  693. function getTimeout(delays, durations) {
  694. while (delays.length < durations.length) {
  695. delays = delays.concat(delays);
  696. }
  697. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  698. }
  699. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer
  700. // numbers in a locale-dependent way, using a comma instead of a dot.
  701. // If comma is not replaced with a dot, the input will be rounded down
  702. // (i.e. acting as a floor function) causing unexpected behaviors
  703. function toMs(s) {
  704. return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  705. }
  706. // synchronously force layout to put elements into a certain state
  707. function forceReflow() {
  708. return document.body.offsetHeight;
  709. }
  710. const positionMap = new WeakMap();
  711. const newPositionMap = new WeakMap();
  712. const TransitionGroupImpl = {
  713. name: 'TransitionGroup',
  714. props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
  715. tag: String,
  716. moveClass: String
  717. }),
  718. setup(props, { slots }) {
  719. const instance = getCurrentInstance();
  720. const state = useTransitionState();
  721. let prevChildren;
  722. let children;
  723. onUpdated(() => {
  724. // children is guaranteed to exist after initial render
  725. if (!prevChildren.length) {
  726. return;
  727. }
  728. const moveClass = props.moveClass || `${props.name || 'v'}-move`;
  729. if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
  730. return;
  731. }
  732. // we divide the work into three loops to avoid mixing DOM reads and writes
  733. // in each iteration - which helps prevent layout thrashing.
  734. prevChildren.forEach(callPendingCbs);
  735. prevChildren.forEach(recordPosition);
  736. const movedChildren = prevChildren.filter(applyTranslation);
  737. // force reflow to put everything in position
  738. forceReflow();
  739. movedChildren.forEach(c => {
  740. const el = c.el;
  741. const style = el.style;
  742. addTransitionClass(el, moveClass);
  743. style.transform = style.webkitTransform = style.transitionDuration = '';
  744. const cb = (el._moveCb = (e) => {
  745. if (e && e.target !== el) {
  746. return;
  747. }
  748. if (!e || /transform$/.test(e.propertyName)) {
  749. el.removeEventListener('transitionend', cb);
  750. el._moveCb = null;
  751. removeTransitionClass(el, moveClass);
  752. }
  753. });
  754. el.addEventListener('transitionend', cb);
  755. });
  756. });
  757. return () => {
  758. const rawProps = toRaw(props);
  759. const cssTransitionProps = resolveTransitionProps(rawProps);
  760. const tag = rawProps.tag || Fragment;
  761. prevChildren = children;
  762. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  763. for (let i = 0; i < children.length; i++) {
  764. const child = children[i];
  765. if (child.key != null) {
  766. setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
  767. }
  768. else if ((process.env.NODE_ENV !== 'production')) {
  769. warn(`<TransitionGroup> children must be keyed.`);
  770. }
  771. }
  772. if (prevChildren) {
  773. for (let i = 0; i < prevChildren.length; i++) {
  774. const child = prevChildren[i];
  775. setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
  776. positionMap.set(child, child.el.getBoundingClientRect());
  777. }
  778. }
  779. return createVNode(tag, null, children);
  780. };
  781. }
  782. };
  783. const TransitionGroup = TransitionGroupImpl;
  784. function callPendingCbs(c) {
  785. const el = c.el;
  786. if (el._moveCb) {
  787. el._moveCb();
  788. }
  789. if (el._enterCb) {
  790. el._enterCb();
  791. }
  792. }
  793. function recordPosition(c) {
  794. newPositionMap.set(c, c.el.getBoundingClientRect());
  795. }
  796. function applyTranslation(c) {
  797. const oldPos = positionMap.get(c);
  798. const newPos = newPositionMap.get(c);
  799. const dx = oldPos.left - newPos.left;
  800. const dy = oldPos.top - newPos.top;
  801. if (dx || dy) {
  802. const s = c.el.style;
  803. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  804. s.transitionDuration = '0s';
  805. return c;
  806. }
  807. }
  808. function hasCSSTransform(el, root, moveClass) {
  809. // Detect whether an element with the move class applied has
  810. // CSS transitions. Since the element may be inside an entering
  811. // transition at this very moment, we make a clone of it and remove
  812. // all other transition classes applied to ensure only the move class
  813. // is applied.
  814. const clone = el.cloneNode();
  815. if (el._vtc) {
  816. el._vtc.forEach(cls => {
  817. cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
  818. });
  819. }
  820. moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
  821. clone.style.display = 'none';
  822. const container = (root.nodeType === 1
  823. ? root
  824. : root.parentNode);
  825. container.appendChild(clone);
  826. const { hasTransform } = getTransitionInfo(clone);
  827. container.removeChild(clone);
  828. return hasTransform;
  829. }
  830. const getModelAssigner = (vnode) => {
  831. const fn = vnode.props['onUpdate:modelValue'];
  832. return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
  833. };
  834. function onCompositionStart(e) {
  835. e.target.composing = true;
  836. }
  837. function onCompositionEnd(e) {
  838. const target = e.target;
  839. if (target.composing) {
  840. target.composing = false;
  841. trigger(target, 'input');
  842. }
  843. }
  844. function trigger(el, type) {
  845. const e = document.createEvent('HTMLEvents');
  846. e.initEvent(type, true, true);
  847. el.dispatchEvent(e);
  848. }
  849. // We are exporting the v-model runtime directly as vnode hooks so that it can
  850. // be tree-shaken in case v-model is never used.
  851. const vModelText = {
  852. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  853. el._assign = getModelAssigner(vnode);
  854. const castToNumber = number || el.type === 'number';
  855. addEventListener(el, lazy ? 'change' : 'input', e => {
  856. if (e.target.composing)
  857. return;
  858. let domValue = el.value;
  859. if (trim) {
  860. domValue = domValue.trim();
  861. }
  862. else if (castToNumber) {
  863. domValue = toNumber(domValue);
  864. }
  865. el._assign(domValue);
  866. });
  867. if (trim) {
  868. addEventListener(el, 'change', () => {
  869. el.value = el.value.trim();
  870. });
  871. }
  872. if (!lazy) {
  873. addEventListener(el, 'compositionstart', onCompositionStart);
  874. addEventListener(el, 'compositionend', onCompositionEnd);
  875. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  876. // switching focus before confirming composition choice
  877. // this also fixes the issue where some browsers e.g. iOS Chrome
  878. // fires "change" instead of "input" on autocomplete.
  879. addEventListener(el, 'change', onCompositionEnd);
  880. }
  881. },
  882. // set value on mounted so it's after min/max for type="range"
  883. mounted(el, { value }) {
  884. el.value = value == null ? '' : value;
  885. },
  886. beforeUpdate(el, { value, modifiers: { trim, number } }, vnode) {
  887. el._assign = getModelAssigner(vnode);
  888. // avoid clearing unresolved text. #2302
  889. if (el.composing)
  890. return;
  891. if (document.activeElement === el) {
  892. if (trim && el.value.trim() === value) {
  893. return;
  894. }
  895. if ((number || el.type === 'number') && toNumber(el.value) === value) {
  896. return;
  897. }
  898. }
  899. const newValue = value == null ? '' : value;
  900. if (el.value !== newValue) {
  901. el.value = newValue;
  902. }
  903. }
  904. };
  905. const vModelCheckbox = {
  906. created(el, _, vnode) {
  907. el._assign = getModelAssigner(vnode);
  908. addEventListener(el, 'change', () => {
  909. const modelValue = el._modelValue;
  910. const elementValue = getValue(el);
  911. const checked = el.checked;
  912. const assign = el._assign;
  913. if (isArray(modelValue)) {
  914. const index = looseIndexOf(modelValue, elementValue);
  915. const found = index !== -1;
  916. if (checked && !found) {
  917. assign(modelValue.concat(elementValue));
  918. }
  919. else if (!checked && found) {
  920. const filtered = [...modelValue];
  921. filtered.splice(index, 1);
  922. assign(filtered);
  923. }
  924. }
  925. else if (isSet(modelValue)) {
  926. const cloned = new Set(modelValue);
  927. if (checked) {
  928. cloned.add(elementValue);
  929. }
  930. else {
  931. cloned.delete(elementValue);
  932. }
  933. assign(cloned);
  934. }
  935. else {
  936. assign(getCheckboxValue(el, checked));
  937. }
  938. });
  939. },
  940. // set initial checked on mount to wait for true-value/false-value
  941. mounted: setChecked,
  942. beforeUpdate(el, binding, vnode) {
  943. el._assign = getModelAssigner(vnode);
  944. setChecked(el, binding, vnode);
  945. }
  946. };
  947. function setChecked(el, { value, oldValue }, vnode) {
  948. el._modelValue = value;
  949. if (isArray(value)) {
  950. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  951. }
  952. else if (isSet(value)) {
  953. el.checked = value.has(vnode.props.value);
  954. }
  955. else if (value !== oldValue) {
  956. el.checked = looseEqual(value, getCheckboxValue(el, true));
  957. }
  958. }
  959. const vModelRadio = {
  960. created(el, { value }, vnode) {
  961. el.checked = looseEqual(value, vnode.props.value);
  962. el._assign = getModelAssigner(vnode);
  963. addEventListener(el, 'change', () => {
  964. el._assign(getValue(el));
  965. });
  966. },
  967. beforeUpdate(el, { value, oldValue }, vnode) {
  968. el._assign = getModelAssigner(vnode);
  969. if (value !== oldValue) {
  970. el.checked = looseEqual(value, vnode.props.value);
  971. }
  972. }
  973. };
  974. const vModelSelect = {
  975. created(el, { value, modifiers: { number } }, vnode) {
  976. const isSetModel = isSet(value);
  977. addEventListener(el, 'change', () => {
  978. const selectedVal = Array.prototype.filter
  979. .call(el.options, (o) => o.selected)
  980. .map((o) => number ? toNumber(getValue(o)) : getValue(o));
  981. el._assign(el.multiple
  982. ? isSetModel
  983. ? new Set(selectedVal)
  984. : selectedVal
  985. : selectedVal[0]);
  986. });
  987. el._assign = getModelAssigner(vnode);
  988. },
  989. // set value in mounted & updated because <select> relies on its children
  990. // <option>s.
  991. mounted(el, { value }) {
  992. setSelected(el, value);
  993. },
  994. beforeUpdate(el, _binding, vnode) {
  995. el._assign = getModelAssigner(vnode);
  996. },
  997. updated(el, { value }) {
  998. setSelected(el, value);
  999. }
  1000. };
  1001. function setSelected(el, value) {
  1002. const isMultiple = el.multiple;
  1003. if (isMultiple && !isArray(value) && !isSet(value)) {
  1004. (process.env.NODE_ENV !== 'production') &&
  1005. warn(`<select multiple v-model> expects an Array or Set value for its binding, ` +
  1006. `but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
  1007. return;
  1008. }
  1009. for (let i = 0, l = el.options.length; i < l; i++) {
  1010. const option = el.options[i];
  1011. const optionValue = getValue(option);
  1012. if (isMultiple) {
  1013. if (isArray(value)) {
  1014. option.selected = looseIndexOf(value, optionValue) > -1;
  1015. }
  1016. else {
  1017. option.selected = value.has(optionValue);
  1018. }
  1019. }
  1020. else {
  1021. if (looseEqual(getValue(option), value)) {
  1022. el.selectedIndex = i;
  1023. return;
  1024. }
  1025. }
  1026. }
  1027. if (!isMultiple) {
  1028. el.selectedIndex = -1;
  1029. }
  1030. }
  1031. // retrieve raw value set via :value bindings
  1032. function getValue(el) {
  1033. return '_value' in el ? el._value : el.value;
  1034. }
  1035. // retrieve raw value for true-value and false-value set via :true-value or :false-value bindings
  1036. function getCheckboxValue(el, checked) {
  1037. const key = checked ? '_trueValue' : '_falseValue';
  1038. return key in el ? el[key] : checked;
  1039. }
  1040. const vModelDynamic = {
  1041. created(el, binding, vnode) {
  1042. callModelHook(el, binding, vnode, null, 'created');
  1043. },
  1044. mounted(el, binding, vnode) {
  1045. callModelHook(el, binding, vnode, null, 'mounted');
  1046. },
  1047. beforeUpdate(el, binding, vnode, prevVNode) {
  1048. callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate');
  1049. },
  1050. updated(el, binding, vnode, prevVNode) {
  1051. callModelHook(el, binding, vnode, prevVNode, 'updated');
  1052. }
  1053. };
  1054. function callModelHook(el, binding, vnode, prevVNode, hook) {
  1055. let modelToUse;
  1056. switch (el.tagName) {
  1057. case 'SELECT':
  1058. modelToUse = vModelSelect;
  1059. break;
  1060. case 'TEXTAREA':
  1061. modelToUse = vModelText;
  1062. break;
  1063. default:
  1064. switch (vnode.props && vnode.props.type) {
  1065. case 'checkbox':
  1066. modelToUse = vModelCheckbox;
  1067. break;
  1068. case 'radio':
  1069. modelToUse = vModelRadio;
  1070. break;
  1071. default:
  1072. modelToUse = vModelText;
  1073. }
  1074. }
  1075. const fn = modelToUse[hook];
  1076. fn && fn(el, binding, vnode, prevVNode);
  1077. }
  1078. const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
  1079. const modifierGuards = {
  1080. stop: e => e.stopPropagation(),
  1081. prevent: e => e.preventDefault(),
  1082. self: e => e.target !== e.currentTarget,
  1083. ctrl: e => !e.ctrlKey,
  1084. shift: e => !e.shiftKey,
  1085. alt: e => !e.altKey,
  1086. meta: e => !e.metaKey,
  1087. left: e => 'button' in e && e.button !== 0,
  1088. middle: e => 'button' in e && e.button !== 1,
  1089. right: e => 'button' in e && e.button !== 2,
  1090. exact: (e, modifiers) => systemModifiers.some(m => e[`${m}Key`] && !modifiers.includes(m))
  1091. };
  1092. /**
  1093. * @private
  1094. */
  1095. const withModifiers = (fn, modifiers) => {
  1096. return (event, ...args) => {
  1097. for (let i = 0; i < modifiers.length; i++) {
  1098. const guard = modifierGuards[modifiers[i]];
  1099. if (guard && guard(event, modifiers))
  1100. return;
  1101. }
  1102. return fn(event, ...args);
  1103. };
  1104. };
  1105. // Kept for 2.x compat.
  1106. // Note: IE11 compat for `spacebar` and `del` is removed for now.
  1107. const keyNames = {
  1108. esc: 'escape',
  1109. space: ' ',
  1110. up: 'arrow-up',
  1111. left: 'arrow-left',
  1112. right: 'arrow-right',
  1113. down: 'arrow-down',
  1114. delete: 'backspace'
  1115. };
  1116. /**
  1117. * @private
  1118. */
  1119. const withKeys = (fn, modifiers) => {
  1120. return (event) => {
  1121. if (!('key' in event))
  1122. return;
  1123. const eventKey = hyphenate(event.key);
  1124. if (
  1125. // None of the provided key modifiers match the current event key
  1126. !modifiers.some(k => k === eventKey || keyNames[k] === eventKey)) {
  1127. return;
  1128. }
  1129. return fn(event);
  1130. };
  1131. };
  1132. const vShow = {
  1133. beforeMount(el, { value }, { transition }) {
  1134. el._vod = el.style.display === 'none' ? '' : el.style.display;
  1135. if (transition && value) {
  1136. transition.beforeEnter(el);
  1137. }
  1138. else {
  1139. setDisplay(el, value);
  1140. }
  1141. },
  1142. mounted(el, { value }, { transition }) {
  1143. if (transition && value) {
  1144. transition.enter(el);
  1145. }
  1146. },
  1147. updated(el, { value, oldValue }, { transition }) {
  1148. if (transition && value !== oldValue) {
  1149. if (value) {
  1150. transition.beforeEnter(el);
  1151. setDisplay(el, true);
  1152. transition.enter(el);
  1153. }
  1154. else {
  1155. transition.leave(el, () => {
  1156. setDisplay(el, false);
  1157. });
  1158. }
  1159. }
  1160. else {
  1161. setDisplay(el, value);
  1162. }
  1163. },
  1164. beforeUnmount(el, { value }) {
  1165. setDisplay(el, value);
  1166. }
  1167. };
  1168. function setDisplay(el, value) {
  1169. el.style.display = value ? el._vod : 'none';
  1170. }
  1171. const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
  1172. // lazy create the renderer - this makes core renderer logic tree-shakable
  1173. // in case the user only imports reactivity utilities from Vue.
  1174. let renderer;
  1175. let enabledHydration = false;
  1176. function ensureRenderer() {
  1177. return renderer || (renderer = createRenderer(rendererOptions));
  1178. }
  1179. function ensureHydrationRenderer() {
  1180. renderer = enabledHydration
  1181. ? renderer
  1182. : createHydrationRenderer(rendererOptions);
  1183. enabledHydration = true;
  1184. return renderer;
  1185. }
  1186. // use explicit type casts here to avoid import() calls in rolled-up d.ts
  1187. const render = ((...args) => {
  1188. ensureRenderer().render(...args);
  1189. });
  1190. const hydrate = ((...args) => {
  1191. ensureHydrationRenderer().hydrate(...args);
  1192. });
  1193. const createApp = ((...args) => {
  1194. const app = ensureRenderer().createApp(...args);
  1195. if ((process.env.NODE_ENV !== 'production')) {
  1196. injectNativeTagCheck(app);
  1197. }
  1198. const { mount } = app;
  1199. app.mount = (containerOrSelector) => {
  1200. const container = normalizeContainer(containerOrSelector);
  1201. if (!container)
  1202. return;
  1203. const component = app._component;
  1204. if (!isFunction(component) && !component.render && !component.template) {
  1205. component.template = container.innerHTML;
  1206. }
  1207. // clear content before mounting
  1208. container.innerHTML = '';
  1209. const proxy = mount(container);
  1210. if (container instanceof Element) {
  1211. container.removeAttribute('v-cloak');
  1212. container.setAttribute('data-v-app', '');
  1213. }
  1214. return proxy;
  1215. };
  1216. return app;
  1217. });
  1218. const createSSRApp = ((...args) => {
  1219. const app = ensureHydrationRenderer().createApp(...args);
  1220. if ((process.env.NODE_ENV !== 'production')) {
  1221. injectNativeTagCheck(app);
  1222. }
  1223. const { mount } = app;
  1224. app.mount = (containerOrSelector) => {
  1225. const container = normalizeContainer(containerOrSelector);
  1226. if (container) {
  1227. return mount(container, true);
  1228. }
  1229. };
  1230. return app;
  1231. });
  1232. function injectNativeTagCheck(app) {
  1233. // Inject `isNativeTag`
  1234. // this is used for component name validation (dev only)
  1235. Object.defineProperty(app.config, 'isNativeTag', {
  1236. value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  1237. writable: false
  1238. });
  1239. }
  1240. function normalizeContainer(container) {
  1241. if (isString(container)) {
  1242. const res = document.querySelector(container);
  1243. if ((process.env.NODE_ENV !== 'production') && !res) {
  1244. warn(`Failed to mount app: mount target selector "${container}" returned null.`);
  1245. }
  1246. return res;
  1247. }
  1248. if ((process.env.NODE_ENV !== 'production') &&
  1249. container instanceof window.ShadowRoot &&
  1250. container.mode === 'closed') {
  1251. warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
  1252. }
  1253. return container;
  1254. }
  1255. export { Transition, TransitionGroup, createApp, createSSRApp, hydrate, render, useCssModule, useCssVars, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };