@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.esm-browser.js
CHANGED
|
@@ -2098,12 +2098,6 @@ function reload(id, newComp) {
|
|
|
2098
2098
|
// components to be unmounted and re-mounted. Queue the update so that we
|
|
2099
2099
|
// don't end up forcing the same parent to re-render multiple times.
|
|
2100
2100
|
queueJob(instance.parent.update);
|
|
2101
|
-
// instance is the inner component of an async custom element
|
|
2102
|
-
// invoke to reset styles
|
|
2103
|
-
if (instance.parent.type.__asyncLoader &&
|
|
2104
|
-
instance.parent.ceReload) {
|
|
2105
|
-
instance.parent.ceReload(newComp.styles);
|
|
2106
|
-
}
|
|
2107
2101
|
}
|
|
2108
2102
|
else if (instance.appContext.reload) {
|
|
2109
2103
|
// root instance mounted via createApp() has a reload method
|
|
@@ -2334,8 +2328,8 @@ const deprecationData = {
|
|
|
2334
2328
|
},
|
|
2335
2329
|
["INSTANCE_EVENT_HOOKS" /* DeprecationTypes.INSTANCE_EVENT_HOOKS */]: {
|
|
2336
2330
|
message: event => `"${event}" lifecycle events are no longer supported. From templates, ` +
|
|
2337
|
-
`use the "
|
|
2338
|
-
`should be changed to @
|
|
2331
|
+
`use the "vue:" prefix instead of "hook:". For example, @${event} ` +
|
|
2332
|
+
`should be changed to @vue:${event.slice(5)}. ` +
|
|
2339
2333
|
`From JavaScript, use Composition API to dynamically register lifecycle ` +
|
|
2340
2334
|
`hooks.`,
|
|
2341
2335
|
link: `https://v3-migration.vuejs.org/breaking-changes/vnode-lifecycle-events.html`
|
|
@@ -3912,10 +3906,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3912
3906
|
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
3913
3907
|
newValue,
|
|
3914
3908
|
// pass undefined as the old value when it's changed for the first time
|
|
3915
|
-
oldValue === INITIAL_WATCHER_VALUE
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3909
|
+
oldValue === INITIAL_WATCHER_VALUE
|
|
3910
|
+
? undefined
|
|
3911
|
+
: (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
|
|
3912
|
+
? []
|
|
3913
|
+
: oldValue,
|
|
3919
3914
|
onCleanup
|
|
3920
3915
|
]);
|
|
3921
3916
|
oldValue = newValue;
|
|
@@ -4515,10 +4510,15 @@ function defineAsyncComponent(source) {
|
|
|
4515
4510
|
}
|
|
4516
4511
|
});
|
|
4517
4512
|
}
|
|
4518
|
-
function createInnerComp(comp,
|
|
4513
|
+
function createInnerComp(comp, parent) {
|
|
4514
|
+
const { ref, props, children, ce } = parent.vnode;
|
|
4519
4515
|
const vnode = createVNode(comp, props, children);
|
|
4520
4516
|
// ensure inner component inherits the async wrapper's ref owner
|
|
4521
4517
|
vnode.ref = ref;
|
|
4518
|
+
// pass the custom element callback on to the inner comp
|
|
4519
|
+
// and remove it from the async wrapper
|
|
4520
|
+
vnode.ce = ce;
|
|
4521
|
+
delete parent.vnode.ce;
|
|
4522
4522
|
return vnode;
|
|
4523
4523
|
}
|
|
4524
4524
|
|
|
@@ -4676,8 +4676,7 @@ const KeepAliveImpl = {
|
|
|
4676
4676
|
: comp);
|
|
4677
4677
|
const { include, exclude, max } = props;
|
|
4678
4678
|
if ((include && (!name || !matches(include, name))) ||
|
|
4679
|
-
(exclude && name && matches(exclude, name))
|
|
4680
|
-
(hmrDirtyComponents.has(comp))) {
|
|
4679
|
+
(exclude && name && matches(exclude, name))) {
|
|
4681
4680
|
current = vnode;
|
|
4682
4681
|
return rawVNode;
|
|
4683
4682
|
}
|
|
@@ -4790,14 +4789,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
4790
4789
|
}, target);
|
|
4791
4790
|
}
|
|
4792
4791
|
function resetShapeFlag(vnode) {
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
}
|
|
4797
|
-
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
4798
|
-
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4799
|
-
}
|
|
4800
|
-
vnode.shapeFlag = shapeFlag;
|
|
4792
|
+
// bitwise operations to remove keep alive flags
|
|
4793
|
+
vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4794
|
+
vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4801
4795
|
}
|
|
4802
4796
|
function getInnerChild(vnode) {
|
|
4803
4797
|
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
@@ -5425,7 +5419,9 @@ fallback, noSlotted) {
|
|
|
5425
5419
|
(currentRenderingInstance.parent &&
|
|
5426
5420
|
isAsyncWrapper(currentRenderingInstance.parent) &&
|
|
5427
5421
|
currentRenderingInstance.parent.isCE)) {
|
|
5428
|
-
|
|
5422
|
+
if (name !== 'default')
|
|
5423
|
+
props.name = name;
|
|
5424
|
+
return createVNode('slot', props, fallback && fallback());
|
|
5429
5425
|
}
|
|
5430
5426
|
let slot = slots[name];
|
|
5431
5427
|
if (slot && slot.length > 1) {
|
|
@@ -5745,6 +5741,7 @@ const publicPropertiesMap =
|
|
|
5745
5741
|
installCompatInstanceProperties(publicPropertiesMap);
|
|
5746
5742
|
}
|
|
5747
5743
|
const isReservedPrefix = (key) => key === '_' || key === '$';
|
|
5744
|
+
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
|
5748
5745
|
const PublicInstanceProxyHandlers = {
|
|
5749
5746
|
get({ _: instance }, key) {
|
|
5750
5747
|
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
@@ -5752,15 +5749,6 @@ const PublicInstanceProxyHandlers = {
|
|
|
5752
5749
|
if (key === '__isVue') {
|
|
5753
5750
|
return true;
|
|
5754
5751
|
}
|
|
5755
|
-
// prioritize <script setup> bindings during dev.
|
|
5756
|
-
// this allows even properties that start with _ or $ to be used - so that
|
|
5757
|
-
// it aligns with the production behavior where the render fn is inlined and
|
|
5758
|
-
// indeed has access to all declared variables.
|
|
5759
|
-
if (setupState !== EMPTY_OBJ &&
|
|
5760
|
-
setupState.__isScriptSetup &&
|
|
5761
|
-
hasOwn(setupState, key)) {
|
|
5762
|
-
return setupState[key];
|
|
5763
|
-
}
|
|
5764
5752
|
// data / props / ctx
|
|
5765
5753
|
// This getter gets called for every property access on the render context
|
|
5766
5754
|
// during render and is a major hotspot. The most expensive part of this
|
|
@@ -5783,7 +5771,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5783
5771
|
// default: just fallthrough
|
|
5784
5772
|
}
|
|
5785
5773
|
}
|
|
5786
|
-
else if (
|
|
5774
|
+
else if (hasSetupBinding(setupState, key)) {
|
|
5787
5775
|
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
5788
5776
|
return setupState[key];
|
|
5789
5777
|
}
|
|
@@ -5862,21 +5850,26 @@ const PublicInstanceProxyHandlers = {
|
|
|
5862
5850
|
},
|
|
5863
5851
|
set({ _: instance }, key, value) {
|
|
5864
5852
|
const { data, setupState, ctx } = instance;
|
|
5865
|
-
if (
|
|
5853
|
+
if (hasSetupBinding(setupState, key)) {
|
|
5866
5854
|
setupState[key] = value;
|
|
5867
5855
|
return true;
|
|
5868
5856
|
}
|
|
5857
|
+
else if (setupState.__isScriptSetup &&
|
|
5858
|
+
hasOwn(setupState, key)) {
|
|
5859
|
+
warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
5860
|
+
return false;
|
|
5861
|
+
}
|
|
5869
5862
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
5870
5863
|
data[key] = value;
|
|
5871
5864
|
return true;
|
|
5872
5865
|
}
|
|
5873
5866
|
else if (hasOwn(instance.props, key)) {
|
|
5874
|
-
warn$1(`Attempting to mutate prop "${key}". Props are readonly
|
|
5867
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
5875
5868
|
return false;
|
|
5876
5869
|
}
|
|
5877
5870
|
if (key[0] === '$' && key.slice(1) in instance) {
|
|
5878
5871
|
warn$1(`Attempting to mutate public property "${key}". ` +
|
|
5879
|
-
`Properties starting with $ are reserved and readonly
|
|
5872
|
+
`Properties starting with $ are reserved and readonly.`);
|
|
5880
5873
|
return false;
|
|
5881
5874
|
}
|
|
5882
5875
|
else {
|
|
@@ -5897,7 +5890,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5897
5890
|
let normalizedProps;
|
|
5898
5891
|
return (!!accessCache[key] ||
|
|
5899
5892
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
5900
|
-
(setupState
|
|
5893
|
+
hasSetupBinding(setupState, key) ||
|
|
5901
5894
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
5902
5895
|
hasOwn(ctx, key) ||
|
|
5903
5896
|
hasOwn(publicPropertiesMap, key) ||
|
|
@@ -7172,7 +7165,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
7172
7165
|
return vm;
|
|
7173
7166
|
}
|
|
7174
7167
|
}
|
|
7175
|
-
Vue.version = `2.6.14-compat:${"3.2.
|
|
7168
|
+
Vue.version = `2.6.14-compat:${"3.2.45"}`;
|
|
7176
7169
|
Vue.config = singletonApp.config;
|
|
7177
7170
|
Vue.use = (p, ...options) => {
|
|
7178
7171
|
if (p && isFunction(p.install)) {
|
|
@@ -9559,6 +9552,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
9559
9552
|
if (!shallow)
|
|
9560
9553
|
traverseStaticChildren(c1, c2);
|
|
9561
9554
|
}
|
|
9555
|
+
// #6852 also inherit for text nodes
|
|
9556
|
+
if (c2.type === Text) {
|
|
9557
|
+
c2.el = c1.el;
|
|
9558
|
+
}
|
|
9562
9559
|
// also inherit for comment nodes, but not placeholders (e.g. v-if which
|
|
9563
9560
|
// would have received .el during block patch)
|
|
9564
9561
|
if (c2.type === Comment && !c2.el) {
|
|
@@ -9729,6 +9726,7 @@ const TeleportImpl = {
|
|
|
9729
9726
|
}
|
|
9730
9727
|
}
|
|
9731
9728
|
}
|
|
9729
|
+
updateCssVars(n2);
|
|
9732
9730
|
},
|
|
9733
9731
|
remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
9734
9732
|
const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
|
@@ -9807,11 +9805,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
9807
9805
|
hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
9808
9806
|
}
|
|
9809
9807
|
}
|
|
9808
|
+
updateCssVars(vnode);
|
|
9810
9809
|
}
|
|
9811
9810
|
return vnode.anchor && nextSibling(vnode.anchor);
|
|
9812
9811
|
}
|
|
9813
9812
|
// Force-casted public typing for h and TSX props inference
|
|
9814
9813
|
const Teleport = TeleportImpl;
|
|
9814
|
+
function updateCssVars(vnode) {
|
|
9815
|
+
// presence of .ut method indicates owner component uses css vars.
|
|
9816
|
+
// code path here can assume browser environment.
|
|
9817
|
+
const ctx = vnode.ctx;
|
|
9818
|
+
if (ctx && ctx.ut) {
|
|
9819
|
+
let node = vnode.children[0].el;
|
|
9820
|
+
while (node !== vnode.targetAnchor) {
|
|
9821
|
+
if (node.nodeType === 1)
|
|
9822
|
+
node.setAttribute('data-v-owner', ctx.uid);
|
|
9823
|
+
node = node.nextSibling;
|
|
9824
|
+
}
|
|
9825
|
+
ctx.ut();
|
|
9826
|
+
}
|
|
9827
|
+
}
|
|
9815
9828
|
|
|
9816
9829
|
const normalizedAsyncComponentMap = new Map();
|
|
9817
9830
|
function convertLegacyAsyncComponent(comp) {
|
|
@@ -9966,6 +9979,10 @@ function isVNode(value) {
|
|
|
9966
9979
|
function isSameVNodeType(n1, n2) {
|
|
9967
9980
|
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
9968
9981
|
hmrDirtyComponents.has(n2.type)) {
|
|
9982
|
+
// #7042, ensure the vnode being unmounted during HMR
|
|
9983
|
+
// bitwise operations to remove keep alive flags
|
|
9984
|
+
n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
9985
|
+
n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
9969
9986
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
9970
9987
|
return false;
|
|
9971
9988
|
}
|
|
@@ -10021,7 +10038,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
10021
10038
|
patchFlag,
|
|
10022
10039
|
dynamicProps,
|
|
10023
10040
|
dynamicChildren: null,
|
|
10024
|
-
appContext: null
|
|
10041
|
+
appContext: null,
|
|
10042
|
+
ctx: currentRenderingInstance
|
|
10025
10043
|
};
|
|
10026
10044
|
if (needFullChildrenNormalization) {
|
|
10027
10045
|
normalizeChildren(vnode, children);
|
|
@@ -10196,7 +10214,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
10196
10214
|
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
10197
10215
|
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
10198
10216
|
el: vnode.el,
|
|
10199
|
-
anchor: vnode.anchor
|
|
10217
|
+
anchor: vnode.anchor,
|
|
10218
|
+
ctx: vnode.ctx
|
|
10200
10219
|
};
|
|
10201
10220
|
{
|
|
10202
10221
|
defineLegacyVNodeProperties(cloned);
|
|
@@ -11184,7 +11203,7 @@ function isMemoSame(cached, memo) {
|
|
|
11184
11203
|
}
|
|
11185
11204
|
|
|
11186
11205
|
// Core API ------------------------------------------------------------------
|
|
11187
|
-
const version = "3.2.
|
|
11206
|
+
const version = "3.2.45";
|
|
11188
11207
|
/**
|
|
11189
11208
|
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
11190
11209
|
* @internal
|
|
@@ -11337,6 +11356,7 @@ function patchStyle(el, prev, next) {
|
|
|
11337
11356
|
}
|
|
11338
11357
|
}
|
|
11339
11358
|
}
|
|
11359
|
+
const semicolonRE = /[^\\];\s*$/;
|
|
11340
11360
|
const importantRE = /\s*!important$/;
|
|
11341
11361
|
function setStyle(style, name, val) {
|
|
11342
11362
|
if (isArray(val)) {
|
|
@@ -11345,6 +11365,11 @@ function setStyle(style, name, val) {
|
|
|
11345
11365
|
else {
|
|
11346
11366
|
if (val == null)
|
|
11347
11367
|
val = '';
|
|
11368
|
+
{
|
|
11369
|
+
if (semicolonRE.test(val)) {
|
|
11370
|
+
warn$1(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
11371
|
+
}
|
|
11372
|
+
}
|
|
11348
11373
|
if (name.startsWith('--')) {
|
|
11349
11374
|
// custom property definition
|
|
11350
11375
|
style.setProperty(name, val);
|
|
@@ -11712,12 +11737,21 @@ class VueElement extends BaseClass {
|
|
|
11712
11737
|
`defined as hydratable. Use \`defineSSRCustomElement\`.`);
|
|
11713
11738
|
}
|
|
11714
11739
|
this.attachShadow({ mode: 'open' });
|
|
11740
|
+
if (!this._def.__asyncLoader) {
|
|
11741
|
+
// for sync component defs we can immediately resolve props
|
|
11742
|
+
this._resolveProps(this._def);
|
|
11743
|
+
}
|
|
11715
11744
|
}
|
|
11716
11745
|
}
|
|
11717
11746
|
connectedCallback() {
|
|
11718
11747
|
this._connected = true;
|
|
11719
11748
|
if (!this._instance) {
|
|
11720
|
-
this.
|
|
11749
|
+
if (this._resolved) {
|
|
11750
|
+
this._update();
|
|
11751
|
+
}
|
|
11752
|
+
else {
|
|
11753
|
+
this._resolveDef();
|
|
11754
|
+
}
|
|
11721
11755
|
}
|
|
11722
11756
|
}
|
|
11723
11757
|
disconnectedCallback() {
|
|
@@ -11733,9 +11767,6 @@ class VueElement extends BaseClass {
|
|
|
11733
11767
|
* resolve inner component definition (handle possible async component)
|
|
11734
11768
|
*/
|
|
11735
11769
|
_resolveDef() {
|
|
11736
|
-
if (this._resolved) {
|
|
11737
|
-
return;
|
|
11738
|
-
}
|
|
11739
11770
|
this._resolved = true;
|
|
11740
11771
|
// set initial attrs
|
|
11741
11772
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
@@ -11747,38 +11778,26 @@ class VueElement extends BaseClass {
|
|
|
11747
11778
|
this._setAttr(m.attributeName);
|
|
11748
11779
|
}
|
|
11749
11780
|
}).observe(this, { attributes: true });
|
|
11750
|
-
const resolve = (def) => {
|
|
11751
|
-
const { props
|
|
11752
|
-
const hasOptions = !isArray(props);
|
|
11753
|
-
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
11781
|
+
const resolve = (def, isAsync = false) => {
|
|
11782
|
+
const { props, styles } = def;
|
|
11754
11783
|
// cast Number-type props set before resolve
|
|
11755
11784
|
let numberProps;
|
|
11756
|
-
if (
|
|
11757
|
-
for (const key in
|
|
11785
|
+
if (props && !isArray(props)) {
|
|
11786
|
+
for (const key in props) {
|
|
11758
11787
|
const opt = props[key];
|
|
11759
11788
|
if (opt === Number || (opt && opt.type === Number)) {
|
|
11760
|
-
|
|
11761
|
-
|
|
11789
|
+
if (key in this._props) {
|
|
11790
|
+
this._props[key] = toNumber(this._props[key]);
|
|
11791
|
+
}
|
|
11792
|
+
(numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
|
|
11762
11793
|
}
|
|
11763
11794
|
}
|
|
11764
11795
|
}
|
|
11765
11796
|
this._numberProps = numberProps;
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
}
|
|
11771
|
-
}
|
|
11772
|
-
// defining getter/setters on prototype
|
|
11773
|
-
for (const key of rawKeys.map(camelize)) {
|
|
11774
|
-
Object.defineProperty(this, key, {
|
|
11775
|
-
get() {
|
|
11776
|
-
return this._getProp(key);
|
|
11777
|
-
},
|
|
11778
|
-
set(val) {
|
|
11779
|
-
this._setProp(key, val);
|
|
11780
|
-
}
|
|
11781
|
-
});
|
|
11797
|
+
if (isAsync) {
|
|
11798
|
+
// defining getter/setters on prototype
|
|
11799
|
+
// for sync defs, this already happened in the constructor
|
|
11800
|
+
this._resolveProps(def);
|
|
11782
11801
|
}
|
|
11783
11802
|
// apply CSS
|
|
11784
11803
|
this._applyStyles(styles);
|
|
@@ -11787,12 +11806,33 @@ class VueElement extends BaseClass {
|
|
|
11787
11806
|
};
|
|
11788
11807
|
const asyncDef = this._def.__asyncLoader;
|
|
11789
11808
|
if (asyncDef) {
|
|
11790
|
-
asyncDef().then(resolve);
|
|
11809
|
+
asyncDef().then(def => resolve(def, true));
|
|
11791
11810
|
}
|
|
11792
11811
|
else {
|
|
11793
11812
|
resolve(this._def);
|
|
11794
11813
|
}
|
|
11795
11814
|
}
|
|
11815
|
+
_resolveProps(def) {
|
|
11816
|
+
const { props } = def;
|
|
11817
|
+
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
11818
|
+
// check if there are props set pre-upgrade or connect
|
|
11819
|
+
for (const key of Object.keys(this)) {
|
|
11820
|
+
if (key[0] !== '_' && declaredPropKeys.includes(key)) {
|
|
11821
|
+
this._setProp(key, this[key], true, false);
|
|
11822
|
+
}
|
|
11823
|
+
}
|
|
11824
|
+
// defining getter/setters on prototype
|
|
11825
|
+
for (const key of declaredPropKeys.map(camelize)) {
|
|
11826
|
+
Object.defineProperty(this, key, {
|
|
11827
|
+
get() {
|
|
11828
|
+
return this._getProp(key);
|
|
11829
|
+
},
|
|
11830
|
+
set(val) {
|
|
11831
|
+
this._setProp(key, val);
|
|
11832
|
+
}
|
|
11833
|
+
});
|
|
11834
|
+
}
|
|
11835
|
+
}
|
|
11796
11836
|
_setAttr(key) {
|
|
11797
11837
|
let value = this.getAttribute(key);
|
|
11798
11838
|
const camelKey = camelize(key);
|
|
@@ -11848,27 +11888,31 @@ class VueElement extends BaseClass {
|
|
|
11848
11888
|
this._styles.length = 0;
|
|
11849
11889
|
}
|
|
11850
11890
|
this._applyStyles(newStyles);
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
if (!this._def.__asyncLoader) {
|
|
11854
|
-
// reload
|
|
11855
|
-
this._instance = null;
|
|
11856
|
-
this._update();
|
|
11857
|
-
}
|
|
11891
|
+
this._instance = null;
|
|
11892
|
+
this._update();
|
|
11858
11893
|
};
|
|
11859
11894
|
}
|
|
11860
|
-
|
|
11861
|
-
instance.emit = (event, ...args) => {
|
|
11895
|
+
const dispatch = (event, args) => {
|
|
11862
11896
|
this.dispatchEvent(new CustomEvent(event, {
|
|
11863
11897
|
detail: args
|
|
11864
11898
|
}));
|
|
11865
11899
|
};
|
|
11900
|
+
// intercept emit
|
|
11901
|
+
instance.emit = (event, ...args) => {
|
|
11902
|
+
// dispatch both the raw and hyphenated versions of an event
|
|
11903
|
+
// to match Vue behavior
|
|
11904
|
+
dispatch(event, args);
|
|
11905
|
+
if (hyphenate(event) !== event) {
|
|
11906
|
+
dispatch(hyphenate(event), args);
|
|
11907
|
+
}
|
|
11908
|
+
};
|
|
11866
11909
|
// locate nearest Vue custom element parent for provide/inject
|
|
11867
11910
|
let parent = this;
|
|
11868
11911
|
while ((parent =
|
|
11869
11912
|
parent && (parent.parentNode || parent.host))) {
|
|
11870
11913
|
if (parent instanceof VueElement) {
|
|
11871
11914
|
instance.parent = parent._instance;
|
|
11915
|
+
instance.provides = parent._instance.provides;
|
|
11872
11916
|
break;
|
|
11873
11917
|
}
|
|
11874
11918
|
}
|
|
@@ -11924,7 +11968,14 @@ function useCssVars(getter) {
|
|
|
11924
11968
|
warn$1(`useCssVars is called without current active component instance.`);
|
|
11925
11969
|
return;
|
|
11926
11970
|
}
|
|
11927
|
-
const
|
|
11971
|
+
const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
|
|
11972
|
+
Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach(node => setVarsOnNode(node, vars));
|
|
11973
|
+
});
|
|
11974
|
+
const setVars = () => {
|
|
11975
|
+
const vars = getter(instance.proxy);
|
|
11976
|
+
setVarsOnVNode(instance.subTree, vars);
|
|
11977
|
+
updateTeleports(vars);
|
|
11978
|
+
};
|
|
11928
11979
|
watchPostEffect(setVars);
|
|
11929
11980
|
onMounted(() => {
|
|
11930
11981
|
const ob = new MutationObserver(setVars);
|
|
@@ -13185,15 +13236,16 @@ const errorMessages = {
|
|
|
13185
13236
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
13186
13237
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
13187
13238
|
[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.`,
|
|
13188
|
-
[44 /* ErrorCodes.
|
|
13189
|
-
[45 /* ErrorCodes.
|
|
13239
|
+
[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.`,
|
|
13240
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
13241
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
13190
13242
|
// generic errors
|
|
13191
|
-
[
|
|
13192
|
-
[
|
|
13193
|
-
[
|
|
13194
|
-
[
|
|
13243
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
13244
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
13245
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
13246
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
13195
13247
|
// just to fulfill types
|
|
13196
|
-
[
|
|
13248
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
13197
13249
|
};
|
|
13198
13250
|
|
|
13199
13251
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -15818,7 +15870,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
15818
15870
|
if (keywordMatch) {
|
|
15819
15871
|
message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
|
|
15820
15872
|
}
|
|
15821
|
-
context.onError(createCompilerError(
|
|
15873
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
|
|
15822
15874
|
}
|
|
15823
15875
|
}
|
|
15824
15876
|
|
|
@@ -16612,7 +16664,7 @@ const transformElement = (node, context) => {
|
|
|
16612
16664
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
16613
16665
|
patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
16614
16666
|
if (node.children.length > 1) {
|
|
16615
|
-
context.onError(createCompilerError(
|
|
16667
|
+
context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
16616
16668
|
start: node.children[0].loc.start,
|
|
16617
16669
|
end: node.children[node.children.length - 1].loc.end,
|
|
16618
16670
|
source: ''
|
|
@@ -17467,8 +17519,14 @@ const transformModel = (dir, node, context) => {
|
|
|
17467
17519
|
const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
|
|
17468
17520
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
17469
17521
|
// _unref(exp)
|
|
17470
|
-
context.bindingMetadata[rawExp];
|
|
17471
|
-
|
|
17522
|
+
const bindingType = context.bindingMetadata[rawExp];
|
|
17523
|
+
// check props
|
|
17524
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
17525
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
17526
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
17527
|
+
return createTransformProps();
|
|
17528
|
+
}
|
|
17529
|
+
const maybeRef = !true ;
|
|
17472
17530
|
if (!expString.trim() ||
|
|
17473
17531
|
(!isMemberExpression(expString) && !maybeRef)) {
|
|
17474
17532
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -17735,18 +17793,18 @@ function baseCompile(template, options = {}) {
|
|
|
17735
17793
|
/* istanbul ignore if */
|
|
17736
17794
|
{
|
|
17737
17795
|
if (options.prefixIdentifiers === true) {
|
|
17738
|
-
onError(createCompilerError(
|
|
17796
|
+
onError(createCompilerError(47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
|
|
17739
17797
|
}
|
|
17740
17798
|
else if (isModuleMode) {
|
|
17741
|
-
onError(createCompilerError(
|
|
17799
|
+
onError(createCompilerError(48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
|
|
17742
17800
|
}
|
|
17743
17801
|
}
|
|
17744
17802
|
const prefixIdentifiers = !true ;
|
|
17745
17803
|
if (options.cacheHandlers) {
|
|
17746
|
-
onError(createCompilerError(
|
|
17804
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
17747
17805
|
}
|
|
17748
17806
|
if (options.scopeId && !isModuleMode) {
|
|
17749
|
-
onError(createCompilerError(
|
|
17807
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
17750
17808
|
}
|
|
17751
17809
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
17752
17810
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
@@ -17904,26 +17962,26 @@ function createDOMCompilerError(code, loc) {
|
|
|
17904
17962
|
return createCompilerError(code, loc, DOMErrorMessages );
|
|
17905
17963
|
}
|
|
17906
17964
|
const DOMErrorMessages = {
|
|
17907
|
-
[
|
|
17908
|
-
[
|
|
17909
|
-
[
|
|
17910
|
-
[
|
|
17911
|
-
[
|
|
17912
|
-
[
|
|
17913
|
-
[
|
|
17914
|
-
[
|
|
17915
|
-
[
|
|
17916
|
-
[
|
|
17917
|
-
[
|
|
17965
|
+
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
|
17966
|
+
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
|
17967
|
+
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
|
17968
|
+
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
|
17969
|
+
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
17970
|
+
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
|
17971
|
+
[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.`,
|
|
17972
|
+
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
17973
|
+
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
|
17974
|
+
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
|
17975
|
+
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
17918
17976
|
};
|
|
17919
17977
|
|
|
17920
17978
|
const transformVHtml = (dir, node, context) => {
|
|
17921
17979
|
const { exp, loc } = dir;
|
|
17922
17980
|
if (!exp) {
|
|
17923
|
-
context.onError(createDOMCompilerError(
|
|
17981
|
+
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
|
17924
17982
|
}
|
|
17925
17983
|
if (node.children.length) {
|
|
17926
|
-
context.onError(createDOMCompilerError(
|
|
17984
|
+
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
|
17927
17985
|
node.children.length = 0;
|
|
17928
17986
|
}
|
|
17929
17987
|
return {
|
|
@@ -17936,10 +17994,10 @@ const transformVHtml = (dir, node, context) => {
|
|
|
17936
17994
|
const transformVText = (dir, node, context) => {
|
|
17937
17995
|
const { exp, loc } = dir;
|
|
17938
17996
|
if (!exp) {
|
|
17939
|
-
context.onError(createDOMCompilerError(
|
|
17997
|
+
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
|
17940
17998
|
}
|
|
17941
17999
|
if (node.children.length) {
|
|
17942
|
-
context.onError(createDOMCompilerError(
|
|
18000
|
+
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
|
17943
18001
|
node.children.length = 0;
|
|
17944
18002
|
}
|
|
17945
18003
|
return {
|
|
@@ -17960,12 +18018,12 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17960
18018
|
return baseResult;
|
|
17961
18019
|
}
|
|
17962
18020
|
if (dir.arg) {
|
|
17963
|
-
context.onError(createDOMCompilerError(
|
|
18021
|
+
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
|
17964
18022
|
}
|
|
17965
18023
|
function checkDuplicatedValue() {
|
|
17966
18024
|
const value = findProp(node, 'value');
|
|
17967
18025
|
if (value) {
|
|
17968
|
-
context.onError(createDOMCompilerError(
|
|
18026
|
+
context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
|
17969
18027
|
}
|
|
17970
18028
|
}
|
|
17971
18029
|
const { tag } = node;
|
|
@@ -17993,7 +18051,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17993
18051
|
break;
|
|
17994
18052
|
case 'file':
|
|
17995
18053
|
isInvalidType = true;
|
|
17996
|
-
context.onError(createDOMCompilerError(
|
|
18054
|
+
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
|
17997
18055
|
break;
|
|
17998
18056
|
default:
|
|
17999
18057
|
// text type
|
|
@@ -18027,7 +18085,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
18027
18085
|
}
|
|
18028
18086
|
}
|
|
18029
18087
|
else {
|
|
18030
|
-
context.onError(createDOMCompilerError(
|
|
18088
|
+
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
|
18031
18089
|
}
|
|
18032
18090
|
// native vmodel doesn't need the `modelValue` props since they are also
|
|
18033
18091
|
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
@@ -18151,7 +18209,7 @@ const transformOn$1 = (dir, node, context) => {
|
|
|
18151
18209
|
const transformShow = (dir, node, context) => {
|
|
18152
18210
|
const { exp, loc } = dir;
|
|
18153
18211
|
if (!exp) {
|
|
18154
|
-
context.onError(createDOMCompilerError(
|
|
18212
|
+
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
|
18155
18213
|
}
|
|
18156
18214
|
return {
|
|
18157
18215
|
props: [],
|
|
@@ -18170,7 +18228,7 @@ const transformTransition = (node, context) => {
|
|
|
18170
18228
|
}
|
|
18171
18229
|
// warn multiple transition children
|
|
18172
18230
|
if (hasMultipleChildren(node)) {
|
|
18173
|
-
context.onError(createDOMCompilerError(
|
|
18231
|
+
context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
|
|
18174
18232
|
start: node.children[0].loc.start,
|
|
18175
18233
|
end: node.children[node.children.length - 1].loc.end,
|
|
18176
18234
|
source: ''
|
|
@@ -18209,7 +18267,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
18209
18267
|
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
18210
18268
|
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
|
18211
18269
|
(node.tag === 'script' || node.tag === 'style')) {
|
|
18212
|
-
context.onError(createDOMCompilerError(
|
|
18270
|
+
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
|
18213
18271
|
context.removeNode();
|
|
18214
18272
|
}
|
|
18215
18273
|
};
|