diff --git a/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts b/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts index be9e88ad630dd86452f82c787980c38ca06be43d..2c525ea49c7be4890703f14622450f97584242e5 100644 --- a/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts +++ b/packages/uni-app-plus/__tests__/service/dom/dom.spec.ts @@ -1,4 +1,4 @@ -import { UniEventListener } from '@dcloudio/uni-shared' +import { encodeTag, UniEventListener } from '@dcloudio/uni-shared' import { createPageNode } from '../../../src/service/framework/dom/Page' import { createElement, @@ -13,6 +13,8 @@ import { ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ACTION_TYPE_REMOVE, + CreateAction, + ACTION_TYPE_CREATE, } from '../../../src/PageAction' import { EventModifierFlags } from '@dcloudio/uni-shared' @@ -35,18 +37,24 @@ describe('dom', () => { windowBottom: 0, }) test('proxyNode', () => { - const viewElem = createElement('view') + const viewElem = createElement('view', { pageNode: root }) viewElem.setAttribute('id', 'view') root.appendChild(viewElem) viewElem.setAttribute('hidden', true) const { updateActions } = root - const addElementAction = updateActions[0] as InsertAction + const createElementAction = updateActions[0] as CreateAction + expect(createElementAction[0]).toBe(ACTION_TYPE_CREATE) + expect(createElementAction[1]).toBe(1) + expect(createElementAction[2]).toBe(encodeTag('VIEW')) + expect(createElementAction[3]).toBe(0) + expect(createElementAction[4]!.a!.id).toBe('view') + const addElementAction = updateActions[1] as InsertAction expect(addElementAction[0]).toBe(ACTION_TYPE_INSERT) expect(addElementAction[1]).toBe(1) // nodeId expect(addElementAction[2]).toBe(0) // parentNodeId expect(addElementAction[3]).toBe(-1) // index - const setAttributeAction = updateActions[1] as SetAttributeAction + const setAttributeAction = updateActions[2] as SetAttributeAction expect(setAttributeAction[0]).toBe(ACTION_TYPE_SET_ATTRIBUTE) expect(setAttributeAction[1]).toBe(1) expect(setAttributeAction[2]).toBe('hidden') @@ -79,10 +87,10 @@ describe('dom', () => { expect(removeChildAction[1]).toBe(1) root.updateActions.length = 0 - const textNode = createTextNode('hello') + const textNode = createTextNode('hello', { pageNode: root }) root.appendChild(textNode) const { - updateActions: [addTextNodeAction], + updateActions: [, addTextNodeAction], } = root expect(addTextNodeAction[0]).toBe(ACTION_TYPE_INSERT) expect(addTextNodeAction[1]).toBe(2) diff --git a/packages/uni-app-plus/dist/uni-app-service.es.js b/packages/uni-app-plus/dist/uni-app-service.es.js index a4b0f3f5fabfbfd0604eb0ee17d7ac8b7d4d9e6f..7c6bf8b3753fd6346f52101e1733c0d15f7112a2 100644 --- a/packages/uni-app-plus/dist/uni-app-service.es.js +++ b/packages/uni-app-plus/dist/uni-app-service.es.js @@ -7386,9 +7386,6 @@ var serviceContext = (function (vue) { break; } this.updateActions.push(action); - if ((process.env.NODE_ENV !== 'production')) { - console.log(formatLog('PageNode', 'push', action)); - } vue.queuePostFlushCb(this._update); } restore() { diff --git a/packages/uni-app-plus/dist/uni-app-view.umd.js b/packages/uni-app-plus/dist/uni-app-view.umd.js index 8da490086f7c90576f7e784375d5ada2d555a1a7..c64e5ab4b95fec38ed9de5e0efc89c50e2404d91 100644 --- a/packages/uni-app-plus/dist/uni-app-view.umd.js +++ b/packages/uni-app-plus/dist/uni-app-view.umd.js @@ -3248,6 +3248,10 @@ } setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); } + Object.defineProperty(el, "__vueParentComponent", { + value: parentComponent, + enumerable: false + }); if (dirs) { invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); } @@ -3866,7 +3870,7 @@ unmount(container._vnode, null, null, true); } } else { - patch(container._vnode || null, vnode, container, null, null, null, isSVG); + patch(container._vnode || null, vnode, container, null, container.__vueParent || null, null, isSVG); } flushPostFlushCbs(); container._vnode = vnode; @@ -5826,11 +5830,12 @@ const ACTION_TYPE_SET_TEXT = 8; const ACTION_TYPE_EVENT = 20; class UniNode { - constructor(id2, tag, element) { + constructor(id2, tag, parentNodeId, element) { this.isMounted = false; this.isUnmounted = false; this.id = id2; this.tag = tag; + this.pid = parentNodeId; if (element) { this.$ = element; } @@ -5857,6 +5862,7 @@ const { $: $2 } = this; $2.parentNode.removeChild($2); this.isUnmounted = false; + removeElement(this.id); } appendChild(node) { return this.$.appendChild(node); @@ -5866,8 +5872,8 @@ } } class UniComment extends UniNode { - constructor(id2) { - super(id2, "#comment", document.createComment("")); + constructor(id2, parentNodeId) { + super(id2, "#comment", parentNodeId, document.createComment("")); } } var text$1 = "uni-text[selectable] {\n cursor: auto;\n -webkit-user-select: text;\n user-select: text;\n}\n"; @@ -14083,8 +14089,8 @@ } } class UniElement extends UniNode { - constructor(id2, element, nodeJson, propNames = []) { - super(id2, element.tagName, element); + constructor(id2, element, parentNodeId, nodeJson, propNames = []) { + super(id2, element.tagName, parentNodeId, element); this.$props = reactive({}); this.$.__id = id2; this.$.__listeners = Object.create(null); @@ -14148,8 +14154,8 @@ } const PROP_NAMES_HOVER$1 = ["space", "decode"]; class UniTextElement extends UniElement { - constructor(id2, _parentNodeId, nodeJson) { - super(id2, document.createElement("uni-text"), nodeJson, PROP_NAMES_HOVER$1); + constructor(id2, parentNodeId, nodeJson) { + super(id2, document.createElement("uni-text"), parentNodeId, nodeJson, PROP_NAMES_HOVER$1); this._text = ""; } init(nodeJson) { @@ -14173,8 +14179,8 @@ } } class UniTextNode extends UniNode { - constructor(id2) { - super(id2, "#text", document.createTextNode("")); + constructor(id2, parentNodeId) { + super(id2, "#text", parentNodeId, document.createTextNode("")); } } var view = "uni-view {\n display: block;\n}\nuni-view[hidden] {\n display: none;\n}\n"; @@ -14185,8 +14191,11 @@ "hover-stay-time" ]; class UniHoverElement extends UniElement { - constructor(id2, element, nodeJson, propNames = []) { - super(id2, element, nodeJson, [...PROP_NAMES_HOVER, ...propNames]); + constructor(id2, element, parentNodeId, nodeJson, propNames = []) { + super(id2, element, parentNodeId, nodeJson, [ + ...PROP_NAMES_HOVER, + ...propNames + ]); } update() { const hoverClass = this.$props["hover-class"]; @@ -14294,8 +14303,8 @@ } } class UniViewElement extends UniHoverElement { - constructor(id2, _parentNodeId, nodeJson) { - super(id2, document.createElement("uni-view"), nodeJson); + constructor(id2, parentNodeId, nodeJson) { + super(id2, document.createElement("uni-view"), parentNodeId, nodeJson); } } var Ad = /* @__PURE__ */ defineBuiltInComponent({ @@ -14303,8 +14312,9 @@ }); class UniComponent extends UniNode { constructor(id2, tag, component, parentNodeId, nodeJson, selector) { - super(id2, tag); + super(id2, tag, parentNodeId); const container = document.createElement("div"); + container.__vueParent = getVueParent(this); this.$props = reactive({}); this.init(nodeJson); createApp(createWrapper(component, this.$props)).mount(container); @@ -14345,6 +14355,18 @@ return (this.$holder || this.$).insertBefore(newChild, refChild); } } + function getVueParent(node) { + while (node && node.pid > 0) { + node = $(node.pid); + if (node) { + const { __vueParentComponent } = node.$; + if (__vueParentComponent) { + return __vueParentComponent; + } + } + } + return null; + } class UniAd extends UniComponent { constructor(id2, parentNodeId, nodeJson) { super(id2, "uni-ad", Ad, parentNodeId, nodeJson); @@ -15214,12 +15236,18 @@ function $(id2) { return elements.get(id2); } + function removeElement(id2) { + { + console.log(formatLog("Remove", id2, elements.size - 1)); + } + return elements.delete(id2); + } function createElement(id2, tag, parentNodeId, nodeJson = {}) { let element; if (id2 === 0) { - element = new UniNode(id2, tag, document.createElement(tag)); + element = new UniNode(id2, tag, parentNodeId, document.createElement(tag)); } else if (isString(tag)) { - element = new UniElement(id2, document.createElement(tag), nodeJson); + element = new UniElement(id2, document.createElement(tag), parentNodeId, nodeJson); } else { element = createBuiltInComponent(tag, id2, parentNodeId, nodeJson); } @@ -15265,7 +15293,7 @@ }; } function initPageElement() { - createElement(0, "div").$ = document.getElementById("app"); + createElement(0, "div", -1).$ = document.getElementById("app"); } function initPageCss(route) { const element = document.createElement("link"); diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts index deec8cca731eb68a66e23031a897b0131a0d0a04..4039f36164599ccff1dd3eab65eaebf728a34957 100644 --- a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts +++ b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts @@ -1,9 +1,10 @@ import { hasOwn } from '@vue/shared' -import { Component, createApp, reactive } from 'vue' +import { Component, ComponentInternalInstance, createApp, reactive } from 'vue' import { decodeAttr, parseEventName, UniNodeJSON } from '@dcloudio/uni-shared' import { UniNode } from '../elements/UniNode' import { createInvoker } from '../modules/events' import { createWrapper, UniCustomElement } from '.' +import { $ } from '../page' export class UniComponent extends UniNode { declare $: UniCustomElement @@ -17,8 +18,9 @@ export class UniComponent extends UniNode { nodeJson: Partial, selector?: string ) { - super(id, tag) + super(id, tag, parentNodeId) const container = document.createElement('div') + ;(container as any).__vueParent = getVueParent(this) this.$props = reactive({}) this.init(nodeJson) createApp(createWrapper(component, this.$props)).mount(container) @@ -63,3 +65,18 @@ export class UniComponent extends UniNode { return (this.$holder || this.$).insertBefore(newChild, refChild) } } + +function getVueParent(node: UniNode): ComponentInternalInstance | null { + while (node && node.pid > 0) { + node = $(node.pid) + if (node) { + const { __vueParentComponent } = node.$ as unknown as { + __vueParentComponent: ComponentInternalInstance + } + if (__vueParentComponent) { + return __vueParentComponent + } + } + } + return null +} diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts index 51ac486525512a4abf88dddc7ab4577fec779fe4..6beca823566b5cae8e2c688f56c801f5433a30f8 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts @@ -1,7 +1,7 @@ import { UniNode } from './UniNode' export class UniComment extends UniNode { - constructor(id: number) { - super(id, '#comment', document.createComment('')) + constructor(id: number, parentNodeId: number) { + super(id, '#comment', parentNodeId, document.createComment('')) } } diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts index e43591a42f9d492419cc8007eeecb596e8731bfb..9f589cb49bedecd12bf5a51afeb7f7a44bb955bd 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts @@ -16,10 +16,11 @@ export class UniElement extends UniNode { constructor( id: number, element: Element, + parentNodeId: number, nodeJson: Partial, propNames: string[] = [] ) { - super(id, element.tagName, element) + super(id, element.tagName, parentNodeId, element) this.$.__id = id this.$.__listeners = Object.create(null) this.$propNames = propNames diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts index 961e29d7c779364377cb477f8ceb5095be7d0d07..edff16ecd2216edb5beecd38d1e78b234cc662fd 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts @@ -19,10 +19,14 @@ export class UniHoverElement extends UniElement { constructor( id: number, element: Element, + parentNodeId: number, nodeJson: Partial, propNames: string[] = [] ) { - super(id, element, nodeJson, [...PROP_NAMES_HOVER, ...propNames]) + super(id, element, parentNodeId, nodeJson, [ + ...PROP_NAMES_HOVER, + ...propNames, + ]) } update() { const hoverClass = this.$props['hover-class'] diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts index 408ea5d786b921e1cf20497713921238ac3f035d..528d757798d259d215424a3a0e03036dda8bc8b0 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts @@ -1,17 +1,24 @@ import { hasOwn } from '@vue/shared' import { UniNodeJSON } from '@dcloudio/uni-shared' -import { $ } from '../page' +import { $, removeElement } from '../page' export class UniNode { id: number tag: string + pid: number $!: Element | Text | Comment isMounted: boolean = false isUnmounted: boolean = false - constructor(id: number, tag: string, element?: Element | Text | Comment) { + constructor( + id: number, + tag: string, + parentNodeId: number, + element?: Element | Text | Comment + ) { this.id = id this.tag = tag + this.pid = parentNodeId if (element) { this.$ = element } @@ -38,6 +45,7 @@ export class UniNode { const { $ } = this $.parentNode!.removeChild($) this.isUnmounted = false + removeElement(this.id) } appendChild(node: Node) { return this.$.appendChild(node) diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts index 60b005477348fc60ef764b038e23b627e618abda..69982b886abc955f6f510b6be3d5aa1e6c374f3f 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts @@ -15,10 +15,16 @@ export class UniTextElement extends UniElement { constructor( id: number, - _parentNodeId: number, + parentNodeId: number, nodeJson: Partial ) { - super(id, document.createElement('uni-text'), nodeJson, PROP_NAMES_HOVER) + super( + id, + document.createElement('uni-text'), + parentNodeId, + nodeJson, + PROP_NAMES_HOVER + ) } init(nodeJson: Partial) { diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts index 0c186466f85d01d83211db0eef4cdffa6a72cc65..6b32505e6d372136d132e30e6c392b206be8b6ac 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts @@ -1,7 +1,7 @@ import { UniNode } from './UniNode' export class UniTextNode extends UniNode { - constructor(id: number) { - super(id, '#text', document.createTextNode('')) + constructor(id: number, parentNodeId: number) { + super(id, '#text', parentNodeId, document.createTextNode('')) } } diff --git a/packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts b/packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts index effb13ecccb8eca253f25e87f2105f0534193c86..8f3113f111774108c484d5dfb5ac9782fe6c6a0a 100644 --- a/packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts +++ b/packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts @@ -4,9 +4,9 @@ import { UniHoverElement } from './UniHoverElement' export class UniViewElement extends UniHoverElement { constructor( id: number, - _parentNodeId: number, + parentNodeId: number, nodeJson: Partial ) { - super(id, document.createElement('uni-view'), nodeJson) + super(id, document.createElement('uni-view'), parentNodeId, nodeJson) } } diff --git a/packages/uni-app-plus/src/view/framework/dom/page.ts b/packages/uni-app-plus/src/view/framework/dom/page.ts index 820b5c2eaa84b9ebe3ae14c11e28dff7be791ecb..709b43d616182bf11718a64bfb145448dfa5ab90 100644 --- a/packages/uni-app-plus/src/view/framework/dom/page.ts +++ b/packages/uni-app-plus/src/view/framework/dom/page.ts @@ -19,10 +19,17 @@ export function $(id: number) { return elements.get(id) as UniElement } +export function removeElement(id: number) { + if (__DEV__) { + console.log(formatLog('Remove', id, elements.size - 1)) + } + return elements.delete(id) +} + export function createElement( id: number, tag: string | number, - parentNodeId?: number, + parentNodeId: number, nodeJson: Partial = {} ) { let element: UniNode @@ -31,10 +38,16 @@ export function createElement( element = new UniNode( id, tag as string, + parentNodeId, document.createElement(tag as string) ) } else if (isString(tag)) { - element = new UniElement(id, document.createElement(tag), nodeJson) + element = new UniElement( + id, + document.createElement(tag), + parentNodeId, + nodeJson + ) } else { element = createBuiltInComponent(tag, id, parentNodeId!, nodeJson) } @@ -92,7 +105,7 @@ function initSystemInfo( } function initPageElement() { - createElement(0, 'div').$ = document.getElementById('app')! + createElement(0, 'div', -1).$ = document.getElementById('app')! } function initPageCss(route: string) { diff --git a/packages/uni-app-vue/dist/service.runtime.esm.js b/packages/uni-app-vue/dist/service.runtime.esm.js index e5e9efdac9ef0d7ea7b071bd381433b198a6b082..42445a9b7a71cedba43519631e198ea06a4362e0 100644 --- a/packages/uni-app-vue/dist/service.runtime.esm.js +++ b/packages/uni-app-vue/dist/service.runtime.esm.js @@ -849,12 +849,12 @@ export default function vueFactory(exports) { return UniTextNode; }(UniBaseNode); - /** - * Make a map and return a function for checking if a key - * is in that map. - * IMPORTANT: all calls of this function must be prefixed with - * \/\*#\_\_PURE\_\_\*\/ - * So that rollup can tree-shake them if necessary. + /** + * Make a map and return a function for checking if a key + * is in that map. + * IMPORTANT: all calls of this function must be prefixed with + * \/\*#\_\_PURE\_\_\*\/ + * So that rollup can tree-shake them if necessary. */ @@ -942,9 +942,9 @@ export default function vueFactory(exports) { var SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' + 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' + 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' + 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' + 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' + 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' + 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' + 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' + 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' + 'text,textPath,title,tspan,unknown,use,view'; var isHTMLTag = /*#__PURE__*/makeMap(HTML_TAGS); var isSVGTag = /*#__PURE__*/makeMap(SVG_TAGS); - /** - * For converting {{ interpolation }} values to displayed strings. - * @private + /** + * For converting {{ interpolation }} values to displayed strings. + * @private */ var toDisplayString = function toDisplayString(val) { @@ -978,8 +978,8 @@ export default function vueFactory(exports) { var EMPTY_ARR = process.env.NODE_ENV !== 'production' ? Object.freeze([]) : []; var NOOP = function NOOP() {}; - /** - * Always return false. + /** + * Always return false. */ @@ -1074,8 +1074,8 @@ export default function vueFactory(exports) { }; var camelizeRE = /-(\w)/g; - /** - * @private + /** + * @private */ var camelize = cacheStringFunction(function (str) { @@ -1084,22 +1084,22 @@ export default function vueFactory(exports) { }); }); var hyphenateRE = /\B([A-Z])/g; - /** - * @private + /** + * @private */ var hyphenate = cacheStringFunction(function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); }); - /** - * @private + /** + * @private */ var capitalize = cacheStringFunction(function (str) { return str.charAt(0).toUpperCase() + str.slice(1); }); - /** - * @private + /** + * @private */ var toHandlerKey = cacheStringFunction(function (str) { @@ -1289,7 +1289,7 @@ export default function vueFactory(exports) { } }; - if (type === 'clear' + if (type === "clear" /* CLEAR */ ) { // collection being cleared @@ -1309,7 +1309,7 @@ export default function vueFactory(exports) { switch (type) { - case 'add' + case "add" /* ADD */ : if (!isArray(target)) { @@ -1325,7 +1325,7 @@ export default function vueFactory(exports) { break; - case 'delete' + case "delete" /* DELETE */ : if (!isArray(target)) { @@ -1338,7 +1338,7 @@ export default function vueFactory(exports) { break; - case 'set' + case "set" /* SET */ : if (isMap(target)) { @@ -1391,7 +1391,7 @@ export default function vueFactory(exports) { var arr = toRaw(this); for (var i = 0, l = this.length; i < l; i++) { - track(arr, 'get' + track(arr, "get" /* GET */ , i + ''); } // we run the method using the original args first (which may be reactive) @@ -1433,15 +1433,15 @@ export default function vueFactory(exports) { var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var shallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return function get(target, key, receiver) { - if (key === '__v_isReactive' + if (key === "__v_isReactive" /* IS_REACTIVE */ ) { return !isReadonly; - } else if (key === '__v_isReadonly' + } else if (key === "__v_isReadonly" /* IS_READONLY */ ) { return isReadonly; - } else if (key === '__v_raw' + } else if (key === "__v_raw" /* RAW */ && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { return target; @@ -1460,7 +1460,7 @@ export default function vueFactory(exports) { } if (!isReadonly) { - track(target, 'get' + track(target, "get" /* GET */ , key); } @@ -1509,11 +1509,11 @@ export default function vueFactory(exports) { if (target === toRaw(receiver)) { if (!hadKey) { - trigger(target, 'add' + trigger(target, "add" /* ADD */ , key, value); } else if (hasChanged(value, oldValue)) { - trigger(target, 'set' + trigger(target, "set" /* SET */ , key, value, oldValue); } @@ -1529,7 +1529,7 @@ export default function vueFactory(exports) { var result = Reflect.deleteProperty(target, key); if (result && hadKey) { - trigger(target, 'delete' + trigger(target, "delete" /* DELETE */ , key, undefined, oldValue); } @@ -1541,7 +1541,7 @@ export default function vueFactory(exports) { var result = Reflect.has(target, key); if (!isSymbol(key) || !builtInSymbols.has(key)) { - track(target, 'has' + track(target, "has" /* HAS */ , key); } @@ -1550,7 +1550,7 @@ export default function vueFactory(exports) { } function ownKeys(target) { - track(target, 'iterate' + track(target, "iterate" /* ITERATE */ , isArray(target) ? 'length' : ITERATE_KEY); return Reflect.ownKeys(target); @@ -1615,19 +1615,19 @@ export default function vueFactory(exports) { var isShallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // #1772: readonly(reactive(Map)) should return readonly + reactive version // of the value - target = target['__v_raw' + target = target["__v_raw" /* RAW */ ]; var rawTarget = toRaw(target); var rawKey = toRaw(key); if (key !== rawKey) { - !isReadonly && track(rawTarget, 'get' + !isReadonly && track(rawTarget, "get" /* GET */ , key); } - !isReadonly && track(rawTarget, 'get' + !isReadonly && track(rawTarget, "get" /* GET */ , rawKey); @@ -1649,19 +1649,19 @@ export default function vueFactory(exports) { function has$1(key) { var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var target = this['__v_raw' + var target = this["__v_raw" /* RAW */ ]; var rawTarget = toRaw(target); var rawKey = toRaw(key); if (key !== rawKey) { - !isReadonly && track(rawTarget, 'has' + !isReadonly && track(rawTarget, "has" /* HAS */ , key); } - !isReadonly && track(rawTarget, 'has' + !isReadonly && track(rawTarget, "has" /* HAS */ , rawKey); return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); @@ -1669,10 +1669,10 @@ export default function vueFactory(exports) { function size(target) { var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - target = target['__v_raw' + target = target["__v_raw" /* RAW */ ]; - !isReadonly && track(toRaw(target), 'iterate' + !isReadonly && track(toRaw(target), "iterate" /* ITERATE */ , ITERATE_KEY); return Reflect.get(target, 'size', target); @@ -1686,7 +1686,7 @@ export default function vueFactory(exports) { if (!hadKey) { target.add(value); - trigger(target, 'add' + trigger(target, "add" /* ADD */ , value, value); } @@ -1715,11 +1715,11 @@ export default function vueFactory(exports) { target.set(key, value); if (!hadKey) { - trigger(target, 'add' + trigger(target, "add" /* ADD */ , key, value); } else if (hasChanged(value, oldValue)) { - trigger(target, 'set' + trigger(target, "set" /* SET */ , key, value, oldValue); } @@ -1748,7 +1748,7 @@ export default function vueFactory(exports) { var result = target.delete(key); if (hadKey) { - trigger(target, 'delete' + trigger(target, "delete" /* DELETE */ , key, undefined, oldValue); } @@ -1764,7 +1764,7 @@ export default function vueFactory(exports) { var result = target.clear(); if (hadItems) { - trigger(target, 'clear' + trigger(target, "clear" /* CLEAR */ , undefined, undefined, oldTarget); } @@ -1775,12 +1775,12 @@ export default function vueFactory(exports) { function createForEach(isReadonly, isShallow) { return function forEach(callback, thisArg) { var observed = this; - var target = observed['__v_raw' + var target = observed["__v_raw" /* RAW */ ]; var rawTarget = toRaw(target); var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; - !isReadonly && track(rawTarget, 'iterate' + !isReadonly && track(rawTarget, "iterate" /* ITERATE */ , ITERATE_KEY); return target.forEach(function (value, key) { @@ -1794,7 +1794,7 @@ export default function vueFactory(exports) { function createIterableMethod(method, isReadonly, isShallow) { return function () { - var target = this['__v_raw' + var target = this["__v_raw" /* RAW */ ]; var rawTarget = toRaw(target); @@ -1803,7 +1803,7 @@ export default function vueFactory(exports) { var isKeyOnly = method === 'keys' && targetIsMap; var innerIterator = target[method].apply(target, arguments); var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; - !isReadonly && track(rawTarget, 'iterate' + !isReadonly && track(rawTarget, "iterate" /* ITERATE */ , isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); // return a wrapped iterator which returns observed versions of the // values emitted from the real iterator @@ -1840,7 +1840,7 @@ export default function vueFactory(exports) { console.warn("".concat(capitalize(type), " operation ").concat(key, "failed: target is readonly."), toRaw(this)); } - return type === 'delete' + return type === "delete" /* DELETE */ ? false : this; }; @@ -1892,16 +1892,16 @@ export default function vueFactory(exports) { return has$1.call(this, key, true); }, - add: createReadonlyMethod('add' + add: createReadonlyMethod("add" /* ADD */ ), - set: createReadonlyMethod('set' + set: createReadonlyMethod("set" /* SET */ ), - delete: createReadonlyMethod('delete' + delete: createReadonlyMethod("delete" /* DELETE */ ), - clear: createReadonlyMethod('clear' + clear: createReadonlyMethod("clear" /* CLEAR */ ), forEach: createForEach(true, false) @@ -1919,16 +1919,16 @@ export default function vueFactory(exports) { return has$1.call(this, key, true); }, - add: createReadonlyMethod('add' + add: createReadonlyMethod("add" /* ADD */ ), - set: createReadonlyMethod('set' + set: createReadonlyMethod("set" /* SET */ ), - delete: createReadonlyMethod('delete' + delete: createReadonlyMethod("delete" /* DELETE */ ), - clear: createReadonlyMethod('clear' + clear: createReadonlyMethod("clear" /* CLEAR */ ), forEach: createForEach(true, true) @@ -1953,15 +1953,15 @@ export default function vueFactory(exports) { function createInstrumentationGetter(isReadonly, shallow) { var instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; return function (target, key, receiver) { - if (key === '__v_isReactive' + if (key === "__v_isReactive" /* IS_REACTIVE */ ) { return !isReadonly; - } else if (key === '__v_isReadonly' + } else if (key === "__v_isReadonly" /* IS_READONLY */ ) { return isReadonly; - } else if (key === '__v_raw' + } else if (key === "__v_raw" /* RAW */ ) { return target; @@ -2002,27 +2002,27 @@ export default function vueFactory(exports) { switch (rawType) { case 'Object': case 'Array': - return 1; - - /* COMMON */ + return 1 + /* COMMON */ + ; case 'Map': case 'Set': case 'WeakMap': case 'WeakSet': - return 2; - - /* COLLECTION */ + return 2 + /* COLLECTION */ + ; default: - return 0; - - /* INVALID */ + return 0 + /* INVALID */ + ; } } function getTargetType(value) { - return value['__v_skip' + return value["__v_skip" /* SKIP */ ] || !Object.isExtensible(value) ? 0 /* INVALID */ @@ -2031,7 +2031,7 @@ export default function vueFactory(exports) { function reactive(target) { // if trying to observe a readonly proxy, return the readonly version. - if (target && target['__v_isReadonly' + if (target && target["__v_isReadonly" /* IS_READONLY */ ]) { return target; @@ -2039,30 +2039,30 @@ export default function vueFactory(exports) { return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); } - /** - * Return a shallowly-reactive copy of the original object, where only the root - * level properties are reactive. It also does not auto-unwrap refs (even at the - * root level). + /** + * Return a shallowly-reactive copy of the original object, where only the root + * level properties are reactive. It also does not auto-unwrap refs (even at the + * root level). */ function shallowReactive(target) { return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap); } - /** - * Creates a readonly copy of the original object. Note the returned copy is not - * made reactive, but `readonly` can be called on an already reactive object. + /** + * Creates a readonly copy of the original object. Note the returned copy is not + * made reactive, but `readonly` can be called on an already reactive object. */ function readonly(target) { return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); } - /** - * Returns a reactive-copy of the original object, where only the root level - * properties are readonly, and does NOT unwrap refs nor recursively convert - * returned properties. - * This is used for creating the props proxy object for stateful components. + /** + * Returns a reactive-copy of the original object, where only the root level + * properties are readonly, and does NOT unwrap refs nor recursively convert + * returned properties. + * This is used for creating the props proxy object for stateful components. */ @@ -2081,9 +2081,9 @@ export default function vueFactory(exports) { // exception: calling readonly() on a reactive object - if (target['__v_raw' + if (target["__v_raw" /* RAW */ - ] && !(isReadonly && target['__v_isReactive' + ] && !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */ ])) { return target; @@ -2114,18 +2114,18 @@ export default function vueFactory(exports) { function isReactive(value) { if (isReadonly(value)) { - return isReactive(value['__v_raw' + return isReactive(value["__v_raw" /* RAW */ ]); } - return !!(value && value['__v_isReactive' + return !!(value && value["__v_isReactive" /* IS_REACTIVE */ ]); } function isReadonly(value) { - return !!(value && value['__v_isReadonly' + return !!(value && value["__v_isReadonly" /* IS_READONLY */ ]); } @@ -2135,13 +2135,13 @@ export default function vueFactory(exports) { } function toRaw(observed) { - return observed && toRaw(observed['__v_raw' + return observed && toRaw(observed["__v_raw" /* RAW */ ]) || observed; } function markRaw(value) { - def(value, '__v_skip' + def(value, "__v_skip" /* SKIP */ , true); return value; @@ -2176,7 +2176,7 @@ export default function vueFactory(exports) { _createClass(RefImpl, [{ key: "value", get: function get() { - track(toRaw(this), 'get' + track(toRaw(this), "get" /* GET */ , 'value'); return this._value; @@ -2185,7 +2185,7 @@ export default function vueFactory(exports) { if (hasChanged(toRaw(newVal), this._rawValue)) { this._rawValue = newVal; this._value = this._shallow ? newVal : convert(newVal); - trigger(toRaw(this), 'set' + trigger(toRaw(this), "set" /* SET */ , 'value', newVal); } @@ -2206,7 +2206,7 @@ export default function vueFactory(exports) { } function triggerRef(ref) { - trigger(toRaw(ref), 'set' + trigger(toRaw(ref), "set" /* SET */ , 'value', process.env.NODE_ENV !== 'production' ? ref.value : void 0); } @@ -2244,13 +2244,13 @@ export default function vueFactory(exports) { this.__v_isRef = true; var _factory = factory(function () { - return track(_this7, 'get' + return track(_this7, "get" /* GET */ , /* GET */ 'value'); }, function () { - return trigger(_this7, 'set' + return trigger(_this7, "set" /* SET */ , /* SET */ @@ -2334,13 +2334,13 @@ export default function vueFactory(exports) { scheduler: function scheduler() { if (!_this8._dirty) { _this8._dirty = true; - trigger(toRaw(_this8), 'set' + trigger(toRaw(_this8), "set" /* SET */ , 'value'); } } }); - this['__v_isReadonly' + this["__v_isReadonly" /* IS_READONLY */ ] = isReadonly; } @@ -2356,7 +2356,7 @@ export default function vueFactory(exports) { self._dirty = false; } - track(self, 'get' + track(self, "get" /* GET */ , 'value'); return self._value; @@ -2519,46 +2519,46 @@ export default function vueFactory(exports) { } var ErrorTypeStrings = { - ['sp' + ["sp" /* SERVER_PREFETCH */ ]: 'serverPrefetch hook', - ['bc' + ["bc" /* BEFORE_CREATE */ ]: 'beforeCreate hook', - ['c' + ["c" /* CREATED */ ]: 'created hook', - ['bm' + ["bm" /* BEFORE_MOUNT */ ]: 'beforeMount hook', - ['m' + ["m" /* MOUNTED */ ]: 'mounted hook', - ['bu' + ["bu" /* BEFORE_UPDATE */ ]: 'beforeUpdate hook', - ['u' + ["u" /* UPDATED */ ]: 'updated', - ['bum' + ["bum" /* BEFORE_UNMOUNT */ ]: 'beforeUnmount hook', - ['um' + ["um" /* UNMOUNTED */ ]: 'unmounted hook', - ['a' + ["a" /* ACTIVATED */ ]: 'activated hook', - ['da' + ["da" /* DEACTIVATED */ ]: 'deactivated hook', - ['ec' + ["ec" /* ERROR_CAPTURED */ ]: 'errorCaptured hook', - ['rtc' + ["rtc" /* RENDER_TRACKED */ ]: 'renderTracked hook', - ['rtg' + ["rtg" /* RENDER_TRIGGERED */ ]: 'renderTriggered hook', [0 @@ -3078,7 +3078,7 @@ export default function vueFactory(exports) { function devtoolsInitApp(app, version) { // TODO queue if devtools is undefined if (!devtools) return; - devtools.emit('app:init' + devtools.emit("app:init" /* APP_INIT */ , app, version, { Fragment, @@ -3090,18 +3090,18 @@ export default function vueFactory(exports) { function devtoolsUnmountApp(app) { if (!devtools) return; - devtools.emit('app:unmount' + devtools.emit("app:unmount" /* APP_UNMOUNT */ , app); } - var devtoolsComponentAdded = /*#__PURE__*/createDevtoolsComponentHook('component:added' + var devtoolsComponentAdded = /*#__PURE__*/createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */ ); - var devtoolsComponentUpdated = /*#__PURE__*/createDevtoolsComponentHook('component:updated' + var devtoolsComponentUpdated = /*#__PURE__*/createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */ ); - var devtoolsComponentRemoved = /*#__PURE__*/createDevtoolsComponentHook('component:removed' + var devtoolsComponentRemoved = /*#__PURE__*/createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */ ); @@ -3112,10 +3112,10 @@ export default function vueFactory(exports) { }; } - var devtoolsPerfStart = /*#__PURE__*/createDevtoolsPerformanceHook('perf:start' + var devtoolsPerfStart = /*#__PURE__*/createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */ ); - var devtoolsPerfEnd = /*#__PURE__*/createDevtoolsPerformanceHook('perf:end' + var devtoolsPerfEnd = /*#__PURE__*/createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */ ); @@ -3128,7 +3128,7 @@ export default function vueFactory(exports) { function devtoolsComponentEmit(component, event, params) { if (!devtools) return; - devtools.emit('component:emit' + devtools.emit("component:emit" /* COMPONENT_EMIT */ , component.appContext.app, component, event, params); } @@ -3326,23 +3326,23 @@ export default function vueFactory(exports) { key = key.slice(2).replace(/Once$/, ''); return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); } - /** - * mark the current rendering instance for asset resolution (e.g. - * resolveComponent, resolveDirective) during render + /** + * mark the current rendering instance for asset resolution (e.g. + * resolveComponent, resolveDirective) during render */ var currentRenderingInstance = null; var currentScopeId = null; - /** - * Note: rendering calls maybe nested. The function returns the parent rendering - * instance if present, which should be restored after the render is done: - * - * ```js - * const prev = setCurrentRenderingInstance(i) - * // ...render - * setCurrentRenderingInstance(prev) - * ``` + /** + * Note: rendering calls maybe nested. The function returns the parent rendering + * instance if present, which should be restored after the render is done: + * + * ```js + * const prev = setCurrentRenderingInstance(i) + * // ...render + * setCurrentRenderingInstance(prev) + * ``` */ function setCurrentRenderingInstance(instance) { @@ -3351,37 +3351,37 @@ export default function vueFactory(exports) { currentScopeId = instance && instance.type.__scopeId || null; return prev; } - /** - * Set scope id when creating hoisted vnodes. - * @private compiler helper + /** + * Set scope id when creating hoisted vnodes. + * @private compiler helper */ function pushScopeId(id) { currentScopeId = id; } - /** - * Technically we no longer need this after 3.0.8 but we need to keep the same - * API for backwards compat w/ code generated by compilers. - * @private + /** + * Technically we no longer need this after 3.0.8 but we need to keep the same + * API for backwards compat w/ code generated by compilers. + * @private */ function popScopeId() { currentScopeId = null; } - /** - * Only for backwards compat - * @private + /** + * Only for backwards compat + * @private */ var withScopeId = function withScopeId(_id) { return withCtx; }; - /** - * Wrap a slot function to memoize current rendering instance - * @private compiler helper + /** + * Wrap a slot function to memoize current rendering instance + * @private compiler helper */ @@ -3430,10 +3430,10 @@ export default function vueFactory(exports) { renderFnWithContext._d = true; return renderFnWithContext; } - /** - * dev only flag to track whether $attrs was used during render. - * If $attrs was used during render then the warning for failed attrs - * fallthrough can be suppressed. + /** + * dev only flag to track whether $attrs was used during render. + * If $attrs was used during render then the warning for failed attrs + * fallthrough can be suppressed. */ @@ -3575,15 +3575,15 @@ export default function vueFactory(exports) { } } - if (false && isCompatEnabled('INSTANCE_ATTRS_CLASS_STYLE' + if (false && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */ , instance) && vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ && (root.shapeFlag & 1 /* ELEMENT */ - || root.shapeFlag & 6) + || root.shapeFlag & 6 /* COMPONENT */ - ) ; // inherit directives + )) ; // inherit directives if (vnode.dirs) { if (process.env.NODE_ENV !== 'production' && !isElementRoot(root)) { @@ -3618,11 +3618,11 @@ export default function vueFactory(exports) { setCurrentRenderingInstance(prev); return result; } - /** - * dev only - * In dev mode, template root level comments are rendered, which turns the - * template into a fragment root, but we need to locate the single element - * root for attrs and scope id processing. + /** + * dev only + * In dev mode, template root level comments are rendered, which turns the + * template into a fragment root, but we need to locate the single element + * root for attrs and scope id processing. */ @@ -4266,9 +4266,9 @@ export default function vueFactory(exports) { function normalizeSuspenseChildren(vnode) { var shapeFlag = vnode.shapeFlag, children = vnode.children; - var isSlotChildren = shapeFlag & 32; + var isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */ - + ; vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children); vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); } @@ -4632,7 +4632,7 @@ export default function vueFactory(exports) { function traverse(value) { var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set(); - if (!isObject(value) || seen.has(value) || value['__v_skip' + if (!isObject(value) || seen.has(value) || value["__v_skip" /* SKIP */ ]) { return value; @@ -5027,8 +5027,9 @@ export default function vueFactory(exports) { if (keyedFragmentCount > 1) { for (var _i2 = 0; _i2 < ret.length; _i2++) { - ret[_i2].patchFlag = -2; + ret[_i2].patchFlag = -2 /* BAIL */ + ; } } @@ -5415,7 +5416,11 @@ export default function vueFactory(exports) { current = null; return children; - } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { + } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4 + /* STATEFUL_COMPONENT */ + ) && !(rawVNode.shapeFlag & 128 + /* SUSPENSE */ + )) { current = null; return rawVNode; } @@ -5465,9 +5470,9 @@ export default function vueFactory(exports) { } // avoid vnode being mounted as fresh - vnode.shapeFlag |= 512; + vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */ - // make this key the freshest + ; // make this key the freshest keys.delete(key); keys.add(key); @@ -5480,9 +5485,9 @@ export default function vueFactory(exports) { } // avoid vnode being unmounted - vnode.shapeFlag |= 256; + vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ - + ; current = vnode; return rawVNode; }; @@ -5510,13 +5515,13 @@ export default function vueFactory(exports) { } function onActivated(hook, target) { - registerKeepAliveHook(hook, 'a' + registerKeepAliveHook(hook, "a" /* ACTIVATED */ , target); } function onDeactivated(hook, target) { - registerKeepAliveHook(hook, 'da' + registerKeepAliveHook(hook, "da" /* DEACTIVATED */ , target); } @@ -5578,15 +5583,17 @@ export default function vueFactory(exports) { if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ) { - shapeFlag -= 256; + shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ + ; } if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */ ) { - shapeFlag -= 512; + shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */ + ; } vnode.shapeFlag = shapeFlag; @@ -5647,44 +5654,44 @@ export default function vueFactory(exports) { return function (hook) { var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance; return (// post-create lifecycle registrations are noops during SSR (except for serverPrefetch) - (!isInSSRComponentSetup || lifecycle === 'sp') && + (!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */ - injectHook(lifecycle, hook, target) + ) && injectHook(lifecycle, hook, target) ); }; }; - var onBeforeMount = createHook('bm' + var onBeforeMount = createHook("bm" /* BEFORE_MOUNT */ ); - var onMounted = createHook('m' + var onMounted = createHook("m" /* MOUNTED */ ); - var onBeforeUpdate = createHook('bu' + var onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */ ); - var onUpdated = createHook('u' + var onUpdated = createHook("u" /* UPDATED */ ); - var onBeforeUnmount = createHook('bum' + var onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */ ); - var onUnmounted = createHook('um' + var onUnmounted = createHook("um" /* UNMOUNTED */ ); - var onServerPrefetch = createHook('sp' + var onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */ ); - var onRenderTriggered = createHook('rtg' + var onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */ ); - var onRenderTracked = createHook('rtc' + var onRenderTracked = createHook("rtc" /* RENDER_TRACKED */ ); function onErrorCaptured(hook) { var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance; - injectHook('ec' + injectHook("ec" /* ERROR_CAPTURED */ , hook, target); } @@ -5718,7 +5725,7 @@ export default function vueFactory(exports) { // the hook may mutate resolved options (#2791) if (options.beforeCreate) { - callHook(options.beforeCreate, instance, 'bc' + callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */ ); } @@ -5758,7 +5765,7 @@ export default function vueFactory(exports) { if (propsOptions) { for (var key in propsOptions) { - checkDuplicateProperties('Props' + checkDuplicateProperties("Props" /* PROPS */ , key); } @@ -5795,7 +5802,7 @@ export default function vueFactory(exports) { } if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties('Methods' + checkDuplicateProperties("Methods" /* METHODS */ , _key8); } @@ -5824,7 +5831,7 @@ export default function vueFactory(exports) { if (process.env.NODE_ENV !== 'production') { var _loop = function _loop(_key9) { - checkDuplicateProperties('Data' + checkDuplicateProperties("Data" /* DATA */ , _key9); // expose data on ctx during dev @@ -5879,7 +5886,7 @@ export default function vueFactory(exports) { }); if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties('Computed' + checkDuplicateProperties("Computed" /* COMPUTED */ , _key10); } @@ -5904,7 +5911,7 @@ export default function vueFactory(exports) { } if (created) { - callHook(created, instance, 'c' + callHook(created, instance, "c" /* CREATED */ ); } @@ -5988,7 +5995,7 @@ export default function vueFactory(exports) { } if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties('Inject' + checkDuplicateProperties("Inject" /* INJECT */ , key); } @@ -6034,10 +6041,10 @@ export default function vueFactory(exports) { warn("Invalid watch option: \"".concat(key, "\""), raw); } } - /** - * Resolve merged options and cache it on the component. - * This is done only once per-component since the merging does not involve - * instances. + /** + * Resolve merged options and cache it on the component. + * This is done only once per-component since the merging does not involve + * instances. */ @@ -6232,7 +6239,9 @@ export default function vueFactory(exports) { if ( // always force full diff in dev // - #1942 if hmr is enabled with sfc component // - vite#872 non-sfc component used by sfc component - !(process.env.NODE_ENV !== 'production' && (instance.type.__hmrId || instance.parent && instance.parent.type.__hmrId)) && (optimized || patchFlag > 0) && !(patchFlag & 16)) { + !(process.env.NODE_ENV !== 'production' && (instance.type.__hmrId || instance.parent && instance.parent.type.__hmrId)) && (optimized || patchFlag > 0) && !(patchFlag & 16 + /* FULL_PROPS */ + )) { if (patchFlag & 8 /* PROPS */ ) { @@ -6310,7 +6319,7 @@ export default function vueFactory(exports) { if (hasAttrsChanged) { - trigger(instance, 'set' + trigger(instance, "set" /* SET */ , '$attrs'); } @@ -6536,8 +6545,8 @@ export default function vueFactory(exports) { return -1; } - /** - * dev only + /** + * dev only */ @@ -6551,8 +6560,8 @@ export default function vueFactory(exports) { validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))); } } - /** - * dev only + /** + * dev only */ @@ -6599,8 +6608,8 @@ export default function vueFactory(exports) { } var isSimpleType = /*#__PURE__*/makeMap('String,Number,Boolean,Function,Symbol,BigInt'); - /** - * dev only + /** + * dev only */ function assertType(value, type) { @@ -6627,8 +6636,8 @@ export default function vueFactory(exports) { expectedType }; } - /** - * dev only + /** + * dev only */ @@ -6651,8 +6660,8 @@ export default function vueFactory(exports) { return message; } - /** - * dev only + /** + * dev only */ @@ -6665,8 +6674,8 @@ export default function vueFactory(exports) { return "".concat(value); } } - /** - * dev only + /** + * dev only */ @@ -6676,8 +6685,8 @@ export default function vueFactory(exports) { return type.toLowerCase() === elem; }); } - /** - * dev only + /** + * dev only */ @@ -6834,17 +6843,17 @@ export default function vueFactory(exports) { } } }; - /** - Runtime helper for applying directives to a vnode. Example usage: + /** + Runtime helper for applying directives to a vnode. Example usage: - const comp = resolveComponent('comp') - const foo = resolveDirective('foo') - const bar = resolveDirective('bar') + const comp = resolveComponent('comp') + const foo = resolveDirective('foo') + const bar = resolveDirective('bar') - return withDirectives(h(comp), [ - [foo, this.x], - [bar, this.y] - ]) + return withDirectives(h(comp), [ + [foo, this.x], + [bar, this.y] + ]) */ @@ -6855,8 +6864,8 @@ export default function vueFactory(exports) { warn('Do not use built-in directive ids as custom directive id: ' + name); } } - /** - * Adds directives to a VNode. + /** + * Adds directives to a VNode. */ @@ -7117,9 +7126,9 @@ export default function vueFactory(exports) { var isComment = function isComment(node) { return node.nodeType === 8; - }; + } /* COMMENT */ - // Note: hydration is DOM-specific + ; // Note: hydration is DOM-specific // But we have to place it in core due to tight coupling with core - splitting // it out creates a ton of unnecessary complexity. // Hydration also depends on some renderer internal logic which needs to be @@ -7328,12 +7337,12 @@ export default function vueFactory(exports) { || patchFlag & 32 /* HYDRATE_EVENTS */ ) { - for (var key in props) { - if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) { - patchProp(el, key, null, props[key]); - } + for (var key in props) { + if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) { + patchProp(el, key, null, props[key]); } - } else if (props.onClick) { + } + } else if (props.onClick) { // Fast path for click listeners (which is most often) to avoid // iterating through props. patchProp(el, 'onClick', null, props.onClick); @@ -7545,12 +7554,12 @@ export default function vueFactory(exports) { return supported; } - /** - * This is only called in esm-bundler builds. - * It is called when a renderer is created, in `baseCreateRenderer` so that - * importing runtime-core is side-effects free. - * - * istanbul-ignore-next + /** + * This is only called in esm-bundler builds. + * It is called when a renderer is created, in `baseCreateRenderer` so that + * importing runtime-core is side-effects free. + * + * istanbul-ignore-next */ @@ -7666,20 +7675,20 @@ export default function vueFactory(exports) { warn('Invalid template ref type:', value, "(".concat(typeof value, ")")); } }; - /** - * The createRenderer function accepts two generic arguments: - * HostNode and HostElement, corresponding to Node and Element types in the - * host environment. For example, for runtime-dom, HostNode would be the DOM - * `Node` interface and HostElement would be the DOM `Element` interface. - * - * Custom renderers can pass in the platform specific types like this: - * - * ``` js - * const { render, createApp } = createRenderer({ - * patchProp, - * ...nodeOps - * }) - * ``` + /** + * The createRenderer function accepts two generic arguments: + * HostNode and HostElement, corresponding to Node and Element types in the + * host environment. For example, for runtime-dom, HostNode would be the DOM + * `Node` interface and HostElement would be the DOM `Element` interface. + * + * Custom renderers can pass in the platform specific types like this: + * + * ``` js + * const { render, createApp } = createRenderer({ + * patchProp, + * ...nodeOps + * }) + * ``` */ @@ -7839,8 +7848,8 @@ export default function vueFactory(exports) { n2.el = nodes[0]; n2.anchor = nodes[nodes.length - 1]; }; - /** - * Dev / HMR only + /** + * Dev / HMR only */ @@ -8032,9 +8041,9 @@ export default function vueFactory(exports) { dirs = n2.dirs; // #1426 take the old vnode's patch flag into account since user may clone a // compiler-generated vnode, which de-opts to FULL_PROPS - patchFlag |= n1.patchFlag & 16; + patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */ - + ; var oldProps = n1.props || EMPTY_OBJ; var newProps = n2.props || EMPTY_OBJ; var vnodeHook; @@ -8157,9 +8166,9 @@ export default function vueFactory(exports) { !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. oldVNode.shapeFlag & 6 /* COMPONENT */ - || oldVNode.shapeFlag & 64) + || oldVNode.shapeFlag & 64 /* TELEPORT */ - ? hostParentNode(oldVNode.el) : // In other cases, the parent container is not actually used so we + ) ? hostParentNode(oldVNode.el) : // In other cases, the parent container is not actually used so we // just pass the block element here to avoid a DOM parentNode call. fallbackContainer; patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, true); @@ -9001,13 +9010,13 @@ export default function vueFactory(exports) { unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true); } else if (type === Fragment && (patchFlag & 128 /* KEYED_FRAGMENT */ - || patchFlag & 256) + || patchFlag & 256 /* UNKEYED_FRAGMENT */ - || !optimized && shapeFlag & 16 + ) || !optimized && shapeFlag & 16 /* ARRAY_CHILDREN */ ) { - unmountChildren(children, parentComponent, parentSuspense); - } + unmountChildren(children, parentComponent, parentSuspense); + } if (doRemove) { remove(vnode); @@ -9208,16 +9217,16 @@ export default function vueFactory(exports) { /* VNODE_HOOK */ , [vnode, prevVNode]); } - /** - * #1156 - * When a component is HMR-enabled, we need to make sure that all static nodes - * inside a block also inherit the DOM element from the previous tree so that - * HMR updates (which are full updates) can retrieve the element for patching. - * - * #2080 - * Inside keyed `template` fragment static children, if a fragment is moved, - * the children will always moved so that need inherit el form previous nodes - * to ensure correct moved position. + /** + * #1156 + * When a component is HMR-enabled, we need to make sure that all static nodes + * inside a block also inherit the DOM element from the previous tree so that + * HMR updates (which are full updates) can retrieve the element for patching. + * + * #2080 + * Inside keyed `template` fragment static children, if a fragment is moved, + * the children will always moved so that need inherit el form previous nodes + * to ensure correct moved position. */ @@ -9513,9 +9522,9 @@ export default function vueFactory(exports) { shapeFlag = vnode.shapeFlag, children = vnode.children, props = vnode.props; - var isReorder = moveType === 2; + var isReorder = moveType === 2 /* REORDER */ - // move main view anchor if this is a re-order. + ; // move main view anchor if this is a re-order. if (isReorder) { insert(el, container, parentAnchor); @@ -9577,8 +9586,8 @@ export default function vueFactory(exports) { var Teleport = TeleportImpl; var COMPONENTS = 'components'; var DIRECTIVES = 'directives'; - /** - * @private + /** + * @private */ function resolveComponent(name, maybeSelfReference) { @@ -9586,8 +9595,8 @@ export default function vueFactory(exports) { } var NULL_DYNAMIC_COMPONENT = Symbol(); - /** - * @private + /** + * @private */ function resolveDynamicComponent(component) { @@ -9598,8 +9607,8 @@ export default function vueFactory(exports) { return component || NULL_DYNAMIC_COMPONENT; } } - /** - * @private + /** + * @private */ @@ -9659,21 +9668,21 @@ export default function vueFactory(exports) { var blockStack = []; var currentBlock = null; - /** - * Open a block. - * This must be called before `createBlock`. It cannot be part of `createBlock` - * because the children of the block are evaluated before `createBlock` itself - * is called. The generated code typically looks like this: - * - * ```js - * function render() { - * return (openBlock(),createBlock('div', null, [...])) - * } - * ``` - * disableTracking is true when creating a v-for fragment block, since a v-for - * fragment always diffs its children. - * - * @private + /** + * Open a block. + * This must be called before `createBlock`. It cannot be part of `createBlock` + * because the children of the block are evaluated before `createBlock` itself + * is called. The generated code typically looks like this: + * + * ```js + * function render() { + * return (openBlock(),createBlock('div', null, [...])) + * } + * ``` + * disableTracking is true when creating a v-for fragment block, since a v-for + * fragment always diffs its children. + * + * @private */ function openBlock() { @@ -9691,32 +9700,32 @@ export default function vueFactory(exports) { var isBlockTreeEnabled = 1; - /** - * Block tracking sometimes needs to be disabled, for example during the - * creation of a tree that needs to be cached by v-once. The compiler generates - * code like this: - * - * ``` js - * _cache[1] || ( - * setBlockTracking(-1), - * _cache[1] = createVNode(...), - * setBlockTracking(1), - * _cache[1] - * ) - * ``` - * - * @private + /** + * Block tracking sometimes needs to be disabled, for example during the + * creation of a tree that needs to be cached by v-once. The compiler generates + * code like this: + * + * ``` js + * _cache[1] || ( + * setBlockTracking(-1), + * _cache[1] = createVNode(...), + * setBlockTracking(1), + * _cache[1] + * ) + * ``` + * + * @private */ function setBlockTracking(value) { isBlockTreeEnabled += value; } - /** - * Create a block root vnode. Takes the same exact arguments as `createVNode`. - * A block root keeps track of dynamic nodes within the block in the - * `dynamicChildren` array. - * - * @private + /** + * Create a block root vnode. Takes the same exact arguments as `createVNode`. + * A block root keeps track of dynamic nodes within the block in the + * `dynamicChildren` array. + * + * @private */ @@ -9753,11 +9762,11 @@ export default function vueFactory(exports) { } var vnodeArgsTransformer; - /** - * Internal API for registering an arguments transform for createVNode - * used for creating stubs in the test-utils - * It is *internal* but needs to be exposed for test-utils to pick up proper - * typings + /** + * Internal API for registering an arguments transform for createVNode + * used for creating stubs in the test-utils + * It is *internal* but needs to be exposed for test-utils to pick up proper + * typings */ function transformVNodeArgs(transformer) { @@ -9915,9 +9924,9 @@ export default function vueFactory(exports) { // component nodes also should always be patched, because even if the // component doesn't need to update, it needs to persist the instance on to // the next vnode so that it can be properly unmounted later. - patchFlag > 0 || shapeFlag & 6) + patchFlag > 0 || shapeFlag & 6 /* COMPONENT */ - && // the EVENTS flag is only for hydration and if it is the only flag, the + ) && // the EVENTS flag is only for hydration and if it is the only flag, the // vnode should not be considered dynamic due to handler caching. patchFlag !== 32 /* HYDRATE_EVENTS */ @@ -9985,9 +9994,9 @@ export default function vueFactory(exports) { }; return cloned; } - /** - * Dev only, for HMR of hoisted vnodes reused in v-for - * https://github.com/vitejs/vite/issues/2022 + /** + * Dev only, for HMR of hoisted vnodes reused in v-for + * https://github.com/vitejs/vite/issues/2022 */ @@ -10000,8 +10009,8 @@ export default function vueFactory(exports) { return cloned; } - /** - * @private + /** + * @private */ @@ -10010,8 +10019,8 @@ export default function vueFactory(exports) { var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return createVNode(Text, null, text, flag); } - /** - * @private + /** + * @private */ @@ -10022,8 +10031,8 @@ export default function vueFactory(exports) { vnode.staticCount = numberOfNodes; return vnode; } - /** - * @private + /** + * @private */ @@ -10063,8 +10072,9 @@ export default function vueFactory(exports) { if (children == null) { children = null; } else if (isArray(children)) { - type = 16; + type = 16 /* ARRAY_CHILDREN */ + ; } else if (typeof children === 'object') { if (shapeFlag & 1 /* ELEMENT */ @@ -10083,9 +10093,9 @@ export default function vueFactory(exports) { return; } else { - type = 32; + type = 32 /* SLOTS_CHILDREN */ - + ; var slotFlag = children._; if (!slotFlag && !(InternalObjectKey in children)) { @@ -10098,14 +10108,16 @@ export default function vueFactory(exports) { if (currentRenderingInstance.slots._ === 1 /* STABLE */ ) { - children._ = 1; + children._ = 1 /* STABLE */ + ; } else { - children._ = 2; + children._ = 2 /* DYNAMIC */ - - vnode.patchFlag |= 1024; + ; + vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */ + ; } } } @@ -10114,21 +10126,23 @@ export default function vueFactory(exports) { default: children, _ctx: currentRenderingInstance }; - type = 32; + type = 32 /* SLOTS_CHILDREN */ + ; } else { children = String(children); // force teleport children to array so it can be moved around if (shapeFlag & 64 /* TELEPORT */ ) { - type = 16; + type = 16 /* ARRAY_CHILDREN */ - + ; children = [createTextVNode(children)]; } else { - type = 8; + type = 8 /* TEXT_CHILDREN */ + ; } } @@ -10164,8 +10178,8 @@ export default function vueFactory(exports) { return ret; } - /** - * Actual implementation + /** + * Actual implementation */ @@ -10207,9 +10221,9 @@ export default function vueFactory(exports) { return ret; } - /** - * Compiler runtime helper for creating dynamic slots object - * @private + /** + * Compiler runtime helper for creating dynamic slots object + * @private */ @@ -10229,9 +10243,9 @@ export default function vueFactory(exports) { return slots; } - /** - * Compiler runtime helper for rendering `` - * @private + /** + * Compiler runtime helper for rendering `` + * @private */ @@ -10290,9 +10304,9 @@ export default function vueFactory(exports) { return true; }) ? vnodes : null; } - /** - * For prefixing keys in v-on="obj" with "on" - * @private + /** + * For prefixing keys in v-on="obj" with "on" + * @private */ @@ -10310,10 +10324,10 @@ export default function vueFactory(exports) { return ret; } - /** - * #2437 In Vue 3, functional components do not have a public instance proxy but - * they exist in the internal parent chain. For code that relies on traversing - * public $parent chains, skip functional ones and go to the parent instead. + /** + * #2437 In Vue 3, functional components do not have a public instance proxy but + * they exist in the internal parent chain. For code that relies on traversing + * public $parent chains, skip functional ones and go to the parent instead. */ @@ -10427,30 +10441,31 @@ export default function vueFactory(exports) { // default: just fallthrough } } else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) { - accessCache[key] = 0; + accessCache[key] = 0 /* SETUP */ - + ; return setupState[key]; } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { - accessCache[key] = 1; + accessCache[key] = 1 /* DATA */ - + ; return data[key]; } else if ( // only cache other properties when instance has declared (thus stable) // props (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) { - accessCache[key] = 2; + accessCache[key] = 2 /* PROPS */ - + ; return props[key]; } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { - accessCache[key] = 3; + accessCache[key] = 3 /* CONTEXT */ - + ; return ctx[key]; } else if (shouldCacheAccess) { - accessCache[key] = 4; + accessCache[key] = 4 /* OTHER */ + ; } } @@ -10459,7 +10474,7 @@ export default function vueFactory(exports) { if (publicGetter) { if (key === '$attrs') { - track(instance, 'get' + track(instance, "get" /* GET */ , key); process.env.NODE_ENV !== 'production' && markAttrsAccessed(); @@ -10471,9 +10486,9 @@ export default function vueFactory(exports) { return cssModule; } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { // user may set custom properties to `this` that start with `$` - accessCache[key] = 3; + accessCache[key] = 3 /* CONTEXT */ - + ; return ctx[key]; } else if ( // window properties globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) { @@ -10744,8 +10759,9 @@ export default function vueFactory(exports) { } function isStatefulComponent(instance) { - return instance.vnode.shapeFlag & 4; + return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ + ; } var isInSSRComponentSetup = false; @@ -10879,9 +10895,9 @@ export default function vueFactory(exports) { var isRuntimeOnly = function isRuntimeOnly() { return !compile; }; - /** - * For runtime-dom to register the compiler. - * Note the exported method uses any to avoid d.ts relying on the compiler types. + /** + * For runtime-dom to register the compiler. + * Note the exported method uses any to avoid d.ts relying on the compiler types. */ @@ -11108,23 +11124,23 @@ export default function vueFactory(exports) { return null; } - /** - * @deprecated use `defineEmits` instead. + /** + * @deprecated use `defineEmits` instead. */ var defineEmit = defineEmits; - /** - * Vue `