@vue/runtime-core 3.4.7 → 3.4.9
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/runtime-core.cjs.js +100 -73
- package/dist/runtime-core.cjs.prod.js +61 -48
- package/dist/runtime-core.d.ts +12 -11
- package/dist/runtime-core.esm-bundler.js +103 -76
- package/package.json +17 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vue/runtime-core v3.4.9
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1096,8 +1101,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
1096
1101
|
return false;
|
|
1097
1102
|
}
|
|
1098
1103
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
1099
|
-
if (!el)
|
|
1100
|
-
return;
|
|
1101
1104
|
while (parent) {
|
|
1102
1105
|
const root = parent.subTree;
|
|
1103
1106
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
@@ -1189,6 +1192,10 @@ const SuspenseImpl = {
|
|
|
1189
1192
|
rendererInternals
|
|
1190
1193
|
);
|
|
1191
1194
|
} else {
|
|
1195
|
+
if (parentSuspense && parentSuspense.deps > 0) {
|
|
1196
|
+
n2.suspense = n1.suspense;
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1192
1199
|
patchSuspense(
|
|
1193
1200
|
n1,
|
|
1194
1201
|
n2,
|
|
@@ -1738,7 +1745,12 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
1738
1745
|
function setActiveBranch(suspense, branch) {
|
|
1739
1746
|
suspense.activeBranch = branch;
|
|
1740
1747
|
const { vnode, parentComponent } = suspense;
|
|
1741
|
-
|
|
1748
|
+
let el = branch.el;
|
|
1749
|
+
while (!el && branch.component) {
|
|
1750
|
+
branch = branch.component.subTree;
|
|
1751
|
+
el = branch.el;
|
|
1752
|
+
}
|
|
1753
|
+
vnode.el = el;
|
|
1742
1754
|
if (parentComponent && parentComponent.subTree === vnode) {
|
|
1743
1755
|
parentComponent.vnode.el = el;
|
|
1744
1756
|
updateHOCHostEl(parentComponent, el);
|
|
@@ -3284,58 +3296,6 @@ function useSlots() {
|
|
|
3284
3296
|
function useAttrs() {
|
|
3285
3297
|
return getContext().attrs;
|
|
3286
3298
|
}
|
|
3287
|
-
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
3288
|
-
const i = getCurrentInstance();
|
|
3289
|
-
if (!i) {
|
|
3290
|
-
warn$1(`useModel() called without active instance.`);
|
|
3291
|
-
return reactivity.ref();
|
|
3292
|
-
}
|
|
3293
|
-
if (!i.propsOptions[0][name]) {
|
|
3294
|
-
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
3295
|
-
return reactivity.ref();
|
|
3296
|
-
}
|
|
3297
|
-
const camelizedName = shared.camelize(name);
|
|
3298
|
-
const hyphenatedName = shared.hyphenate(name);
|
|
3299
|
-
const res = reactivity.customRef((track, trigger) => {
|
|
3300
|
-
let localValue;
|
|
3301
|
-
watchSyncEffect(() => {
|
|
3302
|
-
const propValue = props[name];
|
|
3303
|
-
if (shared.hasChanged(localValue, propValue)) {
|
|
3304
|
-
localValue = propValue;
|
|
3305
|
-
trigger();
|
|
3306
|
-
}
|
|
3307
|
-
});
|
|
3308
|
-
return {
|
|
3309
|
-
get() {
|
|
3310
|
-
track();
|
|
3311
|
-
return options.get ? options.get(localValue) : localValue;
|
|
3312
|
-
},
|
|
3313
|
-
set(value) {
|
|
3314
|
-
const rawProps = i.vnode.props;
|
|
3315
|
-
if (!(rawProps && // check if parent has passed v-model
|
|
3316
|
-
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
|
|
3317
|
-
localValue = value;
|
|
3318
|
-
trigger();
|
|
3319
|
-
}
|
|
3320
|
-
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
3321
|
-
}
|
|
3322
|
-
};
|
|
3323
|
-
});
|
|
3324
|
-
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
3325
|
-
res[Symbol.iterator] = () => {
|
|
3326
|
-
let i2 = 0;
|
|
3327
|
-
return {
|
|
3328
|
-
next() {
|
|
3329
|
-
if (i2 < 2) {
|
|
3330
|
-
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
3331
|
-
} else {
|
|
3332
|
-
return { done: true };
|
|
3333
|
-
}
|
|
3334
|
-
}
|
|
3335
|
-
};
|
|
3336
|
-
};
|
|
3337
|
-
return res;
|
|
3338
|
-
}
|
|
3339
3299
|
function getContext() {
|
|
3340
3300
|
const i = getCurrentInstance();
|
|
3341
3301
|
if (!i) {
|
|
@@ -5097,29 +5057,43 @@ function propHasMismatch(el, key, clientValue, vnode) {
|
|
|
5097
5057
|
let actual;
|
|
5098
5058
|
let expected;
|
|
5099
5059
|
if (key === "class") {
|
|
5100
|
-
actual =
|
|
5101
|
-
expected =
|
|
5102
|
-
if (!isSetEqual(actual, expected)) {
|
|
5060
|
+
actual = el.getAttribute("class");
|
|
5061
|
+
expected = shared.normalizeClass(clientValue);
|
|
5062
|
+
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
|
5103
5063
|
mismatchType = mismatchKey = `class`;
|
|
5104
5064
|
}
|
|
5105
5065
|
} else if (key === "style") {
|
|
5106
|
-
actual =
|
|
5107
|
-
expected =
|
|
5108
|
-
|
|
5109
|
-
);
|
|
5066
|
+
actual = el.getAttribute("style");
|
|
5067
|
+
expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
|
|
5068
|
+
const actualMap = toStyleMap(actual);
|
|
5069
|
+
const expectedMap = toStyleMap(expected);
|
|
5110
5070
|
if (vnode.dirs) {
|
|
5111
5071
|
for (const { dir, value } of vnode.dirs) {
|
|
5112
5072
|
if (dir.name === "show" && !value) {
|
|
5113
|
-
|
|
5073
|
+
expectedMap.set("display", "none");
|
|
5114
5074
|
}
|
|
5115
5075
|
}
|
|
5116
5076
|
}
|
|
5117
|
-
if (!isMapEqual(
|
|
5077
|
+
if (!isMapEqual(actualMap, expectedMap)) {
|
|
5118
5078
|
mismatchType = mismatchKey = "style";
|
|
5119
5079
|
}
|
|
5120
5080
|
} else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
|
|
5121
|
-
|
|
5122
|
-
|
|
5081
|
+
if (shared.isBooleanAttr(key)) {
|
|
5082
|
+
actual = el.hasAttribute(key);
|
|
5083
|
+
expected = shared.includeBooleanAttr(clientValue);
|
|
5084
|
+
} else {
|
|
5085
|
+
if (el.hasAttribute(key)) {
|
|
5086
|
+
actual = el.getAttribute(key);
|
|
5087
|
+
} else if (key in el) {
|
|
5088
|
+
const serverValue = el[key];
|
|
5089
|
+
if (!shared.isObject(serverValue)) {
|
|
5090
|
+
actual = serverValue == null ? "" : String(serverValue);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
if (!shared.isObject(clientValue)) {
|
|
5094
|
+
expected = clientValue == null ? "" : String(clientValue);
|
|
5095
|
+
}
|
|
5096
|
+
}
|
|
5123
5097
|
if (actual !== expected) {
|
|
5124
5098
|
mismatchType = `attribute`;
|
|
5125
5099
|
mismatchKey = key;
|
|
@@ -5127,15 +5101,15 @@ function propHasMismatch(el, key, clientValue, vnode) {
|
|
|
5127
5101
|
}
|
|
5128
5102
|
if (mismatchType) {
|
|
5129
5103
|
const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
el,
|
|
5133
|
-
`
|
|
5104
|
+
const preSegment = `Hydration ${mismatchType} mismatch on`;
|
|
5105
|
+
const postSegment = `
|
|
5134
5106
|
- rendered on server: ${format(actual)}
|
|
5135
5107
|
- expected on client: ${format(expected)}
|
|
5136
5108
|
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
|
5137
|
-
You should fix the source of the mismatch
|
|
5138
|
-
|
|
5109
|
+
You should fix the source of the mismatch.`;
|
|
5110
|
+
{
|
|
5111
|
+
warn$1(preSegment, el, postSegment);
|
|
5112
|
+
}
|
|
5139
5113
|
return true;
|
|
5140
5114
|
}
|
|
5141
5115
|
return false;
|
|
@@ -7808,6 +7782,59 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
7808
7782
|
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
7809
7783
|
};
|
|
7810
7784
|
|
|
7785
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
7786
|
+
const i = getCurrentInstance();
|
|
7787
|
+
if (!i) {
|
|
7788
|
+
warn$1(`useModel() called without active instance.`);
|
|
7789
|
+
return reactivity.ref();
|
|
7790
|
+
}
|
|
7791
|
+
if (!i.propsOptions[0][name]) {
|
|
7792
|
+
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
7793
|
+
return reactivity.ref();
|
|
7794
|
+
}
|
|
7795
|
+
const camelizedName = shared.camelize(name);
|
|
7796
|
+
const hyphenatedName = shared.hyphenate(name);
|
|
7797
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
7798
|
+
let localValue;
|
|
7799
|
+
watchSyncEffect(() => {
|
|
7800
|
+
const propValue = props[name];
|
|
7801
|
+
if (shared.hasChanged(localValue, propValue)) {
|
|
7802
|
+
localValue = propValue;
|
|
7803
|
+
trigger();
|
|
7804
|
+
}
|
|
7805
|
+
});
|
|
7806
|
+
return {
|
|
7807
|
+
get() {
|
|
7808
|
+
track();
|
|
7809
|
+
return options.get ? options.get(localValue) : localValue;
|
|
7810
|
+
},
|
|
7811
|
+
set(value) {
|
|
7812
|
+
const rawProps = i.vnode.props;
|
|
7813
|
+
if (!(rawProps && // check if parent has passed v-model
|
|
7814
|
+
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
|
|
7815
|
+
localValue = value;
|
|
7816
|
+
trigger();
|
|
7817
|
+
}
|
|
7818
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
7819
|
+
}
|
|
7820
|
+
};
|
|
7821
|
+
});
|
|
7822
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
7823
|
+
res[Symbol.iterator] = () => {
|
|
7824
|
+
let i2 = 0;
|
|
7825
|
+
return {
|
|
7826
|
+
next() {
|
|
7827
|
+
if (i2 < 2) {
|
|
7828
|
+
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
7829
|
+
} else {
|
|
7830
|
+
return { done: true };
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
};
|
|
7834
|
+
};
|
|
7835
|
+
return res;
|
|
7836
|
+
}
|
|
7837
|
+
|
|
7811
7838
|
function h(type, propsOrChildren, children) {
|
|
7812
7839
|
const l = arguments.length;
|
|
7813
7840
|
if (l === 2) {
|
|
@@ -8034,7 +8061,7 @@ function isMemoSame(cached, memo) {
|
|
|
8034
8061
|
return true;
|
|
8035
8062
|
}
|
|
8036
8063
|
|
|
8037
|
-
const version = "3.4.
|
|
8064
|
+
const version = "3.4.9";
|
|
8038
8065
|
const warn = warn$1 ;
|
|
8039
8066
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
8040
8067
|
const devtools = devtools$1 ;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vue/runtime-core v3.4.9
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -604,8 +609,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
604
609
|
return false;
|
|
605
610
|
}
|
|
606
611
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
607
|
-
if (!el)
|
|
608
|
-
return;
|
|
609
612
|
while (parent) {
|
|
610
613
|
const root = parent.subTree;
|
|
611
614
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
@@ -688,6 +691,10 @@ const SuspenseImpl = {
|
|
|
688
691
|
rendererInternals
|
|
689
692
|
);
|
|
690
693
|
} else {
|
|
694
|
+
if (parentSuspense && parentSuspense.deps > 0) {
|
|
695
|
+
n2.suspense = n1.suspense;
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
691
698
|
patchSuspense(
|
|
692
699
|
n1,
|
|
693
700
|
n2,
|
|
@@ -1206,7 +1213,12 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
1206
1213
|
function setActiveBranch(suspense, branch) {
|
|
1207
1214
|
suspense.activeBranch = branch;
|
|
1208
1215
|
const { vnode, parentComponent } = suspense;
|
|
1209
|
-
|
|
1216
|
+
let el = branch.el;
|
|
1217
|
+
while (!el && branch.component) {
|
|
1218
|
+
branch = branch.component.subTree;
|
|
1219
|
+
el = branch.el;
|
|
1220
|
+
}
|
|
1221
|
+
vnode.el = el;
|
|
1210
1222
|
if (parentComponent && parentComponent.subTree === vnode) {
|
|
1211
1223
|
parentComponent.vnode.el = el;
|
|
1212
1224
|
updateHOCHostEl(parentComponent, el);
|
|
@@ -2523,50 +2535,6 @@ function useSlots() {
|
|
|
2523
2535
|
function useAttrs() {
|
|
2524
2536
|
return getContext().attrs;
|
|
2525
2537
|
}
|
|
2526
|
-
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
2527
|
-
const i = getCurrentInstance();
|
|
2528
|
-
const camelizedName = shared.camelize(name);
|
|
2529
|
-
const hyphenatedName = shared.hyphenate(name);
|
|
2530
|
-
const res = reactivity.customRef((track, trigger) => {
|
|
2531
|
-
let localValue;
|
|
2532
|
-
watchSyncEffect(() => {
|
|
2533
|
-
const propValue = props[name];
|
|
2534
|
-
if (shared.hasChanged(localValue, propValue)) {
|
|
2535
|
-
localValue = propValue;
|
|
2536
|
-
trigger();
|
|
2537
|
-
}
|
|
2538
|
-
});
|
|
2539
|
-
return {
|
|
2540
|
-
get() {
|
|
2541
|
-
track();
|
|
2542
|
-
return options.get ? options.get(localValue) : localValue;
|
|
2543
|
-
},
|
|
2544
|
-
set(value) {
|
|
2545
|
-
const rawProps = i.vnode.props;
|
|
2546
|
-
if (!(rawProps && // check if parent has passed v-model
|
|
2547
|
-
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
|
|
2548
|
-
localValue = value;
|
|
2549
|
-
trigger();
|
|
2550
|
-
}
|
|
2551
|
-
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
});
|
|
2555
|
-
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
2556
|
-
res[Symbol.iterator] = () => {
|
|
2557
|
-
let i2 = 0;
|
|
2558
|
-
return {
|
|
2559
|
-
next() {
|
|
2560
|
-
if (i2 < 2) {
|
|
2561
|
-
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
2562
|
-
} else {
|
|
2563
|
-
return { done: true };
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
};
|
|
2567
|
-
};
|
|
2568
|
-
return res;
|
|
2569
|
-
}
|
|
2570
2538
|
function getContext() {
|
|
2571
2539
|
const i = getCurrentInstance();
|
|
2572
2540
|
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
@@ -6213,6 +6181,51 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
6213
6181
|
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
6214
6182
|
};
|
|
6215
6183
|
|
|
6184
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
6185
|
+
const i = getCurrentInstance();
|
|
6186
|
+
const camelizedName = shared.camelize(name);
|
|
6187
|
+
const hyphenatedName = shared.hyphenate(name);
|
|
6188
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
6189
|
+
let localValue;
|
|
6190
|
+
watchSyncEffect(() => {
|
|
6191
|
+
const propValue = props[name];
|
|
6192
|
+
if (shared.hasChanged(localValue, propValue)) {
|
|
6193
|
+
localValue = propValue;
|
|
6194
|
+
trigger();
|
|
6195
|
+
}
|
|
6196
|
+
});
|
|
6197
|
+
return {
|
|
6198
|
+
get() {
|
|
6199
|
+
track();
|
|
6200
|
+
return options.get ? options.get(localValue) : localValue;
|
|
6201
|
+
},
|
|
6202
|
+
set(value) {
|
|
6203
|
+
const rawProps = i.vnode.props;
|
|
6204
|
+
if (!(rawProps && // check if parent has passed v-model
|
|
6205
|
+
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
|
|
6206
|
+
localValue = value;
|
|
6207
|
+
trigger();
|
|
6208
|
+
}
|
|
6209
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
6210
|
+
}
|
|
6211
|
+
};
|
|
6212
|
+
});
|
|
6213
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
6214
|
+
res[Symbol.iterator] = () => {
|
|
6215
|
+
let i2 = 0;
|
|
6216
|
+
return {
|
|
6217
|
+
next() {
|
|
6218
|
+
if (i2 < 2) {
|
|
6219
|
+
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
6220
|
+
} else {
|
|
6221
|
+
return { done: true };
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6224
|
+
};
|
|
6225
|
+
};
|
|
6226
|
+
return res;
|
|
6227
|
+
}
|
|
6228
|
+
|
|
6216
6229
|
function h(type, propsOrChildren, children) {
|
|
6217
6230
|
const l = arguments.length;
|
|
6218
6231
|
if (l === 2) {
|
|
@@ -6265,7 +6278,7 @@ function isMemoSame(cached, memo) {
|
|
|
6265
6278
|
return true;
|
|
6266
6279
|
}
|
|
6267
6280
|
|
|
6268
|
-
const version = "3.4.
|
|
6281
|
+
const version = "3.4.9";
|
|
6269
6282
|
const warn$1 = shared.NOOP;
|
|
6270
6283
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6271
6284
|
const devtools = void 0;
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1281,6 +1281,10 @@ export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> &
|
|
|
1281
1281
|
ModelRef<T, M>,
|
|
1282
1282
|
Record<M, true | undefined>
|
|
1283
1283
|
];
|
|
1284
|
+
type DefineModelOptions<T = any> = {
|
|
1285
|
+
get?: (v: T) => any;
|
|
1286
|
+
set?: (v: T) => any;
|
|
1287
|
+
};
|
|
1284
1288
|
/**
|
|
1285
1289
|
* Vue `<script setup>` compiler macro for declaring a
|
|
1286
1290
|
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
@@ -1316,18 +1320,18 @@ export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> &
|
|
|
1316
1320
|
*/
|
|
1317
1321
|
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1318
1322
|
required: true;
|
|
1319
|
-
} & PropOptions<T> &
|
|
1323
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1320
1324
|
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1321
1325
|
default: any;
|
|
1322
|
-
} & PropOptions<T> &
|
|
1323
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> &
|
|
1326
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1327
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1324
1328
|
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1325
1329
|
required: true;
|
|
1326
|
-
} & PropOptions<T> &
|
|
1330
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1327
1331
|
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1328
1332
|
default: any;
|
|
1329
|
-
} & PropOptions<T> &
|
|
1330
|
-
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> &
|
|
1333
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1334
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1331
1335
|
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1332
1336
|
type InferDefaults<T> = {
|
|
1333
1337
|
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
@@ -1362,11 +1366,8 @@ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof
|
|
|
1362
1366
|
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1363
1367
|
export declare function useSlots(): SetupContext['slots'];
|
|
1364
1368
|
export declare function useAttrs(): SetupContext['attrs'];
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
set?: (v: T) => any;
|
|
1368
|
-
};
|
|
1369
|
-
export declare function useModel<M extends string | number | symbol, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: UseModelOptions<T[K]>): ModelRef<T[K], M>;
|
|
1369
|
+
|
|
1370
|
+
export declare function useModel<M extends string | number | symbol, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>;
|
|
1370
1371
|
|
|
1371
1372
|
type RawProps = VNodeProps & {
|
|
1372
1373
|
__v_isVNode?: never;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @vue/runtime-core v3.4.9
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
6
|
+
import { pauseTracking, resetTracking, isRef, toRaw, isShallow as isShallow$1, isReactive, ReactiveEffect, getCurrentScope, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, customRef, isReadonly } from '@vue/reactivity';
|
|
2
7
|
export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
3
8
|
import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr } from '@vue/shared';
|
|
4
9
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
@@ -1098,8 +1103,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
1098
1103
|
return false;
|
|
1099
1104
|
}
|
|
1100
1105
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
1101
|
-
if (!el)
|
|
1102
|
-
return;
|
|
1103
1106
|
while (parent) {
|
|
1104
1107
|
const root = parent.subTree;
|
|
1105
1108
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
@@ -1191,6 +1194,10 @@ const SuspenseImpl = {
|
|
|
1191
1194
|
rendererInternals
|
|
1192
1195
|
);
|
|
1193
1196
|
} else {
|
|
1197
|
+
if (parentSuspense && parentSuspense.deps > 0) {
|
|
1198
|
+
n2.suspense = n1.suspense;
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1194
1201
|
patchSuspense(
|
|
1195
1202
|
n1,
|
|
1196
1203
|
n2,
|
|
@@ -1740,7 +1747,12 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
1740
1747
|
function setActiveBranch(suspense, branch) {
|
|
1741
1748
|
suspense.activeBranch = branch;
|
|
1742
1749
|
const { vnode, parentComponent } = suspense;
|
|
1743
|
-
|
|
1750
|
+
let el = branch.el;
|
|
1751
|
+
while (!el && branch.component) {
|
|
1752
|
+
branch = branch.component.subTree;
|
|
1753
|
+
el = branch.el;
|
|
1754
|
+
}
|
|
1755
|
+
vnode.el = el;
|
|
1744
1756
|
if (parentComponent && parentComponent.subTree === vnode) {
|
|
1745
1757
|
parentComponent.vnode.el = el;
|
|
1746
1758
|
updateHOCHostEl(parentComponent, el);
|
|
@@ -3288,58 +3300,6 @@ function useSlots() {
|
|
|
3288
3300
|
function useAttrs() {
|
|
3289
3301
|
return getContext().attrs;
|
|
3290
3302
|
}
|
|
3291
|
-
function useModel(props, name, options = EMPTY_OBJ) {
|
|
3292
|
-
const i = getCurrentInstance();
|
|
3293
|
-
if (!!(process.env.NODE_ENV !== "production") && !i) {
|
|
3294
|
-
warn$1(`useModel() called without active instance.`);
|
|
3295
|
-
return ref();
|
|
3296
|
-
}
|
|
3297
|
-
if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][name]) {
|
|
3298
|
-
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
3299
|
-
return ref();
|
|
3300
|
-
}
|
|
3301
|
-
const camelizedName = camelize(name);
|
|
3302
|
-
const hyphenatedName = hyphenate(name);
|
|
3303
|
-
const res = customRef((track, trigger) => {
|
|
3304
|
-
let localValue;
|
|
3305
|
-
watchSyncEffect(() => {
|
|
3306
|
-
const propValue = props[name];
|
|
3307
|
-
if (hasChanged(localValue, propValue)) {
|
|
3308
|
-
localValue = propValue;
|
|
3309
|
-
trigger();
|
|
3310
|
-
}
|
|
3311
|
-
});
|
|
3312
|
-
return {
|
|
3313
|
-
get() {
|
|
3314
|
-
track();
|
|
3315
|
-
return options.get ? options.get(localValue) : localValue;
|
|
3316
|
-
},
|
|
3317
|
-
set(value) {
|
|
3318
|
-
const rawProps = i.vnode.props;
|
|
3319
|
-
if (!(rawProps && // check if parent has passed v-model
|
|
3320
|
-
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
|
|
3321
|
-
localValue = value;
|
|
3322
|
-
trigger();
|
|
3323
|
-
}
|
|
3324
|
-
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
3325
|
-
}
|
|
3326
|
-
};
|
|
3327
|
-
});
|
|
3328
|
-
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
3329
|
-
res[Symbol.iterator] = () => {
|
|
3330
|
-
let i2 = 0;
|
|
3331
|
-
return {
|
|
3332
|
-
next() {
|
|
3333
|
-
if (i2 < 2) {
|
|
3334
|
-
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
3335
|
-
} else {
|
|
3336
|
-
return { done: true };
|
|
3337
|
-
}
|
|
3338
|
-
}
|
|
3339
|
-
};
|
|
3340
|
-
};
|
|
3341
|
-
return res;
|
|
3342
|
-
}
|
|
3343
3303
|
function getContext() {
|
|
3344
3304
|
const i = getCurrentInstance();
|
|
3345
3305
|
if (!!(process.env.NODE_ENV !== "production") && !i) {
|
|
@@ -5115,29 +5075,43 @@ function propHasMismatch(el, key, clientValue, vnode) {
|
|
|
5115
5075
|
let actual;
|
|
5116
5076
|
let expected;
|
|
5117
5077
|
if (key === "class") {
|
|
5118
|
-
actual =
|
|
5119
|
-
expected =
|
|
5120
|
-
if (!isSetEqual(actual, expected)) {
|
|
5078
|
+
actual = el.getAttribute("class");
|
|
5079
|
+
expected = normalizeClass(clientValue);
|
|
5080
|
+
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
|
5121
5081
|
mismatchType = mismatchKey = `class`;
|
|
5122
5082
|
}
|
|
5123
5083
|
} else if (key === "style") {
|
|
5124
|
-
actual =
|
|
5125
|
-
expected =
|
|
5126
|
-
|
|
5127
|
-
);
|
|
5084
|
+
actual = el.getAttribute("style");
|
|
5085
|
+
expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
|
|
5086
|
+
const actualMap = toStyleMap(actual);
|
|
5087
|
+
const expectedMap = toStyleMap(expected);
|
|
5128
5088
|
if (vnode.dirs) {
|
|
5129
5089
|
for (const { dir, value } of vnode.dirs) {
|
|
5130
5090
|
if (dir.name === "show" && !value) {
|
|
5131
|
-
|
|
5091
|
+
expectedMap.set("display", "none");
|
|
5132
5092
|
}
|
|
5133
5093
|
}
|
|
5134
5094
|
}
|
|
5135
|
-
if (!isMapEqual(
|
|
5095
|
+
if (!isMapEqual(actualMap, expectedMap)) {
|
|
5136
5096
|
mismatchType = mismatchKey = "style";
|
|
5137
5097
|
}
|
|
5138
5098
|
} else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
|
|
5139
|
-
|
|
5140
|
-
|
|
5099
|
+
if (isBooleanAttr(key)) {
|
|
5100
|
+
actual = el.hasAttribute(key);
|
|
5101
|
+
expected = includeBooleanAttr(clientValue);
|
|
5102
|
+
} else {
|
|
5103
|
+
if (el.hasAttribute(key)) {
|
|
5104
|
+
actual = el.getAttribute(key);
|
|
5105
|
+
} else if (key in el) {
|
|
5106
|
+
const serverValue = el[key];
|
|
5107
|
+
if (!isObject(serverValue)) {
|
|
5108
|
+
actual = serverValue == null ? "" : String(serverValue);
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
if (!isObject(clientValue)) {
|
|
5112
|
+
expected = clientValue == null ? "" : String(clientValue);
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5141
5115
|
if (actual !== expected) {
|
|
5142
5116
|
mismatchType = `attribute`;
|
|
5143
5117
|
mismatchKey = key;
|
|
@@ -5145,15 +5119,15 @@ function propHasMismatch(el, key, clientValue, vnode) {
|
|
|
5145
5119
|
}
|
|
5146
5120
|
if (mismatchType) {
|
|
5147
5121
|
const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
el,
|
|
5151
|
-
`
|
|
5122
|
+
const preSegment = `Hydration ${mismatchType} mismatch on`;
|
|
5123
|
+
const postSegment = `
|
|
5152
5124
|
- rendered on server: ${format(actual)}
|
|
5153
5125
|
- expected on client: ${format(expected)}
|
|
5154
5126
|
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
|
5155
|
-
You should fix the source of the mismatch
|
|
5156
|
-
|
|
5127
|
+
You should fix the source of the mismatch.`;
|
|
5128
|
+
{
|
|
5129
|
+
warn$1(preSegment, el, postSegment);
|
|
5130
|
+
}
|
|
5157
5131
|
return true;
|
|
5158
5132
|
}
|
|
5159
5133
|
return false;
|
|
@@ -7880,6 +7854,59 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
7880
7854
|
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
7881
7855
|
};
|
|
7882
7856
|
|
|
7857
|
+
function useModel(props, name, options = EMPTY_OBJ) {
|
|
7858
|
+
const i = getCurrentInstance();
|
|
7859
|
+
if (!!(process.env.NODE_ENV !== "production") && !i) {
|
|
7860
|
+
warn$1(`useModel() called without active instance.`);
|
|
7861
|
+
return ref();
|
|
7862
|
+
}
|
|
7863
|
+
if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][name]) {
|
|
7864
|
+
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
7865
|
+
return ref();
|
|
7866
|
+
}
|
|
7867
|
+
const camelizedName = camelize(name);
|
|
7868
|
+
const hyphenatedName = hyphenate(name);
|
|
7869
|
+
const res = customRef((track, trigger) => {
|
|
7870
|
+
let localValue;
|
|
7871
|
+
watchSyncEffect(() => {
|
|
7872
|
+
const propValue = props[name];
|
|
7873
|
+
if (hasChanged(localValue, propValue)) {
|
|
7874
|
+
localValue = propValue;
|
|
7875
|
+
trigger();
|
|
7876
|
+
}
|
|
7877
|
+
});
|
|
7878
|
+
return {
|
|
7879
|
+
get() {
|
|
7880
|
+
track();
|
|
7881
|
+
return options.get ? options.get(localValue) : localValue;
|
|
7882
|
+
},
|
|
7883
|
+
set(value) {
|
|
7884
|
+
const rawProps = i.vnode.props;
|
|
7885
|
+
if (!(rawProps && // check if parent has passed v-model
|
|
7886
|
+
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
|
|
7887
|
+
localValue = value;
|
|
7888
|
+
trigger();
|
|
7889
|
+
}
|
|
7890
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
7891
|
+
}
|
|
7892
|
+
};
|
|
7893
|
+
});
|
|
7894
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
7895
|
+
res[Symbol.iterator] = () => {
|
|
7896
|
+
let i2 = 0;
|
|
7897
|
+
return {
|
|
7898
|
+
next() {
|
|
7899
|
+
if (i2 < 2) {
|
|
7900
|
+
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
7901
|
+
} else {
|
|
7902
|
+
return { done: true };
|
|
7903
|
+
}
|
|
7904
|
+
}
|
|
7905
|
+
};
|
|
7906
|
+
};
|
|
7907
|
+
return res;
|
|
7908
|
+
}
|
|
7909
|
+
|
|
7883
7910
|
function h(type, propsOrChildren, children) {
|
|
7884
7911
|
const l = arguments.length;
|
|
7885
7912
|
if (l === 2) {
|
|
@@ -8106,11 +8133,11 @@ function isMemoSame(cached, memo) {
|
|
|
8106
8133
|
return true;
|
|
8107
8134
|
}
|
|
8108
8135
|
|
|
8109
|
-
const version = "3.4.
|
|
8136
|
+
const version = "3.4.9";
|
|
8110
8137
|
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
8111
8138
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
8112
|
-
const devtools = !!(process.env.NODE_ENV !== "production") ||
|
|
8113
|
-
const setDevtoolsHook = !!(process.env.NODE_ENV !== "production") ||
|
|
8139
|
+
const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
8140
|
+
const setDevtoolsHook = !!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
|
|
8114
8141
|
const _ssrUtils = {
|
|
8115
8142
|
createComponentInstance,
|
|
8116
8143
|
setupComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.9",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -9,6 +9,20 @@
|
|
|
9
9
|
"index.js",
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/runtime-core.d.ts",
|
|
15
|
+
"node": {
|
|
16
|
+
"production": "./dist/runtime-core.cjs.prod.js",
|
|
17
|
+
"development": "./dist/runtime-core.cjs.js",
|
|
18
|
+
"default": "./index.js"
|
|
19
|
+
},
|
|
20
|
+
"module": "./dist/runtime-core.esm-bundler.js",
|
|
21
|
+
"import": "./dist/runtime-core.esm-bundler.js",
|
|
22
|
+
"require": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./*": "./*"
|
|
25
|
+
},
|
|
12
26
|
"buildOptions": {
|
|
13
27
|
"name": "VueRuntimeCore",
|
|
14
28
|
"formats": [
|
|
@@ -32,7 +46,7 @@
|
|
|
32
46
|
},
|
|
33
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
|
34
48
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.4.
|
|
36
|
-
"@vue/reactivity": "3.4.
|
|
49
|
+
"@vue/shared": "3.4.9",
|
|
50
|
+
"@vue/reactivity": "3.4.9"
|
|
37
51
|
}
|
|
38
52
|
}
|