10.18前的开发

This commit is contained in:
2023-10-18 21:00:42 +08:00
parent 4fa658db18
commit aa47166ae7
70 changed files with 9936 additions and 172 deletions

View File

@@ -29,7 +29,7 @@ function normalizeStyle(value) {
return res;
} else if (isString(value)) {
return value;
} else if (isObject(value)) {
} else if (isObject$1(value)) {
return value;
}
}
@@ -57,7 +57,7 @@ function normalizeClass(value) {
res += normalized + " ";
}
}
} else if (isObject(value)) {
} else if (isObject$1(value)) {
for (const name in value) {
if (value[name]) {
res += name + " ";
@@ -66,6 +66,28 @@ function normalizeClass(value) {
}
return res.trim();
}
const toDisplayString = (val) => {
return isString(val) ? val : val == null ? "" : isArray(val) || isObject$1(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
entries[`${key} =>`] = val2;
return entries;
}, {})
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()]
};
} else if (isObject$1(val) && !isArray(val) && !isPlainObject$1(val)) {
return String(val);
}
return val;
};
const EMPTY_OBJ = Object.freeze({});
const EMPTY_ARR = Object.freeze([]);
const NOOP = () => {
@@ -81,17 +103,17 @@ const remove = (arr, el) => {
arr.splice(i, 1);
}
};
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
const hasOwn$1 = (val, key) => hasOwnProperty$2.call(val, key);
const isArray = Array.isArray;
const isMap = (val) => toTypeString(val) === "[object Map]";
const isSet = (val) => toTypeString(val) === "[object Set]";
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isSymbol = (val) => typeof val === "symbol";
const isObject = (val) => val !== null && typeof val === "object";
const isObject$1 = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
@@ -362,11 +384,96 @@ E.prototype = {
}
};
var E$1 = E;
const isObject = (val) => val !== null && typeof val === "object";
const defaultDelimiters = ["{", "}"];
class BaseFormatter {
constructor() {
this._caches = /* @__PURE__ */ Object.create(null);
}
interpolate(message, values, delimiters = defaultDelimiters) {
if (!values) {
return [message];
}
let tokens = this._caches[message];
if (!tokens) {
tokens = parse(message, delimiters);
this._caches[message] = tokens;
}
return compile$1(tokens, values);
}
}
const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
function parse(format, [startDelimiter, endDelimiter]) {
const tokens = [];
let position = 0;
let text = "";
while (position < format.length) {
let char = format[position++];
if (char === startDelimiter) {
if (text) {
tokens.push({ type: "text", value: text });
}
text = "";
let sub = "";
char = format[position++];
while (char !== void 0 && char !== endDelimiter) {
sub += char;
char = format[position++];
}
const isClosed = char === endDelimiter;
const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
tokens.push({ value: sub, type });
} else {
text += char;
}
}
text && tokens.push({ type: "text", value: text });
return tokens;
}
function compile$1(tokens, values) {
const compiled = [];
let index2 = 0;
const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
if (mode === "unknown") {
return compiled;
}
while (index2 < tokens.length) {
const token = tokens[index2];
switch (token.type) {
case "text":
compiled.push(token.value);
break;
case "list":
compiled.push(values[parseInt(token.value, 10)]);
break;
case "named":
if (mode === "named") {
compiled.push(values[token.value]);
} else {
{
console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
}
}
break;
case "unknown":
{
console.warn(`Detect 'unknown' type of token!`);
}
break;
}
index2++;
}
return compiled;
}
const LOCALE_ZH_HANS = "zh-Hans";
const LOCALE_ZH_HANT = "zh-Hant";
const LOCALE_EN = "en";
const LOCALE_FR = "fr";
const LOCALE_ES = "es";
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
const defaultFormatter = new BaseFormatter();
function include(str, parts) {
return !!parts.find((part) => str.indexOf(part) !== -1);
}
@@ -406,6 +513,161 @@ function normalizeLocale(locale, messages) {
return lang;
}
}
class I18n {
constructor({ locale, fallbackLocale, messages, watcher, formater }) {
this.locale = LOCALE_EN;
this.fallbackLocale = LOCALE_EN;
this.message = {};
this.messages = {};
this.watchers = [];
if (fallbackLocale) {
this.fallbackLocale = fallbackLocale;
}
this.formater = formater || defaultFormatter;
this.messages = messages || {};
this.setLocale(locale || LOCALE_EN);
if (watcher) {
this.watchLocale(watcher);
}
}
setLocale(locale) {
const oldLocale = this.locale;
this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
if (!this.messages[this.locale]) {
this.messages[this.locale] = {};
}
this.message = this.messages[this.locale];
if (oldLocale !== this.locale) {
this.watchers.forEach((watcher) => {
watcher(this.locale, oldLocale);
});
}
}
getLocale() {
return this.locale;
}
watchLocale(fn) {
const index2 = this.watchers.push(fn) - 1;
return () => {
this.watchers.splice(index2, 1);
};
}
add(locale, message, override = true) {
const curMessages = this.messages[locale];
if (curMessages) {
if (override) {
Object.assign(curMessages, message);
} else {
Object.keys(message).forEach((key) => {
if (!hasOwn(curMessages, key)) {
curMessages[key] = message[key];
}
});
}
} else {
this.messages[locale] = message;
}
}
f(message, values, delimiters) {
return this.formater.interpolate(message, values, delimiters).join("");
}
t(key, locale, values) {
let message = this.message;
if (typeof locale === "string") {
locale = normalizeLocale(locale, this.messages);
locale && (message = this.messages[locale]);
} else {
values = locale;
}
if (!hasOwn(message, key)) {
console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
return key;
}
return this.formater.interpolate(message[key], values).join("");
}
}
function watchAppLocale(appVm, i18n) {
if (appVm.$watchLocale) {
appVm.$watchLocale((newLocale) => {
i18n.setLocale(newLocale);
});
} else {
appVm.$watch(() => appVm.$locale, (newLocale) => {
i18n.setLocale(newLocale);
});
}
}
function getDefaultLocale() {
if (typeof index !== "undefined" && index.getLocale) {
return index.getLocale();
}
if (typeof global !== "undefined" && global.getLocale) {
return global.getLocale();
}
return LOCALE_EN;
}
function initVueI18n(locale, messages = {}, fallbackLocale, watcher) {
if (typeof locale !== "string") {
[locale, messages] = [
messages,
locale
];
}
if (typeof locale !== "string") {
locale = getDefaultLocale();
}
if (typeof fallbackLocale !== "string") {
fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
}
const i18n = new I18n({
locale,
fallbackLocale,
messages,
watcher
});
let t2 = (key, values) => {
if (typeof getApp !== "function") {
t2 = function(key2, values2) {
return i18n.t(key2, values2);
};
} else {
let isWatchedAppLocale = false;
t2 = function(key2, values2) {
const appVm = getApp().$vm;
if (appVm) {
appVm.$locale;
if (!isWatchedAppLocale) {
isWatchedAppLocale = true;
watchAppLocale(appVm, i18n);
}
}
return i18n.t(key2, values2);
};
}
return t2(key, values);
};
return {
i18n,
f(message, values, delimiters) {
return i18n.f(message, values, delimiters);
},
t(key, values) {
return t2(key, values);
},
add(locale2, message, override = true) {
return i18n.add(locale2, message, override);
},
watch(fn) {
return i18n.watchLocale(fn);
},
getLocale() {
return i18n.getLocale();
},
setLocale(newLocale) {
return i18n.setLocale(newLocale);
}
};
}
function getBaseSystemInfo() {
return wx.getSystemInfoSync();
}
@@ -417,7 +679,7 @@ function validateProtocol(name, data, protocol, onFail) {
onFail = validateProtocolFail;
}
for (const key in protocol) {
const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn(data, key));
const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn$1(data, key));
if (isString(errMsg)) {
onFail(name, errMsg);
}
@@ -474,13 +736,13 @@ function assertType$1(value, type) {
let valid;
const expectedType = getType$1(type);
if (isSimpleType$1(expectedType)) {
const t = typeof value;
valid = t === expectedType.toLowerCase();
if (!valid && t === "object") {
const t2 = typeof value;
valid = t2 === expectedType.toLowerCase();
if (!valid && t2 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
valid = isObject(value);
valid = isObject$1(value);
} else if (expectedType === "Array") {
valid = isArray(value);
} else {
@@ -736,7 +998,7 @@ function formatApiArgs(args, options) {
return errMsg;
}
} else {
if (!hasOwn(params, name)) {
if (!hasOwn$1(params, name)) {
params[name] = formatterOrDefaultValue;
}
}
@@ -1104,7 +1366,7 @@ function initWrapper(protocols2) {
argsOption = argsOption(fromArgs, toArgs) || {};
}
for (const key in fromArgs) {
if (hasOwn(argsOption, key)) {
if (hasOwn$1(argsOption, key)) {
let keyOption = argsOption[key];
if (isFunction(keyOption)) {
keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
@@ -1122,7 +1384,7 @@ function initWrapper(protocols2) {
toArgs[key] = processCallback(methodName, callback, returnValue);
}
} else {
if (!keepFromArgs && !hasOwn(toArgs, key)) {
if (!keepFromArgs && !hasOwn$1(toArgs, key)) {
toArgs[key] = fromArgs[key];
}
}
@@ -1140,7 +1402,7 @@ function initWrapper(protocols2) {
return processArgs(methodName, res, returnValue, {}, keepReturnValue);
}
return function wrapper(methodName, method) {
if (!hasOwn(protocols2, methodName)) {
if (!hasOwn$1(protocols2, methodName)) {
return method;
}
const protocol = protocols2[methodName];
@@ -1434,13 +1696,13 @@ function initUni(api, protocols2, platform = wx) {
const wrapper = initWrapper(protocols2);
const UniProxyHandlers = {
get(target, key) {
if (hasOwn(target, key)) {
if (hasOwn$1(target, key)) {
return target[key];
}
if (hasOwn(api, key)) {
if (hasOwn$1(api, key)) {
return promisify(key, api[key]);
}
if (hasOwn(baseApis, key)) {
if (hasOwn$1(baseApis, key)) {
return promisify(key, baseApis[key]);
}
return promisify(key, wrapper(key, platform[key]));
@@ -1941,7 +2203,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
}
const targetIsArray = isArray(target);
if (!isReadonly2) {
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
if (targetIsArray && hasOwn$1(arrayInstrumentations, key)) {
return Reflect.get(arrayInstrumentations, key, receiver);
}
if (key === "hasOwnProperty") {
@@ -1961,7 +2223,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
if (isRef(res)) {
return targetIsArray && isIntegerKey(key) ? res : res.value;
}
if (isObject(res)) {
if (isObject$1(res)) {
return isReadonly2 ? readonly(res) : reactive(res);
}
return res;
@@ -1985,7 +2247,7 @@ function createSetter(shallow = false) {
return true;
}
}
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$1(target, key);
const result = Reflect.set(target, key, value, receiver);
if (target === toRaw(receiver)) {
if (!hadKey) {
@@ -1998,7 +2260,7 @@ function createSetter(shallow = false) {
};
}
function deleteProperty(target, key) {
const hadKey = hasOwn(target, key);
const hadKey = hasOwn$1(target, key);
const oldValue = target[key];
const result = Reflect.deleteProperty(target, key);
if (result && hadKey) {
@@ -2315,7 +2577,7 @@ function createInstrumentationGetter(isReadonly2, shallow) {
} else if (key === "__v_raw") {
return target;
}
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
return Reflect.get(hasOwn$1(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
};
}
const mutableCollectionHandlers = {
@@ -2377,7 +2639,7 @@ function shallowReadonly(target) {
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
}
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
if (!isObject(target)) {
if (!isObject$1(target)) {
{
console.warn(`value cannot be made reactive: ${String(target)}`);
}
@@ -2442,8 +2704,8 @@ function markRaw(value) {
def(value, "__v_skip", true);
return value;
}
const toReactive = (value) => isObject(value) ? reactive(value) : value;
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
function trackRefValue(ref2) {
if (shouldTrack && activeEffect) {
ref2 = toRaw(ref2);
@@ -3235,7 +3497,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
}
}
if (!raw && !hasExtends) {
if (isObject(comp)) {
if (isObject$1(comp)) {
cache.set(comp, null);
}
return null;
@@ -3245,7 +3507,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
} else {
extend(normalized, raw);
}
if (isObject(comp)) {
if (isObject$1(comp)) {
cache.set(comp, normalized);
}
return normalized;
@@ -3255,7 +3517,7 @@ function isEmitListener(options, key) {
return false;
}
key = key.slice(2).replace(/Once$/, "");
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
return hasOwn$1(options, key[0].toLowerCase() + key.slice(1)) || hasOwn$1(options, hyphenate(key)) || hasOwn$1(options, key);
}
let currentRenderingInstance = null;
function setCurrentRenderingInstance(instance) {
@@ -3472,7 +3734,7 @@ function createPathGetter(ctx, path) {
};
}
function traverse(value, seen) {
if (!isObject(value) || value[
if (!isObject$1(value) || value[
"__v_skip"
/* ReactiveFlags.SKIP */
]) {
@@ -3687,7 +3949,7 @@ const publicPropertiesMap = (
})
);
const isReservedPrefix = (key) => key === "_" || key === "$";
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn$1(state, key);
const PublicInstanceProxyHandlers = {
get({ _: instance }, key) {
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3711,17 +3973,17 @@ const PublicInstanceProxyHandlers = {
} else if (hasSetupBinding(setupState, key)) {
accessCache[key] = 1;
return setupState[key];
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
} else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) {
accessCache[key] = 2;
return data[key];
} else if (
// only cache other properties when instance has declared (thus stable)
// props
(normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
(normalizedProps = instance.propsOptions[0]) && hasOwn$1(normalizedProps, key)
) {
accessCache[key] = 3;
return props[key];
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
} else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
accessCache[key] = 4;
return ctx[key];
} else if (shouldCacheAccess) {
@@ -3740,12 +4002,12 @@ const PublicInstanceProxyHandlers = {
(cssModule = type.__cssModules) && (cssModule = cssModule[key])
) {
return cssModule;
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
} else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
accessCache[key] = 4;
return ctx[key];
} else if (
// global properties
globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
globalProperties = appContext.config.globalProperties, hasOwn$1(globalProperties, key)
) {
{
return globalProperties[key];
@@ -3753,7 +4015,7 @@ const PublicInstanceProxyHandlers = {
} else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
// to infinite warning loop
key.indexOf("__v") !== 0)) {
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$1(data, key)) {
warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`);
} else if (instance === currentRenderingInstance) {
warn(`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`);
@@ -3765,13 +4027,13 @@ const PublicInstanceProxyHandlers = {
if (hasSetupBinding(setupState, key)) {
setupState[key] = value;
return true;
} else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
} else if (setupState.__isScriptSetup && hasOwn$1(setupState, key)) {
warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
return false;
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
} else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) {
data[key] = value;
return true;
} else if (hasOwn(instance.props, key)) {
} else if (hasOwn$1(instance.props, key)) {
warn(`Attempting to mutate prop "${key}". Props are readonly.`);
return false;
}
@@ -3793,12 +4055,12 @@ const PublicInstanceProxyHandlers = {
},
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
let normalizedProps;
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn$1(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn$1(normalizedProps, key) || hasOwn$1(ctx, key) || hasOwn$1(publicPropertiesMap, key) || hasOwn$1(appContext.config.globalProperties, key);
},
defineProperty(target, key, descriptor) {
if (descriptor.get != null) {
target._.accessCache[key] = 0;
} else if (hasOwn(descriptor, "value")) {
} else if (hasOwn$1(descriptor, "value")) {
this.set(target, key, descriptor.value, null);
}
return Reflect.defineProperty(target, key, descriptor);
@@ -3956,7 +4218,7 @@ function applyOptions$1(instance) {
if (isPromise(data)) {
warn(`data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`);
}
if (!isObject(data)) {
if (!isObject$1(data)) {
warn(`data() should return an object.`);
} else {
instance.data = reactive(data);
@@ -4077,7 +4339,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
for (const key in injectOptions) {
const opt = injectOptions[key];
let injected;
if (isObject(opt)) {
if (isObject$1(opt)) {
if ("default" in opt) {
injected = inject(
opt.from || key,
@@ -4127,7 +4389,7 @@ function createWatcher(raw, ctx, publicThis, key) {
}
} else if (isFunction(raw)) {
watch(getter, raw.bind(publicThis));
} else if (isObject(raw)) {
} else if (isObject$1(raw)) {
if (isArray(raw)) {
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
} else {
@@ -4161,7 +4423,7 @@ function resolveMergedOptions(instance) {
}
mergeOptions(resolved, base, optionMergeStrategies);
}
if (isObject(base)) {
if (isObject$1(base)) {
cache.set(base, resolved);
}
return resolved;
@@ -4307,7 +4569,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
}
const value = rawProps[key];
if (options) {
if (hasOwn(attrs, key)) {
if (hasOwn$1(attrs, key)) {
if (value !== attrs[key]) {
attrs[key] = value;
hasAttrsChanged = true;
@@ -4339,9 +4601,9 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
let kebabKey;
for (const key in rawCurrentProps) {
if (!rawProps || // for camelCase
!hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
!hasOwn$1(rawProps, key) && // it's possible the original props was passed in as kebab-case
// and converted to camelCase (#955)
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
((kebabKey = hyphenate(key)) === key || !hasOwn$1(rawProps, kebabKey))) {
if (options) {
if (rawPrevProps && // for camelCase
(rawPrevProps[key] !== void 0 || // for kebab-case
@@ -4363,7 +4625,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
}
if (attrs !== rawCurrentProps) {
for (const key in attrs) {
if (!rawProps || !hasOwn(rawProps, key) && true) {
if (!rawProps || !hasOwn$1(rawProps, key) && true) {
delete attrs[key];
hasAttrsChanged = true;
}
@@ -4388,7 +4650,7 @@ function setFullProps(instance, rawProps, props, attrs) {
}
const value = rawProps[key];
let camelKey;
if (options && hasOwn(options, camelKey = camelize(key))) {
if (options && hasOwn$1(options, camelKey = camelize(key))) {
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
props[camelKey] = value;
} else {
@@ -4407,7 +4669,7 @@ function setFullProps(instance, rawProps, props, attrs) {
const castValues = rawCastValues || EMPTY_OBJ;
for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i];
props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn$1(castValues, key));
}
}
return hasAttrsChanged;
@@ -4415,7 +4677,7 @@ function setFullProps(instance, rawProps, props, attrs) {
function resolvePropValue(options, props, key, value, instance, isAbsent) {
const opt = options[key];
if (opt != null) {
const hasDefault = hasOwn(opt, "default");
const hasDefault = hasOwn$1(opt, "default");
if (hasDefault && value === void 0) {
const defaultValue = opt.default;
if (opt.type !== Function && isFunction(defaultValue)) {
@@ -4476,7 +4738,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
}
}
if (!raw && !hasExtends) {
if (isObject(comp)) {
if (isObject$1(comp)) {
cache.set(comp, EMPTY_ARR);
}
return EMPTY_ARR;
@@ -4492,7 +4754,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
}
}
} else if (raw) {
if (!isObject(raw)) {
if (!isObject$1(raw)) {
warn(`invalid props options`, raw);
}
for (const key in raw) {
@@ -4511,7 +4773,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
1
/* BooleanFlags.shouldCastTrue */
] = stringIndex < 0 || booleanIndex < stringIndex;
if (booleanIndex > -1 || hasOwn(prop, "default")) {
if (booleanIndex > -1 || hasOwn$1(prop, "default")) {
needCastKeys.push(normalizedKey);
}
}
@@ -4519,7 +4781,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
}
}
const res = [normalized, needCastKeys];
if (isObject(comp)) {
if (isObject$1(comp)) {
cache.set(comp, res);
}
return res;
@@ -4541,7 +4803,7 @@ function isSameType(a, b) {
}
function getTypeIndex(type, expectedTypes) {
if (isArray(expectedTypes)) {
return expectedTypes.findIndex((t) => isSameType(t, type));
return expectedTypes.findIndex((t2) => isSameType(t2, type));
} else if (isFunction(expectedTypes)) {
return isSameType(expectedTypes, type) ? 0 : -1;
}
@@ -4554,7 +4816,7 @@ function validateProps(rawProps, props, instance) {
let opt = options[key];
if (opt == null)
continue;
validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
validateProp(key, resolvedValues[key], opt, !hasOwn$1(rawProps, key) && !hasOwn$1(rawProps, hyphenate(key)));
}
}
function validateProp(name, value, prop, isAbsent) {
@@ -4589,13 +4851,13 @@ function assertType(value, type) {
let valid;
const expectedType = getType(type);
if (isSimpleType(expectedType)) {
const t = typeof value;
valid = t === expectedType.toLowerCase();
if (!valid && t === "object") {
const t2 = typeof value;
valid = t2 === expectedType.toLowerCase();
if (!valid && t2 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
valid = isObject(value);
valid = isObject$1(value);
} else if (expectedType === "Array") {
valid = isArray(value);
} else if (expectedType === "null") {
@@ -4666,7 +4928,7 @@ function createAppAPI(render, hydrate) {
if (!isFunction(rootComponent)) {
rootComponent = Object.assign({}, rootComponent);
}
if (rootProps != null && !isObject(rootProps)) {
if (rootProps != null && !isObject$1(rootProps)) {
warn(`root props passed to app.mount() must be an object.`);
rootProps = null;
}
@@ -4974,7 +5236,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
{
instance.render = setupResult;
}
} else if (isObject(setupResult)) {
} else if (isObject$1(setupResult)) {
if (isVNode(setupResult)) {
warn(`setup() should not return VNodes directly - return a render function instead.`);
}
@@ -5269,7 +5531,7 @@ function clone(src, seen) {
copy = {};
seen.set(src, copy);
for (const name in src) {
if (hasOwn(src, name)) {
if (hasOwn$1(src, name)) {
copy[name] = clone(src[name], seen);
}
}
@@ -5377,7 +5639,7 @@ function setRef$1(instance, isUnmount = false) {
}
}
function toSkip(value) {
if (isObject(value)) {
if (isObject$1(value)) {
markRaw(value);
}
return value;
@@ -5416,7 +5678,7 @@ function setTemplateRef({ r, f: f2 }, refValue, setupState) {
onBeforeUnmount(() => remove(existing, refValue), refValue.$);
}
} else if (_isString) {
if (hasOwn(setupState, r)) {
if (hasOwn$1(setupState, r)) {
setupState[r] = refValue;
}
} else if (isRef(r)) {
@@ -5947,14 +6209,14 @@ function patchMPEvent(event) {
event.preventDefault = NOOP;
event.stopPropagation = NOOP;
event.stopImmediatePropagation = NOOP;
if (!hasOwn(event, "detail")) {
if (!hasOwn$1(event, "detail")) {
event.detail = {};
}
if (hasOwn(event, "markerId")) {
if (hasOwn$1(event, "markerId")) {
event.detail = typeof event.detail === "object" ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject$1(event.detail) && hasOwn(event.detail, "checked") && !hasOwn(event.detail, "value")) {
if (isPlainObject$1(event.detail) && hasOwn$1(event.detail, "checked") && !hasOwn$1(event.detail, "value")) {
event.detail.value = event.detail.checked;
}
if (isPlainObject$1(event.detail)) {
@@ -5990,7 +6252,7 @@ function vFor(source, renderItem) {
for (let i = 0; i < source; i++) {
ret[i] = renderItem(i + 1, i, i);
}
} else if (isObject(source)) {
} else if (isObject$1(source)) {
if (source[Symbol.iterator]) {
ret = Array.from(source, (item, i) => renderItem(item, i, i));
} else {
@@ -6031,6 +6293,7 @@ const f = (source, renderItem) => vFor(source, renderItem);
const s = (value) => stringifyStyle(value);
const e = (target, ...sources) => extend(target, ...sources);
const n = (value) => normalizeClass(value);
const t = (val) => toDisplayString(val);
const p = (props) => renderProps(props);
const sr = (ref2, id, opts) => setRef(ref2, id, opts);
function createApp$1(rootComponent, rootProps = null) {
@@ -6099,7 +6362,7 @@ function initComponentInstance(instance, options) {
function initMocks(instance, mpInstance, mocks2) {
const ctx = instance.ctx;
mocks2.forEach((mock) => {
if (hasOwn(mpInstance, mock)) {
if (hasOwn$1(mpInstance, mock)) {
instance[mock] = ctx[mock] = mpInstance[mock];
}
});
@@ -6155,7 +6418,7 @@ function findHooks(vueOptions, hooks = /* @__PURE__ */ new Set()) {
return hooks;
}
function initHook(mpOptions, hook, excludes) {
if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
if (excludes.indexOf(hook) === -1 && !hasOwn$1(mpOptions, hook)) {
mpOptions[hook] = function(args) {
return this.$vm && this.$vm.$callHook(hook, args);
};
@@ -6188,7 +6451,7 @@ const findMixinRuntimeHooks = /* @__PURE__ */ once(() => {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
if (hasOwn$1(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
@@ -6258,13 +6521,13 @@ function initCreateSubpackageApp(parseAppOptions) {
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach((name) => {
if (!hasOwn(globalData, name)) {
if (!hasOwn$1(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach((name) => {
if (!hasOwn(app, name)) {
if (!hasOwn$1(app, name)) {
app[name] = appOptions[name];
}
});
@@ -6314,7 +6577,7 @@ function initVueIds(vueIds, mpInstance) {
const EXTRAS = ["externalClasses"];
function initExtraOptions(miniProgramComponentOptions, vueOptions) {
EXTRAS.forEach((name) => {
if (hasOwn(vueOptions, name)) {
if (hasOwn$1(vueOptions, name)) {
miniProgramComponentOptions[name] = vueOptions[name];
}
});
@@ -6621,7 +6884,7 @@ function applyOptions(componentOptions, vueOptions) {
componentOptions.data = initData();
componentOptions.behaviors = initBehaviors(vueOptions);
}
function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
function parseComponent(vueOptions, { parse: parse2, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
vueOptions = vueOptions.default || vueOptions;
const options = {
multipleSlots: true,
@@ -6631,7 +6894,7 @@ function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, ini
};
if (isArray(vueOptions.mixins)) {
vueOptions.mixins.forEach((item) => {
if (isObject(item.options)) {
if (isObject$1(item.options)) {
extend(options, item.options);
}
});
@@ -6667,8 +6930,8 @@ function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, ini
{
initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
}
if (parse) {
parse(mpComponentOptions, { handleLink: handleLink2 });
if (parse2) {
parse2(mpComponentOptions, { handleLink: handleLink2 });
}
return mpComponentOptions;
}
@@ -6696,7 +6959,7 @@ function $destroyComponent(instance) {
return $destroyComponentFn(instance);
}
function parsePage(vueOptions, parseOptions2) {
const { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
const { parse: parse2, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
const miniProgramPageOptions = parseComponent(vueOptions, {
mocks: mocks2,
isPage: isPage2,
@@ -6719,7 +6982,7 @@ function parsePage(vueOptions, parseOptions2) {
}
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink: handleLink2 });
parse2 && parse2(miniProgramPageOptions, { handleLink: handleLink2 });
return miniProgramPageOptions;
}
function initCreatePage(parseOptions2) {
@@ -7458,6 +7721,7 @@ This will fail in production.`);
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
};
const onShow = /* @__PURE__ */ createHook(ON_SHOW);
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
exports._export_sfc = _export_sfc;
exports.createPinia = createPinia;
@@ -7466,12 +7730,15 @@ exports.defineStore = defineStore;
exports.e = e;
exports.f = f;
exports.index = index;
exports.initVueI18n = initVueI18n;
exports.n = n;
exports.o = o;
exports.onLoad = onLoad;
exports.onShow = onShow;
exports.p = p;
exports.ref = ref;
exports.resolveComponent = resolveComponent;
exports.s = s;
exports.sr = sr;
exports.t = t;
exports.watch = watch;