@dcloudio/uni-mp-vue 3.0.0-alpha-3030020211201002 → 3.0.0-alpha-3030020211208001
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.runtime.esm.js +144 -13
- package/package.json +2 -2
package/dist/vue.runtime.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extend, isSymbol, isObject, toRawType, def, hasChanged, isArray, isFunction, NOOP, remove, toHandlerKey, camelize, capitalize, isString, normalizeClass, normalizeStyle, isOn, isPromise, EMPTY_OBJ, isSet, isMap, isPlainObject,
|
|
1
|
+
import { extend, isSymbol, isObject, toRawType, def, hasChanged, isArray, isFunction, NOOP, remove, toHandlerKey, hasOwn, camelize, hyphenate, isReservedProp, capitalize, isString, normalizeClass, normalizeStyle, isOn, isPromise, EMPTY_OBJ, isSet, isMap, isPlainObject, isIntegerKey, makeMap, toTypeString, invokeArrayFns, NO, toNumber, EMPTY_ARR, stringifyStyle as stringifyStyle$1, toDisplayString } from '@vue/shared';
|
|
2
2
|
export { camelize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
3
3
|
import { isRootHook, ON_ERROR, UniLifecycleHooks, dynamicSlotName } from '@dcloudio/uni-shared';
|
|
4
4
|
|
|
@@ -1968,6 +1968,99 @@ isSSR = false) {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
instance.attrs = attrs;
|
|
1970
1970
|
}
|
|
1971
|
+
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
1972
|
+
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
1973
|
+
const rawCurrentProps = toRaw(props);
|
|
1974
|
+
const [options] = instance.propsOptions;
|
|
1975
|
+
let hasAttrsChanged = false;
|
|
1976
|
+
if (
|
|
1977
|
+
// always force full diff in dev
|
|
1978
|
+
// - #1942 if hmr is enabled with sfc component
|
|
1979
|
+
// - vite#872 non-sfc component used by sfc component
|
|
1980
|
+
!((process.env.NODE_ENV !== 'production') &&
|
|
1981
|
+
(instance.type.__hmrId ||
|
|
1982
|
+
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
1983
|
+
(optimized || patchFlag > 0) &&
|
|
1984
|
+
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
1985
|
+
if (patchFlag & 8 /* PROPS */) {
|
|
1986
|
+
// Compiler-generated props & no keys change, just set the updated
|
|
1987
|
+
// the props.
|
|
1988
|
+
const propsToUpdate = instance.vnode.dynamicProps;
|
|
1989
|
+
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
1990
|
+
let key = propsToUpdate[i];
|
|
1991
|
+
// PROPS flag guarantees rawProps to be non-null
|
|
1992
|
+
const value = rawProps[key];
|
|
1993
|
+
if (options) {
|
|
1994
|
+
// attr / props separation was done on init and will be consistent
|
|
1995
|
+
// in this code path, so just check if attrs have it.
|
|
1996
|
+
if (hasOwn(attrs, key)) {
|
|
1997
|
+
if (value !== attrs[key]) {
|
|
1998
|
+
attrs[key] = value;
|
|
1999
|
+
hasAttrsChanged = true;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
else {
|
|
2003
|
+
const camelizedKey = camelize(key);
|
|
2004
|
+
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
else {
|
|
2008
|
+
if (value !== attrs[key]) {
|
|
2009
|
+
attrs[key] = value;
|
|
2010
|
+
hasAttrsChanged = true;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
else {
|
|
2017
|
+
// full props update.
|
|
2018
|
+
if (setFullProps(instance, rawProps, props, attrs)) {
|
|
2019
|
+
hasAttrsChanged = true;
|
|
2020
|
+
}
|
|
2021
|
+
// in case of dynamic props, check if we need to delete keys from
|
|
2022
|
+
// the props object
|
|
2023
|
+
let kebabKey;
|
|
2024
|
+
for (const key in rawCurrentProps) {
|
|
2025
|
+
if (!rawProps ||
|
|
2026
|
+
// for camelCase
|
|
2027
|
+
(!hasOwn(rawProps, key) &&
|
|
2028
|
+
// it's possible the original props was passed in as kebab-case
|
|
2029
|
+
// and converted to camelCase (#955)
|
|
2030
|
+
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
|
2031
|
+
if (options) {
|
|
2032
|
+
if (rawPrevProps &&
|
|
2033
|
+
// for camelCase
|
|
2034
|
+
(rawPrevProps[key] !== undefined ||
|
|
2035
|
+
// for kebab-case
|
|
2036
|
+
rawPrevProps[kebabKey] !== undefined)) {
|
|
2037
|
+
props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
else {
|
|
2041
|
+
delete props[key];
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
// in the case of functional component w/o props declaration, props and
|
|
2046
|
+
// attrs point to the same object so it should already have been updated.
|
|
2047
|
+
if (attrs !== rawCurrentProps) {
|
|
2048
|
+
for (const key in attrs) {
|
|
2049
|
+
if (!rawProps || !hasOwn(rawProps, key)) {
|
|
2050
|
+
delete attrs[key];
|
|
2051
|
+
hasAttrsChanged = true;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
// trigger updates for $attrs in case it's used in component slots
|
|
2057
|
+
if (hasAttrsChanged) {
|
|
2058
|
+
trigger(instance, "set" /* SET */, '$attrs');
|
|
2059
|
+
}
|
|
2060
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
2061
|
+
validateProps(rawProps || {}, props, instance);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
1971
2064
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
1972
2065
|
const [options, needCastKeys] = instance.propsOptions;
|
|
1973
2066
|
let hasAttrsChanged = false;
|
|
@@ -1991,7 +2084,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
1991
2084
|
}
|
|
1992
2085
|
}
|
|
1993
2086
|
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
1994
|
-
if (value !== attrs[key]) {
|
|
2087
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
1995
2088
|
attrs[key] = value;
|
|
1996
2089
|
hasAttrsChanged = true;
|
|
1997
2090
|
}
|
|
@@ -3749,6 +3842,12 @@ function queueFlush() {
|
|
|
3749
3842
|
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
3750
3843
|
}
|
|
3751
3844
|
}
|
|
3845
|
+
function invalidateJob(job) {
|
|
3846
|
+
const i = queue.indexOf(job);
|
|
3847
|
+
if (i > flushIndex) {
|
|
3848
|
+
queue.splice(i, 1);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3752
3851
|
function queueCb(cb, activeQueue, pendingQueue, index) {
|
|
3753
3852
|
if (!isArray(cb)) {
|
|
3754
3853
|
if (!activeQueue ||
|
|
@@ -4289,7 +4388,7 @@ const useSSRContext = () => {
|
|
|
4289
4388
|
};
|
|
4290
4389
|
|
|
4291
4390
|
// Core API ------------------------------------------------------------------
|
|
4292
|
-
const version = "3.2.
|
|
4391
|
+
const version = "3.2.24";
|
|
4293
4392
|
/**
|
|
4294
4393
|
* @internal only exposed in compat builds
|
|
4295
4394
|
*/
|
|
@@ -4297,6 +4396,9 @@ const resolveFilter = null;
|
|
|
4297
4396
|
|
|
4298
4397
|
function unwrapper(target) {
|
|
4299
4398
|
return unref(target);
|
|
4399
|
+
}
|
|
4400
|
+
function defineAsyncComponent(source) {
|
|
4401
|
+
console.error('defineAsyncComponent is unsupported');
|
|
4300
4402
|
}
|
|
4301
4403
|
|
|
4302
4404
|
// import deepCopy from './deepCopy'
|
|
@@ -4643,8 +4745,12 @@ const getFunctionalFallthrough = (attrs) => {
|
|
|
4643
4745
|
return res;
|
|
4644
4746
|
};
|
|
4645
4747
|
function renderComponentRoot(instance) {
|
|
4646
|
-
const { type: Component, vnode, proxy, withProxy, props, slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;
|
|
4748
|
+
const { type: Component, vnode, proxy, withProxy, props, slots, attrs, emit, render, renderCache, data, setupState, ctx, uid, appContext: { app: { config: { globalProperties: { pruneComponentPropsCache } } } } } = instance;
|
|
4647
4749
|
instance.$ei = 0;
|
|
4750
|
+
// props
|
|
4751
|
+
pruneComponentPropsCache(uid);
|
|
4752
|
+
instance.__counter =
|
|
4753
|
+
instance.__counter === 0 ? 1 : 0;
|
|
4648
4754
|
let result;
|
|
4649
4755
|
const prev = setCurrentRenderingInstance(instance);
|
|
4650
4756
|
try {
|
|
@@ -4970,12 +5076,32 @@ function initApp(app) {
|
|
|
4970
5076
|
}
|
|
4971
5077
|
}
|
|
4972
5078
|
|
|
5079
|
+
const propsCaches = Object.create(null);
|
|
5080
|
+
function renderProps(props) {
|
|
5081
|
+
const { uid, __counter } = getCurrentInstance();
|
|
5082
|
+
const propsId = (propsCaches[uid] || (propsCaches[uid] = [])).push(guardReactiveProps(props)) - 1;
|
|
5083
|
+
// 强制每次更新
|
|
5084
|
+
return uid + ',' + propsId + ',' + __counter;
|
|
5085
|
+
}
|
|
5086
|
+
function pruneComponentPropsCache(uid) {
|
|
5087
|
+
delete propsCaches[uid];
|
|
5088
|
+
}
|
|
5089
|
+
function findComponentPropsData(up) {
|
|
5090
|
+
if (!up) {
|
|
5091
|
+
return;
|
|
5092
|
+
}
|
|
5093
|
+
const [uid, propsId] = up.split(',');
|
|
5094
|
+
if (!propsCaches[uid]) {
|
|
5095
|
+
return;
|
|
5096
|
+
}
|
|
5097
|
+
return propsCaches[uid][parseInt(propsId)];
|
|
5098
|
+
}
|
|
5099
|
+
|
|
4973
5100
|
var plugin = {
|
|
4974
5101
|
install(app) {
|
|
4975
5102
|
initApp(app);
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
app.config.globalProperties.$el = {};
|
|
5103
|
+
app.config.globalProperties.pruneComponentPropsCache =
|
|
5104
|
+
pruneComponentPropsCache;
|
|
4979
5105
|
const oldMount = app.mount;
|
|
4980
5106
|
app.mount = function mount(rootContainer) {
|
|
4981
5107
|
const instance = oldMount.call(app, rootContainer);
|
|
@@ -4995,9 +5121,11 @@ var plugin = {
|
|
|
4995
5121
|
},
|
|
4996
5122
|
};
|
|
4997
5123
|
function getCreateApp() {
|
|
4998
|
-
const method = process.env.
|
|
4999
|
-
? '
|
|
5000
|
-
:
|
|
5124
|
+
const method = process.env.UNI_MP_PLUGIN
|
|
5125
|
+
? 'createPluginApp'
|
|
5126
|
+
: process.env.UNI_SUBPACKAGE
|
|
5127
|
+
? 'createSubpackageApp'
|
|
5128
|
+
: 'createApp';
|
|
5001
5129
|
if (typeof global !== 'undefined') {
|
|
5002
5130
|
return global[method];
|
|
5003
5131
|
}
|
|
@@ -5118,11 +5246,13 @@ function vFor(source, renderItem) {
|
|
|
5118
5246
|
|
|
5119
5247
|
function renderSlot(name, props = {}, key) {
|
|
5120
5248
|
const instance = getCurrentInstance();
|
|
5121
|
-
const
|
|
5249
|
+
const { parent, isMounted, ctx: { $scope }, } = instance;
|
|
5250
|
+
// mp-alipay 为 props
|
|
5251
|
+
const vueIds = ($scope.properties || $scope.props).uI;
|
|
5122
5252
|
if (!vueIds) {
|
|
5123
5253
|
return;
|
|
5124
5254
|
}
|
|
5125
|
-
if (!
|
|
5255
|
+
if (!parent && !isMounted) {
|
|
5126
5256
|
// 头条小程序首次 render 时,还没有 parent
|
|
5127
5257
|
onMounted(() => {
|
|
5128
5258
|
renderSlot(name, props, key);
|
|
@@ -5255,6 +5385,7 @@ const e = (target, ...sources) => extend(target, ...sources);
|
|
|
5255
5385
|
const h = (str) => hyphenate(str);
|
|
5256
5386
|
const n = (value) => normalizeClass(value);
|
|
5257
5387
|
const t = (val) => toDisplayString(val);
|
|
5388
|
+
const p = (props) => renderProps(props);
|
|
5258
5389
|
const sr = (ref, id) => setRef(ref, id);
|
|
5259
5390
|
|
|
5260
5391
|
function createApp(rootComponent, rootProps = null) {
|
|
@@ -5263,4 +5394,4 @@ function createApp(rootComponent, rootProps = null) {
|
|
|
5263
5394
|
}
|
|
5264
5395
|
const createSSRApp = createApp;
|
|
5265
5396
|
|
|
5266
|
-
export { EffectScope, Fragment, ReactiveEffect, Text, c, callWithAsyncErrorHandling, callWithErrorHandling, computed, createApp, createSSRApp, createVNode$1 as createVNode, createVueApp, customRef, d, defineComponent, defineEmits, defineExpose, defineProps, e, effect, effectScope, f, getCurrentInstance, getCurrentScope, h, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, mergeDefaults, mergeProps, n, nextTick, o, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onUnmounted, onUpdated, patch, provide, proxyRefs, queuePostFlushCb, r, reactive, readonly, ref, resolveComponent, resolveDirective, resolveFilter, s, setCurrentRenderingInstance, setupDevtoolsPlugin, shallowReactive, shallowReadonly, shallowRef, sr, stop, t, toHandlers, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, version, w, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withModifiers, withScopeId };
|
|
5397
|
+
export { EffectScope, Fragment, ReactiveEffect, Text, c, callWithAsyncErrorHandling, callWithErrorHandling, computed, createApp, createSSRApp, createVNode$1 as createVNode, createVueApp, customRef, d, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, e, effect, effectScope, f, findComponentPropsData, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, injectHook, invalidateJob, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, mergeDefaults, mergeProps, n, nextTick, o, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, p, patch, provide, proxyRefs, pruneComponentPropsCache, queuePostFlushCb, r, reactive, readonly, ref, resolveComponent, resolveDirective, resolveFilter, s, setCurrentRenderingInstance, setupDevtoolsPlugin, shallowReactive, shallowReadonly, shallowRef, sr, stop, t, toHandlers, toRaw, toRef, toRefs, triggerRef, unref, updateProps, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, version, w, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withModifiers, withScopeId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-mp-vue",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3030020211208001",
|
|
4
4
|
"description": "@dcloudio/uni-mp-vue",
|
|
5
5
|
"main": "dist/vue.runtime.esm.js",
|
|
6
6
|
"module": "dist/vue.runtime.esm.js",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@dcloudio/uni-mp-vue": "3.0.0-alpha-
|
|
22
|
+
"@dcloudio/uni-mp-vue": "3.0.0-alpha-3030020211208001"
|
|
23
23
|
}
|
|
24
24
|
}
|