Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Sep 10, 2024
1 parent 645b57e commit 2678392
Show file tree
Hide file tree
Showing 22 changed files with 269 additions and 280 deletions.
4 changes: 2 additions & 2 deletions packages/uni-app-plus/dist/uni-app-view.umd.js

Large diffs are not rendered by default.

37 changes: 25 additions & 12 deletions packages/uni-app-plus/dist/uni.runtime.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1454,9 +1454,10 @@ function getCurrentPage() {
}
}
function getCurrentPageMeta() {
const page = getCurrentPage();
if (page) {
return page.$page.meta;
var _c;
const $page = (_c = getCurrentPage()) === null || _c === void 0 ? void 0 : _c.$page;
if ($page) {
return $page.meta;
}
}
function getCurrentPageId() {
Expand Down Expand Up @@ -1806,7 +1807,8 @@ function initOn() {
on(ON_APP_ENTER_BACKGROUND, onAppEnterBackground);
}
function onResize(res) {
invokeHook(getCurrentPage(), ON_RESIZE, res);
const page = getCurrentPage();
invokeHook(page, ON_RESIZE, res);
UniServiceJSBridge.invokeOnCallback('onWindowResize', res); // API
}
function onAppEnterForeground(enterOptions) {
Expand Down Expand Up @@ -17438,7 +17440,7 @@ let callbackId = 1;
let proxy;
const callbacks = {};
function isUniElement(obj) {
return typeof (obj === null || obj === void 0 ? void 0 : obj.getNodeId) === 'function' && (obj === null || obj === void 0 ? void 0 : obj.pageId);
return obj && typeof obj.getNodeId === 'function' && obj.pageId;
}
function isComponentPublicInstance(instance) {
return instance && instance.$ && instance.$.proxy === instance;
Expand Down Expand Up @@ -17545,10 +17547,13 @@ function invokePropGetter(args) {
}
return resolveSyncResult(args, getProxy().invokeSync(args, () => { }));
}
function initProxyFunction(type, async, { moduleName, moduleType, package: pkg, class: cls, name: methodName, method, companion, params: methodParams, return: returnOptions, errMsg, }, instanceId, proxy) {
const keepAlive = methodName.indexOf('on') === 0 &&
methodParams.length === 1 &&
methodParams[0].type === 'UTSCallback';
function initProxyFunction(type, async, { moduleName, moduleType, package: pkg, class: cls, name: methodName, method, companion, keepAlive, params: methodParams, return: returnOptions, errMsg, }, instanceId, proxy) {
if (!keepAlive) {
keepAlive =
methodName.indexOf('on') === 0 &&
methodParams.length === 1 &&
methodParams[0].type === 'UTSCallback';
}
// const throws = async
const invokeCallback = ({ id, name, params }) => {
const callback = callbacks[id];
Expand Down Expand Up @@ -17686,7 +17691,11 @@ function initUTSProxyClass(options) {
// 初始化实例 ID
if (!isProxyInterface) {
// 初始化未指定时,每次都要创建instanceId
this.__instanceId = initProxyFunction('constructor', false, extend({ name: 'constructor', params: constructorParams }, baseOptions), 0).apply(null, params);
this.__instanceId = initProxyFunction('constructor', false, extend({
name: 'constructor',
keepAlive: false,
params: constructorParams,
}, baseOptions), 0).apply(null, params);
}
else if (typeof instanceId === 'number') {
this.__instanceId = instanceId;
Expand All @@ -17705,9 +17714,10 @@ function initUTSProxyClass(options) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn$1(methods, name)) {
const { async, params, return: returnOptions } = methods[name];
const { async, keepAlive, params, return: returnOptions, } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
name,
keepAlive,
params,
return: returnOptions,
}, baseOptions), instance.__instanceId, proxy);
Expand Down Expand Up @@ -17736,6 +17746,7 @@ function initUTSProxyClass(options) {
if (param) {
target[setter] = initProxyFunction('setter', false, extend({
name: name,
keepAlive: false,
params: [param],
}, baseOptions), instance.__instanceId, proxy);
}
Expand All @@ -17756,11 +17767,12 @@ function initUTSProxyClass(options) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn$1(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params, return: returnOptions } = staticMethods[name];
const { async, keepAlive, params, return: returnOptions, } = staticMethods[name];
// 静态方法
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({
name,
companion: true,
keepAlive,
params,
return: returnOptions,
}, baseOptions));
Expand All @@ -17785,6 +17797,7 @@ function initUTSProxyClass(options) {
if (param) {
staticPropSetterCache[setter] = initProxyFunction('setter', false, extend({
name: name,
keepAlive: false,
params: [param],
}, baseOptions), 0);
}
Expand Down
29 changes: 19 additions & 10 deletions packages/uni-app-plus/dist/uni.x.runtime.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ function getCurrentPage() {
}
}
function getCurrentPageMeta() {
var page = getCurrentPage();
if (page) {
return page.$page.meta;
var _getCurrentPage;
var $page = (_getCurrentPage = getCurrentPage()) === null || _getCurrentPage === void 0 || (_getCurrentPage = _getCurrentPage.vm) === null || _getCurrentPage === void 0 ? void 0 : _getCurrentPage.$basePage;
if ($page) {
return $page.meta;
}
}
function getCurrentPageVm() {
Expand Down Expand Up @@ -1240,11 +1241,8 @@ function getBorderStyle(borderStyle) {
function fixBorderStyle(tabBarConfig) {
var borderStyle = tabBarConfig.get("borderStyle");
var borderColor = tabBarConfig.get("borderColor");
var isBorderStyleFilled = isString(borderStyle);
var isBorderColorFilled = isString(borderColor);
if (isBorderStyleFilled) {
borderStyle = getBorderStyle(borderStyle);
}
borderStyle = getBorderStyle(borderStyle);
if (isBorderColorFilled) {
borderStyle = borderColor;
}
Expand Down Expand Up @@ -1390,14 +1388,15 @@ function getTabPage(path) {
return new TabPageInfo(page, isFirst);
}
function switchSelect(selected, path) {
var _getCurrentPage;
var query = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var rebuild = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
var callback = arguments.length > 4 ? arguments[4] : void 0;
var shouldShow = false;
if (tabBar0 === null) {
init();
}
var currentPage = getCurrentPage().vm;
var currentPage = (_getCurrentPage = getCurrentPage()) === null || _getCurrentPage === void 0 ? void 0 : _getCurrentPage.vm;
var type = currentPage == null ? "appLaunch" : "switchTab";
invokeBeforeRouteHooks(type);
var pageInfo = getTabPage(getRealPath(path, true), query, rebuild, callback);
Expand Down Expand Up @@ -3601,7 +3600,7 @@ var callbackId = 1;
var proxy;
var callbacks = {};
function isUniElement(obj) {
return typeof (obj === null || obj === void 0 ? void 0 : obj.getNodeId) === "function" && (obj === null || obj === void 0 ? void 0 : obj.pageId);
return obj && typeof obj.getNodeId === "function" && obj.pageId;
}
function isComponentPublicInstance(instance) {
return instance && instance.$ && instance.$.proxy === instance;
Expand Down Expand Up @@ -3712,11 +3711,14 @@ function initProxyFunction(type, async, _ref, instanceId, proxy2) {
name: methodName,
method,
companion,
keepAlive,
params: methodParams,
return: returnOptions,
errMsg
} = _ref;
var keepAlive = methodName.indexOf("on") === 0 && methodParams.length === 1 && methodParams[0].type === "UTSCallback";
if (!keepAlive) {
keepAlive = methodName.indexOf("on") === 0 && methodParams.length === 1 && methodParams[0].type === "UTSCallback";
}
var invokeCallback2 = (_ref2) => {
var {
id: id2,
Expand Down Expand Up @@ -3860,6 +3862,7 @@ function initUTSProxyClass(options) {
}
this.__instanceId = initProxyFunction("constructor", false, extend({
name: "constructor",
keepAlive: false,
params: constructorParams
}, baseOptions), 0).apply(null, params);
} else if (typeof instanceId === "number") {
Expand All @@ -3879,11 +3882,13 @@ function initUTSProxyClass(options) {
if (hasOwn(methods, name)) {
var {
async,
keepAlive,
params: params2,
return: returnOptions
} = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
name,
keepAlive,
params: params2,
return: returnOptions
}, baseOptions), instance.__instanceId, proxy2);
Expand All @@ -3910,6 +3915,7 @@ function initUTSProxyClass(options) {
if (param) {
target[setter] = initProxyFunction("setter", false, extend({
name,
keepAlive: false,
params: [param]
}, baseOptions), instance.__instanceId, proxy2);
}
Expand All @@ -3932,12 +3938,14 @@ function initUTSProxyClass(options) {
if (!staticMethodCache[name]) {
var {
async,
keepAlive,
params,
return: returnOptions
} = staticMethods[name];
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({
name,
companion: true,
keepAlive,
params,
return: returnOptions
}, baseOptions));
Expand All @@ -3961,6 +3969,7 @@ function initUTSProxyClass(options) {
if (param) {
staticPropSetterCache[setter] = initProxyFunction("setter", false, extend({
name,
keepAlive: false,
params: [param]
}, baseOptions), 0);
}
Expand Down
27 changes: 19 additions & 8 deletions packages/uni-app-plus/src/service/api/plugin/uts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let callbackId = 1;
let proxy;
const callbacks = {};
function isUniElement(obj) {
return typeof (obj === null || obj === void 0 ? void 0 : obj.getNodeId) === 'function' && (obj === null || obj === void 0 ? void 0 : obj.pageId);
return obj && typeof obj.getNodeId === 'function' && obj.pageId;
}
function isComponentPublicInstance(instance) {
return instance && instance.$ && instance.$.proxy === instance;
Expand Down Expand Up @@ -112,10 +112,13 @@ function invokePropGetter(args) {
}
return resolveSyncResult(args, getProxy().invokeSync(args, () => { }));
}
function initProxyFunction(type, async, { moduleName, moduleType, package: pkg, class: cls, name: methodName, method, companion, params: methodParams, return: returnOptions, errMsg, }, instanceId, proxy) {
const keepAlive = methodName.indexOf('on') === 0 &&
methodParams.length === 1 &&
methodParams[0].type === 'UTSCallback';
function initProxyFunction(type, async, { moduleName, moduleType, package: pkg, class: cls, name: methodName, method, companion, keepAlive, params: methodParams, return: returnOptions, errMsg, }, instanceId, proxy) {
if (!keepAlive) {
keepAlive =
methodName.indexOf('on') === 0 &&
methodParams.length === 1 &&
methodParams[0].type === 'UTSCallback';
}
// const throws = async
const invokeCallback = ({ id, name, params }) => {
const callback = callbacks[id];
Expand Down Expand Up @@ -253,7 +256,11 @@ function initUTSProxyClass(options) {
// 初始化实例 ID
if (!isProxyInterface) {
// 初始化未指定时,每次都要创建instanceId
this.__instanceId = initProxyFunction('constructor', false, extend({ name: 'constructor', params: constructorParams }, baseOptions), 0).apply(null, params);
this.__instanceId = initProxyFunction('constructor', false, extend({
name: 'constructor',
keepAlive: false,
params: constructorParams,
}, baseOptions), 0).apply(null, params);
}
else if (typeof instanceId === 'number') {
this.__instanceId = instanceId;
Expand All @@ -272,9 +279,10 @@ function initUTSProxyClass(options) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn(methods, name)) {
const { async, params, return: returnOptions } = methods[name];
const { async, keepAlive, params, return: returnOptions, } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
name,
keepAlive,
params,
return: returnOptions,
}, baseOptions), instance.__instanceId, proxy);
Expand Down Expand Up @@ -303,6 +311,7 @@ function initUTSProxyClass(options) {
if (param) {
target[setter] = initProxyFunction('setter', false, extend({
name: name,
keepAlive: false,
params: [param],
}, baseOptions), instance.__instanceId, proxy);
}
Expand All @@ -323,11 +332,12 @@ function initUTSProxyClass(options) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params, return: returnOptions } = staticMethods[name];
const { async, keepAlive, params, return: returnOptions, } = staticMethods[name];
// 静态方法
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({
name,
companion: true,
keepAlive,
params,
return: returnOptions,
}, baseOptions));
Expand All @@ -352,6 +362,7 @@ function initUTSProxyClass(options) {
if (param) {
staticPropSetterCache[setter] = initProxyFunction('setter', false, extend({
name: name,
keepAlive: false,
params: [param],
}, baseOptions), 0);
}
Expand Down
61 changes: 18 additions & 43 deletions packages/uni-app-vue/dist/uvue.runtime.esm.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -1775,37 +1775,20 @@ function createDecl(prop, value, important, raws, source) {
}
var backgroundColor = 'backgroundColor';
var backgroundImage = 'backgroundImage';
function createTransformBackground(options) {
return decl => {
var {
value,
important,
raws,
source
} = decl;
// nvue 平台维持原有逻辑不变
var isUvuePlatform = options.type === 'uvue';
if (isUvuePlatform) {
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) {
return [createDecl(backgroundImage, 'none', important, raws, source), createDecl(backgroundColor, value, important, raws, source)];
} else if (/^linear-gradient(.+)$/.test(value)) {
return [createDecl(backgroundImage, value, important, raws, source), createDecl(backgroundColor, 'transparent', important, raws, source)];
} else if (value == '') {
return [createDecl(backgroundImage, 'none', important, raws, source), createDecl(backgroundColor, 'transparent', important, raws, source)];
}
return [decl];
} else {
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) {
return [createDecl(backgroundColor, value, important, raws, source)];
} else if (/^linear-gradient(.+)$/.test(value)) {
return [createDecl(backgroundImage, value, important, raws, source)];
} else if (value == '') {
return [decl];
}
return [decl];
}
};
}
var transformBackground = decl => {
var {
value,
important,
raws,
source
} = decl;
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) {
return [createDecl(backgroundColor, value, important, raws, source)];
} else if (/^linear-gradient(.+)$/.test(value)) {
return [createDecl(backgroundImage, value, important, raws, source)];
}
return [decl];
};
var borderWidth = 'Width';
var borderStyle = 'Style';
var borderColor = 'Color';
Expand All @@ -1823,16 +1806,8 @@ function createTransformBorder(options) {
var index = splitResult.findIndex(str => item.test(str));
return index < 0 ? null : splitResult.splice(index, 1)[0];
});
var isUvuePlatform = options.type === 'uvue';
if (isUvuePlatform) {
if (splitResult.length > 0 && value !== '') {
return [decl];
}
} else {
// nvue 维持不变
if (splitResult.length > 0) {
return [decl];
}
if (splitResult.length) {
return [decl];
}
return [createDecl(prop + borderWidth, (result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(), important, raws, source), createDecl(prop + borderStyle, (result[1] || (options.type === 'uvue' ? 'none' : 'solid')).trim(), important, raws, source), createDecl(prop + borderColor, (result[2] || '#000000').trim(), important, raws, source)];
};
Expand Down Expand Up @@ -1979,7 +1954,7 @@ function getDeclTransforms(options) {
var styleMap = _objectSpread({
transition: transformTransition,
border: transformBorder,
background: createTransformBackground(options),
background: transformBackground,
borderTop: transformBorder,
borderRight: transformBorder,
borderBottom: transformBorder,
Expand All @@ -2005,7 +1980,7 @@ var DeclTransforms;
var expanded = Symbol('expanded');
function expand(options) {
var plugin = {
postcssPlugin: "".concat(options.type || 'nvue', ":expand"),
postcssPlugin: 'nvue:expand',
Declaration(decl) {
if (decl[expanded]) {
return;
Expand Down
Loading

0 comments on commit 2678392

Please sign in to comment.