1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660 |
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- var runtimeCore = require('@vue/runtime-core');
- var shared = require('@vue/shared');
- let policy = void 0;
- const tt = typeof window !== "undefined" && window.trustedTypes;
- if (tt) {
- try {
- policy = tt.createPolicy("vue", {
- createHTML: (val) => val
- });
- } catch (e) {
- }
- }
- const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
- const svgNS = "http://www.w3.org/2000/svg";
- const mathmlNS = "http://www.w3.org/1998/Math/MathML";
- const doc = typeof document !== "undefined" ? document : null;
- const templateContainer = doc && doc.createElement("template");
- const nodeOps = {
- insert: (child, parent, anchor) => {
- parent.insertBefore(child, anchor || null);
- },
- remove: (child) => {
- const parent = child.parentNode;
- if (parent) {
- parent.removeChild(child);
- }
- },
- createElement: (tag, namespace, is, props) => {
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
- if (tag === "select" && props && props.multiple != null) {
- el.setAttribute("multiple", props.multiple);
- }
- return el;
- },
- createText: (text) => doc.createTextNode(text),
- createComment: (text) => doc.createComment(text),
- setText: (node, text) => {
- node.nodeValue = text;
- },
- setElementText: (el, text) => {
- el.textContent = text;
- },
- parentNode: (node) => node.parentNode,
- nextSibling: (node) => node.nextSibling,
- querySelector: (selector) => doc.querySelector(selector),
- setScopeId(el, id) {
- el.setAttribute(id, "");
- },
-
-
-
-
- insertStaticContent(content, parent, anchor, namespace, start, end) {
- const before = anchor ? anchor.previousSibling : parent.lastChild;
- if (start && (start === end || start.nextSibling)) {
- while (true) {
- parent.insertBefore(start.cloneNode(true), anchor);
- if (start === end || !(start = start.nextSibling)) break;
- }
- } else {
- templateContainer.innerHTML = unsafeToTrustedHTML(
- namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
- );
- const template = templateContainer.content;
- if (namespace === "svg" || namespace === "mathml") {
- const wrapper = template.firstChild;
- while (wrapper.firstChild) {
- template.appendChild(wrapper.firstChild);
- }
- template.removeChild(wrapper);
- }
- parent.insertBefore(template, anchor);
- }
- return [
-
- before ? before.nextSibling : parent.firstChild,
-
- anchor ? anchor.previousSibling : parent.lastChild
- ];
- }
- };
- const TRANSITION = "transition";
- const ANIMATION = "animation";
- const vtcKey = Symbol("_vtc");
- const DOMTransitionPropsValidators = {
- name: String,
- type: String,
- css: {
- type: Boolean,
- default: true
- },
- duration: [String, Number, Object],
- enterFromClass: String,
- enterActiveClass: String,
- enterToClass: String,
- appearFromClass: String,
- appearActiveClass: String,
- appearToClass: String,
- leaveFromClass: String,
- leaveActiveClass: String,
- leaveToClass: String
- };
- const TransitionPropsValidators = shared.extend(
- {},
- runtimeCore.BaseTransitionPropsValidators,
- DOMTransitionPropsValidators
- );
- const decorate$1 = (t) => {
- t.displayName = "Transition";
- t.props = TransitionPropsValidators;
- return t;
- };
- const Transition = decorate$1(
- (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots)
- );
- const callHook = (hook, args = []) => {
- if (shared.isArray(hook)) {
- hook.forEach((h2) => h2(...args));
- } else if (hook) {
- hook(...args);
- }
- };
- const hasExplicitCallback = (hook) => {
- return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
- };
- function resolveTransitionProps(rawProps) {
- const baseProps = {};
- for (const key in rawProps) {
- if (!(key in DOMTransitionPropsValidators)) {
- baseProps[key] = rawProps[key];
- }
- }
- if (rawProps.css === false) {
- return baseProps;
- }
- const {
- name = "v",
- type,
- 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;
- const durations = normalizeDuration(duration);
- const enterDuration = durations && durations[0];
- const leaveDuration = durations && durations[1];
- const {
- onBeforeEnter,
- onEnter,
- onEnterCancelled,
- onLeave,
- onLeaveCancelled,
- onBeforeAppear = onBeforeEnter,
- onAppear = onEnter,
- onAppearCancelled = onEnterCancelled
- } = baseProps;
- const finishEnter = (el, isAppear, done) => {
- removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
- removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
- done && done();
- };
- const finishLeave = (el, done) => {
- el._isLeaving = false;
- removeTransitionClass(el, leaveFromClass);
- removeTransitionClass(el, leaveToClass);
- removeTransitionClass(el, leaveActiveClass);
- done && done();
- };
- const makeEnterHook = (isAppear) => {
- return (el, done) => {
- const hook = isAppear ? onAppear : onEnter;
- const resolve = () => finishEnter(el, isAppear, done);
- callHook(hook, [el, resolve]);
- nextFrame(() => {
- removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
- addTransitionClass(el, isAppear ? appearToClass : enterToClass);
- if (!hasExplicitCallback(hook)) {
- whenTransitionEnds(el, type, enterDuration, resolve);
- }
- });
- };
- };
- return shared.extend(baseProps, {
- onBeforeEnter(el) {
- callHook(onBeforeEnter, [el]);
- addTransitionClass(el, enterFromClass);
- addTransitionClass(el, enterActiveClass);
- },
- onBeforeAppear(el) {
- callHook(onBeforeAppear, [el]);
- addTransitionClass(el, appearFromClass);
- addTransitionClass(el, appearActiveClass);
- },
- onEnter: makeEnterHook(false),
- onAppear: makeEnterHook(true),
- onLeave(el, done) {
- el._isLeaving = true;
- const resolve = () => finishLeave(el, done);
- addTransitionClass(el, leaveFromClass);
- addTransitionClass(el, leaveActiveClass);
- forceReflow();
- nextFrame(() => {
- if (!el._isLeaving) {
- return;
- }
- removeTransitionClass(el, leaveFromClass);
- addTransitionClass(el, leaveToClass);
- if (!hasExplicitCallback(onLeave)) {
- whenTransitionEnds(el, type, leaveDuration, resolve);
- }
- });
- callHook(onLeave, [el, resolve]);
- },
- onEnterCancelled(el) {
- finishEnter(el, false);
- callHook(onEnterCancelled, [el]);
- },
- onAppearCancelled(el) {
- finishEnter(el, true);
- callHook(onAppearCancelled, [el]);
- },
- onLeaveCancelled(el) {
- finishLeave(el);
- callHook(onLeaveCancelled, [el]);
- }
- });
- }
- function normalizeDuration(duration) {
- if (duration == null) {
- return null;
- } else if (shared.isObject(duration)) {
- return [NumberOf(duration.enter), NumberOf(duration.leave)];
- } else {
- const n = NumberOf(duration);
- return [n, n];
- }
- }
- function NumberOf(val) {
- const res = shared.toNumber(val);
- return res;
- }
- function addTransitionClass(el, cls) {
- cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
- (el[vtcKey] || (el[vtcKey] = new Set())).add(cls);
- }
- function removeTransitionClass(el, cls) {
- cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
- const _vtc = el[vtcKey];
- if (_vtc) {
- _vtc.delete(cls);
- if (!_vtc.size) {
- el[vtcKey] = void 0;
- }
- }
- }
- function nextFrame(cb) {
- requestAnimationFrame(() => {
- requestAnimationFrame(cb);
- });
- }
- let endId = 0;
- function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
- const id = el._endId = ++endId;
- const resolveIfNotStale = () => {
- if (id === el._endId) {
- resolve();
- }
- };
- if (explicitTimeout != null) {
- return setTimeout(resolveIfNotStale, explicitTimeout);
- }
- const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
- if (!type) {
- return resolve();
- }
- const endEvent = type + "end";
- let ended = 0;
- const end = () => {
- el.removeEventListener(endEvent, onEnd);
- resolveIfNotStale();
- };
- const onEnd = (e) => {
- if (e.target === el && ++ended >= propCount) {
- end();
- }
- };
- setTimeout(() => {
- if (ended < propCount) {
- end();
- }
- }, timeout + 1);
- el.addEventListener(endEvent, onEnd);
- }
- function getTransitionInfo(el, expectedType) {
- const styles = window.getComputedStyle(el);
- const getStyleProperties = (key) => (styles[key] || "").split(", ");
- const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
- const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
- const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
- const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
- const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
- const animationTimeout = getTimeout(animationDelays, animationDurations);
- let type = null;
- let timeout = 0;
- let propCount = 0;
- if (expectedType === TRANSITION) {
- if (transitionTimeout > 0) {
- type = TRANSITION;
- timeout = transitionTimeout;
- propCount = transitionDurations.length;
- }
- } else if (expectedType === ANIMATION) {
- if (animationTimeout > 0) {
- type = ANIMATION;
- timeout = animationTimeout;
- propCount = animationDurations.length;
- }
- } else {
- timeout = Math.max(transitionTimeout, animationTimeout);
- type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
- propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
- }
- const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
- getStyleProperties(`${TRANSITION}Property`).toString()
- );
- return {
- type,
- timeout,
- propCount,
- hasTransform
- };
- }
- function getTimeout(delays, durations) {
- while (delays.length < durations.length) {
- delays = delays.concat(delays);
- }
- return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
- }
- function toMs(s) {
- if (s === "auto") return 0;
- return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
- }
- function forceReflow() {
- return document.body.offsetHeight;
- }
- function patchClass(el, value, isSVG) {
- const transitionClasses = el[vtcKey];
- if (transitionClasses) {
- value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
- }
- if (value == null) {
- el.removeAttribute("class");
- } else if (isSVG) {
- el.setAttribute("class", value);
- } else {
- el.className = value;
- }
- }
- const vShowOriginalDisplay = Symbol("_vod");
- const vShowHidden = Symbol("_vsh");
- const vShow = {
- beforeMount(el, { value }, { transition }) {
- el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
- if (transition && value) {
- transition.beforeEnter(el);
- } else {
- setDisplay(el, value);
- }
- },
- mounted(el, { value }, { transition }) {
- if (transition && value) {
- transition.enter(el);
- }
- },
- updated(el, { value, oldValue }, { transition }) {
- if (!value === !oldValue) return;
- if (transition) {
- if (value) {
- transition.beforeEnter(el);
- setDisplay(el, true);
- transition.enter(el);
- } else {
- transition.leave(el, () => {
- setDisplay(el, false);
- });
- }
- } else {
- setDisplay(el, value);
- }
- },
- beforeUnmount(el, { value }) {
- setDisplay(el, value);
- }
- };
- function setDisplay(el, value) {
- el.style.display = value ? el[vShowOriginalDisplay] : "none";
- el[vShowHidden] = !value;
- }
- function initVShowForSSR() {
- vShow.getSSRProps = ({ value }) => {
- if (!value) {
- return { style: { display: "none" } };
- }
- };
- }
- const CSS_VAR_TEXT = Symbol("");
- function useCssVars(getter) {
- return;
- }
- const displayRE = /(^|;)\s*display\s*:/;
- function patchStyle(el, prev, next) {
- const style = el.style;
- const isCssString = shared.isString(next);
- let hasControlledDisplay = false;
- if (next && !isCssString) {
- if (prev) {
- if (!shared.isString(prev)) {
- for (const key in prev) {
- if (next[key] == null) {
- setStyle(style, key, "");
- }
- }
- } else {
- for (const prevStyle of prev.split(";")) {
- const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
- if (next[key] == null) {
- setStyle(style, key, "");
- }
- }
- }
- }
- for (const key in next) {
- if (key === "display") {
- hasControlledDisplay = true;
- }
- setStyle(style, key, next[key]);
- }
- } else {
- if (isCssString) {
- if (prev !== next) {
- const cssVarText = style[CSS_VAR_TEXT];
- if (cssVarText) {
- next += ";" + cssVarText;
- }
- style.cssText = next;
- hasControlledDisplay = displayRE.test(next);
- }
- } else if (prev) {
- el.removeAttribute("style");
- }
- }
- if (vShowOriginalDisplay in el) {
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
- if (el[vShowHidden]) {
- style.display = "none";
- }
- }
- }
- const importantRE = /\s*!important$/;
- function setStyle(style, name, val) {
- if (shared.isArray(val)) {
- val.forEach((v) => setStyle(style, name, v));
- } else {
- if (val == null) val = "";
- if (name.startsWith("--")) {
- style.setProperty(name, val);
- } else {
- const prefixed = autoPrefix(style, name);
- if (importantRE.test(val)) {
- style.setProperty(
- shared.hyphenate(prefixed),
- val.replace(importantRE, ""),
- "important"
- );
- } else {
- style[prefixed] = val;
- }
- }
- }
- }
- const prefixes = ["Webkit", "Moz", "ms"];
- const prefixCache = {};
- function autoPrefix(style, rawName) {
- const cached = prefixCache[rawName];
- if (cached) {
- return cached;
- }
- let name = runtimeCore.camelize(rawName);
- if (name !== "filter" && name in style) {
- return prefixCache[rawName] = name;
- }
- name = shared.capitalize(name);
- for (let i = 0; i < prefixes.length; i++) {
- const prefixed = prefixes[i] + name;
- if (prefixed in style) {
- return prefixCache[rawName] = prefixed;
- }
- }
- return rawName;
- }
- const xlinkNS = "http://www.w3.org/1999/xlink";
- function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
- if (isSVG && key.startsWith("xlink:")) {
- if (value == null) {
- el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
- } else {
- el.setAttributeNS(xlinkNS, key, value);
- }
- } else {
- if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
- el.removeAttribute(key);
- } else {
- el.setAttribute(
- key,
- isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
- );
- }
- }
- }
- function patchDOMProp(el, key, value, parentComponent, attrName) {
- if (key === "innerHTML" || key === "textContent") {
- if (value != null) {
- el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
- }
- return;
- }
- const tag = el.tagName;
- if (key === "value" && tag !== "PROGRESS" &&
- !tag.includes("-")) {
- const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
- const newValue = value == null ? (
-
-
- el.type === "checkbox" ? "on" : ""
- ) : String(value);
- if (oldValue !== newValue || !("_value" in el)) {
- el.value = newValue;
- }
- if (value == null) {
- el.removeAttribute(key);
- }
- el._value = value;
- return;
- }
- let needRemove = false;
- if (value === "" || value == null) {
- const type = typeof el[key];
- if (type === "boolean") {
- value = shared.includeBooleanAttr(value);
- } else if (value == null && type === "string") {
- value = "";
- needRemove = true;
- } else if (type === "number") {
- value = 0;
- needRemove = true;
- }
- }
- try {
- el[key] = value;
- } catch (e) {
- }
- needRemove && el.removeAttribute(attrName || key);
- }
- function addEventListener(el, event, handler, options) {
- el.addEventListener(event, handler, options);
- }
- function removeEventListener(el, event, handler, options) {
- el.removeEventListener(event, handler, options);
- }
- const veiKey = Symbol("_vei");
- function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
- const invokers = el[veiKey] || (el[veiKey] = {});
- const existingInvoker = invokers[rawName];
- if (nextValue && existingInvoker) {
- existingInvoker.value = nextValue;
- } else {
- const [name, options] = parseName(rawName);
- if (nextValue) {
- const invoker = invokers[rawName] = createInvoker(
- nextValue,
- instance
- );
- addEventListener(el, name, invoker, options);
- } else if (existingInvoker) {
- removeEventListener(el, name, existingInvoker, options);
- invokers[rawName] = void 0;
- }
- }
- }
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
- function parseName(name) {
- let options;
- if (optionsModifierRE.test(name)) {
- options = {};
- let m;
- while (m = name.match(optionsModifierRE)) {
- name = name.slice(0, name.length - m[0].length);
- options[m[0].toLowerCase()] = true;
- }
- }
- const event = name[2] === ":" ? name.slice(3) : shared.hyphenate(name.slice(2));
- return [event, options];
- }
- let cachedNow = 0;
- const p = Promise.resolve();
- const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
- function createInvoker(initialValue, instance) {
- const invoker = (e) => {
- if (!e._vts) {
- e._vts = Date.now();
- } else if (e._vts <= invoker.attached) {
- return;
- }
- runtimeCore.callWithAsyncErrorHandling(
- patchStopImmediatePropagation(e, invoker.value),
- instance,
- 5,
- [e]
- );
- };
- invoker.value = initialValue;
- invoker.attached = getNow();
- return invoker;
- }
- function patchStopImmediatePropagation(e, value) {
- if (shared.isArray(value)) {
- const originalStop = e.stopImmediatePropagation;
- e.stopImmediatePropagation = () => {
- originalStop.call(e);
- e._stopped = true;
- };
- return value.map(
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
- );
- } else {
- return value;
- }
- }
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
- const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
- const isSVG = namespace === "svg";
- if (key === "class") {
- patchClass(el, nextValue, isSVG);
- } else if (key === "style") {
- patchStyle(el, prevValue, nextValue);
- } else if (shared.isOn(key)) {
- if (!shared.isModelListener(key)) {
- patchEvent(el, key, prevValue, nextValue, parentComponent);
- }
- } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
- patchDOMProp(el, key, nextValue);
- if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
- patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
- }
- } else if (
-
- el._isVueCE && (/[A-Z]/.test(key) || !shared.isString(nextValue))
- ) {
- patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
- } else {
- if (key === "true-value") {
- el._trueValue = nextValue;
- } else if (key === "false-value") {
- el._falseValue = nextValue;
- }
- patchAttr(el, key, nextValue, isSVG);
- }
- };
- function shouldSetAsProp(el, key, value, isSVG) {
- if (isSVG) {
- if (key === "innerHTML" || key === "textContent") {
- return true;
- }
- if (key in el && isNativeOn(key) && shared.isFunction(value)) {
- return true;
- }
- return false;
- }
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
- return false;
- }
- if (key === "form") {
- return false;
- }
- if (key === "list" && el.tagName === "INPUT") {
- return false;
- }
- if (key === "type" && el.tagName === "TEXTAREA") {
- return false;
- }
- if (key === "width" || key === "height") {
- const tag = el.tagName;
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
- return false;
- }
- }
- if (isNativeOn(key) && shared.isString(value)) {
- return false;
- }
- return key in el;
- }
- const REMOVAL = {};
- function defineCustomElement(options, extraOptions, _createApp) {
- const Comp = runtimeCore.defineComponent(options, extraOptions);
- if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
- class VueCustomElement extends VueElement {
- constructor(initialProps) {
- super(Comp, initialProps, _createApp);
- }
- }
- VueCustomElement.def = Comp;
- return VueCustomElement;
- }
- const defineSSRCustomElement = (options, extraOptions) => {
- return defineCustomElement(options, extraOptions, createSSRApp);
- };
- const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
- };
- class VueElement extends BaseClass {
- constructor(_def, _props = {}, _createApp = createApp) {
- super();
- this._def = _def;
- this._props = _props;
- this._createApp = _createApp;
- this._isVueCE = true;
-
- this._instance = null;
-
- this._app = null;
-
- this._nonce = this._def.nonce;
- this._connected = false;
- this._resolved = false;
- this._numberProps = null;
- this._styleChildren = new WeakSet();
- this._ob = null;
- if (this.shadowRoot && _createApp !== createApp) {
- this._root = this.shadowRoot;
- } else {
- if (_def.shadowRoot !== false) {
- this.attachShadow({ mode: "open" });
- this._root = this.shadowRoot;
- } else {
- this._root = this;
- }
- }
- if (!this._def.__asyncLoader) {
- this._resolveProps(this._def);
- }
- }
- connectedCallback() {
- if (!this.isConnected) return;
- if (!this.shadowRoot) {
- this._parseSlots();
- }
- this._connected = true;
- let parent = this;
- while (parent = parent && (parent.parentNode || parent.host)) {
- if (parent instanceof VueElement) {
- this._parent = parent;
- break;
- }
- }
- if (!this._instance) {
- if (this._resolved) {
- this._setParent();
- this._update();
- } else {
- if (parent && parent._pendingResolve) {
- this._pendingResolve = parent._pendingResolve.then(() => {
- this._pendingResolve = void 0;
- this._resolveDef();
- });
- } else {
- this._resolveDef();
- }
- }
- }
- }
- _setParent(parent = this._parent) {
- if (parent) {
- this._instance.parent = parent._instance;
- this._instance.provides = parent._instance.provides;
- }
- }
- disconnectedCallback() {
- this._connected = false;
- runtimeCore.nextTick(() => {
- if (!this._connected) {
- if (this._ob) {
- this._ob.disconnect();
- this._ob = null;
- }
- this._app && this._app.unmount();
- if (this._instance) this._instance.ce = void 0;
- this._app = this._instance = null;
- }
- });
- }
-
- _resolveDef() {
- if (this._pendingResolve) {
- return;
- }
- for (let i = 0; i < this.attributes.length; i++) {
- this._setAttr(this.attributes[i].name);
- }
- this._ob = new MutationObserver((mutations) => {
- for (const m of mutations) {
- this._setAttr(m.attributeName);
- }
- });
- this._ob.observe(this, { attributes: true });
- const resolve = (def, isAsync = false) => {
- this._resolved = true;
- this._pendingResolve = void 0;
- const { props, styles } = def;
- let numberProps;
- if (props && !shared.isArray(props)) {
- for (const key in props) {
- const opt = props[key];
- if (opt === Number || opt && opt.type === Number) {
- if (key in this._props) {
- this._props[key] = shared.toNumber(this._props[key]);
- }
- (numberProps || (numberProps = Object.create(null)))[shared.camelize(key)] = true;
- }
- }
- }
- this._numberProps = numberProps;
- if (isAsync) {
- this._resolveProps(def);
- }
- if (this.shadowRoot) {
- this._applyStyles(styles);
- }
- this._mount(def);
- };
- const asyncDef = this._def.__asyncLoader;
- if (asyncDef) {
- this._pendingResolve = asyncDef().then(
- (def) => resolve(this._def = def, true)
- );
- } else {
- resolve(this._def);
- }
- }
- _mount(def) {
- this._app = this._createApp(def);
- if (def.configureApp) {
- def.configureApp(this._app);
- }
- this._app._ceVNode = this._createVNode();
- this._app.mount(this._root);
- const exposed = this._instance && this._instance.exposed;
- if (!exposed) return;
- for (const key in exposed) {
- if (!shared.hasOwn(this, key)) {
- Object.defineProperty(this, key, {
-
- get: () => runtimeCore.unref(exposed[key])
- });
- }
- }
- }
- _resolveProps(def) {
- const { props } = def;
- const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
- for (const key of Object.keys(this)) {
- if (key[0] !== "_" && declaredPropKeys.includes(key)) {
- this._setProp(key, this[key]);
- }
- }
- for (const key of declaredPropKeys.map(shared.camelize)) {
- Object.defineProperty(this, key, {
- get() {
- return this._getProp(key);
- },
- set(val) {
- this._setProp(key, val, true, true);
- }
- });
- }
- }
- _setAttr(key) {
- if (key.startsWith("data-v-")) return;
- const has = this.hasAttribute(key);
- let value = has ? this.getAttribute(key) : REMOVAL;
- const camelKey = shared.camelize(key);
- if (has && this._numberProps && this._numberProps[camelKey]) {
- value = shared.toNumber(value);
- }
- this._setProp(camelKey, value, false, true);
- }
-
- _getProp(key) {
- return this._props[key];
- }
-
- _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
- if (val !== this._props[key]) {
- if (val === REMOVAL) {
- delete this._props[key];
- } else {
- this._props[key] = val;
- if (key === "key" && this._app) {
- this._app._ceVNode.key = val;
- }
- }
- if (shouldUpdate && this._instance) {
- this._update();
- }
- if (shouldReflect) {
- if (val === true) {
- this.setAttribute(shared.hyphenate(key), "");
- } else if (typeof val === "string" || typeof val === "number") {
- this.setAttribute(shared.hyphenate(key), val + "");
- } else if (!val) {
- this.removeAttribute(shared.hyphenate(key));
- }
- }
- }
- }
- _update() {
- render(this._createVNode(), this._root);
- }
- _createVNode() {
- const baseProps = {};
- if (!this.shadowRoot) {
- baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
- }
- const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
- if (!this._instance) {
- vnode.ce = (instance) => {
- this._instance = instance;
- instance.ce = this;
- instance.isCE = true;
- const dispatch = (event, args) => {
- this.dispatchEvent(
- new CustomEvent(
- event,
- shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
- )
- );
- };
- instance.emit = (event, ...args) => {
- dispatch(event, args);
- if (shared.hyphenate(event) !== event) {
- dispatch(shared.hyphenate(event), args);
- }
- };
- this._setParent();
- };
- }
- return vnode;
- }
- _applyStyles(styles, owner) {
- if (!styles) return;
- if (owner) {
- if (owner === this._def || this._styleChildren.has(owner)) {
- return;
- }
- this._styleChildren.add(owner);
- }
- const nonce = this._nonce;
- for (let i = styles.length - 1; i >= 0; i--) {
- const s = document.createElement("style");
- if (nonce) s.setAttribute("nonce", nonce);
- s.textContent = styles[i];
- this.shadowRoot.prepend(s);
- }
- }
-
- _parseSlots() {
- const slots = this._slots = {};
- let n;
- while (n = this.firstChild) {
- const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
- (slots[slotName] || (slots[slotName] = [])).push(n);
- this.removeChild(n);
- }
- }
-
- _renderSlots() {
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
- const scopeId = this._instance.type.__scopeId;
- for (let i = 0; i < outlets.length; i++) {
- const o = outlets[i];
- const slotName = o.getAttribute("name") || "default";
- const content = this._slots[slotName];
- const parent = o.parentNode;
- if (content) {
- for (const n of content) {
- if (scopeId && n.nodeType === 1) {
- const id = scopeId + "-s";
- const walker = document.createTreeWalker(n, 1);
- n.setAttribute(id, "");
- let child;
- while (child = walker.nextNode()) {
- child.setAttribute(id, "");
- }
- }
- parent.insertBefore(n, o);
- }
- } else {
- while (o.firstChild) parent.insertBefore(o.firstChild, o);
- }
- parent.removeChild(o);
- }
- }
-
- _injectChildStyle(comp) {
- this._applyStyles(comp.styles, comp);
- }
-
- _removeChildStyle(comp) {
- }
- }
- function useHost(caller) {
- const instance = runtimeCore.getCurrentInstance();
- const el = instance && instance.ce;
- if (el) {
- return el;
- }
- return null;
- }
- function useShadowRoot() {
- const el = useHost();
- return el && el.shadowRoot;
- }
- function useCssModule(name = "$style") {
- {
- const instance = runtimeCore.getCurrentInstance();
- if (!instance) {
- return shared.EMPTY_OBJ;
- }
- const modules = instance.type.__cssModules;
- if (!modules) {
- return shared.EMPTY_OBJ;
- }
- const mod = modules[name];
- if (!mod) {
- return shared.EMPTY_OBJ;
- }
- return mod;
- }
- }
- const positionMap = new WeakMap();
- const newPositionMap = new WeakMap();
- const moveCbKey = Symbol("_moveCb");
- const enterCbKey = Symbol("_enterCb");
- const decorate = (t) => {
- delete t.props.mode;
- return t;
- };
- const TransitionGroupImpl = decorate({
- name: "TransitionGroup",
- props: shared.extend({}, TransitionPropsValidators, {
- tag: String,
- moveClass: String
- }),
- setup(props, { slots }) {
- const instance = runtimeCore.getCurrentInstance();
- const state = runtimeCore.useTransitionState();
- let prevChildren;
- let children;
- runtimeCore.onUpdated(() => {
- if (!prevChildren.length) {
- return;
- }
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
- if (!hasCSSTransform(
- prevChildren[0].el,
- instance.vnode.el,
- moveClass
- )) {
- return;
- }
- prevChildren.forEach(callPendingCbs);
- prevChildren.forEach(recordPosition);
- const movedChildren = prevChildren.filter(applyTranslation);
- forceReflow();
- movedChildren.forEach((c) => {
- const el = c.el;
- const style = el.style;
- addTransitionClass(el, moveClass);
- style.transform = style.webkitTransform = style.transitionDuration = "";
- const cb = el[moveCbKey] = (e) => {
- if (e && e.target !== el) {
- return;
- }
- if (!e || /transform$/.test(e.propertyName)) {
- el.removeEventListener("transitionend", cb);
- el[moveCbKey] = null;
- removeTransitionClass(el, moveClass);
- }
- };
- el.addEventListener("transitionend", cb);
- });
- });
- return () => {
- const rawProps = runtimeCore.toRaw(props);
- const cssTransitionProps = resolveTransitionProps(rawProps);
- let tag = rawProps.tag || runtimeCore.Fragment;
- prevChildren = [];
- if (children) {
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- if (child.el && child.el instanceof Element) {
- prevChildren.push(child);
- runtimeCore.setTransitionHooks(
- child,
- runtimeCore.resolveTransitionHooks(
- child,
- cssTransitionProps,
- state,
- instance
- )
- );
- positionMap.set(
- child,
- child.el.getBoundingClientRect()
- );
- }
- }
- }
- children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- if (child.key != null) {
- runtimeCore.setTransitionHooks(
- child,
- runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
- );
- }
- }
- return runtimeCore.createVNode(tag, null, children);
- };
- }
- });
- const TransitionGroup = TransitionGroupImpl;
- function callPendingCbs(c) {
- const el = c.el;
- if (el[moveCbKey]) {
- el[moveCbKey]();
- }
- if (el[enterCbKey]) {
- el[enterCbKey]();
- }
- }
- function recordPosition(c) {
- newPositionMap.set(c, c.el.getBoundingClientRect());
- }
- function applyTranslation(c) {
- const oldPos = positionMap.get(c);
- const newPos = newPositionMap.get(c);
- const dx = oldPos.left - newPos.left;
- const dy = oldPos.top - newPos.top;
- if (dx || dy) {
- const s = c.el.style;
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
- s.transitionDuration = "0s";
- return c;
- }
- }
- function hasCSSTransform(el, root, moveClass) {
- const clone = el.cloneNode();
- const _vtc = el[vtcKey];
- if (_vtc) {
- _vtc.forEach((cls) => {
- cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
- });
- }
- moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
- clone.style.display = "none";
- const container = root.nodeType === 1 ? root : root.parentNode;
- container.appendChild(clone);
- const { hasTransform } = getTransitionInfo(clone);
- container.removeChild(clone);
- return hasTransform;
- }
- const getModelAssigner = (vnode) => {
- const fn = vnode.props["onUpdate:modelValue"] || false;
- return shared.isArray(fn) ? (value) => shared.invokeArrayFns(fn, value) : fn;
- };
- function onCompositionStart(e) {
- e.target.composing = true;
- }
- function onCompositionEnd(e) {
- const target = e.target;
- if (target.composing) {
- target.composing = false;
- target.dispatchEvent(new Event("input"));
- }
- }
- const assignKey = Symbol("_assign");
- const vModelText = {
- created(el, { modifiers: { lazy, trim, number } }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- const castToNumber = number || vnode.props && vnode.props.type === "number";
- addEventListener(el, lazy ? "change" : "input", (e) => {
- if (e.target.composing) return;
- let domValue = el.value;
- if (trim) {
- domValue = domValue.trim();
- }
- if (castToNumber) {
- domValue = shared.looseToNumber(domValue);
- }
- el[assignKey](domValue);
- });
- if (trim) {
- addEventListener(el, "change", () => {
- el.value = el.value.trim();
- });
- }
- if (!lazy) {
- addEventListener(el, "compositionstart", onCompositionStart);
- addEventListener(el, "compositionend", onCompositionEnd);
- addEventListener(el, "change", onCompositionEnd);
- }
- },
-
- mounted(el, { value }) {
- el.value = value == null ? "" : value;
- },
- beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- if (el.composing) return;
- const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
- const newValue = value == null ? "" : value;
- if (elValue === newValue) {
- return;
- }
- if (document.activeElement === el && el.type !== "range") {
- if (lazy && value === oldValue) {
- return;
- }
- if (trim && el.value.trim() === newValue) {
- return;
- }
- }
- el.value = newValue;
- }
- };
- const vModelCheckbox = {
-
- deep: true,
- created(el, _, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- addEventListener(el, "change", () => {
- const modelValue = el._modelValue;
- const elementValue = getValue(el);
- const checked = el.checked;
- const assign = el[assignKey];
- if (shared.isArray(modelValue)) {
- const index = shared.looseIndexOf(modelValue, elementValue);
- const found = index !== -1;
- if (checked && !found) {
- assign(modelValue.concat(elementValue));
- } else if (!checked && found) {
- const filtered = [...modelValue];
- filtered.splice(index, 1);
- assign(filtered);
- }
- } else if (shared.isSet(modelValue)) {
- const cloned = new Set(modelValue);
- if (checked) {
- cloned.add(elementValue);
- } else {
- cloned.delete(elementValue);
- }
- assign(cloned);
- } else {
- assign(getCheckboxValue(el, checked));
- }
- });
- },
-
- mounted: setChecked,
- beforeUpdate(el, binding, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- setChecked(el, binding, vnode);
- }
- };
- function setChecked(el, { value, oldValue }, vnode) {
- el._modelValue = value;
- let checked;
- if (shared.isArray(value)) {
- checked = shared.looseIndexOf(value, vnode.props.value) > -1;
- } else if (shared.isSet(value)) {
- checked = value.has(vnode.props.value);
- } else {
- if (value === oldValue) return;
- checked = shared.looseEqual(value, getCheckboxValue(el, true));
- }
- if (el.checked !== checked) {
- el.checked = checked;
- }
- }
- const vModelRadio = {
- created(el, { value }, vnode) {
- el.checked = shared.looseEqual(value, vnode.props.value);
- el[assignKey] = getModelAssigner(vnode);
- addEventListener(el, "change", () => {
- el[assignKey](getValue(el));
- });
- },
- beforeUpdate(el, { value, oldValue }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- if (value !== oldValue) {
- el.checked = shared.looseEqual(value, vnode.props.value);
- }
- }
- };
- const vModelSelect = {
-
- deep: true,
- created(el, { value, modifiers: { number } }, vnode) {
- const isSetModel = shared.isSet(value);
- addEventListener(el, "change", () => {
- const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
- (o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
- );
- el[assignKey](
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
- );
- el._assigning = true;
- runtimeCore.nextTick(() => {
- el._assigning = false;
- });
- });
- el[assignKey] = getModelAssigner(vnode);
- },
-
-
- mounted(el, { value }) {
- setSelected(el, value);
- },
- beforeUpdate(el, _binding, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- },
- updated(el, { value }) {
- if (!el._assigning) {
- setSelected(el, value);
- }
- }
- };
- function setSelected(el, value) {
- const isMultiple = el.multiple;
- const isArrayValue = shared.isArray(value);
- if (isMultiple && !isArrayValue && !shared.isSet(value)) {
- return;
- }
- for (let i = 0, l = el.options.length; i < l; i++) {
- const option = el.options[i];
- const optionValue = getValue(option);
- if (isMultiple) {
- if (isArrayValue) {
- const optionType = typeof optionValue;
- if (optionType === "string" || optionType === "number") {
- option.selected = value.some((v) => String(v) === String(optionValue));
- } else {
- option.selected = shared.looseIndexOf(value, optionValue) > -1;
- }
- } else {
- option.selected = value.has(optionValue);
- }
- } else if (shared.looseEqual(getValue(option), value)) {
- if (el.selectedIndex !== i) el.selectedIndex = i;
- return;
- }
- }
- if (!isMultiple && el.selectedIndex !== -1) {
- el.selectedIndex = -1;
- }
- }
- function getValue(el) {
- return "_value" in el ? el._value : el.value;
- }
- function getCheckboxValue(el, checked) {
- const key = checked ? "_trueValue" : "_falseValue";
- return key in el ? el[key] : checked;
- }
- const vModelDynamic = {
- created(el, binding, vnode) {
- callModelHook(el, binding, vnode, null, "created");
- },
- mounted(el, binding, vnode) {
- callModelHook(el, binding, vnode, null, "mounted");
- },
- beforeUpdate(el, binding, vnode, prevVNode) {
- callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
- },
- updated(el, binding, vnode, prevVNode) {
- callModelHook(el, binding, vnode, prevVNode, "updated");
- }
- };
- function resolveDynamicModel(tagName, type) {
- switch (tagName) {
- case "SELECT":
- return vModelSelect;
- case "TEXTAREA":
- return vModelText;
- default:
- switch (type) {
- case "checkbox":
- return vModelCheckbox;
- case "radio":
- return vModelRadio;
- default:
- return vModelText;
- }
- }
- }
- function callModelHook(el, binding, vnode, prevVNode, hook) {
- const modelToUse = resolveDynamicModel(
- el.tagName,
- vnode.props && vnode.props.type
- );
- const fn = modelToUse[hook];
- fn && fn(el, binding, vnode, prevVNode);
- }
- function initVModelForSSR() {
- vModelText.getSSRProps = ({ value }) => ({ value });
- vModelRadio.getSSRProps = ({ value }, vnode) => {
- if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
- return { checked: true };
- }
- };
- vModelCheckbox.getSSRProps = ({ value }, vnode) => {
- if (shared.isArray(value)) {
- if (vnode.props && shared.looseIndexOf(value, vnode.props.value) > -1) {
- return { checked: true };
- }
- } else if (shared.isSet(value)) {
- if (vnode.props && value.has(vnode.props.value)) {
- return { checked: true };
- }
- } else if (value) {
- return { checked: true };
- }
- };
- vModelDynamic.getSSRProps = (binding, vnode) => {
- if (typeof vnode.type !== "string") {
- return;
- }
- const modelToUse = resolveDynamicModel(
-
- vnode.type.toUpperCase(),
- vnode.props && vnode.props.type
- );
- if (modelToUse.getSSRProps) {
- return modelToUse.getSSRProps(binding, vnode);
- }
- };
- }
- const systemModifiers = ["ctrl", "shift", "alt", "meta"];
- const modifierGuards = {
- stop: (e) => e.stopPropagation(),
- prevent: (e) => e.preventDefault(),
- self: (e) => e.target !== e.currentTarget,
- ctrl: (e) => !e.ctrlKey,
- shift: (e) => !e.shiftKey,
- alt: (e) => !e.altKey,
- meta: (e) => !e.metaKey,
- left: (e) => "button" in e && e.button !== 0,
- middle: (e) => "button" in e && e.button !== 1,
- right: (e) => "button" in e && e.button !== 2,
- exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
- };
- const withModifiers = (fn, modifiers) => {
- const cache = fn._withMods || (fn._withMods = {});
- const cacheKey = modifiers.join(".");
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
- for (let i = 0; i < modifiers.length; i++) {
- const guard = modifierGuards[modifiers[i]];
- if (guard && guard(event, modifiers)) return;
- }
- return fn(event, ...args);
- });
- };
- const keyNames = {
- esc: "escape",
- space: " ",
- up: "arrow-up",
- left: "arrow-left",
- right: "arrow-right",
- down: "arrow-down",
- delete: "backspace"
- };
- const withKeys = (fn, modifiers) => {
- const cache = fn._withKeys || (fn._withKeys = {});
- const cacheKey = modifiers.join(".");
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
- if (!("key" in event)) {
- return;
- }
- const eventKey = shared.hyphenate(event.key);
- if (modifiers.some(
- (k) => k === eventKey || keyNames[k] === eventKey
- )) {
- return fn(event);
- }
- });
- };
- const rendererOptions = shared.extend({ patchProp }, nodeOps);
- let renderer;
- let enabledHydration = false;
- function ensureRenderer() {
- return renderer || (renderer = runtimeCore.createRenderer(rendererOptions));
- }
- function ensureHydrationRenderer() {
- renderer = enabledHydration ? renderer : runtimeCore.createHydrationRenderer(rendererOptions);
- enabledHydration = true;
- return renderer;
- }
- const render = (...args) => {
- ensureRenderer().render(...args);
- };
- const hydrate = (...args) => {
- ensureHydrationRenderer().hydrate(...args);
- };
- const createApp = (...args) => {
- const app = ensureRenderer().createApp(...args);
- const { mount } = app;
- app.mount = (containerOrSelector) => {
- const container = normalizeContainer(containerOrSelector);
- if (!container) return;
- const component = app._component;
- if (!shared.isFunction(component) && !component.render && !component.template) {
- component.template = container.innerHTML;
- }
- if (container.nodeType === 1) {
- container.textContent = "";
- }
- const proxy = mount(container, false, resolveRootNamespace(container));
- if (container instanceof Element) {
- container.removeAttribute("v-cloak");
- container.setAttribute("data-v-app", "");
- }
- return proxy;
- };
- return app;
- };
- const createSSRApp = (...args) => {
- const app = ensureHydrationRenderer().createApp(...args);
- const { mount } = app;
- app.mount = (containerOrSelector) => {
- const container = normalizeContainer(containerOrSelector);
- if (container) {
- return mount(container, true, resolveRootNamespace(container));
- }
- };
- return app;
- };
- function resolveRootNamespace(container) {
- if (container instanceof SVGElement) {
- return "svg";
- }
- if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
- return "mathml";
- }
- }
- function normalizeContainer(container) {
- if (shared.isString(container)) {
- const res = document.querySelector(container);
- return res;
- }
- return container;
- }
- let ssrDirectiveInitialized = false;
- const initDirectivesForSSR = () => {
- if (!ssrDirectiveInitialized) {
- ssrDirectiveInitialized = true;
- initVModelForSSR();
- initVShowForSSR();
- }
- } ;
- exports.Transition = Transition;
- exports.TransitionGroup = TransitionGroup;
- exports.VueElement = VueElement;
- exports.createApp = createApp;
- exports.createSSRApp = createSSRApp;
- exports.defineCustomElement = defineCustomElement;
- exports.defineSSRCustomElement = defineSSRCustomElement;
- exports.hydrate = hydrate;
- exports.initDirectivesForSSR = initDirectivesForSSR;
- exports.render = render;
- exports.useCssModule = useCssModule;
- exports.useCssVars = useCssVars;
- exports.useHost = useHost;
- exports.useShadowRoot = useShadowRoot;
- exports.vModelCheckbox = vModelCheckbox;
- exports.vModelDynamic = vModelDynamic;
- exports.vModelRadio = vModelRadio;
- exports.vModelSelect = vModelSelect;
- exports.vModelText = vModelText;
- exports.vShow = vShow;
- exports.withKeys = withKeys;
- exports.withModifiers = withModifiers;
- Object.keys(runtimeCore).forEach(function (k) {
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
- });
|