From 07b136d2200eca62d69bf454bfc4841ba7cd7086 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Thu, 20 May 2021 16:58:44 +0800 Subject: [PATCH] chore: add animation mixin --- .../uni-components/src/helpers/component.ts | 9 ++--- packages/uni-h5/dist/uni-h5.cjs.js | 5 ++- packages/uni-h5/dist/uni-h5.es.js | 39 ++++++++++--------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/uni-components/src/helpers/component.ts b/packages/uni-components/src/helpers/component.ts index 4c54857d3c..80dc9271de 100644 --- a/packages/uni-components/src/helpers/component.ts +++ b/packages/uni-components/src/helpers/component.ts @@ -9,11 +9,10 @@ export const defineBuiltInComponent: typeof defineComponent = ( options: any ) => { // TODO 可能会补充特殊标记 - if (!options.props || typeof options.props.animation === 'undefined') { - // 补充内置组件animation - typeof options.mixins !== 'undefined' - ? options.mixins.push(animation) - : (options.mixins = [animation]) + const { props, mixins } = options + // 补充内置组件animation + if (!props || !props.animation) { + ;(mixins || (options.mixins = [])).push(animation) } return defineSystemComponent(options) } diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index bd929539ec..a204fe4bf6 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -1149,8 +1149,9 @@ var animation = { } }; const defineBuiltInComponent = (options) => { - if (!options.props || typeof options.props.animation === "undefined") { - typeof options.mixins !== "undefined" ? options.mixins.push(animation) : options.mixins = [animation]; + const {props: props2, mixins} = options; + if (!props2 || !props2.animation) { + (mixins || (options.mixins = [])).push(animation); } return defineSystemComponent(options); }; diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index a9cfeaa5a8..b32450580f 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -485,7 +485,7 @@ var safeAreaInsets = { onChange, offChange }; -var D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out = safeAreaInsets; +var out = safeAreaInsets; const onEventPrevent = /* @__PURE__ */ withModifiers(() => { }, ["prevent"]); const onEventStop = /* @__PURE__ */ withModifiers(() => { @@ -497,10 +497,10 @@ function getWindowOffset() { const left = parseInt(style.getPropertyValue("--window-left")); const right = parseInt(style.getPropertyValue("--window-right")); return { - top: top ? top + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top : 0, - bottom: bottom ? bottom + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom : 0, - left: left ? left + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left : 0, - right: right ? right + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right : 0 + top: top ? top + out.top : 0, + bottom: bottom ? bottom + out.bottom : 0, + left: left ? left + out.left : 0, + right: right ? right + out.right : 0 }; } function updateCssVar(cssVars) { @@ -1190,7 +1190,7 @@ function normalizePageMeta(pageMeta) { let offset = rpx2px(refreshOptions.offset); const {type} = navigationBar; if (type !== "transparent" && type !== "none") { - offset += NAVBAR_HEIGHT + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top; + offset += NAVBAR_HEIGHT + out.top; } refreshOptions.offset = offset; refreshOptions.height = rpx2px(refreshOptions.height); @@ -2090,8 +2090,9 @@ var animation = { } }; const defineBuiltInComponent = (options) => { - if (!options.props || typeof options.props.animation === "undefined") { - typeof options.mixins !== "undefined" ? options.mixins.push(animation) : options.mixins = [animation]; + const {props: props2, mixins} = options; + if (!props2 || !props2.animation) { + (mixins || (options.mixins = [])).push(animation); } return defineSystemComponent(options); }; @@ -14916,7 +14917,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () const windowWidth = getWindowWidth(screenWidth); let windowHeight = window.innerHeight; const language = navigator.language; - const statusBarHeight = D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top; + const statusBarHeight = out.top; let osname; let osversion; let model; @@ -15029,12 +15030,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () const system = `${osname} ${osversion}`; const platform = osname.toLocaleLowerCase(); const safeArea = { - left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left, - right: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right, - top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top, - bottom: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom, - width: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right, - height: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom + left: out.left, + right: windowWidth - out.right, + top: out.top, + bottom: windowHeight - out.bottom, + width: windowWidth - out.left - out.right, + height: windowHeight - out.top - out.bottom }; const {top: windowTop, bottom: windowBottom} = getWindowOffset(); windowHeight -= windowTop; @@ -15054,10 +15055,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () model, safeArea, safeAreaInsets: { - top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top, - right: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right, - bottom: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom, - left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left + top: out.top, + right: out.right, + bottom: out.bottom, + left: out.left } }; }); -- GitLab