All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.compiler-dom.esm-bundler.js Maven / Gradle / Ivy

The newest version!
/**
* @vue/compiler-dom v3.5.10
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
export * from '@vue/compiler-core';
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, extend } from '@vue/shared';

const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
const V_MODEL_CHECKBOX = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``
);
const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
const V_MODEL_SELECT = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``
);
const V_MODEL_DYNAMIC = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``
);
const V_ON_WITH_MODIFIERS = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``
);
const V_ON_WITH_KEYS = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``
);
const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
const TRANSITION_GROUP = Symbol(
  !!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``
);
registerRuntimeHelpers({
  [V_MODEL_RADIO]: `vModelRadio`,
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  [V_MODEL_TEXT]: `vModelText`,
  [V_MODEL_SELECT]: `vModelSelect`,
  [V_MODEL_DYNAMIC]: `vModelDynamic`,
  [V_ON_WITH_MODIFIERS]: `withModifiers`,
  [V_ON_WITH_KEYS]: `withKeys`,
  [V_SHOW]: `vShow`,
  [TRANSITION]: `Transition`,
  [TRANSITION_GROUP]: `TransitionGroup`
});

let decoder;
function decodeHtmlBrowser(raw, asAttr = false) {
  if (!decoder) {
    decoder = document.createElement("div");
  }
  if (asAttr) {
    decoder.innerHTML = `
`; return decoder.children[0].getAttribute("foo"); } else { decoder.innerHTML = raw; return decoder.textContent; } } const parserOptions = { parseMode: "html", isVoidTag, isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), isPreTag: (tag) => tag === "pre", isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", decodeEntities: decodeHtmlBrowser , isBuiltInComponent: (tag) => { if (tag === "Transition" || tag === "transition") { return TRANSITION; } else if (tag === "TransitionGroup" || tag === "transition-group") { return TRANSITION_GROUP; } }, // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher getNamespace(tag, parent, rootNamespace) { let ns = parent ? parent.ns : rootNamespace; if (parent && ns === 2) { if (parent.tag === "annotation-xml") { if (tag === "svg") { return 1; } if (parent.props.some( (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") )) { ns = 0; } } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { ns = 0; } } else if (parent && ns === 1) { if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { ns = 0; } } if (ns === 0) { if (tag === "svg") { return 1; } if (tag === "math") { return 2; } } return ns; } }; const transformStyle = (node) => { if (node.type === 1) { node.props.forEach((p, i) => { if (p.type === 6 && p.name === "style" && p.value) { node.props[i] = { type: 7, name: `bind`, arg: createSimpleExpression(`style`, true, p.loc), exp: parseInlineCSS(p.value.content, p.loc), modifiers: [], loc: p.loc }; } }); } }; const parseInlineCSS = (cssText, loc) => { const normalized = parseStringStyle(cssText); return createSimpleExpression( JSON.stringify(normalized), false, loc, 3 ); }; function createDOMCompilerError(code, loc) { return createCompilerError( code, loc, !!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0 ); } const DOMErrorCodes = { "X_V_HTML_NO_EXPRESSION": 53, "53": "X_V_HTML_NO_EXPRESSION", "X_V_HTML_WITH_CHILDREN": 54, "54": "X_V_HTML_WITH_CHILDREN", "X_V_TEXT_NO_EXPRESSION": 55, "55": "X_V_TEXT_NO_EXPRESSION", "X_V_TEXT_WITH_CHILDREN": 56, "56": "X_V_TEXT_WITH_CHILDREN", "X_V_MODEL_ON_INVALID_ELEMENT": 57, "57": "X_V_MODEL_ON_INVALID_ELEMENT", "X_V_MODEL_ARG_ON_ELEMENT": 58, "58": "X_V_MODEL_ARG_ON_ELEMENT", "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59, "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT", "X_V_MODEL_UNNECESSARY_VALUE": 60, "60": "X_V_MODEL_UNNECESSARY_VALUE", "X_V_SHOW_NO_EXPRESSION": 61, "61": "X_V_SHOW_NO_EXPRESSION", "X_TRANSITION_INVALID_CHILDREN": 62, "62": "X_TRANSITION_INVALID_CHILDREN", "X_IGNORED_SIDE_EFFECT_TAG": 63, "63": "X_IGNORED_SIDE_EFFECT_TAG", "__EXTEND_POINT__": 64, "64": "__EXTEND_POINT__" }; const DOMErrorMessages = { [53]: `v-html is missing expression.`, [54]: `v-html will override element children.`, [55]: `v-text is missing expression.`, [56]: `v-text will override element children.`, [57]: `v-model can only be used on ,