@vue/runtime-dom 3.2.16 → 3.2.20
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-dom.cjs.js +23 -7
- package/dist/runtime-dom.cjs.prod.js +23 -7
- package/dist/runtime-dom.d.ts +5 -1
- package/dist/runtime-dom.esm-browser.js +71 -32
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +48 -2
- package/dist/runtime-dom.global.js +72 -31
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1344,8 +1344,9 @@ function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
|
1344
1344
|
const fn = modelToUse[hook];
|
|
1345
1345
|
fn && fn(el, binding, vnode, prevVNode);
|
|
1346
1346
|
}
|
|
1347
|
-
// SSR vnode transforms
|
|
1348
|
-
|
|
1347
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1348
|
+
// function in SSR
|
|
1349
|
+
function initVModelForSSR() {
|
|
1349
1350
|
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
1350
1351
|
vModelRadio.getSSRProps = ({ value }, vnode) => {
|
|
1351
1352
|
if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
|
|
@@ -1460,15 +1461,17 @@ const vShow = {
|
|
|
1460
1461
|
setDisplay(el, value);
|
|
1461
1462
|
}
|
|
1462
1463
|
};
|
|
1463
|
-
{
|
|
1464
|
+
function setDisplay(el, value) {
|
|
1465
|
+
el.style.display = value ? el._vod : 'none';
|
|
1466
|
+
}
|
|
1467
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1468
|
+
// function in SSR
|
|
1469
|
+
function initVShowForSSR() {
|
|
1464
1470
|
vShow.getSSRProps = ({ value }) => {
|
|
1465
1471
|
if (!value) {
|
|
1466
1472
|
return { style: { display: 'none' } };
|
|
1467
1473
|
}
|
|
1468
1474
|
};
|
|
1469
|
-
}
|
|
1470
|
-
function setDisplay(el, value) {
|
|
1471
|
-
el.style.display = value ? el._vod : 'none';
|
|
1472
1475
|
}
|
|
1473
1476
|
|
|
1474
1477
|
const rendererOptions = shared.extend({ patchProp }, nodeOps);
|
|
@@ -1593,7 +1596,19 @@ function normalizeContainer(container) {
|
|
|
1593
1596
|
runtimeCore.warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
1594
1597
|
}
|
|
1595
1598
|
return container;
|
|
1596
|
-
}
|
|
1599
|
+
}
|
|
1600
|
+
let ssrDirectiveInitialized = false;
|
|
1601
|
+
/**
|
|
1602
|
+
* @internal
|
|
1603
|
+
*/
|
|
1604
|
+
const initDirectivesForSSR = () => {
|
|
1605
|
+
if (!ssrDirectiveInitialized) {
|
|
1606
|
+
ssrDirectiveInitialized = true;
|
|
1607
|
+
initVModelForSSR();
|
|
1608
|
+
initVShowForSSR();
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
;
|
|
1597
1612
|
|
|
1598
1613
|
Object.keys(runtimeCore).forEach(function (k) {
|
|
1599
1614
|
if (k !== 'default') exports[k] = runtimeCore[k];
|
|
@@ -1606,6 +1621,7 @@ exports.createSSRApp = createSSRApp;
|
|
|
1606
1621
|
exports.defineCustomElement = defineCustomElement;
|
|
1607
1622
|
exports.defineSSRCustomElement = defineSSRCustomElement;
|
|
1608
1623
|
exports.hydrate = hydrate;
|
|
1624
|
+
exports.initDirectivesForSSR = initDirectivesForSSR;
|
|
1609
1625
|
exports.render = render;
|
|
1610
1626
|
exports.useCssModule = useCssModule;
|
|
1611
1627
|
exports.useCssVars = useCssVars;
|
|
@@ -1295,8 +1295,9 @@ function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
|
1295
1295
|
const fn = modelToUse[hook];
|
|
1296
1296
|
fn && fn(el, binding, vnode, prevVNode);
|
|
1297
1297
|
}
|
|
1298
|
-
// SSR vnode transforms
|
|
1299
|
-
|
|
1298
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1299
|
+
// function in SSR
|
|
1300
|
+
function initVModelForSSR() {
|
|
1300
1301
|
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
1301
1302
|
vModelRadio.getSSRProps = ({ value }, vnode) => {
|
|
1302
1303
|
if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
|
|
@@ -1411,15 +1412,17 @@ const vShow = {
|
|
|
1411
1412
|
setDisplay(el, value);
|
|
1412
1413
|
}
|
|
1413
1414
|
};
|
|
1414
|
-
{
|
|
1415
|
+
function setDisplay(el, value) {
|
|
1416
|
+
el.style.display = value ? el._vod : 'none';
|
|
1417
|
+
}
|
|
1418
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1419
|
+
// function in SSR
|
|
1420
|
+
function initVShowForSSR() {
|
|
1415
1421
|
vShow.getSSRProps = ({ value }) => {
|
|
1416
1422
|
if (!value) {
|
|
1417
1423
|
return { style: { display: 'none' } };
|
|
1418
1424
|
}
|
|
1419
1425
|
};
|
|
1420
|
-
}
|
|
1421
|
-
function setDisplay(el, value) {
|
|
1422
|
-
el.style.display = value ? el._vod : 'none';
|
|
1423
1426
|
}
|
|
1424
1427
|
|
|
1425
1428
|
const rendererOptions = shared.extend({ patchProp }, nodeOps);
|
|
@@ -1488,7 +1491,19 @@ function normalizeContainer(container) {
|
|
|
1488
1491
|
return res;
|
|
1489
1492
|
}
|
|
1490
1493
|
return container;
|
|
1491
|
-
}
|
|
1494
|
+
}
|
|
1495
|
+
let ssrDirectiveInitialized = false;
|
|
1496
|
+
/**
|
|
1497
|
+
* @internal
|
|
1498
|
+
*/
|
|
1499
|
+
const initDirectivesForSSR = () => {
|
|
1500
|
+
if (!ssrDirectiveInitialized) {
|
|
1501
|
+
ssrDirectiveInitialized = true;
|
|
1502
|
+
initVModelForSSR();
|
|
1503
|
+
initVShowForSSR();
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
;
|
|
1492
1507
|
|
|
1493
1508
|
Object.keys(runtimeCore).forEach(function (k) {
|
|
1494
1509
|
if (k !== 'default') exports[k] = runtimeCore[k];
|
|
@@ -1501,6 +1516,7 @@ exports.createSSRApp = createSSRApp;
|
|
|
1501
1516
|
exports.defineCustomElement = defineCustomElement;
|
|
1502
1517
|
exports.defineSSRCustomElement = defineSSRCustomElement;
|
|
1503
1518
|
exports.hydrate = hydrate;
|
|
1519
|
+
exports.initDirectivesForSSR = initDirectivesForSSR;
|
|
1504
1520
|
exports.render = render;
|
|
1505
1521
|
exports.useCssModule = useCssModule;
|
|
1506
1522
|
exports.useCssVars = useCssVars;
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export declare const defineSSRCustomElement: typeof defineCustomElement;
|
|
|
56
56
|
|
|
57
57
|
export declare const hydrate: RootHydrateFunction;
|
|
58
58
|
|
|
59
|
+
/* Excluded from this release type: initDirectivesForSSR */
|
|
60
|
+
|
|
59
61
|
declare type InnerComponentDef = ConcreteComponent & {
|
|
60
62
|
styles?: string[];
|
|
61
63
|
};
|
|
@@ -195,7 +197,9 @@ export { }
|
|
|
195
197
|
import { VNode } from '@vue/runtime-core'
|
|
196
198
|
import * as CSS from 'csstype'
|
|
197
199
|
|
|
198
|
-
export interface CSSProperties
|
|
200
|
+
export interface CSSProperties
|
|
201
|
+
extends CSS.Properties<string | number>,
|
|
202
|
+
CSS.PropertiesHyphen<string | number> {
|
|
199
203
|
/**
|
|
200
204
|
* The index signature was removed to enable closed typing for style
|
|
201
205
|
* using CSSType. You're able to use type assertion or module augmentation
|
|
@@ -1438,14 +1438,7 @@ const hmrDirtyComponents = new Set();
|
|
|
1438
1438
|
// Note: for a component to be eligible for HMR it also needs the __hmrId option
|
|
1439
1439
|
// to be set so that its instances can be registered / removed.
|
|
1440
1440
|
{
|
|
1441
|
-
|
|
1442
|
-
? global
|
|
1443
|
-
: typeof self !== 'undefined'
|
|
1444
|
-
? self
|
|
1445
|
-
: typeof window !== 'undefined'
|
|
1446
|
-
? window
|
|
1447
|
-
: {};
|
|
1448
|
-
globalObject.__VUE_HMR_RUNTIME__ = {
|
|
1441
|
+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
1449
1442
|
createRecord: tryWrap(createRecord),
|
|
1450
1443
|
rerender: tryWrap(rerender),
|
|
1451
1444
|
reload: tryWrap(reload)
|
|
@@ -1456,19 +1449,22 @@ function registerHMR(instance) {
|
|
|
1456
1449
|
const id = instance.type.__hmrId;
|
|
1457
1450
|
let record = map.get(id);
|
|
1458
1451
|
if (!record) {
|
|
1459
|
-
createRecord(id);
|
|
1452
|
+
createRecord(id, instance.type);
|
|
1460
1453
|
record = map.get(id);
|
|
1461
1454
|
}
|
|
1462
|
-
record.add(instance);
|
|
1455
|
+
record.instances.add(instance);
|
|
1463
1456
|
}
|
|
1464
1457
|
function unregisterHMR(instance) {
|
|
1465
|
-
map.get(instance.type.__hmrId).delete(instance);
|
|
1458
|
+
map.get(instance.type.__hmrId).instances.delete(instance);
|
|
1466
1459
|
}
|
|
1467
|
-
function createRecord(id) {
|
|
1460
|
+
function createRecord(id, initialDef) {
|
|
1468
1461
|
if (map.has(id)) {
|
|
1469
1462
|
return false;
|
|
1470
1463
|
}
|
|
1471
|
-
map.set(id,
|
|
1464
|
+
map.set(id, {
|
|
1465
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
1466
|
+
instances: new Set()
|
|
1467
|
+
});
|
|
1472
1468
|
return true;
|
|
1473
1469
|
}
|
|
1474
1470
|
function normalizeClassComponent(component) {
|
|
@@ -1479,7 +1475,9 @@ function rerender(id, newRender) {
|
|
|
1479
1475
|
if (!record) {
|
|
1480
1476
|
return;
|
|
1481
1477
|
}
|
|
1482
|
-
|
|
1478
|
+
// update initial record (for not-yet-rendered component)
|
|
1479
|
+
record.initialDef.render = newRender;
|
|
1480
|
+
[...record.instances].forEach(instance => {
|
|
1483
1481
|
if (newRender) {
|
|
1484
1482
|
instance.render = newRender;
|
|
1485
1483
|
normalizeClassComponent(instance.type).render = newRender;
|
|
@@ -1496,17 +1494,16 @@ function reload(id, newComp) {
|
|
|
1496
1494
|
if (!record)
|
|
1497
1495
|
return;
|
|
1498
1496
|
newComp = normalizeClassComponent(newComp);
|
|
1497
|
+
// update initial def (for not-yet-rendered components)
|
|
1498
|
+
updateComponentDef(record.initialDef, newComp);
|
|
1499
1499
|
// create a snapshot which avoids the set being mutated during updates
|
|
1500
|
-
const instances = [...record];
|
|
1500
|
+
const instances = [...record.instances];
|
|
1501
1501
|
for (const instance of instances) {
|
|
1502
1502
|
const oldComp = normalizeClassComponent(instance.type);
|
|
1503
1503
|
if (!hmrDirtyComponents.has(oldComp)) {
|
|
1504
1504
|
// 1. Update existing comp definition to match new one
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
if (key !== '__file' && !(key in newComp)) {
|
|
1508
|
-
delete oldComp[key];
|
|
1509
|
-
}
|
|
1505
|
+
if (oldComp !== record.initialDef) {
|
|
1506
|
+
updateComponentDef(oldComp, newComp);
|
|
1510
1507
|
}
|
|
1511
1508
|
// 2. mark definition dirty. This forces the renderer to replace the
|
|
1512
1509
|
// component on patch.
|
|
@@ -1552,6 +1549,14 @@ function reload(id, newComp) {
|
|
|
1552
1549
|
}
|
|
1553
1550
|
});
|
|
1554
1551
|
}
|
|
1552
|
+
function updateComponentDef(oldComp, newComp) {
|
|
1553
|
+
extend(oldComp, newComp);
|
|
1554
|
+
for (const key in oldComp) {
|
|
1555
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
1556
|
+
delete oldComp[key];
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1555
1560
|
function tryWrap(fn) {
|
|
1556
1561
|
return (id, arg) => {
|
|
1557
1562
|
try {
|
|
@@ -1588,6 +1593,11 @@ function setDevtoolsHook(hook, target) {
|
|
|
1588
1593
|
replay.push((newHook) => {
|
|
1589
1594
|
setDevtoolsHook(newHook, target);
|
|
1590
1595
|
});
|
|
1596
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
1597
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
1598
|
+
setTimeout(() => {
|
|
1599
|
+
buffer = [];
|
|
1600
|
+
}, 3000);
|
|
1591
1601
|
}
|
|
1592
1602
|
}
|
|
1593
1603
|
function devtoolsInitApp(app, version) {
|
|
@@ -7712,9 +7722,11 @@ const isRuntimeOnly = () => !compile;
|
|
|
7712
7722
|
function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
7713
7723
|
const Component = instance.type;
|
|
7714
7724
|
// template / render function normalization
|
|
7725
|
+
// could be already set when returned from setup()
|
|
7715
7726
|
if (!instance.render) {
|
|
7716
|
-
//
|
|
7717
|
-
|
|
7727
|
+
// only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
|
|
7728
|
+
// is done by server-renderer
|
|
7729
|
+
if (!isSSR && compile && !Component.render) {
|
|
7718
7730
|
const template = Component.template;
|
|
7719
7731
|
if (template) {
|
|
7720
7732
|
{
|
|
@@ -8604,15 +8616,21 @@ function getContext() {
|
|
|
8604
8616
|
* only.
|
|
8605
8617
|
* @internal
|
|
8606
8618
|
*/
|
|
8607
|
-
function mergeDefaults(
|
|
8608
|
-
|
|
8609
|
-
|
|
8619
|
+
function mergeDefaults(raw, defaults) {
|
|
8620
|
+
const props = isArray(raw)
|
|
8621
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
8622
|
+
: raw;
|
|
8610
8623
|
for (const key in defaults) {
|
|
8611
|
-
const
|
|
8612
|
-
if (
|
|
8613
|
-
|
|
8624
|
+
const opt = props[key];
|
|
8625
|
+
if (opt) {
|
|
8626
|
+
if (isArray(opt) || isFunction(opt)) {
|
|
8627
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
8628
|
+
}
|
|
8629
|
+
else {
|
|
8630
|
+
opt.default = defaults[key];
|
|
8631
|
+
}
|
|
8614
8632
|
}
|
|
8615
|
-
else if (
|
|
8633
|
+
else if (opt === null) {
|
|
8616
8634
|
props[key] = { default: defaults[key] };
|
|
8617
8635
|
}
|
|
8618
8636
|
else {
|
|
@@ -8621,6 +8639,23 @@ props, defaults) {
|
|
|
8621
8639
|
}
|
|
8622
8640
|
return props;
|
|
8623
8641
|
}
|
|
8642
|
+
/**
|
|
8643
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
8644
|
+
* defineProps().
|
|
8645
|
+
* @internal
|
|
8646
|
+
*/
|
|
8647
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
8648
|
+
const ret = {};
|
|
8649
|
+
for (const key in props) {
|
|
8650
|
+
if (!excludedKeys.includes(key)) {
|
|
8651
|
+
Object.defineProperty(ret, key, {
|
|
8652
|
+
enumerable: true,
|
|
8653
|
+
get: () => props[key]
|
|
8654
|
+
});
|
|
8655
|
+
}
|
|
8656
|
+
}
|
|
8657
|
+
return ret;
|
|
8658
|
+
}
|
|
8624
8659
|
/**
|
|
8625
8660
|
* `<script setup>` helper for persisting the current instance context over
|
|
8626
8661
|
* async/await flows.
|
|
@@ -8913,7 +8948,7 @@ function isMemoSame(cached, memo) {
|
|
|
8913
8948
|
}
|
|
8914
8949
|
|
|
8915
8950
|
// Core API ------------------------------------------------------------------
|
|
8916
|
-
const version = "3.2.
|
|
8951
|
+
const version = "3.2.20";
|
|
8917
8952
|
/**
|
|
8918
8953
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
8919
8954
|
* @internal
|
|
@@ -10535,6 +10570,10 @@ function normalizeContainer(container) {
|
|
|
10535
10570
|
warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
10536
10571
|
}
|
|
10537
10572
|
return container;
|
|
10538
|
-
}
|
|
10573
|
+
}
|
|
10574
|
+
/**
|
|
10575
|
+
* @internal
|
|
10576
|
+
*/
|
|
10577
|
+
const initDirectivesForSSR = NOOP;
|
|
10539
10578
|
|
|
10540
|
-
export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|
|
10579
|
+
export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|