@vue/compat 3.2.43 → 3.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +167 -115
- package/dist/vue.cjs.prod.js +143 -86
- package/dist/vue.esm-browser.js +176 -118
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +177 -120
- package/dist/vue.global.js +176 -118
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +132 -81
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +133 -83
- package/dist/vue.runtime.global.js +132 -81
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -2238,12 +2238,6 @@ function reload(id, newComp) {
|
|
|
2238
2238
|
// components to be unmounted and re-mounted. Queue the update so that we
|
|
2239
2239
|
// don't end up forcing the same parent to re-render multiple times.
|
|
2240
2240
|
queueJob(instance.parent.update);
|
|
2241
|
-
// instance is the inner component of an async custom element
|
|
2242
|
-
// invoke to reset styles
|
|
2243
|
-
if (instance.parent.type.__asyncLoader &&
|
|
2244
|
-
instance.parent.ceReload) {
|
|
2245
|
-
instance.parent.ceReload(newComp.styles);
|
|
2246
|
-
}
|
|
2247
2241
|
}
|
|
2248
2242
|
else if (instance.appContext.reload) {
|
|
2249
2243
|
// root instance mounted via createApp() has a reload method
|
|
@@ -2474,8 +2468,8 @@ const deprecationData = {
|
|
|
2474
2468
|
},
|
|
2475
2469
|
["INSTANCE_EVENT_HOOKS" /* DeprecationTypes.INSTANCE_EVENT_HOOKS */]: {
|
|
2476
2470
|
message: event => `"${event}" lifecycle events are no longer supported. From templates, ` +
|
|
2477
|
-
`use the "
|
|
2478
|
-
`should be changed to @
|
|
2471
|
+
`use the "vue:" prefix instead of "hook:". For example, @${event} ` +
|
|
2472
|
+
`should be changed to @vue:${event.slice(5)}. ` +
|
|
2479
2473
|
`From JavaScript, use Composition API to dynamically register lifecycle ` +
|
|
2480
2474
|
`hooks.`,
|
|
2481
2475
|
link: `https://v3-migration.vuejs.org/breaking-changes/vnode-lifecycle-events.html`
|
|
@@ -4078,10 +4072,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
4078
4072
|
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
4079
4073
|
newValue,
|
|
4080
4074
|
// pass undefined as the old value when it's changed for the first time
|
|
4081
|
-
oldValue === INITIAL_WATCHER_VALUE
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4075
|
+
oldValue === INITIAL_WATCHER_VALUE
|
|
4076
|
+
? undefined
|
|
4077
|
+
: (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
|
|
4078
|
+
? []
|
|
4079
|
+
: oldValue,
|
|
4085
4080
|
onCleanup
|
|
4086
4081
|
]);
|
|
4087
4082
|
oldValue = newValue;
|
|
@@ -4683,10 +4678,15 @@ function defineAsyncComponent(source) {
|
|
|
4683
4678
|
}
|
|
4684
4679
|
});
|
|
4685
4680
|
}
|
|
4686
|
-
function createInnerComp(comp,
|
|
4681
|
+
function createInnerComp(comp, parent) {
|
|
4682
|
+
const { ref, props, children, ce } = parent.vnode;
|
|
4687
4683
|
const vnode = createVNode(comp, props, children);
|
|
4688
4684
|
// ensure inner component inherits the async wrapper's ref owner
|
|
4689
4685
|
vnode.ref = ref;
|
|
4686
|
+
// pass the custom element callback on to the inner comp
|
|
4687
|
+
// and remove it from the async wrapper
|
|
4688
|
+
vnode.ce = ce;
|
|
4689
|
+
delete parent.vnode.ce;
|
|
4690
4690
|
return vnode;
|
|
4691
4691
|
}
|
|
4692
4692
|
|
|
@@ -4852,8 +4852,7 @@ const KeepAliveImpl = {
|
|
|
4852
4852
|
: comp);
|
|
4853
4853
|
const { include, exclude, max } = props;
|
|
4854
4854
|
if ((include && (!name || !matches(include, name))) ||
|
|
4855
|
-
(exclude && name && matches(exclude, name))
|
|
4856
|
-
(hmrDirtyComponents.has(comp))) {
|
|
4855
|
+
(exclude && name && matches(exclude, name))) {
|
|
4857
4856
|
current = vnode;
|
|
4858
4857
|
return rawVNode;
|
|
4859
4858
|
}
|
|
@@ -4966,14 +4965,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
4966
4965
|
}, target);
|
|
4967
4966
|
}
|
|
4968
4967
|
function resetShapeFlag(vnode) {
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
}
|
|
4973
|
-
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
4974
|
-
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4975
|
-
}
|
|
4976
|
-
vnode.shapeFlag = shapeFlag;
|
|
4968
|
+
// bitwise operations to remove keep alive flags
|
|
4969
|
+
vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4970
|
+
vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4977
4971
|
}
|
|
4978
4972
|
function getInnerChild(vnode) {
|
|
4979
4973
|
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
@@ -5601,7 +5595,9 @@ fallback, noSlotted) {
|
|
|
5601
5595
|
(currentRenderingInstance.parent &&
|
|
5602
5596
|
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
5603
5597
|
currentRenderingInstance.parent.isCE)) {
|
|
5604
|
-
|
|
5598
|
+
if (name !== 'default')
|
|
5599
|
+
props.name = name;
|
|
5600
|
+
return createVNode('slot', props, fallback && fallback());
|
|
5605
5601
|
}
|
|
5606
5602
|
let slot = slots[name];
|
|
5607
5603
|
if (slot && slot.length > 1) {
|
|
@@ -5921,6 +5917,7 @@ const publicPropertiesMap =
|
|
|
5921
5917
|
installCompatInstanceProperties(publicPropertiesMap);
|
|
5922
5918
|
}
|
|
5923
5919
|
const isReservedPrefix = (key) => key === '_' || key === '$';
|
|
5920
|
+
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
|
5924
5921
|
const PublicInstanceProxyHandlers = {
|
|
5925
5922
|
get({ _: instance }, key) {
|
|
5926
5923
|
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
@@ -5928,15 +5925,6 @@ const PublicInstanceProxyHandlers = {
|
|
|
5928
5925
|
if (key === '__isVue') {
|
|
5929
5926
|
return true;
|
|
5930
5927
|
}
|
|
5931
|
-
// prioritize <script setup> bindings during dev.
|
|
5932
|
-
// this allows even properties that start with _ or $ to be used - so that
|
|
5933
|
-
// it aligns with the production behavior where the render fn is inlined and
|
|
5934
|
-
// indeed has access to all declared variables.
|
|
5935
|
-
if (setupState !== EMPTY_OBJ &&
|
|
5936
|
-
setupState.__isScriptSetup &&
|
|
5937
|
-
hasOwn(setupState, key)) {
|
|
5938
|
-
return setupState[key];
|
|
5939
|
-
}
|
|
5940
5928
|
// data / props / ctx
|
|
5941
5929
|
// This getter gets called for every property access on the render context
|
|
5942
5930
|
// during render and is a major hotspot. The most expensive part of this
|
|
@@ -5959,7 +5947,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5959
5947
|
// default: just fallthrough
|
|
5960
5948
|
}
|
|
5961
5949
|
}
|
|
5962
|
-
else if (
|
|
5950
|
+
else if (hasSetupBinding(setupState, key)) {
|
|
5963
5951
|
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
5964
5952
|
return setupState[key];
|
|
5965
5953
|
}
|
|
@@ -6038,21 +6026,26 @@ const PublicInstanceProxyHandlers = {
|
|
|
6038
6026
|
},
|
|
6039
6027
|
set({ _: instance }, key, value) {
|
|
6040
6028
|
const { data, setupState, ctx } = instance;
|
|
6041
|
-
if (
|
|
6029
|
+
if (hasSetupBinding(setupState, key)) {
|
|
6042
6030
|
setupState[key] = value;
|
|
6043
6031
|
return true;
|
|
6044
6032
|
}
|
|
6033
|
+
else if (setupState.__isScriptSetup &&
|
|
6034
|
+
hasOwn(setupState, key)) {
|
|
6035
|
+
warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
6036
|
+
return false;
|
|
6037
|
+
}
|
|
6045
6038
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
6046
6039
|
data[key] = value;
|
|
6047
6040
|
return true;
|
|
6048
6041
|
}
|
|
6049
6042
|
else if (hasOwn(instance.props, key)) {
|
|
6050
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly
|
|
6043
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
6051
6044
|
return false;
|
|
6052
6045
|
}
|
|
6053
6046
|
if (key[0] === '$' && key.slice(1) in instance) {
|
|
6054
6047
|
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
6055
|
-
`Properties starting with $ are reserved and readonly
|
|
6048
|
+
`Properties starting with $ are reserved and readonly.`);
|
|
6056
6049
|
return false;
|
|
6057
6050
|
}
|
|
6058
6051
|
else {
|
|
@@ -6073,7 +6066,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
6073
6066
|
let normalizedProps;
|
|
6074
6067
|
return (!!accessCache[key] ||
|
|
6075
6068
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
6076
|
-
(setupState
|
|
6069
|
+
hasSetupBinding(setupState, key) ||
|
|
6077
6070
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
6078
6071
|
hasOwn(ctx, key) ||
|
|
6079
6072
|
hasOwn(publicPropertiesMap, key) ||
|
|
@@ -7348,7 +7341,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
7348
7341
|
return vm;
|
|
7349
7342
|
}
|
|
7350
7343
|
}
|
|
7351
|
-
Vue.version = `2.6.14-compat:${"3.2.
|
|
7344
|
+
Vue.version = `2.6.14-compat:${"3.2.45"}`;
|
|
7352
7345
|
Vue.config = singletonApp.config;
|
|
7353
7346
|
Vue.use = (p, ...options) => {
|
|
7354
7347
|
if (p && isFunction(p.install)) {
|
|
@@ -9735,6 +9728,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
9735
9728
|
if (!shallow)
|
|
9736
9729
|
traverseStaticChildren(c1, c2);
|
|
9737
9730
|
}
|
|
9731
|
+
// #6852 also inherit for text nodes
|
|
9732
|
+
if (c2.type === Text) {
|
|
9733
|
+
c2.el = c1.el;
|
|
9734
|
+
}
|
|
9738
9735
|
// also inherit for comment nodes, but not placeholders (e.g. v-if which
|
|
9739
9736
|
// would have received .el during block patch)
|
|
9740
9737
|
if (c2.type === Comment && !c2.el) {
|
|
@@ -9905,6 +9902,7 @@ const TeleportImpl = {
|
|
|
9905
9902
|
}
|
|
9906
9903
|
}
|
|
9907
9904
|
}
|
|
9905
|
+
updateCssVars(n2);
|
|
9908
9906
|
},
|
|
9909
9907
|
remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
9910
9908
|
const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
|
@@ -9983,11 +9981,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
9983
9981
|
hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
9984
9982
|
}
|
|
9985
9983
|
}
|
|
9984
|
+
updateCssVars(vnode);
|
|
9986
9985
|
}
|
|
9987
9986
|
return vnode.anchor && nextSibling(vnode.anchor);
|
|
9988
9987
|
}
|
|
9989
9988
|
// Force-casted public typing for h and TSX props inference
|
|
9990
9989
|
const Teleport = TeleportImpl;
|
|
9990
|
+
function updateCssVars(vnode) {
|
|
9991
|
+
// presence of .ut method indicates owner component uses css vars.
|
|
9992
|
+
// code path here can assume browser environment.
|
|
9993
|
+
const ctx = vnode.ctx;
|
|
9994
|
+
if (ctx && ctx.ut) {
|
|
9995
|
+
let node = vnode.children[0].el;
|
|
9996
|
+
while (node !== vnode.targetAnchor) {
|
|
9997
|
+
if (node.nodeType === 1)
|
|
9998
|
+
node.setAttribute('data-v-owner', ctx.uid);
|
|
9999
|
+
node = node.nextSibling;
|
|
10000
|
+
}
|
|
10001
|
+
ctx.ut();
|
|
10002
|
+
}
|
|
10003
|
+
}
|
|
9991
10004
|
|
|
9992
10005
|
const normalizedAsyncComponentMap = new Map();
|
|
9993
10006
|
function convertLegacyAsyncComponent(comp) {
|
|
@@ -10142,6 +10155,10 @@ function isVNode(value) {
|
|
|
10142
10155
|
function isSameVNodeType(n1, n2) {
|
|
10143
10156
|
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
10144
10157
|
hmrDirtyComponents.has(n2.type)) {
|
|
10158
|
+
// #7042, ensure the vnode being unmounted during HMR
|
|
10159
|
+
// bitwise operations to remove keep alive flags
|
|
10160
|
+
n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
10161
|
+
n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
10145
10162
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
10146
10163
|
return false;
|
|
10147
10164
|
}
|
|
@@ -10197,7 +10214,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
10197
10214
|
patchFlag,
|
|
10198
10215
|
dynamicProps,
|
|
10199
10216
|
dynamicChildren: null,
|
|
10200
|
-
appContext: null
|
|
10217
|
+
appContext: null,
|
|
10218
|
+
ctx: currentRenderingInstance
|
|
10201
10219
|
};
|
|
10202
10220
|
if (needFullChildrenNormalization) {
|
|
10203
10221
|
normalizeChildren(vnode, children);
|
|
@@ -10372,7 +10390,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
10372
10390
|
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
10373
10391
|
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
10374
10392
|
el: vnode.el,
|
|
10375
|
-
anchor: vnode.anchor
|
|
10393
|
+
anchor: vnode.anchor,
|
|
10394
|
+
ctx: vnode.ctx
|
|
10376
10395
|
};
|
|
10377
10396
|
{
|
|
10378
10397
|
defineLegacyVNodeProperties(cloned);
|
|
@@ -11364,7 +11383,7 @@ function isMemoSame(cached, memo) {
|
|
|
11364
11383
|
}
|
|
11365
11384
|
|
|
11366
11385
|
// Core API ------------------------------------------------------------------
|
|
11367
|
-
const version = "3.2.
|
|
11386
|
+
const version = "3.2.45";
|
|
11368
11387
|
const _ssrUtils = {
|
|
11369
11388
|
createComponentInstance,
|
|
11370
11389
|
setupComponent,
|
|
@@ -11525,6 +11544,7 @@ function patchStyle(el, prev, next) {
|
|
|
11525
11544
|
}
|
|
11526
11545
|
}
|
|
11527
11546
|
}
|
|
11547
|
+
const semicolonRE = /[^\\];\s*$/;
|
|
11528
11548
|
const importantRE = /\s*!important$/;
|
|
11529
11549
|
function setStyle(style, name, val) {
|
|
11530
11550
|
if (isArray(val)) {
|
|
@@ -11533,6 +11553,11 @@ function setStyle(style, name, val) {
|
|
|
11533
11553
|
else {
|
|
11534
11554
|
if (val == null)
|
|
11535
11555
|
val = '';
|
|
11556
|
+
{
|
|
11557
|
+
if (semicolonRE.test(val)) {
|
|
11558
|
+
warn$1(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
11559
|
+
}
|
|
11560
|
+
}
|
|
11536
11561
|
if (name.startsWith('--')) {
|
|
11537
11562
|
// custom property definition
|
|
11538
11563
|
style.setProperty(name, val);
|
|
@@ -11900,12 +11925,21 @@ class VueElement extends BaseClass {
|
|
|
11900
11925
|
`defined as hydratable. Use \`defineSSRCustomElement\`.`);
|
|
11901
11926
|
}
|
|
11902
11927
|
this.attachShadow({ mode: 'open' });
|
|
11928
|
+
if (!this._def.__asyncLoader) {
|
|
11929
|
+
// for sync component defs we can immediately resolve props
|
|
11930
|
+
this._resolveProps(this._def);
|
|
11931
|
+
}
|
|
11903
11932
|
}
|
|
11904
11933
|
}
|
|
11905
11934
|
connectedCallback() {
|
|
11906
11935
|
this._connected = true;
|
|
11907
11936
|
if (!this._instance) {
|
|
11908
|
-
this.
|
|
11937
|
+
if (this._resolved) {
|
|
11938
|
+
this._update();
|
|
11939
|
+
}
|
|
11940
|
+
else {
|
|
11941
|
+
this._resolveDef();
|
|
11942
|
+
}
|
|
11909
11943
|
}
|
|
11910
11944
|
}
|
|
11911
11945
|
disconnectedCallback() {
|
|
@@ -11921,9 +11955,6 @@ class VueElement extends BaseClass {
|
|
|
11921
11955
|
* resolve inner component definition (handle possible async component)
|
|
11922
11956
|
*/
|
|
11923
11957
|
_resolveDef() {
|
|
11924
|
-
if (this._resolved) {
|
|
11925
|
-
return;
|
|
11926
|
-
}
|
|
11927
11958
|
this._resolved = true;
|
|
11928
11959
|
// set initial attrs
|
|
11929
11960
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
@@ -11935,38 +11966,26 @@ class VueElement extends BaseClass {
|
|
|
11935
11966
|
this._setAttr(m.attributeName);
|
|
11936
11967
|
}
|
|
11937
11968
|
}).observe(this, { attributes: true });
|
|
11938
|
-
const resolve = (def) => {
|
|
11939
|
-
const { props
|
|
11940
|
-
const hasOptions = !isArray(props);
|
|
11941
|
-
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
11969
|
+
const resolve = (def, isAsync = false) => {
|
|
11970
|
+
const { props, styles } = def;
|
|
11942
11971
|
// cast Number-type props set before resolve
|
|
11943
11972
|
let numberProps;
|
|
11944
|
-
if (
|
|
11945
|
-
for (const key in
|
|
11973
|
+
if (props && !isArray(props)) {
|
|
11974
|
+
for (const key in props) {
|
|
11946
11975
|
const opt = props[key];
|
|
11947
11976
|
if (opt === Number || (opt && opt.type === Number)) {
|
|
11948
|
-
|
|
11949
|
-
|
|
11977
|
+
if (key in this._props) {
|
|
11978
|
+
this._props[key] = toNumber(this._props[key]);
|
|
11979
|
+
}
|
|
11980
|
+
(numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
|
|
11950
11981
|
}
|
|
11951
11982
|
}
|
|
11952
11983
|
}
|
|
11953
11984
|
this._numberProps = numberProps;
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
}
|
|
11959
|
-
}
|
|
11960
|
-
// defining getter/setters on prototype
|
|
11961
|
-
for (const key of rawKeys.map(camelize)) {
|
|
11962
|
-
Object.defineProperty(this, key, {
|
|
11963
|
-
get() {
|
|
11964
|
-
return this._getProp(key);
|
|
11965
|
-
},
|
|
11966
|
-
set(val) {
|
|
11967
|
-
this._setProp(key, val);
|
|
11968
|
-
}
|
|
11969
|
-
});
|
|
11985
|
+
if (isAsync) {
|
|
11986
|
+
// defining getter/setters on prototype
|
|
11987
|
+
// for sync defs, this already happened in the constructor
|
|
11988
|
+
this._resolveProps(def);
|
|
11970
11989
|
}
|
|
11971
11990
|
// apply CSS
|
|
11972
11991
|
this._applyStyles(styles);
|
|
@@ -11975,12 +11994,33 @@ class VueElement extends BaseClass {
|
|
|
11975
11994
|
};
|
|
11976
11995
|
const asyncDef = this._def.__asyncLoader;
|
|
11977
11996
|
if (asyncDef) {
|
|
11978
|
-
asyncDef().then(resolve);
|
|
11997
|
+
asyncDef().then(def => resolve(def, true));
|
|
11979
11998
|
}
|
|
11980
11999
|
else {
|
|
11981
12000
|
resolve(this._def);
|
|
11982
12001
|
}
|
|
11983
12002
|
}
|
|
12003
|
+
_resolveProps(def) {
|
|
12004
|
+
const { props } = def;
|
|
12005
|
+
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
12006
|
+
// check if there are props set pre-upgrade or connect
|
|
12007
|
+
for (const key of Object.keys(this)) {
|
|
12008
|
+
if (key[0] !== '_' && declaredPropKeys.includes(key)) {
|
|
12009
|
+
this._setProp(key, this[key], true, false);
|
|
12010
|
+
}
|
|
12011
|
+
}
|
|
12012
|
+
// defining getter/setters on prototype
|
|
12013
|
+
for (const key of declaredPropKeys.map(camelize)) {
|
|
12014
|
+
Object.defineProperty(this, key, {
|
|
12015
|
+
get() {
|
|
12016
|
+
return this._getProp(key);
|
|
12017
|
+
},
|
|
12018
|
+
set(val) {
|
|
12019
|
+
this._setProp(key, val);
|
|
12020
|
+
}
|
|
12021
|
+
});
|
|
12022
|
+
}
|
|
12023
|
+
}
|
|
11984
12024
|
_setAttr(key) {
|
|
11985
12025
|
let value = this.getAttribute(key);
|
|
11986
12026
|
const camelKey = camelize(key);
|
|
@@ -12036,27 +12076,31 @@ class VueElement extends BaseClass {
|
|
|
12036
12076
|
this._styles.length = 0;
|
|
12037
12077
|
}
|
|
12038
12078
|
this._applyStyles(newStyles);
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
if (!this._def.__asyncLoader) {
|
|
12042
|
-
// reload
|
|
12043
|
-
this._instance = null;
|
|
12044
|
-
this._update();
|
|
12045
|
-
}
|
|
12079
|
+
this._instance = null;
|
|
12080
|
+
this._update();
|
|
12046
12081
|
};
|
|
12047
12082
|
}
|
|
12048
|
-
|
|
12049
|
-
instance.emit = (event, ...args) => {
|
|
12083
|
+
const dispatch = (event, args) => {
|
|
12050
12084
|
this.dispatchEvent(new CustomEvent(event, {
|
|
12051
12085
|
detail: args
|
|
12052
12086
|
}));
|
|
12053
12087
|
};
|
|
12088
|
+
// intercept emit
|
|
12089
|
+
instance.emit = (event, ...args) => {
|
|
12090
|
+
// dispatch both the raw and hyphenated versions of an event
|
|
12091
|
+
// to match Vue behavior
|
|
12092
|
+
dispatch(event, args);
|
|
12093
|
+
if (hyphenate(event) !== event) {
|
|
12094
|
+
dispatch(hyphenate(event), args);
|
|
12095
|
+
}
|
|
12096
|
+
};
|
|
12054
12097
|
// locate nearest Vue custom element parent for provide/inject
|
|
12055
12098
|
let parent = this;
|
|
12056
12099
|
while ((parent =
|
|
12057
12100
|
parent && (parent.parentNode || parent.host))) {
|
|
12058
12101
|
if (parent instanceof VueElement) {
|
|
12059
12102
|
instance.parent = parent._instance;
|
|
12103
|
+
instance.provides = parent._instance.provides;
|
|
12060
12104
|
break;
|
|
12061
12105
|
}
|
|
12062
12106
|
}
|
|
@@ -13363,15 +13407,16 @@ const errorMessages = {
|
|
|
13363
13407
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
13364
13408
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
13365
13409
|
[43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
13366
|
-
[44 /* ErrorCodes.
|
|
13367
|
-
[45 /* ErrorCodes.
|
|
13410
|
+
[44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
13411
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
13412
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
13368
13413
|
// generic errors
|
|
13369
|
-
[
|
|
13370
|
-
[
|
|
13371
|
-
[
|
|
13372
|
-
[
|
|
13414
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
13415
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
13416
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
13417
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
13373
13418
|
// just to fulfill types
|
|
13374
|
-
[
|
|
13419
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
13375
13420
|
};
|
|
13376
13421
|
|
|
13377
13422
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -16660,7 +16705,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
16660
16705
|
}).program;
|
|
16661
16706
|
}
|
|
16662
16707
|
catch (e) {
|
|
16663
|
-
context.onError(createCompilerError(
|
|
16708
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
|
|
16664
16709
|
return node;
|
|
16665
16710
|
}
|
|
16666
16711
|
const ids = [];
|
|
@@ -17560,7 +17605,7 @@ const transformElement = (node, context) => {
|
|
|
17560
17605
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
17561
17606
|
patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
17562
17607
|
if (node.children.length > 1) {
|
|
17563
|
-
context.onError(createCompilerError(
|
|
17608
|
+
context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
17564
17609
|
start: node.children[0].loc.start,
|
|
17565
17610
|
end: node.children[node.children.length - 1].loc.end,
|
|
17566
17611
|
source: ''
|
|
@@ -18531,9 +18576,16 @@ const transformModel = (dir, node, context) => {
|
|
|
18531
18576
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
18532
18577
|
// _unref(exp)
|
|
18533
18578
|
const bindingType = context.bindingMetadata[rawExp];
|
|
18579
|
+
// check props
|
|
18580
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
18581
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
18582
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
18583
|
+
return createTransformProps();
|
|
18584
|
+
}
|
|
18534
18585
|
const maybeRef = context.inline &&
|
|
18535
|
-
bindingType
|
|
18536
|
-
|
|
18586
|
+
(bindingType === "setup-let" /* BindingTypes.SETUP_LET */ ||
|
|
18587
|
+
bindingType === "setup-ref" /* BindingTypes.SETUP_REF */ ||
|
|
18588
|
+
bindingType === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
18537
18589
|
if (!expString.trim() ||
|
|
18538
18590
|
(!isMemberExpression(expString, context) && !maybeRef)) {
|
|
18539
18591
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -18837,10 +18889,10 @@ function baseCompile(template, options = {}) {
|
|
|
18837
18889
|
const isModuleMode = options.mode === 'module';
|
|
18838
18890
|
const prefixIdentifiers = (options.prefixIdentifiers === true || isModuleMode);
|
|
18839
18891
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
18840
|
-
onError(createCompilerError(
|
|
18892
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
18841
18893
|
}
|
|
18842
18894
|
if (options.scopeId && !isModuleMode) {
|
|
18843
|
-
onError(createCompilerError(
|
|
18895
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
18844
18896
|
}
|
|
18845
18897
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
18846
18898
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
@@ -21344,26 +21396,26 @@ function createDOMCompilerError(code, loc) {
|
|
|
21344
21396
|
return createCompilerError(code, loc, DOMErrorMessages );
|
|
21345
21397
|
}
|
|
21346
21398
|
const DOMErrorMessages = {
|
|
21347
|
-
[
|
|
21348
|
-
[
|
|
21349
|
-
[
|
|
21350
|
-
[
|
|
21351
|
-
[
|
|
21352
|
-
[
|
|
21353
|
-
[
|
|
21354
|
-
[
|
|
21355
|
-
[
|
|
21356
|
-
[
|
|
21357
|
-
[
|
|
21399
|
+
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
|
21400
|
+
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
|
21401
|
+
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
|
21402
|
+
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
|
21403
|
+
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
21404
|
+
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
|
21405
|
+
[57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
21406
|
+
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
21407
|
+
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
|
21408
|
+
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
|
21409
|
+
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
21358
21410
|
};
|
|
21359
21411
|
|
|
21360
21412
|
const transformVHtml = (dir, node, context) => {
|
|
21361
21413
|
const { exp, loc } = dir;
|
|
21362
21414
|
if (!exp) {
|
|
21363
|
-
context.onError(createDOMCompilerError(
|
|
21415
|
+
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
|
21364
21416
|
}
|
|
21365
21417
|
if (node.children.length) {
|
|
21366
|
-
context.onError(createDOMCompilerError(
|
|
21418
|
+
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
|
21367
21419
|
node.children.length = 0;
|
|
21368
21420
|
}
|
|
21369
21421
|
return {
|
|
@@ -21376,10 +21428,10 @@ const transformVHtml = (dir, node, context) => {
|
|
|
21376
21428
|
const transformVText = (dir, node, context) => {
|
|
21377
21429
|
const { exp, loc } = dir;
|
|
21378
21430
|
if (!exp) {
|
|
21379
|
-
context.onError(createDOMCompilerError(
|
|
21431
|
+
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
|
21380
21432
|
}
|
|
21381
21433
|
if (node.children.length) {
|
|
21382
|
-
context.onError(createDOMCompilerError(
|
|
21434
|
+
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
|
21383
21435
|
node.children.length = 0;
|
|
21384
21436
|
}
|
|
21385
21437
|
return {
|
|
@@ -21400,12 +21452,12 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
21400
21452
|
return baseResult;
|
|
21401
21453
|
}
|
|
21402
21454
|
if (dir.arg) {
|
|
21403
|
-
context.onError(createDOMCompilerError(
|
|
21455
|
+
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
|
21404
21456
|
}
|
|
21405
21457
|
function checkDuplicatedValue() {
|
|
21406
21458
|
const value = findProp(node, 'value');
|
|
21407
21459
|
if (value) {
|
|
21408
|
-
context.onError(createDOMCompilerError(
|
|
21460
|
+
context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
|
21409
21461
|
}
|
|
21410
21462
|
}
|
|
21411
21463
|
const { tag } = node;
|
|
@@ -21433,7 +21485,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
21433
21485
|
break;
|
|
21434
21486
|
case 'file':
|
|
21435
21487
|
isInvalidType = true;
|
|
21436
|
-
context.onError(createDOMCompilerError(
|
|
21488
|
+
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
|
21437
21489
|
break;
|
|
21438
21490
|
default:
|
|
21439
21491
|
// text type
|
|
@@ -21467,7 +21519,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
21467
21519
|
}
|
|
21468
21520
|
}
|
|
21469
21521
|
else {
|
|
21470
|
-
context.onError(createDOMCompilerError(
|
|
21522
|
+
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
|
21471
21523
|
}
|
|
21472
21524
|
// native vmodel doesn't need the `modelValue` props since they are also
|
|
21473
21525
|
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
@@ -21591,7 +21643,7 @@ const transformOn$1 = (dir, node, context) => {
|
|
|
21591
21643
|
const transformShow = (dir, node, context) => {
|
|
21592
21644
|
const { exp, loc } = dir;
|
|
21593
21645
|
if (!exp) {
|
|
21594
|
-
context.onError(createDOMCompilerError(
|
|
21646
|
+
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
|
21595
21647
|
}
|
|
21596
21648
|
return {
|
|
21597
21649
|
props: [],
|
|
@@ -21610,7 +21662,7 @@ const transformTransition = (node, context) => {
|
|
|
21610
21662
|
}
|
|
21611
21663
|
// warn multiple transition children
|
|
21612
21664
|
if (hasMultipleChildren(node)) {
|
|
21613
|
-
context.onError(createDOMCompilerError(
|
|
21665
|
+
context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
|
|
21614
21666
|
start: node.children[0].loc.start,
|
|
21615
21667
|
end: node.children[node.children.length - 1].loc.end,
|
|
21616
21668
|
source: ''
|
|
@@ -21945,7 +21997,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
21945
21997
|
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
21946
21998
|
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
|
21947
21999
|
(node.tag === 'script' || node.tag === 'style')) {
|
|
21948
|
-
context.onError(createDOMCompilerError(
|
|
22000
|
+
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
|
21949
22001
|
context.removeNode();
|
|
21950
22002
|
}
|
|
21951
22003
|
};
|