@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.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
|
**/
|
|
@@ -1268,7 +1268,7 @@ function iterator(self, method, wrapValue) {
|
|
|
1268
1268
|
iter._next = iter.next;
|
|
1269
1269
|
iter.next = () => {
|
|
1270
1270
|
const result = iter._next();
|
|
1271
|
-
if (result.
|
|
1271
|
+
if (!result.done) {
|
|
1272
1272
|
result.value = wrapValue(result.value);
|
|
1273
1273
|
}
|
|
1274
1274
|
return result;
|
|
@@ -1395,7 +1395,8 @@ class BaseReactiveHandler {
|
|
|
1395
1395
|
return res;
|
|
1396
1396
|
}
|
|
1397
1397
|
if (isRef(res)) {
|
|
1398
|
-
|
|
1398
|
+
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
1399
|
+
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
1399
1400
|
}
|
|
1400
1401
|
if (isObject(res)) {
|
|
1401
1402
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
@@ -2745,14 +2746,11 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
2745
2746
|
let isHmrUpdating = false;
|
|
2746
2747
|
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
2747
2748
|
{
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
reload: tryWrap(reload)
|
|
2754
|
-
};
|
|
2755
|
-
}
|
|
2749
|
+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
2750
|
+
createRecord: tryWrap(createRecord),
|
|
2751
|
+
rerender: tryWrap(rerender),
|
|
2752
|
+
reload: tryWrap(reload)
|
|
2753
|
+
};
|
|
2756
2754
|
}
|
|
2757
2755
|
const map = /* @__PURE__ */ new Map();
|
|
2758
2756
|
function registerHMR(instance) {
|
|
@@ -3647,9 +3645,6 @@ const TeleportImpl = {
|
|
|
3647
3645
|
insert(mainAnchor, container, anchor);
|
|
3648
3646
|
const mount = (container2, anchor2) => {
|
|
3649
3647
|
if (shapeFlag & 16) {
|
|
3650
|
-
if (parentComponent && parentComponent.isCE) {
|
|
3651
|
-
parentComponent.ce._teleportTarget = container2;
|
|
3652
|
-
}
|
|
3653
3648
|
mountChildren(
|
|
3654
3649
|
children,
|
|
3655
3650
|
container2,
|
|
@@ -3671,6 +3666,9 @@ const TeleportImpl = {
|
|
|
3671
3666
|
} else if (namespace !== "mathml" && isTargetMathML(target)) {
|
|
3672
3667
|
namespace = "mathml";
|
|
3673
3668
|
}
|
|
3669
|
+
if (parentComponent && parentComponent.isCE) {
|
|
3670
|
+
(parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
3671
|
+
}
|
|
3674
3672
|
if (!disabled) {
|
|
3675
3673
|
mount(target, targetAnchor);
|
|
3676
3674
|
updateCssVars(n2, false);
|
|
@@ -6127,12 +6125,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
6127
6125
|
|
|
6128
6126
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
6129
6127
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
6128
|
+
const hasProps = Object.keys(props).length > 0;
|
|
6130
6129
|
if (name !== "default") props.name = name;
|
|
6131
6130
|
return openBlock(), createBlock(
|
|
6132
6131
|
Fragment,
|
|
6133
6132
|
null,
|
|
6134
6133
|
[createVNode("slot", props, fallback && fallback())],
|
|
6135
|
-
64
|
|
6134
|
+
hasProps ? -2 : 64
|
|
6136
6135
|
);
|
|
6137
6136
|
}
|
|
6138
6137
|
let slot = slots[name];
|
|
@@ -7323,7 +7322,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
7323
7322
|
return vm;
|
|
7324
7323
|
}
|
|
7325
7324
|
}
|
|
7326
|
-
Vue.version = `2.6.14-compat:${"3.5.
|
|
7325
|
+
Vue.version = `2.6.14-compat:${"3.5.22"}`;
|
|
7327
7326
|
Vue.config = singletonApp.config;
|
|
7328
7327
|
Vue.use = (plugin, ...options) => {
|
|
7329
7328
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -12248,31 +12247,28 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
12248
12247
|
};
|
|
12249
12248
|
|
|
12250
12249
|
function h(type, propsOrChildren, children) {
|
|
12251
|
-
|
|
12250
|
+
try {
|
|
12252
12251
|
setBlockTracking(-1);
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
if (isVNode(propsOrChildren)) {
|
|
12263
|
-
return doCreateVNode(type, null, [propsOrChildren]);
|
|
12252
|
+
const l = arguments.length;
|
|
12253
|
+
if (l === 2) {
|
|
12254
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
12255
|
+
if (isVNode(propsOrChildren)) {
|
|
12256
|
+
return createVNode(type, null, [propsOrChildren]);
|
|
12257
|
+
}
|
|
12258
|
+
return createVNode(type, propsOrChildren);
|
|
12259
|
+
} else {
|
|
12260
|
+
return createVNode(type, null, propsOrChildren);
|
|
12264
12261
|
}
|
|
12265
|
-
return doCreateVNode(type, propsOrChildren);
|
|
12266
12262
|
} else {
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
children = [children];
|
|
12263
|
+
if (l > 3) {
|
|
12264
|
+
children = Array.prototype.slice.call(arguments, 2);
|
|
12265
|
+
} else if (l === 3 && isVNode(children)) {
|
|
12266
|
+
children = [children];
|
|
12267
|
+
}
|
|
12268
|
+
return createVNode(type, propsOrChildren, children);
|
|
12274
12269
|
}
|
|
12275
|
-
|
|
12270
|
+
} finally {
|
|
12271
|
+
setBlockTracking(1);
|
|
12276
12272
|
}
|
|
12277
12273
|
}
|
|
12278
12274
|
|
|
@@ -12482,7 +12478,7 @@ function isMemoSame(cached, memo) {
|
|
|
12482
12478
|
return true;
|
|
12483
12479
|
}
|
|
12484
12480
|
|
|
12485
|
-
const version = "3.5.
|
|
12481
|
+
const version = "3.5.22";
|
|
12486
12482
|
const warn = warn$1 ;
|
|
12487
12483
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
12488
12484
|
const devtools = devtools$1 ;
|
|
@@ -12752,11 +12748,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
12752
12748
|
addTransitionClass(el, legacyLeaveFromClass);
|
|
12753
12749
|
}
|
|
12754
12750
|
if (!el._enterCancelled) {
|
|
12755
|
-
forceReflow();
|
|
12751
|
+
forceReflow(el);
|
|
12756
12752
|
addTransitionClass(el, leaveActiveClass);
|
|
12757
12753
|
} else {
|
|
12758
12754
|
addTransitionClass(el, leaveActiveClass);
|
|
12759
|
-
forceReflow();
|
|
12755
|
+
forceReflow(el);
|
|
12760
12756
|
}
|
|
12761
12757
|
nextFrame(() => {
|
|
12762
12758
|
if (!el._isLeaving) {
|
|
@@ -12905,8 +12901,9 @@ function toMs(s) {
|
|
|
12905
12901
|
if (s === "auto") return 0;
|
|
12906
12902
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
12907
12903
|
}
|
|
12908
|
-
function forceReflow() {
|
|
12909
|
-
|
|
12904
|
+
function forceReflow(el) {
|
|
12905
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
12906
|
+
return targetDocument.body.offsetHeight;
|
|
12910
12907
|
}
|
|
12911
12908
|
|
|
12912
12909
|
function patchClass(el, value, isSVG) {
|
|
@@ -13395,7 +13392,11 @@ class VueElement extends BaseClass {
|
|
|
13395
13392
|
);
|
|
13396
13393
|
}
|
|
13397
13394
|
if (_def.shadowRoot !== false) {
|
|
13398
|
-
this.attachShadow(
|
|
13395
|
+
this.attachShadow(
|
|
13396
|
+
extend({}, _def.shadowRootOptions, {
|
|
13397
|
+
mode: "open"
|
|
13398
|
+
})
|
|
13399
|
+
);
|
|
13399
13400
|
this._root = this.shadowRoot;
|
|
13400
13401
|
} else {
|
|
13401
13402
|
this._root = this;
|
|
@@ -13455,9 +13456,18 @@ class VueElement extends BaseClass {
|
|
|
13455
13456
|
this._app && this._app.unmount();
|
|
13456
13457
|
if (this._instance) this._instance.ce = void 0;
|
|
13457
13458
|
this._app = this._instance = null;
|
|
13459
|
+
if (this._teleportTargets) {
|
|
13460
|
+
this._teleportTargets.clear();
|
|
13461
|
+
this._teleportTargets = void 0;
|
|
13462
|
+
}
|
|
13458
13463
|
}
|
|
13459
13464
|
});
|
|
13460
13465
|
}
|
|
13466
|
+
_processMutations(mutations) {
|
|
13467
|
+
for (const m of mutations) {
|
|
13468
|
+
this._setAttr(m.attributeName);
|
|
13469
|
+
}
|
|
13470
|
+
}
|
|
13461
13471
|
/**
|
|
13462
13472
|
* resolve inner component definition (handle possible async component)
|
|
13463
13473
|
*/
|
|
@@ -13468,11 +13478,7 @@ class VueElement extends BaseClass {
|
|
|
13468
13478
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
13469
13479
|
this._setAttr(this.attributes[i].name);
|
|
13470
13480
|
}
|
|
13471
|
-
this._ob = new MutationObserver((
|
|
13472
|
-
for (const m of mutations) {
|
|
13473
|
-
this._setAttr(m.attributeName);
|
|
13474
|
-
}
|
|
13475
|
-
});
|
|
13481
|
+
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
13476
13482
|
this._ob.observe(this, { attributes: true });
|
|
13477
13483
|
const resolve = (def, isAsync = false) => {
|
|
13478
13484
|
this._resolved = true;
|
|
@@ -13588,7 +13594,10 @@ class VueElement extends BaseClass {
|
|
|
13588
13594
|
}
|
|
13589
13595
|
if (shouldReflect) {
|
|
13590
13596
|
const ob = this._ob;
|
|
13591
|
-
|
|
13597
|
+
if (ob) {
|
|
13598
|
+
this._processMutations(ob.takeRecords());
|
|
13599
|
+
ob.disconnect();
|
|
13600
|
+
}
|
|
13592
13601
|
if (val === true) {
|
|
13593
13602
|
this.setAttribute(hyphenate(key), "");
|
|
13594
13603
|
} else if (typeof val === "string" || typeof val === "number") {
|
|
@@ -13692,7 +13701,7 @@ class VueElement extends BaseClass {
|
|
|
13692
13701
|
* Only called when shadowRoot is false
|
|
13693
13702
|
*/
|
|
13694
13703
|
_renderSlots() {
|
|
13695
|
-
const outlets =
|
|
13704
|
+
const outlets = this._getSlots();
|
|
13696
13705
|
const scopeId = this._instance.type.__scopeId;
|
|
13697
13706
|
for (let i = 0; i < outlets.length; i++) {
|
|
13698
13707
|
const o = outlets[i];
|
|
@@ -13718,6 +13727,19 @@ class VueElement extends BaseClass {
|
|
|
13718
13727
|
parent.removeChild(o);
|
|
13719
13728
|
}
|
|
13720
13729
|
}
|
|
13730
|
+
/**
|
|
13731
|
+
* @internal
|
|
13732
|
+
*/
|
|
13733
|
+
_getSlots() {
|
|
13734
|
+
const roots = [this];
|
|
13735
|
+
if (this._teleportTargets) {
|
|
13736
|
+
roots.push(...this._teleportTargets);
|
|
13737
|
+
}
|
|
13738
|
+
return roots.reduce((res, i) => {
|
|
13739
|
+
res.push(...Array.from(i.querySelectorAll("slot")));
|
|
13740
|
+
return res;
|
|
13741
|
+
}, []);
|
|
13742
|
+
}
|
|
13721
13743
|
/**
|
|
13722
13744
|
* @internal
|
|
13723
13745
|
*/
|
|
@@ -13822,7 +13844,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
13822
13844
|
prevChildren.forEach(callPendingCbs);
|
|
13823
13845
|
prevChildren.forEach(recordPosition);
|
|
13824
13846
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
13825
|
-
forceReflow();
|
|
13847
|
+
forceReflow(instance.vnode.el);
|
|
13826
13848
|
movedChildren.forEach((c) => {
|
|
13827
13849
|
const el = c.el;
|
|
13828
13850
|
const style = el.style;
|
|
@@ -15938,16 +15960,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
15938
15960
|
(id) => markScopeIdentifier(node, id, knownIds)
|
|
15939
15961
|
);
|
|
15940
15962
|
}
|
|
15963
|
+
} else if (node.type === "SwitchStatement") {
|
|
15964
|
+
if (node.scopeIds) {
|
|
15965
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
15966
|
+
} else {
|
|
15967
|
+
walkSwitchStatement(
|
|
15968
|
+
node,
|
|
15969
|
+
false,
|
|
15970
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
15971
|
+
);
|
|
15972
|
+
}
|
|
15941
15973
|
} else if (node.type === "CatchClause" && node.param) {
|
|
15942
|
-
|
|
15943
|
-
|
|
15974
|
+
if (node.scopeIds) {
|
|
15975
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
15976
|
+
} else {
|
|
15977
|
+
for (const id of extractIdentifiers(node.param)) {
|
|
15978
|
+
markScopeIdentifier(node, id, knownIds);
|
|
15979
|
+
}
|
|
15944
15980
|
}
|
|
15945
15981
|
} else if (isForStatement(node)) {
|
|
15946
|
-
|
|
15947
|
-
node,
|
|
15948
|
-
|
|
15949
|
-
(
|
|
15950
|
-
|
|
15982
|
+
if (node.scopeIds) {
|
|
15983
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
15984
|
+
} else {
|
|
15985
|
+
walkForStatement(
|
|
15986
|
+
node,
|
|
15987
|
+
false,
|
|
15988
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
15989
|
+
);
|
|
15990
|
+
}
|
|
15951
15991
|
}
|
|
15952
15992
|
},
|
|
15953
15993
|
leave(node, parent) {
|
|
@@ -16018,7 +16058,8 @@ function walkFunctionParams(node, onIdent) {
|
|
|
16018
16058
|
}
|
|
16019
16059
|
}
|
|
16020
16060
|
function walkBlockDeclarations(block, onIdent) {
|
|
16021
|
-
|
|
16061
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
16062
|
+
for (const stmt of body) {
|
|
16022
16063
|
if (stmt.type === "VariableDeclaration") {
|
|
16023
16064
|
if (stmt.declare) continue;
|
|
16024
16065
|
for (const decl of stmt.declarations) {
|
|
@@ -16031,6 +16072,8 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
16031
16072
|
onIdent(stmt.id);
|
|
16032
16073
|
} else if (isForStatement(stmt)) {
|
|
16033
16074
|
walkForStatement(stmt, true, onIdent);
|
|
16075
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
16076
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
16034
16077
|
}
|
|
16035
16078
|
}
|
|
16036
16079
|
}
|
|
@@ -16047,6 +16090,20 @@ function walkForStatement(stmt, isVar, onIdent) {
|
|
|
16047
16090
|
}
|
|
16048
16091
|
}
|
|
16049
16092
|
}
|
|
16093
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
16094
|
+
for (const cs of stmt.cases) {
|
|
16095
|
+
for (const stmt2 of cs.consequent) {
|
|
16096
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
16097
|
+
for (const decl of stmt2.declarations) {
|
|
16098
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
16099
|
+
onIdent(id);
|
|
16100
|
+
}
|
|
16101
|
+
}
|
|
16102
|
+
}
|
|
16103
|
+
}
|
|
16104
|
+
walkBlockDeclarations(cs, onIdent);
|
|
16105
|
+
}
|
|
16106
|
+
}
|
|
16050
16107
|
function extractIdentifiers(param, nodes = []) {
|
|
16051
16108
|
switch (param.type) {
|
|
16052
16109
|
case "Identifier":
|
|
@@ -16282,6 +16339,7 @@ function isCoreComponent(tag) {
|
|
|
16282
16339
|
}
|
|
16283
16340
|
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
16284
16341
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
16342
|
+
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
16285
16343
|
const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
|
|
16286
16344
|
const isMemberExpressionNode = (exp, context) => {
|
|
16287
16345
|
try {
|
|
@@ -19135,90 +19193,6 @@ function getParentCondition(node) {
|
|
|
19135
19193
|
}
|
|
19136
19194
|
}
|
|
19137
19195
|
|
|
19138
|
-
const transformBind = (dir, _node, context) => {
|
|
19139
|
-
const { modifiers, loc } = dir;
|
|
19140
|
-
const arg = dir.arg;
|
|
19141
|
-
let { exp } = dir;
|
|
19142
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
19143
|
-
{
|
|
19144
|
-
context.onError(
|
|
19145
|
-
createCompilerError(34, loc)
|
|
19146
|
-
);
|
|
19147
|
-
return {
|
|
19148
|
-
props: [
|
|
19149
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
19150
|
-
]
|
|
19151
|
-
};
|
|
19152
|
-
}
|
|
19153
|
-
}
|
|
19154
|
-
if (!exp) {
|
|
19155
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
19156
|
-
context.onError(
|
|
19157
|
-
createCompilerError(
|
|
19158
|
-
52,
|
|
19159
|
-
arg.loc
|
|
19160
|
-
)
|
|
19161
|
-
);
|
|
19162
|
-
return {
|
|
19163
|
-
props: [
|
|
19164
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
19165
|
-
]
|
|
19166
|
-
};
|
|
19167
|
-
}
|
|
19168
|
-
transformBindShorthand(dir, context);
|
|
19169
|
-
exp = dir.exp;
|
|
19170
|
-
}
|
|
19171
|
-
if (arg.type !== 4) {
|
|
19172
|
-
arg.children.unshift(`(`);
|
|
19173
|
-
arg.children.push(`) || ""`);
|
|
19174
|
-
} else if (!arg.isStatic) {
|
|
19175
|
-
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
19176
|
-
}
|
|
19177
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
19178
|
-
if (arg.type === 4) {
|
|
19179
|
-
if (arg.isStatic) {
|
|
19180
|
-
arg.content = camelize(arg.content);
|
|
19181
|
-
} else {
|
|
19182
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
19183
|
-
}
|
|
19184
|
-
} else {
|
|
19185
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
19186
|
-
arg.children.push(`)`);
|
|
19187
|
-
}
|
|
19188
|
-
}
|
|
19189
|
-
if (!context.inSSR) {
|
|
19190
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
19191
|
-
injectPrefix(arg, ".");
|
|
19192
|
-
}
|
|
19193
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
19194
|
-
injectPrefix(arg, "^");
|
|
19195
|
-
}
|
|
19196
|
-
}
|
|
19197
|
-
return {
|
|
19198
|
-
props: [createObjectProperty(arg, exp)]
|
|
19199
|
-
};
|
|
19200
|
-
};
|
|
19201
|
-
const transformBindShorthand = (dir, context) => {
|
|
19202
|
-
const arg = dir.arg;
|
|
19203
|
-
const propName = camelize(arg.content);
|
|
19204
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
19205
|
-
{
|
|
19206
|
-
dir.exp = processExpression(dir.exp, context);
|
|
19207
|
-
}
|
|
19208
|
-
};
|
|
19209
|
-
const injectPrefix = (arg, prefix) => {
|
|
19210
|
-
if (arg.type === 4) {
|
|
19211
|
-
if (arg.isStatic) {
|
|
19212
|
-
arg.content = prefix + arg.content;
|
|
19213
|
-
} else {
|
|
19214
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
19215
|
-
}
|
|
19216
|
-
} else {
|
|
19217
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
19218
|
-
arg.children.push(`)`);
|
|
19219
|
-
}
|
|
19220
|
-
};
|
|
19221
|
-
|
|
19222
19196
|
const transformFor = createStructuralDirectiveTransform(
|
|
19223
19197
|
"for",
|
|
19224
19198
|
(node, dir, context) => {
|
|
@@ -19231,9 +19205,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
19231
19205
|
const memo = findDir(node, "memo");
|
|
19232
19206
|
const keyProp = findProp(node, `key`, false, true);
|
|
19233
19207
|
const isDirKey = keyProp && keyProp.type === 7;
|
|
19234
|
-
if (isDirKey && !keyProp.exp) {
|
|
19235
|
-
transformBindShorthand(keyProp, context);
|
|
19236
|
-
}
|
|
19237
19208
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
19238
19209
|
if (memo && keyExp && isDirKey) {
|
|
19239
19210
|
{
|
|
@@ -20549,6 +20520,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
20549
20520
|
return ret;
|
|
20550
20521
|
};
|
|
20551
20522
|
|
|
20523
|
+
const transformBind = (dir, _node, context) => {
|
|
20524
|
+
const { modifiers, loc } = dir;
|
|
20525
|
+
const arg = dir.arg;
|
|
20526
|
+
let { exp } = dir;
|
|
20527
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
20528
|
+
{
|
|
20529
|
+
context.onError(
|
|
20530
|
+
createCompilerError(34, loc)
|
|
20531
|
+
);
|
|
20532
|
+
return {
|
|
20533
|
+
props: [
|
|
20534
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
20535
|
+
]
|
|
20536
|
+
};
|
|
20537
|
+
}
|
|
20538
|
+
}
|
|
20539
|
+
if (arg.type !== 4) {
|
|
20540
|
+
arg.children.unshift(`(`);
|
|
20541
|
+
arg.children.push(`) || ""`);
|
|
20542
|
+
} else if (!arg.isStatic) {
|
|
20543
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
20544
|
+
}
|
|
20545
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
20546
|
+
if (arg.type === 4) {
|
|
20547
|
+
if (arg.isStatic) {
|
|
20548
|
+
arg.content = camelize(arg.content);
|
|
20549
|
+
} else {
|
|
20550
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
20551
|
+
}
|
|
20552
|
+
} else {
|
|
20553
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
20554
|
+
arg.children.push(`)`);
|
|
20555
|
+
}
|
|
20556
|
+
}
|
|
20557
|
+
if (!context.inSSR) {
|
|
20558
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
20559
|
+
injectPrefix(arg, ".");
|
|
20560
|
+
}
|
|
20561
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
20562
|
+
injectPrefix(arg, "^");
|
|
20563
|
+
}
|
|
20564
|
+
}
|
|
20565
|
+
return {
|
|
20566
|
+
props: [createObjectProperty(arg, exp)]
|
|
20567
|
+
};
|
|
20568
|
+
};
|
|
20569
|
+
const injectPrefix = (arg, prefix) => {
|
|
20570
|
+
if (arg.type === 4) {
|
|
20571
|
+
if (arg.isStatic) {
|
|
20572
|
+
arg.content = prefix + arg.content;
|
|
20573
|
+
} else {
|
|
20574
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
20575
|
+
}
|
|
20576
|
+
} else {
|
|
20577
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
20578
|
+
arg.children.push(`)`);
|
|
20579
|
+
}
|
|
20580
|
+
};
|
|
20581
|
+
|
|
20552
20582
|
const transformText = (node, context) => {
|
|
20553
20583
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
20554
20584
|
return () => {
|
|
@@ -20904,9 +20934,35 @@ const transformMemo = (node, context) => {
|
|
|
20904
20934
|
}
|
|
20905
20935
|
};
|
|
20906
20936
|
|
|
20937
|
+
const transformVBindShorthand = (node, context) => {
|
|
20938
|
+
if (node.type === 1) {
|
|
20939
|
+
for (const prop of node.props) {
|
|
20940
|
+
if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
|
|
20941
|
+
const arg = prop.arg;
|
|
20942
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
20943
|
+
context.onError(
|
|
20944
|
+
createCompilerError(
|
|
20945
|
+
52,
|
|
20946
|
+
arg.loc
|
|
20947
|
+
)
|
|
20948
|
+
);
|
|
20949
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
20950
|
+
} else {
|
|
20951
|
+
const propName = camelize(arg.content);
|
|
20952
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
20953
|
+
propName[0] === "-") {
|
|
20954
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
20955
|
+
}
|
|
20956
|
+
}
|
|
20957
|
+
}
|
|
20958
|
+
}
|
|
20959
|
+
}
|
|
20960
|
+
};
|
|
20961
|
+
|
|
20907
20962
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
20908
20963
|
return [
|
|
20909
20964
|
[
|
|
20965
|
+
transformVBindShorthand,
|
|
20910
20966
|
transformOnce,
|
|
20911
20967
|
transformIf,
|
|
20912
20968
|
transformMemo,
|
|
@@ -21468,6 +21524,9 @@ function analyzeNode(node) {
|
|
|
21468
21524
|
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
|
21469
21525
|
return false;
|
|
21470
21526
|
}
|
|
21527
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
21528
|
+
return false;
|
|
21529
|
+
}
|
|
21471
21530
|
if (node.type === 12) {
|
|
21472
21531
|
return [1, 0];
|
|
21473
21532
|
}
|