@vue/compat 3.5.21 → 3.5.22
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 +205 -146
- package/dist/vue.cjs.prod.js +200 -138
- package/dist/vue.esm-browser.js +152 -129
- package/dist/vue.esm-browser.prod.js +4 -4
- package/dist/vue.esm-bundler.js +152 -129
- package/dist/vue.global.js +152 -129
- package/dist/vue.global.prod.js +4 -4
- package/dist/vue.runtime.esm-browser.js +73 -51
- package/dist/vue.runtime.esm-browser.prod.js +3 -3
- package/dist/vue.runtime.esm-bundler.js +73 -51
- package/dist/vue.runtime.global.js +73 -51
- package/dist/vue.runtime.global.prod.js +3 -3
- package/package.json +3 -3
package/dist/vue.cjs.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.5.
|
|
2
|
+
* @vue/compat v3.5.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1113,7 +1113,7 @@ function iterator(self, method, wrapValue) {
|
|
|
1113
1113
|
iter._next = iter.next;
|
|
1114
1114
|
iter.next = () => {
|
|
1115
1115
|
const result = iter._next();
|
|
1116
|
-
if (result.
|
|
1116
|
+
if (!result.done) {
|
|
1117
1117
|
result.value = wrapValue(result.value);
|
|
1118
1118
|
}
|
|
1119
1119
|
return result;
|
|
@@ -1240,7 +1240,8 @@ class BaseReactiveHandler {
|
|
|
1240
1240
|
return res;
|
|
1241
1241
|
}
|
|
1242
1242
|
if (isRef(res)) {
|
|
1243
|
-
|
|
1243
|
+
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
1244
|
+
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
1244
1245
|
}
|
|
1245
1246
|
if (isObject(res)) {
|
|
1246
1247
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
@@ -2721,9 +2722,6 @@ const TeleportImpl = {
|
|
|
2721
2722
|
insert(mainAnchor, container, anchor);
|
|
2722
2723
|
const mount = (container2, anchor2) => {
|
|
2723
2724
|
if (shapeFlag & 16) {
|
|
2724
|
-
if (parentComponent && parentComponent.isCE) {
|
|
2725
|
-
parentComponent.ce._teleportTarget = container2;
|
|
2726
|
-
}
|
|
2727
2725
|
mountChildren(
|
|
2728
2726
|
children,
|
|
2729
2727
|
container2,
|
|
@@ -2745,6 +2743,9 @@ const TeleportImpl = {
|
|
|
2745
2743
|
} else if (namespace !== "mathml" && isTargetMathML(target)) {
|
|
2746
2744
|
namespace = "mathml";
|
|
2747
2745
|
}
|
|
2746
|
+
if (parentComponent && parentComponent.isCE) {
|
|
2747
|
+
(parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2748
|
+
}
|
|
2748
2749
|
if (!disabled) {
|
|
2749
2750
|
mount(target, targetAnchor);
|
|
2750
2751
|
updateCssVars(n2, false);
|
|
@@ -4928,12 +4929,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
4928
4929
|
|
|
4929
4930
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
4930
4931
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
4932
|
+
const hasProps = Object.keys(props).length > 0;
|
|
4931
4933
|
if (name !== "default") props.name = name;
|
|
4932
4934
|
return openBlock(), createBlock(
|
|
4933
4935
|
Fragment,
|
|
4934
4936
|
null,
|
|
4935
4937
|
[createVNode("slot", props, fallback && fallback())],
|
|
4936
|
-
64
|
|
4938
|
+
hasProps ? -2 : 64
|
|
4937
4939
|
);
|
|
4938
4940
|
}
|
|
4939
4941
|
let slot = slots[name];
|
|
@@ -5865,7 +5867,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
5865
5867
|
return vm;
|
|
5866
5868
|
}
|
|
5867
5869
|
}
|
|
5868
|
-
Vue.version = `2.6.14-compat:${"3.5.
|
|
5870
|
+
Vue.version = `2.6.14-compat:${"3.5.22"}`;
|
|
5869
5871
|
Vue.config = singletonApp.config;
|
|
5870
5872
|
Vue.use = (plugin, ...options) => {
|
|
5871
5873
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -9965,31 +9967,28 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
9965
9967
|
};
|
|
9966
9968
|
|
|
9967
9969
|
function h(type, propsOrChildren, children) {
|
|
9968
|
-
|
|
9970
|
+
try {
|
|
9969
9971
|
setBlockTracking(-1);
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
if (isVNode(propsOrChildren)) {
|
|
9980
|
-
return doCreateVNode(type, null, [propsOrChildren]);
|
|
9972
|
+
const l = arguments.length;
|
|
9973
|
+
if (l === 2) {
|
|
9974
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
9975
|
+
if (isVNode(propsOrChildren)) {
|
|
9976
|
+
return createVNode(type, null, [propsOrChildren]);
|
|
9977
|
+
}
|
|
9978
|
+
return createVNode(type, propsOrChildren);
|
|
9979
|
+
} else {
|
|
9980
|
+
return createVNode(type, null, propsOrChildren);
|
|
9981
9981
|
}
|
|
9982
|
-
return doCreateVNode(type, propsOrChildren);
|
|
9983
9982
|
} else {
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
children = [children];
|
|
9983
|
+
if (l > 3) {
|
|
9984
|
+
children = Array.prototype.slice.call(arguments, 2);
|
|
9985
|
+
} else if (l === 3 && isVNode(children)) {
|
|
9986
|
+
children = [children];
|
|
9987
|
+
}
|
|
9988
|
+
return createVNode(type, propsOrChildren, children);
|
|
9991
9989
|
}
|
|
9992
|
-
|
|
9990
|
+
} finally {
|
|
9991
|
+
setBlockTracking(1);
|
|
9993
9992
|
}
|
|
9994
9993
|
}
|
|
9995
9994
|
|
|
@@ -10025,7 +10024,7 @@ function isMemoSame(cached, memo) {
|
|
|
10025
10024
|
return true;
|
|
10026
10025
|
}
|
|
10027
10026
|
|
|
10028
|
-
const version = "3.5.
|
|
10027
|
+
const version = "3.5.22";
|
|
10029
10028
|
const warn$1 = NOOP;
|
|
10030
10029
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10031
10030
|
const devtools = void 0;
|
|
@@ -10294,11 +10293,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
10294
10293
|
addTransitionClass(el, legacyLeaveFromClass);
|
|
10295
10294
|
}
|
|
10296
10295
|
if (!el._enterCancelled) {
|
|
10297
|
-
forceReflow();
|
|
10296
|
+
forceReflow(el);
|
|
10298
10297
|
addTransitionClass(el, leaveActiveClass);
|
|
10299
10298
|
} else {
|
|
10300
10299
|
addTransitionClass(el, leaveActiveClass);
|
|
10301
|
-
forceReflow();
|
|
10300
|
+
forceReflow(el);
|
|
10302
10301
|
}
|
|
10303
10302
|
nextFrame(() => {
|
|
10304
10303
|
if (!el._isLeaving) {
|
|
@@ -10444,8 +10443,9 @@ function toMs(s) {
|
|
|
10444
10443
|
if (s === "auto") return 0;
|
|
10445
10444
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
10446
10445
|
}
|
|
10447
|
-
function forceReflow() {
|
|
10448
|
-
|
|
10446
|
+
function forceReflow(el) {
|
|
10447
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
10448
|
+
return targetDocument.body.offsetHeight;
|
|
10449
10449
|
}
|
|
10450
10450
|
|
|
10451
10451
|
function patchClass(el, value, isSVG) {
|
|
@@ -10900,7 +10900,11 @@ class VueElement extends BaseClass {
|
|
|
10900
10900
|
this._root = this.shadowRoot;
|
|
10901
10901
|
} else {
|
|
10902
10902
|
if (_def.shadowRoot !== false) {
|
|
10903
|
-
this.attachShadow(
|
|
10903
|
+
this.attachShadow(
|
|
10904
|
+
extend$1({}, _def.shadowRootOptions, {
|
|
10905
|
+
mode: "open"
|
|
10906
|
+
})
|
|
10907
|
+
);
|
|
10904
10908
|
this._root = this.shadowRoot;
|
|
10905
10909
|
} else {
|
|
10906
10910
|
this._root = this;
|
|
@@ -10960,9 +10964,18 @@ class VueElement extends BaseClass {
|
|
|
10960
10964
|
this._app && this._app.unmount();
|
|
10961
10965
|
if (this._instance) this._instance.ce = void 0;
|
|
10962
10966
|
this._app = this._instance = null;
|
|
10967
|
+
if (this._teleportTargets) {
|
|
10968
|
+
this._teleportTargets.clear();
|
|
10969
|
+
this._teleportTargets = void 0;
|
|
10970
|
+
}
|
|
10963
10971
|
}
|
|
10964
10972
|
});
|
|
10965
10973
|
}
|
|
10974
|
+
_processMutations(mutations) {
|
|
10975
|
+
for (const m of mutations) {
|
|
10976
|
+
this._setAttr(m.attributeName);
|
|
10977
|
+
}
|
|
10978
|
+
}
|
|
10966
10979
|
/**
|
|
10967
10980
|
* resolve inner component definition (handle possible async component)
|
|
10968
10981
|
*/
|
|
@@ -10973,11 +10986,7 @@ class VueElement extends BaseClass {
|
|
|
10973
10986
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
10974
10987
|
this._setAttr(this.attributes[i].name);
|
|
10975
10988
|
}
|
|
10976
|
-
this._ob = new MutationObserver((
|
|
10977
|
-
for (const m of mutations) {
|
|
10978
|
-
this._setAttr(m.attributeName);
|
|
10979
|
-
}
|
|
10980
|
-
});
|
|
10989
|
+
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
10981
10990
|
this._ob.observe(this, { attributes: true });
|
|
10982
10991
|
const resolve = (def, isAsync = false) => {
|
|
10983
10992
|
this._resolved = true;
|
|
@@ -11084,7 +11093,10 @@ class VueElement extends BaseClass {
|
|
|
11084
11093
|
}
|
|
11085
11094
|
if (shouldReflect) {
|
|
11086
11095
|
const ob = this._ob;
|
|
11087
|
-
|
|
11096
|
+
if (ob) {
|
|
11097
|
+
this._processMutations(ob.takeRecords());
|
|
11098
|
+
ob.disconnect();
|
|
11099
|
+
}
|
|
11088
11100
|
if (val === true) {
|
|
11089
11101
|
this.setAttribute(hyphenate(key), "");
|
|
11090
11102
|
} else if (typeof val === "string" || typeof val === "number") {
|
|
@@ -11163,7 +11175,7 @@ class VueElement extends BaseClass {
|
|
|
11163
11175
|
* Only called when shadowRoot is false
|
|
11164
11176
|
*/
|
|
11165
11177
|
_renderSlots() {
|
|
11166
|
-
const outlets =
|
|
11178
|
+
const outlets = this._getSlots();
|
|
11167
11179
|
const scopeId = this._instance.type.__scopeId;
|
|
11168
11180
|
for (let i = 0; i < outlets.length; i++) {
|
|
11169
11181
|
const o = outlets[i];
|
|
@@ -11189,6 +11201,19 @@ class VueElement extends BaseClass {
|
|
|
11189
11201
|
parent.removeChild(o);
|
|
11190
11202
|
}
|
|
11191
11203
|
}
|
|
11204
|
+
/**
|
|
11205
|
+
* @internal
|
|
11206
|
+
*/
|
|
11207
|
+
_getSlots() {
|
|
11208
|
+
const roots = [this];
|
|
11209
|
+
if (this._teleportTargets) {
|
|
11210
|
+
roots.push(...this._teleportTargets);
|
|
11211
|
+
}
|
|
11212
|
+
return roots.reduce((res, i) => {
|
|
11213
|
+
res.push(...Array.from(i.querySelectorAll("slot")));
|
|
11214
|
+
return res;
|
|
11215
|
+
}, []);
|
|
11216
|
+
}
|
|
11192
11217
|
/**
|
|
11193
11218
|
* @internal
|
|
11194
11219
|
*/
|
|
@@ -11270,7 +11295,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
11270
11295
|
prevChildren.forEach(callPendingCbs);
|
|
11271
11296
|
prevChildren.forEach(recordPosition);
|
|
11272
11297
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
11273
|
-
forceReflow();
|
|
11298
|
+
forceReflow(instance.vnode.el);
|
|
11274
11299
|
movedChildren.forEach((c) => {
|
|
11275
11300
|
const el = c.el;
|
|
11276
11301
|
const style = el.style;
|
|
@@ -13260,16 +13285,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
13260
13285
|
(id) => markScopeIdentifier(node, id, knownIds)
|
|
13261
13286
|
);
|
|
13262
13287
|
}
|
|
13288
|
+
} else if (node.type === "SwitchStatement") {
|
|
13289
|
+
if (node.scopeIds) {
|
|
13290
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
13291
|
+
} else {
|
|
13292
|
+
walkSwitchStatement(
|
|
13293
|
+
node,
|
|
13294
|
+
false,
|
|
13295
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
13296
|
+
);
|
|
13297
|
+
}
|
|
13263
13298
|
} else if (node.type === "CatchClause" && node.param) {
|
|
13264
|
-
|
|
13265
|
-
|
|
13299
|
+
if (node.scopeIds) {
|
|
13300
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
13301
|
+
} else {
|
|
13302
|
+
for (const id of extractIdentifiers(node.param)) {
|
|
13303
|
+
markScopeIdentifier(node, id, knownIds);
|
|
13304
|
+
}
|
|
13266
13305
|
}
|
|
13267
13306
|
} else if (isForStatement(node)) {
|
|
13268
|
-
|
|
13269
|
-
node,
|
|
13270
|
-
|
|
13271
|
-
(
|
|
13272
|
-
|
|
13307
|
+
if (node.scopeIds) {
|
|
13308
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
13309
|
+
} else {
|
|
13310
|
+
walkForStatement(
|
|
13311
|
+
node,
|
|
13312
|
+
false,
|
|
13313
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
13314
|
+
);
|
|
13315
|
+
}
|
|
13273
13316
|
}
|
|
13274
13317
|
},
|
|
13275
13318
|
leave(node, parent) {
|
|
@@ -13340,7 +13383,8 @@ function walkFunctionParams(node, onIdent) {
|
|
|
13340
13383
|
}
|
|
13341
13384
|
}
|
|
13342
13385
|
function walkBlockDeclarations(block, onIdent) {
|
|
13343
|
-
|
|
13386
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
13387
|
+
for (const stmt of body) {
|
|
13344
13388
|
if (stmt.type === "VariableDeclaration") {
|
|
13345
13389
|
if (stmt.declare) continue;
|
|
13346
13390
|
for (const decl of stmt.declarations) {
|
|
@@ -13353,6 +13397,8 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
13353
13397
|
onIdent(stmt.id);
|
|
13354
13398
|
} else if (isForStatement(stmt)) {
|
|
13355
13399
|
walkForStatement(stmt, true, onIdent);
|
|
13400
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
13401
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
13356
13402
|
}
|
|
13357
13403
|
}
|
|
13358
13404
|
}
|
|
@@ -13369,6 +13415,20 @@ function walkForStatement(stmt, isVar, onIdent) {
|
|
|
13369
13415
|
}
|
|
13370
13416
|
}
|
|
13371
13417
|
}
|
|
13418
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
13419
|
+
for (const cs of stmt.cases) {
|
|
13420
|
+
for (const stmt2 of cs.consequent) {
|
|
13421
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
13422
|
+
for (const decl of stmt2.declarations) {
|
|
13423
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
13424
|
+
onIdent(id);
|
|
13425
|
+
}
|
|
13426
|
+
}
|
|
13427
|
+
}
|
|
13428
|
+
}
|
|
13429
|
+
walkBlockDeclarations(cs, onIdent);
|
|
13430
|
+
}
|
|
13431
|
+
}
|
|
13372
13432
|
function extractIdentifiers(param, nodes = []) {
|
|
13373
13433
|
switch (param.type) {
|
|
13374
13434
|
case "Identifier":
|
|
@@ -13604,6 +13664,7 @@ function isCoreComponent(tag) {
|
|
|
13604
13664
|
}
|
|
13605
13665
|
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
13606
13666
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
13667
|
+
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
13607
13668
|
const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
|
|
13608
13669
|
const isMemberExpressionNode = (exp, context) => {
|
|
13609
13670
|
try {
|
|
@@ -16371,90 +16432,6 @@ function getParentCondition(node) {
|
|
|
16371
16432
|
}
|
|
16372
16433
|
}
|
|
16373
16434
|
|
|
16374
|
-
const transformBind = (dir, _node, context) => {
|
|
16375
|
-
const { modifiers, loc } = dir;
|
|
16376
|
-
const arg = dir.arg;
|
|
16377
|
-
let { exp } = dir;
|
|
16378
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
16379
|
-
{
|
|
16380
|
-
context.onError(
|
|
16381
|
-
createCompilerError(34, loc)
|
|
16382
|
-
);
|
|
16383
|
-
return {
|
|
16384
|
-
props: [
|
|
16385
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
16386
|
-
]
|
|
16387
|
-
};
|
|
16388
|
-
}
|
|
16389
|
-
}
|
|
16390
|
-
if (!exp) {
|
|
16391
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
16392
|
-
context.onError(
|
|
16393
|
-
createCompilerError(
|
|
16394
|
-
52,
|
|
16395
|
-
arg.loc
|
|
16396
|
-
)
|
|
16397
|
-
);
|
|
16398
|
-
return {
|
|
16399
|
-
props: [
|
|
16400
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
16401
|
-
]
|
|
16402
|
-
};
|
|
16403
|
-
}
|
|
16404
|
-
transformBindShorthand(dir, context);
|
|
16405
|
-
exp = dir.exp;
|
|
16406
|
-
}
|
|
16407
|
-
if (arg.type !== 4) {
|
|
16408
|
-
arg.children.unshift(`(`);
|
|
16409
|
-
arg.children.push(`) || ""`);
|
|
16410
|
-
} else if (!arg.isStatic) {
|
|
16411
|
-
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
16412
|
-
}
|
|
16413
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
16414
|
-
if (arg.type === 4) {
|
|
16415
|
-
if (arg.isStatic) {
|
|
16416
|
-
arg.content = camelize(arg.content);
|
|
16417
|
-
} else {
|
|
16418
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
16419
|
-
}
|
|
16420
|
-
} else {
|
|
16421
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
16422
|
-
arg.children.push(`)`);
|
|
16423
|
-
}
|
|
16424
|
-
}
|
|
16425
|
-
if (!context.inSSR) {
|
|
16426
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
16427
|
-
injectPrefix(arg, ".");
|
|
16428
|
-
}
|
|
16429
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
16430
|
-
injectPrefix(arg, "^");
|
|
16431
|
-
}
|
|
16432
|
-
}
|
|
16433
|
-
return {
|
|
16434
|
-
props: [createObjectProperty(arg, exp)]
|
|
16435
|
-
};
|
|
16436
|
-
};
|
|
16437
|
-
const transformBindShorthand = (dir, context) => {
|
|
16438
|
-
const arg = dir.arg;
|
|
16439
|
-
const propName = camelize(arg.content);
|
|
16440
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
16441
|
-
{
|
|
16442
|
-
dir.exp = processExpression(dir.exp, context);
|
|
16443
|
-
}
|
|
16444
|
-
};
|
|
16445
|
-
const injectPrefix = (arg, prefix) => {
|
|
16446
|
-
if (arg.type === 4) {
|
|
16447
|
-
if (arg.isStatic) {
|
|
16448
|
-
arg.content = prefix + arg.content;
|
|
16449
|
-
} else {
|
|
16450
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
16451
|
-
}
|
|
16452
|
-
} else {
|
|
16453
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
16454
|
-
arg.children.push(`)`);
|
|
16455
|
-
}
|
|
16456
|
-
};
|
|
16457
|
-
|
|
16458
16435
|
const transformFor = createStructuralDirectiveTransform(
|
|
16459
16436
|
"for",
|
|
16460
16437
|
(node, dir, context) => {
|
|
@@ -16467,9 +16444,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
16467
16444
|
const memo = findDir(node, "memo");
|
|
16468
16445
|
const keyProp = findProp(node, `key`, false, true);
|
|
16469
16446
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
16470
|
-
if (isDirKey && !keyProp.exp) {
|
|
16471
|
-
transformBindShorthand(keyProp, context);
|
|
16472
|
-
}
|
|
16473
16447
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
16474
16448
|
if (memo && keyExp && isDirKey) {
|
|
16475
16449
|
{
|
|
@@ -17752,6 +17726,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
17752
17726
|
return ret;
|
|
17753
17727
|
};
|
|
17754
17728
|
|
|
17729
|
+
const transformBind = (dir, _node, context) => {
|
|
17730
|
+
const { modifiers, loc } = dir;
|
|
17731
|
+
const arg = dir.arg;
|
|
17732
|
+
let { exp } = dir;
|
|
17733
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
17734
|
+
{
|
|
17735
|
+
context.onError(
|
|
17736
|
+
createCompilerError(34, loc)
|
|
17737
|
+
);
|
|
17738
|
+
return {
|
|
17739
|
+
props: [
|
|
17740
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
17741
|
+
]
|
|
17742
|
+
};
|
|
17743
|
+
}
|
|
17744
|
+
}
|
|
17745
|
+
if (arg.type !== 4) {
|
|
17746
|
+
arg.children.unshift(`(`);
|
|
17747
|
+
arg.children.push(`) || ""`);
|
|
17748
|
+
} else if (!arg.isStatic) {
|
|
17749
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
17750
|
+
}
|
|
17751
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
17752
|
+
if (arg.type === 4) {
|
|
17753
|
+
if (arg.isStatic) {
|
|
17754
|
+
arg.content = camelize(arg.content);
|
|
17755
|
+
} else {
|
|
17756
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
17757
|
+
}
|
|
17758
|
+
} else {
|
|
17759
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
17760
|
+
arg.children.push(`)`);
|
|
17761
|
+
}
|
|
17762
|
+
}
|
|
17763
|
+
if (!context.inSSR) {
|
|
17764
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
17765
|
+
injectPrefix(arg, ".");
|
|
17766
|
+
}
|
|
17767
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
17768
|
+
injectPrefix(arg, "^");
|
|
17769
|
+
}
|
|
17770
|
+
}
|
|
17771
|
+
return {
|
|
17772
|
+
props: [createObjectProperty(arg, exp)]
|
|
17773
|
+
};
|
|
17774
|
+
};
|
|
17775
|
+
const injectPrefix = (arg, prefix) => {
|
|
17776
|
+
if (arg.type === 4) {
|
|
17777
|
+
if (arg.isStatic) {
|
|
17778
|
+
arg.content = prefix + arg.content;
|
|
17779
|
+
} else {
|
|
17780
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
17781
|
+
}
|
|
17782
|
+
} else {
|
|
17783
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
17784
|
+
arg.children.push(`)`);
|
|
17785
|
+
}
|
|
17786
|
+
};
|
|
17787
|
+
|
|
17755
17788
|
const transformText = (node, context) => {
|
|
17756
17789
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
17757
17790
|
return () => {
|
|
@@ -18102,9 +18135,35 @@ const transformMemo = (node, context) => {
|
|
|
18102
18135
|
}
|
|
18103
18136
|
};
|
|
18104
18137
|
|
|
18138
|
+
const transformVBindShorthand = (node, context) => {
|
|
18139
|
+
if (node.type === 1) {
|
|
18140
|
+
for (const prop of node.props) {
|
|
18141
|
+
if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
|
|
18142
|
+
const arg = prop.arg;
|
|
18143
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
18144
|
+
context.onError(
|
|
18145
|
+
createCompilerError(
|
|
18146
|
+
52,
|
|
18147
|
+
arg.loc
|
|
18148
|
+
)
|
|
18149
|
+
);
|
|
18150
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
18151
|
+
} else {
|
|
18152
|
+
const propName = camelize(arg.content);
|
|
18153
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
18154
|
+
propName[0] === "-") {
|
|
18155
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
18156
|
+
}
|
|
18157
|
+
}
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
18160
|
+
}
|
|
18161
|
+
};
|
|
18162
|
+
|
|
18105
18163
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
18106
18164
|
return [
|
|
18107
18165
|
[
|
|
18166
|
+
transformVBindShorthand,
|
|
18108
18167
|
transformOnce,
|
|
18109
18168
|
transformIf,
|
|
18110
18169
|
transformMemo,
|
|
@@ -18600,6 +18659,9 @@ function analyzeNode(node) {
|
|
|
18600
18659
|
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
|
18601
18660
|
return false;
|
|
18602
18661
|
}
|
|
18662
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
18663
|
+
return false;
|
|
18664
|
+
}
|
|
18603
18665
|
if (node.type === 12) {
|
|
18604
18666
|
return [1, 0];
|
|
18605
18667
|
}
|