@vue/compat 3.2.8 → 3.2.12
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 +375 -184
- package/dist/vue.cjs.prod.js +272 -152
- package/dist/vue.esm-browser.js +210 -172
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +212 -172
- package/dist/vue.global.js +213 -179
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +197 -169
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +199 -169
- package/dist/vue.runtime.global.js +200 -176
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +2 -2
|
@@ -1456,41 +1456,33 @@ function registerHMR(instance) {
|
|
|
1456
1456
|
const id = instance.type.__hmrId;
|
|
1457
1457
|
let record = map.get(id);
|
|
1458
1458
|
if (!record) {
|
|
1459
|
-
createRecord(id
|
|
1459
|
+
createRecord(id);
|
|
1460
1460
|
record = map.get(id);
|
|
1461
1461
|
}
|
|
1462
|
-
record.
|
|
1462
|
+
record.add(instance);
|
|
1463
1463
|
}
|
|
1464
1464
|
function unregisterHMR(instance) {
|
|
1465
|
-
map.get(instance.type.__hmrId).
|
|
1465
|
+
map.get(instance.type.__hmrId).delete(instance);
|
|
1466
1466
|
}
|
|
1467
|
-
function createRecord(id
|
|
1468
|
-
if (!component) {
|
|
1469
|
-
warn$1(`HMR API usage is out of date.\n` +
|
|
1470
|
-
`Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
|
|
1471
|
-
`dependency that handles Vue SFC compilation.`);
|
|
1472
|
-
component = {};
|
|
1473
|
-
}
|
|
1467
|
+
function createRecord(id) {
|
|
1474
1468
|
if (map.has(id)) {
|
|
1475
1469
|
return false;
|
|
1476
1470
|
}
|
|
1477
|
-
map.set(id,
|
|
1478
|
-
component: isClassComponent(component) ? component.__vccOpts : component,
|
|
1479
|
-
instances: new Set()
|
|
1480
|
-
});
|
|
1471
|
+
map.set(id, new Set());
|
|
1481
1472
|
return true;
|
|
1482
1473
|
}
|
|
1474
|
+
function normalizeClassComponent(component) {
|
|
1475
|
+
return isClassComponent(component) ? component.__vccOpts : component;
|
|
1476
|
+
}
|
|
1483
1477
|
function rerender(id, newRender) {
|
|
1484
1478
|
const record = map.get(id);
|
|
1485
|
-
if (!record)
|
|
1479
|
+
if (!record) {
|
|
1486
1480
|
return;
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
// Array.from creates a snapshot which avoids the set being mutated during
|
|
1490
|
-
// updates
|
|
1491
|
-
Array.from(record.instances).forEach(instance => {
|
|
1481
|
+
}
|
|
1482
|
+
[...record].forEach(instance => {
|
|
1492
1483
|
if (newRender) {
|
|
1493
1484
|
instance.render = newRender;
|
|
1485
|
+
normalizeClassComponent(instance.type).render = newRender;
|
|
1494
1486
|
}
|
|
1495
1487
|
instance.renderCache = [];
|
|
1496
1488
|
// this flag forces child components with slot content to update
|
|
@@ -1503,34 +1495,31 @@ function reload(id, newComp) {
|
|
|
1503
1495
|
const record = map.get(id);
|
|
1504
1496
|
if (!record)
|
|
1505
1497
|
return;
|
|
1506
|
-
|
|
1507
|
-
// updates
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
});
|
|
1525
|
-
}
|
|
1526
|
-
Array.from(instances).forEach(instance => {
|
|
1527
|
-
// invalidate options resolution cache
|
|
1498
|
+
newComp = normalizeClassComponent(newComp);
|
|
1499
|
+
// create a snapshot which avoids the set being mutated during updates
|
|
1500
|
+
const instances = [...record];
|
|
1501
|
+
for (const instance of instances) {
|
|
1502
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
1503
|
+
if (!hmrDirtyComponents.has(oldComp)) {
|
|
1504
|
+
// 1. Update existing comp definition to match new one
|
|
1505
|
+
extend(oldComp, newComp);
|
|
1506
|
+
for (const key in oldComp) {
|
|
1507
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
1508
|
+
delete oldComp[key];
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
// 2. mark definition dirty. This forces the renderer to replace the
|
|
1512
|
+
// component on patch.
|
|
1513
|
+
hmrDirtyComponents.add(oldComp);
|
|
1514
|
+
}
|
|
1515
|
+
// 3. invalidate options resolution cache
|
|
1528
1516
|
instance.appContext.optionsCache.delete(instance.type);
|
|
1517
|
+
// 4. actually update
|
|
1529
1518
|
if (instance.ceReload) {
|
|
1530
1519
|
// custom element
|
|
1531
|
-
hmrDirtyComponents.add(
|
|
1520
|
+
hmrDirtyComponents.add(oldComp);
|
|
1532
1521
|
instance.ceReload(newComp.styles);
|
|
1533
|
-
hmrDirtyComponents.delete(
|
|
1522
|
+
hmrDirtyComponents.delete(oldComp);
|
|
1534
1523
|
}
|
|
1535
1524
|
else if (instance.parent) {
|
|
1536
1525
|
// 4. Force the parent instance to re-render. This will cause all updated
|
|
@@ -1555,6 +1544,12 @@ function reload(id, newComp) {
|
|
|
1555
1544
|
else {
|
|
1556
1545
|
console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
|
|
1557
1546
|
}
|
|
1547
|
+
}
|
|
1548
|
+
// 5. make sure to cleanup dirty hmr components after update
|
|
1549
|
+
queuePostFlushCb(() => {
|
|
1550
|
+
for (const instance of instances) {
|
|
1551
|
+
hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
|
|
1552
|
+
}
|
|
1558
1553
|
});
|
|
1559
1554
|
}
|
|
1560
1555
|
function tryWrap(fn) {
|
|
@@ -2368,12 +2363,12 @@ function markAttrsAccessed() {
|
|
|
2368
2363
|
function renderComponentRoot(instance) {
|
|
2369
2364
|
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
|
2370
2365
|
let result;
|
|
2366
|
+
let fallthroughAttrs;
|
|
2371
2367
|
const prev = setCurrentRenderingInstance(instance);
|
|
2372
2368
|
{
|
|
2373
2369
|
accessedAttrs = false;
|
|
2374
2370
|
}
|
|
2375
2371
|
try {
|
|
2376
|
-
let fallthroughAttrs;
|
|
2377
2372
|
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
2378
2373
|
// withProxy is a proxy with a different `has` trap only for
|
|
2379
2374
|
// runtime-compiled render functions using `with` block.
|
|
@@ -2404,108 +2399,105 @@ function renderComponentRoot(instance) {
|
|
|
2404
2399
|
? attrs
|
|
2405
2400
|
: getFunctionalFallthrough(attrs);
|
|
2406
2401
|
}
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2402
|
+
}
|
|
2403
|
+
catch (err) {
|
|
2404
|
+
blockStack.length = 0;
|
|
2405
|
+
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
2406
|
+
result = createVNode(Comment);
|
|
2407
|
+
}
|
|
2408
|
+
// attr merging
|
|
2409
|
+
// in dev mode, comments are preserved, and it's possible for a template
|
|
2410
|
+
// to have comments along side the root element which makes it a fragment
|
|
2411
|
+
let root = result;
|
|
2412
|
+
let setRoot = undefined;
|
|
2413
|
+
if (result.patchFlag > 0 &&
|
|
2414
|
+
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
2415
|
+
[root, setRoot] = getChildRoot(result);
|
|
2416
|
+
}
|
|
2417
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
2418
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
2419
|
+
const { shapeFlag } = root;
|
|
2420
|
+
if (keys.length) {
|
|
2421
|
+
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2422
|
+
if (propsOptions && keys.some(isModelListener)) {
|
|
2423
|
+
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
2424
|
+
// prop, it indicates this component expects to handle v-model and
|
|
2425
|
+
// it should not fallthrough.
|
|
2426
|
+
// related: #1543, #1643, #1989
|
|
2427
|
+
fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
|
2428
|
+
}
|
|
2429
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
2430
|
+
}
|
|
2431
|
+
else if (!accessedAttrs && root.type !== Comment) {
|
|
2432
|
+
const allAttrs = Object.keys(attrs);
|
|
2433
|
+
const eventAttrs = [];
|
|
2434
|
+
const extraAttrs = [];
|
|
2435
|
+
for (let i = 0, l = allAttrs.length; i < l; i++) {
|
|
2436
|
+
const key = allAttrs[i];
|
|
2437
|
+
if (isOn(key)) {
|
|
2438
|
+
// ignore v-model handlers when they fail to fallthrough
|
|
2439
|
+
if (!isModelListener(key)) {
|
|
2440
|
+
// remove `on`, lowercase first letter to reflect event casing
|
|
2441
|
+
// accurately
|
|
2442
|
+
eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
|
2448
2443
|
}
|
|
2449
2444
|
}
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
`${extraAttrs.join(', ')}) ` +
|
|
2453
|
-
`were passed to component but could not be automatically inherited ` +
|
|
2454
|
-
`because component renders fragment or text root nodes.`);
|
|
2455
|
-
}
|
|
2456
|
-
if (eventAttrs.length) {
|
|
2457
|
-
warn$1(`Extraneous non-emits event listeners (` +
|
|
2458
|
-
`${eventAttrs.join(', ')}) ` +
|
|
2459
|
-
`were passed to component but could not be automatically inherited ` +
|
|
2460
|
-
`because component renders fragment or text root nodes. ` +
|
|
2461
|
-
`If the listener is intended to be a component custom event listener only, ` +
|
|
2462
|
-
`declare it using the "emits" option.`);
|
|
2445
|
+
else {
|
|
2446
|
+
extraAttrs.push(key);
|
|
2463
2447
|
}
|
|
2464
2448
|
}
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2449
|
+
if (extraAttrs.length) {
|
|
2450
|
+
warn$1(`Extraneous non-props attributes (` +
|
|
2451
|
+
`${extraAttrs.join(', ')}) ` +
|
|
2452
|
+
`were passed to component but could not be automatically inherited ` +
|
|
2453
|
+
`because component renders fragment or text root nodes.`);
|
|
2454
|
+
}
|
|
2455
|
+
if (eventAttrs.length) {
|
|
2456
|
+
warn$1(`Extraneous non-emits event listeners (` +
|
|
2457
|
+
`${eventAttrs.join(', ')}) ` +
|
|
2458
|
+
`were passed to component but could not be automatically inherited ` +
|
|
2459
|
+
`because component renders fragment or text root nodes. ` +
|
|
2460
|
+
`If the listener is intended to be a component custom event listener only, ` +
|
|
2461
|
+
`declare it using the "emits" option.`);
|
|
2475
2462
|
}
|
|
2476
|
-
root = cloneVNode(root, {
|
|
2477
|
-
class: cls,
|
|
2478
|
-
style: style
|
|
2479
|
-
});
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
// inherit directives
|
|
2483
|
-
if (vnode.dirs) {
|
|
2484
|
-
if (true && !isElementRoot(root)) {
|
|
2485
|
-
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2486
|
-
`The directives will not function as intended.`);
|
|
2487
2463
|
}
|
|
2488
|
-
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2489
2464
|
}
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2465
|
+
}
|
|
2466
|
+
if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
|
|
2467
|
+
vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
|
|
2468
|
+
root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2469
|
+
const { class: cls, style } = vnode.props || {};
|
|
2470
|
+
if (cls || style) {
|
|
2471
|
+
if (inheritAttrs === false) {
|
|
2472
|
+
warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
|
|
2495
2473
|
}
|
|
2496
|
-
root
|
|
2474
|
+
root = cloneVNode(root, {
|
|
2475
|
+
class: cls,
|
|
2476
|
+
style: style
|
|
2477
|
+
});
|
|
2497
2478
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2479
|
+
}
|
|
2480
|
+
// inherit directives
|
|
2481
|
+
if (vnode.dirs) {
|
|
2482
|
+
if (!isElementRoot(root)) {
|
|
2483
|
+
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2484
|
+
`The directives will not function as intended.`);
|
|
2500
2485
|
}
|
|
2501
|
-
|
|
2502
|
-
|
|
2486
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2487
|
+
}
|
|
2488
|
+
// inherit transition data
|
|
2489
|
+
if (vnode.transition) {
|
|
2490
|
+
if (!isElementRoot(root)) {
|
|
2491
|
+
warn$1(`Component inside <Transition> renders non-element root node ` +
|
|
2492
|
+
`that cannot be animated.`);
|
|
2503
2493
|
}
|
|
2494
|
+
root.transition = vnode.transition;
|
|
2504
2495
|
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2496
|
+
if (setRoot) {
|
|
2497
|
+
setRoot(root);
|
|
2498
|
+
}
|
|
2499
|
+
else {
|
|
2500
|
+
result = root;
|
|
2509
2501
|
}
|
|
2510
2502
|
setCurrentRenderingInstance(prev);
|
|
2511
2503
|
return result;
|
|
@@ -3040,8 +3032,8 @@ function normalizeSuspenseChildren(vnode) {
|
|
|
3040
3032
|
function normalizeSuspenseSlot(s) {
|
|
3041
3033
|
let block;
|
|
3042
3034
|
if (isFunction(s)) {
|
|
3043
|
-
const
|
|
3044
|
-
if (
|
|
3035
|
+
const trackBlock = isBlockTreeEnabled && s._c;
|
|
3036
|
+
if (trackBlock) {
|
|
3045
3037
|
// disableTracking: false
|
|
3046
3038
|
// allow block tracking for compiled slots
|
|
3047
3039
|
// (see ./componentRenderContext.ts)
|
|
@@ -3049,7 +3041,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
3049
3041
|
openBlock();
|
|
3050
3042
|
}
|
|
3051
3043
|
s = s();
|
|
3052
|
-
if (
|
|
3044
|
+
if (trackBlock) {
|
|
3053
3045
|
s._d = true;
|
|
3054
3046
|
block = currentBlock;
|
|
3055
3047
|
closeBlock();
|
|
@@ -5205,7 +5197,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
5205
5197
|
return vm;
|
|
5206
5198
|
}
|
|
5207
5199
|
}
|
|
5208
|
-
Vue.version = "3.2.
|
|
5200
|
+
Vue.version = "3.2.12";
|
|
5209
5201
|
Vue.config = singletonApp.config;
|
|
5210
5202
|
Vue.use = (p, ...options) => {
|
|
5211
5203
|
if (p && isFunction(p.install)) {
|
|
@@ -7853,7 +7845,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
7853
7845
|
return Component;
|
|
7854
7846
|
}
|
|
7855
7847
|
if (warnMissing && !res) {
|
|
7856
|
-
|
|
7848
|
+
const extra = type === COMPONENTS
|
|
7849
|
+
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
7850
|
+
`component resolution via compilerOptions.isCustomElement.`
|
|
7851
|
+
: ``;
|
|
7852
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
7857
7853
|
}
|
|
7858
7854
|
return res;
|
|
7859
7855
|
}
|
|
@@ -9295,17 +9291,19 @@ function exposePropsOnRenderContext(instance) {
|
|
|
9295
9291
|
function exposeSetupStateOnRenderContext(instance) {
|
|
9296
9292
|
const { ctx, setupState } = instance;
|
|
9297
9293
|
Object.keys(toRaw(setupState)).forEach(key => {
|
|
9298
|
-
if (!setupState.__isScriptSetup
|
|
9299
|
-
|
|
9300
|
-
`
|
|
9301
|
-
|
|
9294
|
+
if (!setupState.__isScriptSetup) {
|
|
9295
|
+
if (key[0] === '$' || key[0] === '_') {
|
|
9296
|
+
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
9297
|
+
`which are reserved prefixes for Vue internals.`);
|
|
9298
|
+
return;
|
|
9299
|
+
}
|
|
9300
|
+
Object.defineProperty(ctx, key, {
|
|
9301
|
+
enumerable: true,
|
|
9302
|
+
configurable: true,
|
|
9303
|
+
get: () => setupState[key],
|
|
9304
|
+
set: NOOP
|
|
9305
|
+
});
|
|
9302
9306
|
}
|
|
9303
|
-
Object.defineProperty(ctx, key, {
|
|
9304
|
-
enumerable: true,
|
|
9305
|
-
configurable: true,
|
|
9306
|
-
get: () => setupState[key],
|
|
9307
|
-
set: NOOP
|
|
9308
|
-
});
|
|
9309
9307
|
});
|
|
9310
9308
|
}
|
|
9311
9309
|
|
|
@@ -10064,11 +10062,18 @@ function flushJobs(seen) {
|
|
|
10064
10062
|
// 2. If a component is unmounted during a parent component's update,
|
|
10065
10063
|
// its update can be skipped.
|
|
10066
10064
|
queue.sort((a, b) => getId(a) - getId(b));
|
|
10065
|
+
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
10066
|
+
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
10067
|
+
// inside try-catch. This can leave all warning code unshaked. Although
|
|
10068
|
+
// they would get eventually shaken by a minifier like terser, some minifiers
|
|
10069
|
+
// would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
|
|
10070
|
+
const check = (job) => checkRecursiveUpdates(seen, job)
|
|
10071
|
+
;
|
|
10067
10072
|
try {
|
|
10068
10073
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
10069
10074
|
const job = queue[flushIndex];
|
|
10070
10075
|
if (job && job.active !== false) {
|
|
10071
|
-
if (true &&
|
|
10076
|
+
if (true && check(job)) {
|
|
10072
10077
|
continue;
|
|
10073
10078
|
}
|
|
10074
10079
|
// console.log(`running:`, job.id)
|
|
@@ -10412,7 +10417,7 @@ function defineExpose(exposed) {
|
|
|
10412
10417
|
}
|
|
10413
10418
|
/**
|
|
10414
10419
|
* Vue `<script setup>` compiler macro for providing props default values when
|
|
10415
|
-
* using type-based `defineProps`
|
|
10420
|
+
* using type-based `defineProps` declaration.
|
|
10416
10421
|
*
|
|
10417
10422
|
* Example usage:
|
|
10418
10423
|
* ```ts
|
|
@@ -10761,7 +10766,7 @@ function isMemoSame(cached, memo) {
|
|
|
10761
10766
|
}
|
|
10762
10767
|
|
|
10763
10768
|
// Core API ------------------------------------------------------------------
|
|
10764
|
-
const version = "3.2.
|
|
10769
|
+
const version = "3.2.12";
|
|
10765
10770
|
/**
|
|
10766
10771
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
10767
10772
|
* @internal
|
|
@@ -10890,19 +10895,13 @@ function patchClass(el, value, isSVG) {
|
|
|
10890
10895
|
|
|
10891
10896
|
function patchStyle(el, prev, next) {
|
|
10892
10897
|
const style = el.style;
|
|
10898
|
+
const currentDisplay = style.display;
|
|
10893
10899
|
if (!next) {
|
|
10894
10900
|
el.removeAttribute('style');
|
|
10895
10901
|
}
|
|
10896
10902
|
else if (isString(next)) {
|
|
10897
10903
|
if (prev !== next) {
|
|
10898
|
-
const current = style.display;
|
|
10899
10904
|
style.cssText = next;
|
|
10900
|
-
// indicates that the `display` of the element is controlled by `v-show`,
|
|
10901
|
-
// so we always keep the current `display` value regardless of the `style` value,
|
|
10902
|
-
// thus handing over control to `v-show`.
|
|
10903
|
-
if ('_vod' in el) {
|
|
10904
|
-
style.display = current;
|
|
10905
|
-
}
|
|
10906
10905
|
}
|
|
10907
10906
|
}
|
|
10908
10907
|
else {
|
|
@@ -10917,6 +10916,12 @@ function patchStyle(el, prev, next) {
|
|
|
10917
10916
|
}
|
|
10918
10917
|
}
|
|
10919
10918
|
}
|
|
10919
|
+
// indicates that the `display` of the element is controlled by `v-show`,
|
|
10920
|
+
// so we always keep the current `display` value regardless of the `style` value,
|
|
10921
|
+
// thus handing over control to `v-show`.
|
|
10922
|
+
if ('_vod' in el) {
|
|
10923
|
+
style.display = currentDisplay;
|
|
10924
|
+
}
|
|
10920
10925
|
}
|
|
10921
10926
|
const importantRE = /\s*!important$/;
|
|
10922
10927
|
function setStyle(style, name, val) {
|
|
@@ -11287,6 +11292,7 @@ class VueElement extends BaseClass {
|
|
|
11287
11292
|
this._instance = null;
|
|
11288
11293
|
this._connected = false;
|
|
11289
11294
|
this._resolved = false;
|
|
11295
|
+
this._numberProps = null;
|
|
11290
11296
|
if (this.shadowRoot && hydrate) {
|
|
11291
11297
|
hydrate(this._createVNode(), this.shadowRoot);
|
|
11292
11298
|
}
|
|
@@ -11302,18 +11308,17 @@ class VueElement extends BaseClass {
|
|
|
11302
11308
|
this._setAttr(this.attributes[i].name);
|
|
11303
11309
|
}
|
|
11304
11310
|
// watch future attr changes
|
|
11305
|
-
|
|
11311
|
+
new MutationObserver(mutations => {
|
|
11306
11312
|
for (const m of mutations) {
|
|
11307
11313
|
this._setAttr(m.attributeName);
|
|
11308
11314
|
}
|
|
11309
|
-
});
|
|
11310
|
-
observer.observe(this, { attributes: true });
|
|
11315
|
+
}).observe(this, { attributes: true });
|
|
11311
11316
|
}
|
|
11312
11317
|
connectedCallback() {
|
|
11313
11318
|
this._connected = true;
|
|
11314
11319
|
if (!this._instance) {
|
|
11315
11320
|
this._resolveDef();
|
|
11316
|
-
|
|
11321
|
+
this._update();
|
|
11317
11322
|
}
|
|
11318
11323
|
}
|
|
11319
11324
|
disconnectedCallback() {
|
|
@@ -11334,15 +11339,31 @@ class VueElement extends BaseClass {
|
|
|
11334
11339
|
}
|
|
11335
11340
|
const resolve = (def) => {
|
|
11336
11341
|
this._resolved = true;
|
|
11342
|
+
const { props, styles } = def;
|
|
11343
|
+
const hasOptions = !isArray(props);
|
|
11344
|
+
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
11345
|
+
// cast Number-type props set before resolve
|
|
11346
|
+
let numberProps;
|
|
11347
|
+
if (hasOptions) {
|
|
11348
|
+
for (const key in this._props) {
|
|
11349
|
+
const opt = props[key];
|
|
11350
|
+
if (opt === Number || (opt && opt.type === Number)) {
|
|
11351
|
+
this._props[key] = toNumber(this._props[key]);
|
|
11352
|
+
(numberProps || (numberProps = Object.create(null)))[key] = true;
|
|
11353
|
+
}
|
|
11354
|
+
}
|
|
11355
|
+
}
|
|
11356
|
+
if (numberProps) {
|
|
11357
|
+
this._numberProps = numberProps;
|
|
11358
|
+
this._update();
|
|
11359
|
+
}
|
|
11337
11360
|
// check if there are props set pre-upgrade or connect
|
|
11338
11361
|
for (const key of Object.keys(this)) {
|
|
11339
11362
|
if (key[0] !== '_') {
|
|
11340
11363
|
this._setProp(key, this[key]);
|
|
11341
11364
|
}
|
|
11342
11365
|
}
|
|
11343
|
-
const { props, styles } = def;
|
|
11344
11366
|
// defining getter/setters on prototype
|
|
11345
|
-
const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
|
|
11346
11367
|
for (const key of rawKeys.map(camelize)) {
|
|
11347
11368
|
Object.defineProperty(this, key, {
|
|
11348
11369
|
get() {
|
|
@@ -11364,7 +11385,11 @@ class VueElement extends BaseClass {
|
|
|
11364
11385
|
}
|
|
11365
11386
|
}
|
|
11366
11387
|
_setAttr(key) {
|
|
11367
|
-
|
|
11388
|
+
let value = this.getAttribute(key);
|
|
11389
|
+
if (this._numberProps && this._numberProps[key]) {
|
|
11390
|
+
value = toNumber(value);
|
|
11391
|
+
}
|
|
11392
|
+
this._setProp(camelize(key), value, false);
|
|
11368
11393
|
}
|
|
11369
11394
|
/**
|
|
11370
11395
|
* @internal
|
|
@@ -11379,7 +11404,7 @@ class VueElement extends BaseClass {
|
|
|
11379
11404
|
if (val !== this._props[key]) {
|
|
11380
11405
|
this._props[key] = val;
|
|
11381
11406
|
if (this._instance) {
|
|
11382
|
-
|
|
11407
|
+
this._update();
|
|
11383
11408
|
}
|
|
11384
11409
|
// reflect
|
|
11385
11410
|
if (shouldReflect) {
|
|
@@ -11395,6 +11420,9 @@ class VueElement extends BaseClass {
|
|
|
11395
11420
|
}
|
|
11396
11421
|
}
|
|
11397
11422
|
}
|
|
11423
|
+
_update() {
|
|
11424
|
+
render(this._createVNode(), this.shadowRoot);
|
|
11425
|
+
}
|
|
11398
11426
|
_createVNode() {
|
|
11399
11427
|
const vnode = createVNode(this._def, extend({}, this._props));
|
|
11400
11428
|
if (!this._instance) {
|
|
@@ -11415,7 +11443,7 @@ class VueElement extends BaseClass {
|
|
|
11415
11443
|
if (!this._def.__asyncLoader) {
|
|
11416
11444
|
// reload
|
|
11417
11445
|
this._instance = null;
|
|
11418
|
-
|
|
11446
|
+
this._update();
|
|
11419
11447
|
}
|
|
11420
11448
|
};
|
|
11421
11449
|
}
|