From 5ff45fb736283d9724c0f8eae4cf43fdde004cd2 Mon Sep 17 00:00:00 2001 From: qiang Date: Mon, 10 May 2021 11:47:36 +0800 Subject: [PATCH] refactor: swiper, swiper-item --- .../uni-components/src/components/index.ts | 6 +- .../src/components/swiper-item/index.tsx | 67 ++ .../src/components/swiper-item/index.vue | 28 - .../src/components/swiper/index.tsx | 746 ++++++++++++++++ .../src/components/swiper/index.vue | 644 -------------- .../src/helpers/useTouchtrack.ts | 2 +- packages/uni-h5/dist/uni-h5.cjs.js | 735 +++++++++++++--- packages/uni-h5/dist/uni-h5.es.js | 806 +++++++++++++++--- 8 files changed, 2165 insertions(+), 869 deletions(-) create mode 100644 packages/uni-components/src/components/swiper-item/index.tsx delete mode 100644 packages/uni-components/src/components/swiper-item/index.vue create mode 100644 packages/uni-components/src/components/swiper/index.tsx delete mode 100644 packages/uni-components/src/components/swiper/index.vue diff --git a/packages/uni-components/src/components/index.ts b/packages/uni-components/src/components/index.ts index 8a26c385b..7ad5e7b37 100644 --- a/packages/uni-components/src/components/index.ts +++ b/packages/uni-components/src/components/index.ts @@ -21,8 +21,8 @@ import ResizeSensor from './resize-sensor/index' import RichText from './rich-text/index.vue' import ScrollView from './scroll-view/index.vue' import Slider from './slider/index' -// import Swiper from './swiper/index.vue' -import SwiperItem from './swiper-item/index.vue' +import Swiper from './swiper/index' +import SwiperItem from './swiper-item/index' import Switch from './switch/index' import Text from './text/index' import Textarea from './textarea/index' @@ -51,7 +51,7 @@ export { RichText, ScrollView, Slider, - // Swiper, + Swiper, SwiperItem, Switch, Text, diff --git a/packages/uni-components/src/components/swiper-item/index.tsx b/packages/uni-components/src/components/swiper-item/index.tsx new file mode 100644 index 000000000..42978f0f8 --- /dev/null +++ b/packages/uni-components/src/components/swiper-item/index.tsx @@ -0,0 +1,67 @@ +import { defineComponent, Ref, ref, onMounted, onUnmounted, inject } from 'vue' +import { AddSwiperContext, SwiperContext, RemoveSwiperContext } from '../swiper' + +const props = { + itemId: { + type: String, + default: '', + }, +} + +export default /*#__PURE__*/ defineComponent({ + name: 'SwiperItem', + props, + setup(props, { slots }) { + const rootRef: Ref = ref(null) + const context: SwiperContext = { + rootRef, + getItemId() { + return props.itemId + }, + getBoundingClientRect() { + const el = rootRef.value as HTMLElement + return el.getBoundingClientRect() + }, + updatePosition(position: number, vertical?: boolean) { + const x = vertical ? '0' : 100 * position + '%' + const y = vertical ? 100 * position + '%' : '0' + const rootEl = rootRef.value + const value = `translate(${x},${y}) translateZ(0)` + if (rootEl) { + rootEl.style.webkitTransform = value + rootEl.style.transform = value + } + }, + } + onMounted(() => { + const addSwiperContext: AddSwiperContext | undefined = inject( + 'addSwiperContext' + ) + if (addSwiperContext) { + addSwiperContext(context) + } + }) + onUnmounted(() => { + const removeSwiperContext: RemoveSwiperContext | undefined = inject( + 'removeSwiperContext' + ) + if (removeSwiperContext) { + removeSwiperContext(context) + } + }) + return () => { + return ( + + {slots.default && slots.default()} + + ) + } + }, +}) diff --git a/packages/uni-components/src/components/swiper-item/index.vue b/packages/uni-components/src/components/swiper-item/index.vue deleted file mode 100644 index 3463b43f9..000000000 --- a/packages/uni-components/src/components/swiper-item/index.vue +++ /dev/null @@ -1,28 +0,0 @@ - - \ No newline at end of file diff --git a/packages/uni-components/src/components/swiper/index.tsx b/packages/uni-components/src/components/swiper/index.tsx new file mode 100644 index 000000000..2b8c107ff --- /dev/null +++ b/packages/uni-components/src/components/swiper/index.tsx @@ -0,0 +1,746 @@ +import { + defineComponent, + Ref, + ref, + watch, + onMounted, + onUnmounted, + provide, + ComputedRef, + computed, + reactive, + VNode, + markRaw, + SetupContext, +} from 'vue' +import { upx2px } from '@dcloudio/uni-api' +import { useCustomEvent, CustomEventTrigger } from '../../helpers/useEvent' +import { useTouchtrack } from '../../helpers/useTouchtrack' + +const props = { + indicatorDots: { + type: [Boolean, String], + default: false, + }, + vertical: { + type: [Boolean, String], + default: false, + }, + autoplay: { + type: [Boolean, String], + default: false, + }, + circular: { + type: [Boolean, String], + default: false, + }, + interval: { + type: [Number, String], + default: 5e3, + }, + duration: { + type: [Number, String], + default: 500, + }, + current: { + type: [Number, String], + default: 0, + }, + indicatorColor: { + type: String, + default: '', + }, + indicatorActiveColor: { + type: String, + default: '', + }, + previousMargin: { + type: String, + default: '', + }, + nextMargin: { + type: String, + default: '', + }, + currentItemId: { + type: String, + default: '', + }, + skipHiddenItemLayout: { + type: [Boolean, String], + default: false, + }, + displayMultipleItems: { + type: [Number, String], + default: 1, + }, + disableTouch: { + type: [Boolean, String], + default: false, + }, +} + +type Props = Record + +export interface SwiperContext { + rootRef: Ref + getItemId(): string + getBoundingClientRect(): DOMRect + updatePosition(position: number, vertical: boolean): void +} +export type AddSwiperContext = (context: SwiperContext) => void +export type RemoveSwiperContext = (context: SwiperContext) => void + +function upx2pxStr(val: string): string { + if (/\d+[ur]px$/i.test(val)) { + val.replace(/\d+[ur]px$/i, (text) => { + return `${upx2px(parseFloat(text))}px` + }) + } + return val || '' +} + +interface State { + interval: number + duration: number + displayMultipleItems: number + current: number + currentItemId: string + userTracking: boolean +} +function useState(props: Props) { + const interval = computed(() => { + const interval = Number(props.interval) + return isNaN(interval) ? 5e3 : interval + }) + const duration = computed(() => { + const duration = Number(props.duration) + return isNaN(duration) ? 500 : duration + }) + const displayMultipleItems = computed(() => { + const displayMultipleItems = Math.round(props.displayMultipleItems) + return isNaN(displayMultipleItems) ? 1 : displayMultipleItems + }) + const state: State = reactive({ + interval, + duration, + displayMultipleItems, + current: Math.round(props.current) || 0, + currentItemId: props.currentItemId, + userTracking: false, + }) + return state +} + +function useLayout( + props: Props, + state: State, + swiperContexts: Ref, + slideFrameRef: Ref, + emit: SetupContext['emit'], + trigger: CustomEventTrigger +) { + function cancelSchedule() { + if (timer) { + clearTimeout(timer) + timer = null + } + } + let timer: number | null = null + let invalid = true + let viewportPosition = 0 + let viewportMoveRatio = 1 + let animating: null | { + toPos: number + acc: number + endTime: number + source: string + } = null + let requestedAnimation = false + let contentTrackViewport = 0 + let transitionStart: number | null + let currentChangeSource = '' + let animationFrame: number + const circularEnabled: ComputedRef = computed( + () => + props.circular && swiperContexts.value.length > state.displayMultipleItems + ) + function checkCircularLayout(index: number) { + if (!invalid) { + for ( + let items = swiperContexts.value, + n = items.length, + i = index + state.displayMultipleItems, + r = 0; + r < n; + r++ + ) { + const item = items[r] + const s = Math.floor(index / n) * n + r + const l = s + n + const c = s - n + const u = Math.max(index - (s + 1), s - i, 0) + const d = Math.max(index - (l + 1), l - i, 0) + const h = Math.max(index - (c + 1), c - i, 0) + const p = Math.min(u, d, h) + const position = [s, l, c][[u, d, h].indexOf(p)] + item.updatePosition(position, props.vertical) + } + } + } + function updateViewport(index: number) { + if ( + !( + Math.floor(2 * viewportPosition) === Math.floor(2 * index) && + Math.ceil(2 * viewportPosition) === Math.ceil(2 * index) + ) + ) { + if (circularEnabled.value) { + checkCircularLayout(index) + } + } + const x = props.vertical ? '0' : 100 * -index * viewportMoveRatio + '%' + const y = props.vertical ? 100 * -index * viewportMoveRatio + '%' : '0' + const transform = 'translate(' + x + ', ' + y + ') translateZ(0)' + const slideFrame = slideFrameRef.value as HTMLElement + if (slideFrame) { + slideFrame.style.webkitTransform = transform + slideFrame.style.transform = transform + } + viewportPosition = index + if (!transitionStart) { + if (index % 1 === 0) { + return + } + transitionStart = index + } + index -= Math.floor(transitionStart) + const items = swiperContexts.value + if (index <= -(items.length - 1)) { + index += items.length + } else if (index >= items.length) { + index -= items.length + } + index = transitionStart % 1 > 0.5 || transitionStart < 0 ? index - 1 : index + trigger('transition', {} as Event, { + dx: props.vertical ? 0 : index * slideFrame.offsetWidth, + dy: props.vertical ? index * slideFrame.offsetHeight : 0, + }) + } + function endViewportAnimation() { + if (animating) { + updateViewport(animating.toPos) + animating = null + } + } + function normalizeCurrentValue(current: number) { + const length = swiperContexts.value.length + if (!length) { + return -1 + } + const index = ((Math.round(current) % length) + length) % length + if (circularEnabled.value) { + if (length <= state.displayMultipleItems) { + return 0 + } + } else if (index > length - state.displayMultipleItems) { + return length - state.displayMultipleItems + } + return index + } + function cancelViewportAnimation() { + animating = null + } + function animateFrameFuncProto() { + if (!animating) { + requestedAnimation = false + return + } + const _animating = animating + const toPos = _animating.toPos + const acc = _animating.acc + const endTime = _animating.endTime + const source = _animating.source + const time = endTime - Date.now() + if (time <= 0) { + updateViewport(toPos) + animating = null + requestedAnimation = false + transitionStart = null + const item = swiperContexts.value[state.current] + if (item) { + const currentItemId = item.getItemId() + trigger('animationfinish', {} as Event, { + current: state.current, + currentItemId, + source, + }) + } + return + } + const s = (acc * time * time) / 2 + const l = toPos + s + updateViewport(l) + animationFrame = requestAnimationFrame(animateFrameFuncProto) + } + function animateViewport(current: number, source: string, n: number) { + cancelViewportAnimation() + const duration = state.duration + const length = swiperContexts.value.length + let position = viewportPosition + if (circularEnabled.value) { + if (n < 0) { + for (; position < current; ) { + position += length + } + for (; position - length > current; ) { + position -= length + } + } else if (n > 0) { + for (; position > current; ) { + position -= length + } + for (; position + length < current; ) { + position += length + } + } else { + for (; position + length < current; ) { + position += length + } + for (; position - length > current; ) { + position -= length + } + if (position + length - current < current - position) { + position += length + } + } + } + + animating = { + toPos: current, + acc: (2 * (position - current)) / (duration * duration), + endTime: Date.now() + duration, + source: source, + } + if (!requestedAnimation) { + requestedAnimation = true + animationFrame = requestAnimationFrame(animateFrameFuncProto) + } + } + function scheduleAutoplay() { + cancelSchedule() + const items = swiperContexts.value + const callback = function () { + timer = null + currentChangeSource = 'autoplay' + if (circularEnabled.value) { + state.current = normalizeCurrentValue(state.current + 1) + } else { + state.current = + state.current + state.displayMultipleItems < items.length + ? state.current + 1 + : 0 + } + animateViewport(state.current, 'autoplay', circularEnabled.value ? 1 : 0) + timer = setTimeout(callback, state.interval) + } + if (!(invalid || items.length <= state.displayMultipleItems)) { + timer = setTimeout(callback, state.interval) + } + } + function resetLayout() { + cancelSchedule() + endViewportAnimation() + const items = swiperContexts.value + for (let i = 0; i < items.length; i++) { + items[i].updatePosition(i, props.vertical) + } + viewportMoveRatio = 1 + const slideFrameEl = slideFrameRef.value as HTMLElement + if (state.displayMultipleItems === 1 && items.length) { + const itemRect = items[0].getBoundingClientRect() + const slideFrameRect = slideFrameEl.getBoundingClientRect() + viewportMoveRatio = itemRect.width / slideFrameRect.width + if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) { + viewportMoveRatio = 1 + } + } + const position = viewportPosition + viewportPosition = -2 + const current = state.current + if (current >= 0) { + invalid = false + if (state.userTracking) { + updateViewport(position + current - contentTrackViewport) + contentTrackViewport = current + } else { + updateViewport(current) + if (props.autoplay) { + scheduleAutoplay() + } + } + } else { + invalid = true + updateViewport(-state.displayMultipleItems - 1) + } + } + watch( + [ + () => props.current, + () => props.currentItemId, + () => [...swiperContexts.value], + ], + () => { + let current = -1 + if (props.currentItemId) { + for (let i = 0, items = swiperContexts.value; i < items.length; i++) { + const itemId = items[i].getItemId() + if (itemId === props.currentItemId) { + current = i + break + } + } + } + if (current < 0) { + current = Math.round(props.current) || 0 + } + current = current < 0 ? 0 : current + if (state.current !== current) { + currentChangeSource = '' + state.current = current + } + } + ) + watch( + [ + () => props.vertical, + () => circularEnabled.value, + () => state.displayMultipleItems, + () => [...swiperContexts.value], + ], + resetLayout + ) + watch( + () => state.interval, + () => { + if (timer) { + cancelSchedule() + scheduleAutoplay() + } + } + ) + function currentChanged(current: number, history: number) { + const source = currentChangeSource + currentChangeSource = '' + const items = swiperContexts.value + if (!source) { + const length = items.length + animateViewport( + current, + '', + circularEnabled.value && + history + ((length - current) % length) > length / 2 + ? 1 + : 0 + ) + } + const item = items[current] + if (item) { + const currentItemId = (state.currentItemId = item.getItemId()) + trigger('change', {} as Event, { + current: state.current, + currentItemId, + source, + }) + } + } + watch( + () => state.current, + (val, oldVal) => { + currentChanged(val, oldVal) + emit('update:current', val) + } + ) + watch( + () => state.currentItemId, + (val) => { + emit('update:currentItemId', val) + } + ) + function inintAutoplay(enable: boolean) { + if (enable) { + scheduleAutoplay() + } else { + cancelSchedule() + } + } + watch(() => props.autoplay && !state.userTracking, inintAutoplay) + inintAutoplay(props.autoplay && !state.userTracking) + + onMounted(() => { + let userDirectionChecked = false + let contentTrackSpeed = 0 + let contentTrackT = 0 + function handleTrackStart() { + cancelSchedule() + contentTrackViewport = viewportPosition + contentTrackSpeed = 0 + contentTrackT = Date.now() + cancelViewportAnimation() + } + function handleTrackMove(data: { + dy: number + ddy: number + dx: number + ddx: number + }) { + const oldContentTrackT = contentTrackT + contentTrackT = Date.now() + const length = swiperContexts.value.length + const other = length - state.displayMultipleItems + function calc(val: number) { + return 0.5 - 0.25 / (val + 0.5) + } + + function move(oldVal: number, newVal: number) { + let val = contentTrackViewport + oldVal + contentTrackSpeed = 0.6 * contentTrackSpeed + 0.4 * newVal + if (!circularEnabled.value) { + if (val < 0 || val > other) { + if (val < 0) { + val = -calc(-val) + } else { + if (val > other) { + val = other + calc(val - other) + } + } + contentTrackSpeed = 0 + } + } + updateViewport(val) + } + const time = contentTrackT - oldContentTrackT || 1 + const slideFrameEl = slideFrameRef.value as HTMLElement + if (props.vertical) { + move(-data.dy / slideFrameEl.offsetHeight, -data.ddy / time) + } else { + move(-data.dx / slideFrameEl.offsetWidth, -data.ddx / time) + } + } + function handleTrackEnd(isCancel: boolean) { + state.userTracking = false + const t = contentTrackSpeed / Math.abs(contentTrackSpeed) + let n = 0 + if (!isCancel && Math.abs(contentTrackSpeed) > 0.2) { + n = 0.5 * t + } + const current = normalizeCurrentValue(viewportPosition + n) + if (isCancel) { + updateViewport(contentTrackViewport) + } else { + currentChangeSource = 'touch' + state.current = current + animateViewport( + current, + 'touch', + n !== 0 + ? n + : current === 0 && circularEnabled.value && viewportPosition >= 1 + ? 1 + : 0 + ) + } + } + useTouchtrack(slideFrameRef.value as HTMLElement, (event) => { + if (props.disableTouch) { + return + } + if (!invalid) { + if (event.detail.state === 'start') { + state.userTracking = true + userDirectionChecked = false + return handleTrackStart() + } + // fixed by xxxxxx + if (event.detail.state === 'end') { + return handleTrackEnd(false) + } + if (event.detail.state === 'cancel') { + return handleTrackEnd(true) + } + if (state.userTracking) { + if (!userDirectionChecked) { + userDirectionChecked = true + const t = Math.abs(event.detail.dx) + const n = Math.abs(event.detail.dy) + if (t >= n && props.vertical) { + state.userTracking = false + } else { + if (t <= n && !props.vertical) { + state.userTracking = false + } + } + if (!state.userTracking) { + if (props.autoplay) { + scheduleAutoplay() + } + return + } + } + handleTrackMove(event.detail) + return false + } + } + }) + }) + onUnmounted(() => { + cancelSchedule() + cancelAnimationFrame(animationFrame) + }) + function onSwiperDotClick(index: number) { + animateViewport( + (state.current = index), + (currentChangeSource = 'click'), + circularEnabled.value ? 1 : 0 + ) + } + return { + onSwiperDotClick, + } +} + +export default /*#__PURE__*/ defineComponent({ + name: 'Swiper', + props, + emits: [ + 'change', + 'transition', + 'animationfinish', + 'update:current', + 'update:currentItemId', + ], + setup(props, { slots, emit }) { + const rootRef: Ref = ref(null) + const trigger = useCustomEvent(rootRef, emit as SetupContext['emit']) + const slidesWrapperRef: Ref = ref(null) + const slideFrameRef: Ref = ref(null) + const state = useState(props) + const slidesStyle = computed(() => { + let style = {} + if (props.nextMargin || props.previousMargin) { + style = props.vertical + ? { + left: 0, + right: 0, + top: upx2pxStr(props.previousMargin), + bottom: upx2pxStr(props.nextMargin), + } + : { + top: 0, + bottom: 0, + left: upx2pxStr(props.previousMargin), + right: upx2pxStr(props.nextMargin), + } + } + return style + }) + const slideFrameStyle = computed(() => { + const value = Math.abs(100 / state.displayMultipleItems) + '%' + return { + width: props.vertical ? '100%' : value, + height: !props.vertical ? '100%' : value, + } + }) + let swiperItems: VNode[] = [] + const originSwiperContexts: SwiperContext[] = [] + const swiperContexts: Ref = ref([]) + function updateSwiperContexts() { + const contexts: SwiperContext[] = [] + for (let index = 0; index < swiperItems.length; index++) { + const swiperItem = swiperItems[index] + const swiperContext = originSwiperContexts.find( + (context) => swiperItem.el === context.rootRef.value + ) + if (swiperContext) { + contexts.push(markRaw(swiperContext)) + } + } + swiperContexts.value = contexts + } + const addSwiperContext: AddSwiperContext = function (swiperContext) { + originSwiperContexts.push(swiperContext) + updateSwiperContexts() + } + provide('addSwiperContext', addSwiperContext) + const removeSwiperContext: RemoveSwiperContext = function (swiperContext) { + const index = originSwiperContexts.indexOf(swiperContext) + if (index >= 0) { + originSwiperContexts.splice(index, 1) + updateSwiperContexts() + } + } + provide('removeSwiperContext', removeSwiperContext) + + const { onSwiperDotClick } = useLayout( + props, + state, + swiperContexts, + slideFrameRef, + emit as SetupContext['emit'], + trigger + ) + + return () => { + const defaultSlots = slots.default && slots.default() + // TODO filter + swiperItems = defaultSlots || [] + return ( + +
+
+
+ {swiperItems} +
+
+ {props.indicatorDots && ( +
+ {swiperContexts.value.map((_, index, array) => ( +
onSwiperDotClick(index)} + class={{ + 'uni-swiper-dot': true, + 'uni-swiper-dot-active': + (index < state.current + state.displayMultipleItems && + index >= state.current) || + index < + state.current + + state.displayMultipleItems - + array.length, + }} + style={{ + background: + index === state.current + ? props.indicatorActiveColor + : props.indicatorColor, + }} + >
+ ))} +
+ )} +
+
+ ) + } + }, +}) diff --git a/packages/uni-components/src/components/swiper/index.vue b/packages/uni-components/src/components/swiper/index.vue deleted file mode 100644 index c1c62149b..000000000 --- a/packages/uni-components/src/components/swiper/index.vue +++ /dev/null @@ -1,644 +0,0 @@ - - \ No newline at end of file diff --git a/packages/uni-components/src/helpers/useTouchtrack.ts b/packages/uni-components/src/helpers/useTouchtrack.ts index ef2cf92b0..414fad273 100644 --- a/packages/uni-components/src/helpers/useTouchtrack.ts +++ b/packages/uni-components/src/helpers/useTouchtrack.ts @@ -53,7 +53,7 @@ let __mouseUpEventListener: (this: Document, ev: MouseEvent) => any export function useTouchtrack( element: HTMLElement, - method: Function, + method: (event: TouchtrackEvent) => boolean | void, useCancel?: boolean ) { onBeforeUnmount(() => { diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index 44bbd3a4f..34b5fdc90 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -799,6 +799,29 @@ function getRealPath(filePath) { } return filePath; } +const ua = navigator.userAgent; +const isIOS$1 = /* @__PURE__ */ /iphone|ipad|ipod/i.test(ua); +function getScreenFix() { + return /^Apple/.test(navigator.vendor) && typeof window.orientation === "number"; +} +function isLandscape(screenFix) { + return screenFix && Math.abs(window.orientation) === 90; +} +function getScreenWidth(screenFix, landscape) { + return screenFix ? Math[landscape ? "max" : "min"](screen.width, screen.height) : screen.width; +} +function getWindowWidth(screenWidth) { + return Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth) || screenWidth; +} +function getBaseSystemInfo() { + const screenFix = getScreenFix(); + const windowWidth = getWindowWidth(getScreenWidth(screenFix, isLandscape(screenFix))); + return { + platform: isIOS$1 ? "ios" : "other", + pixelRatio: window.devicePixelRatio, + windowWidth + }; +} function saveImage(base64, dirname, callback) { callback(null, base64); } @@ -879,6 +902,47 @@ function getSameOriginUrl(url) { } return urlToFile(url).then(fileToUrl); } +const API_UPX2PX = "upx2px"; +const Upx2pxProtocol = [ + { + name: "upx", + type: [Number, String], + required: true + } +]; +const EPS = 1e-4; +const BASE_DEVICE_WIDTH = 750; +let isIOS = false; +let deviceWidth = 0; +let deviceDPR = 0; +function checkDeviceWidth() { + const {platform, pixelRatio: pixelRatio2, windowWidth} = getBaseSystemInfo(); + deviceWidth = windowWidth; + deviceDPR = pixelRatio2; + isIOS = platform === "ios"; +} +const upx2px = /* @__PURE__ */ defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => { + if (deviceWidth === 0) { + checkDeviceWidth(); + } + number = Number(number); + if (number === 0) { + return 0; + } + let result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth); + if (result < 0) { + result = -result; + } + result = Math.floor(result + EPS); + if (result === 0) { + if (deviceDPR === 1 || !isIOS) { + result = 1; + } else { + result = 0.5; + } + } + return number < 0 ? -result : result; +}, Upx2pxProtocol); const canvasEventCallbacks = createCallbacks("canvasEvent"); ServiceJSBridge.subscribe("onCanvasMethodCallback", ({callbackId, data}) => { const callback = canvasEventCallbacks.pop(callbackId); @@ -1138,7 +1202,7 @@ function initHistory() { return vueRouter.createMemoryHistory(); } } -var index$m = { +var index$o = { install(app) { initApp$1(app); if (__UNI_FEATURE_PAGES__) { @@ -1272,7 +1336,7 @@ function throttle(fn, wait) { }; return newFn; } -const _sfc_main$9 = { +const _sfc_main$8 = { name: "Audio", mixins: [subscriber], props: { @@ -1397,7 +1461,7 @@ const _hoisted_3$2 = {class: "uni-audio-time"}; const _hoisted_4$2 = {class: "uni-audio-info"}; const _hoisted_5$1 = {class: "uni-audio-name"}; const _hoisted_6$1 = {class: "uni-audio-author"}; -function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createBlock("uni-audio", vue.mergeProps({ id: $props.id, controls: !!$props.controls @@ -1427,7 +1491,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { ]) ], 16, ["id", "controls"]); } -_sfc_main$9.render = _sfc_render$9; +_sfc_main$8.render = _sfc_render$8; const hoverProps = { hoverClass: { type: String, @@ -1512,7 +1576,7 @@ function useBooleanAttr(props2, keys) { }, Object.create(null)); } const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf"); -var index$l = /* @__PURE__ */ vue.defineComponent({ +var index$n = /* @__PURE__ */ vue.defineComponent({ name: "Form", setup(_props, { slots, @@ -1551,7 +1615,7 @@ function provideForm(emit2) { }); return fields; } -var index$k = /* @__PURE__ */ vue.defineComponent({ +var index$m = /* @__PURE__ */ vue.defineComponent({ name: "Button", props: { id: { @@ -1734,7 +1798,7 @@ function getTempCanvas(width = 0, height = 0) { tempCanvas.height = height; return tempCanvas; } -var _sfc_main$8 = { +var _sfc_main$7 = { name: "Canvas", inheritAttrs: false, components: { @@ -2196,7 +2260,7 @@ const _hoisted_1$5 = { height: "150" }; const _hoisted_2$2 = {style: {position: "absolute", top: "0", left: "0", width: "100%", height: "100%", overflow: "hidden"}}; -function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { const _component_ResizeSensor = vue.resolveComponent("ResizeSensor"); return vue.openBlock(), vue.createBlock("uni-canvas", vue.mergeProps({ "canvas-id": $props.canvasId, @@ -2212,17 +2276,17 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { }, null, 8, ["onResize"]) ], 16, ["canvas-id", "disable-scroll"]); } -_sfc_main$8.render = _sfc_render$8; +_sfc_main$7.render = _sfc_render$7; const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg"); -const props$k = { +const props$m = { name: { type: String, default: "" } }; -var index$j = /* @__PURE__ */ vue.defineComponent({ +var index$l = /* @__PURE__ */ vue.defineComponent({ name: "CheckboxGroup", - props: props$k, + props: props$m, emits: ["change"], setup(props2, { emit: emit2, @@ -2275,15 +2339,15 @@ function useProvideCheckGroup(props2, trigger) { return getFieldsValue; } const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul"); -const props$j = { +const props$l = { for: { type: String, default: "" } }; -var index$i = /* @__PURE__ */ vue.defineComponent({ +var index$k = /* @__PURE__ */ vue.defineComponent({ name: "Label", - props: props$j, + props: props$l, setup(props2, { emit: emit2, slots @@ -2328,7 +2392,7 @@ function useProvideLabel() { }); return handlers; } -const props$i = { +const props$k = { checked: { type: [Boolean, String], default: false @@ -2350,9 +2414,9 @@ const props$i = { default: "" } }; -var index$h = /* @__PURE__ */ vue.defineComponent({ +var index$j = /* @__PURE__ */ vue.defineComponent({ name: "Checkbox", - props: props$i, + props: props$k, setup(props2, { slots }) { @@ -2421,7 +2485,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) { let resetTimer; function iosHideKeyboard() { } -const props$h = { +const props$j = { cursorSpacing: { type: [Number, String], default: 0 @@ -2591,7 +2655,7 @@ function useQuill(props2, rootRef, trigger) { }); useSubscribe(); } -const props$g = /* @__PURE__ */ Object.assign({}, props$h, { +const props$i = /* @__PURE__ */ Object.assign({}, props$j, { id: { type: String, default: "" @@ -2617,9 +2681,9 @@ const props$g = /* @__PURE__ */ Object.assign({}, props$h, { default: false } }); -var index$g = /* @__PURE__ */ vue.defineComponent({ +var index$i = /* @__PURE__ */ vue.defineComponent({ name: "Editor", - props: props$g, + props: props$i, emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1], setup(props2, { emit: emit2 @@ -2678,7 +2742,7 @@ const ICONS = { c: GREY_COLOR } }; -var index$f = /* @__PURE__ */ vue.defineComponent({ +var index$h = /* @__PURE__ */ vue.defineComponent({ name: "Icon", props: { type: { @@ -2700,7 +2764,7 @@ var index$f = /* @__PURE__ */ vue.defineComponent({ return () => vue.createVNode("uni-icon", null, [path.value.d && createSvgIconVNode(path.value.d, props2.color || path.value.c, rpx2px(props2.size))]); } }); -const props$f = { +const props$h = { src: { type: String, default: "" @@ -2737,9 +2801,9 @@ const IMAGE_MODES = { "bottom left": ["left bottom"], "bottom right": ["right bottom"] }; -var index$e = /* @__PURE__ */ vue.defineComponent({ +var index$g = /* @__PURE__ */ vue.defineComponent({ name: "Image", - props: props$f, + props: props$h, setup(props2, { emit: emit2 }) { @@ -2951,7 +3015,7 @@ function useFormField(nameKey, value) { function getValueString(value) { return value === null ? "" : String(value); } -const props$e = /* @__PURE__ */ Object.assign({}, { +const props$g = /* @__PURE__ */ Object.assign({}, { name: { type: String, default: "" @@ -3012,7 +3076,7 @@ const props$e = /* @__PURE__ */ Object.assign({}, { type: String, default: "done" } -}, props$h); +}, props$j); const emit = ["input", "focus", "blur", ...emit$1]; function useBase(props2, rootRef, emit2) { const fieldRef = vue.ref(null); @@ -3188,7 +3252,7 @@ function useField(props2, rootRef, emit2, beforeInput) { trigger }; } -const props$d = /* @__PURE__ */ Object.assign({}, props$e, { +const props$f = /* @__PURE__ */ Object.assign({}, props$g, { placeholderClass: { type: String, default: "input-placeholder" @@ -3196,7 +3260,7 @@ const props$d = /* @__PURE__ */ Object.assign({}, props$e, { }); var Input = /* @__PURE__ */ vue.defineComponent({ name: "Input", - props: props$d, + props: props$f, emit: ["confirm", ...emit], setup(props2, { emit: emit2 @@ -3759,7 +3823,7 @@ function g(e2, t2, n) { model: e2 }; } -const _sfc_main$7 = { +const _sfc_main$6 = { name: "MovableView", mixins: [touchtrack], props: { @@ -4311,16 +4375,16 @@ const _sfc_main$7 = { } } }; -function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { const _component_v_uni_resize_sensor = vue.resolveComponent("v-uni-resize-sensor"); return vue.openBlock(), vue.createBlock("uni-movable-view", _ctx.$attrs, [ vue.createVNode(_component_v_uni_resize_sensor, {onResize: $options.setParent}, null, 8, ["onResize"]), vue.renderSlot(_ctx.$slots, "default") ], 16); } -_sfc_main$7.render = _sfc_render$7; +_sfc_main$6.render = _sfc_render$6; const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"]; -const _sfc_main$6 = { +const _sfc_main$5 = { name: "Navigator", props: { hoverClass: { @@ -4403,7 +4467,7 @@ const _sfc_main$6 = { }; } }; -function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { return $props.hoverClass && $props.hoverClass !== "none" ? (vue.openBlock(), vue.createBlock("uni-navigator", vue.mergeProps({ key: 0, class: [$setup.hovering ? $props.hoverClass : ""] @@ -4418,13 +4482,13 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { vue.renderSlot(_ctx.$slots, "default") ])); } -_sfc_main$6.render = _sfc_render$6; +_sfc_main$5.render = _sfc_render$5; const VALUES = { activeColor: "#007AFF", backgroundColor: "#EBEBEB", activeMode: "backwards" }; -const props$c = { +const props$e = { percent: { type: [Number, String], default: 0, @@ -4471,9 +4535,9 @@ const props$c = { } } }; -var index$d = /* @__PURE__ */ vue.defineComponent({ +var index$f = /* @__PURE__ */ vue.defineComponent({ name: "Progress", - props: props$c, + props: props$e, setup(props2) { const state = useProgressState(props2); _activeAnimation(state, props2); @@ -4544,15 +4608,15 @@ function _activeAnimation(state, props2) { } } const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg"); -const props$b = { +const props$d = { name: { type: String, default: "" } }; -var index$c = /* @__PURE__ */ vue.defineComponent({ +var index$e = /* @__PURE__ */ vue.defineComponent({ name: "RadioGroup", - props: props$b, + props: props$d, setup(props2, { emit: emit2, slots @@ -4628,7 +4692,7 @@ function useProvideRadioGroup(props2, trigger) { } return fields; } -const props$a = { +const props$c = { checked: { type: [Boolean, String], default: false @@ -4650,9 +4714,9 @@ const props$a = { default: "" } }; -var index$b = /* @__PURE__ */ vue.defineComponent({ +var index$d = /* @__PURE__ */ vue.defineComponent({ name: "Radio", - props: props$a, + props: props$c, setup(props2, { slots }) { @@ -4936,7 +5000,7 @@ function parseNodes(nodes, parentNode) { }); return parentNode; } -const _sfc_main$5 = { +const _sfc_main$4 = { name: "RichText", props: { nodes: { @@ -4966,12 +5030,12 @@ const _sfc_main$5 = { } }; const _hoisted_1$4 = /* @__PURE__ */ vue.createVNode("div", null, null, -1); -function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createBlock("uni-rich-text", _ctx.$attrs, [ _hoisted_1$4 ], 16); } -_sfc_main$5.render = _sfc_render$5; +_sfc_main$4.render = _sfc_render$4; function Friction(e2) { this._drag = e2; this._dragLog = Math.log(e2); @@ -5663,7 +5727,7 @@ function disableScrollBounce({disable}) { } } const passiveOptions = uniShared.passive(true); -const _sfc_main$4 = { +const _sfc_main$3 = { name: "ScrollView", mixins: [scroller], props: { @@ -6124,7 +6188,7 @@ const _hoisted_9 = /* @__PURE__ */ vue.createVNode("circle", { style: {color: "#2bd009"}, "stroke-width": "3" }, null, -1); -function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createBlock("uni-scroll-view", _hoisted_1$3, [ vue.createVNode("div", _hoisted_2$1, [ vue.createVNode("div", { @@ -6172,8 +6236,8 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { ], 512) ], 512); } -_sfc_main$4.render = _sfc_render$4; -const props$9 = { +_sfc_main$3.render = _sfc_render$3; +const props$b = { name: { type: String, default: "" @@ -6227,9 +6291,9 @@ const props$9 = { default: false } }; -var index$a = /* @__PURE__ */ vue.defineComponent({ +var index$c = /* @__PURE__ */ vue.defineComponent({ name: "Slider", - props: props$9, + props: props$b, emits: ["changing", "change"], setup(props2, { emit: emit2 @@ -6388,33 +6452,509 @@ var computeController = { return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); } }; -const _sfc_main$3 = { - name: "SwiperItem", - props: { - itemId: { - type: String, - default: "" - } +const props$a = { + indicatorDots: { + type: [Boolean, String], + default: false }, - mounted: function() { - var $el = this.$el; - $el.style.position = "absolute"; - $el.style.width = "100%"; - $el.style.height = "100%"; - var callbacks2 = this.$vnode._callbacks; - if (callbacks2) { - callbacks2.forEach((callback) => { - callback(); + vertical: { + type: [Boolean, String], + default: false + }, + autoplay: { + type: [Boolean, String], + default: false + }, + circular: { + type: [Boolean, String], + default: false + }, + interval: { + type: [Number, String], + default: 5e3 + }, + duration: { + type: [Number, String], + default: 500 + }, + current: { + type: [Number, String], + default: 0 + }, + indicatorColor: { + type: String, + default: "" + }, + indicatorActiveColor: { + type: String, + default: "" + }, + previousMargin: { + type: String, + default: "" + }, + nextMargin: { + type: String, + default: "" + }, + currentItemId: { + type: String, + default: "" + }, + skipHiddenItemLayout: { + type: [Boolean, String], + default: false + }, + displayMultipleItems: { + type: [Number, String], + default: 1 + }, + disableTouch: { + type: [Boolean, String], + default: false + } +}; +function upx2pxStr(val) { + if (/\d+[ur]px$/i.test(val)) { + val.replace(/\d+[ur]px$/i, (text) => { + return `${upx2px(parseFloat(text))}px`; + }); + } + return val || ""; +} +function useState(props2) { + const interval = vue.computed(() => { + const interval2 = Number(props2.interval); + return isNaN(interval2) ? 5e3 : interval2; + }); + const duration = vue.computed(() => { + const duration2 = Number(props2.duration); + return isNaN(duration2) ? 500 : duration2; + }); + const displayMultipleItems = vue.computed(() => { + const displayMultipleItems2 = Math.round(props2.displayMultipleItems); + return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2; + }); + const state = vue.reactive({ + interval, + duration, + displayMultipleItems, + current: Math.round(props2.current) || 0, + currentItemId: props2.currentItemId, + userTracking: false + }); + return state; +} +function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger) { + function cancelSchedule() { + if (timer) { + clearTimeout(timer); + timer = null; + } + } + let timer = null; + let invalid = true; + let viewportPosition = 0; + let viewportMoveRatio = 1; + let animating = null; + let requestedAnimation = false; + let contentTrackViewport = 0; + let transitionStart; + let currentChangeSource = ""; + const circularEnabled = vue.computed(() => props2.circular && swiperContexts.value.length > state.displayMultipleItems); + function checkCircularLayout(index2) { + if (!invalid) { + for (let items = swiperContexts.value, n = items.length, i2 = index2 + state.displayMultipleItems, r = 0; r < n; r++) { + const item = items[r]; + const s = Math.floor(index2 / n) * n + r; + const l = s + n; + const c = s - n; + const u = Math.max(index2 - (s + 1), s - i2, 0); + const d = Math.max(index2 - (l + 1), l - i2, 0); + const h = Math.max(index2 - (c + 1), c - i2, 0); + const p2 = Math.min(u, d, h); + const position = [s, l, c][[u, d, h].indexOf(p2)]; + item.updatePosition(position, props2.vertical); + } + } + } + function updateViewport(index2) { + if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) { + if (circularEnabled.value) { + checkCircularLayout(index2); + } + } + const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%"; + const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0"; + const transform = "translate(" + x + ", " + y + ") translateZ(0)"; + const slideFrame = slideFrameRef.value; + if (slideFrame) { + slideFrame.style.webkitTransform = transform; + slideFrame.style.transform = transform; + } + viewportPosition = index2; + if (!transitionStart) { + if (index2 % 1 === 0) { + return; + } + transitionStart = index2; + } + index2 -= Math.floor(transitionStart); + const items = swiperContexts.value; + if (index2 <= -(items.length - 1)) { + index2 += items.length; + } else if (index2 >= items.length) { + index2 -= items.length; + } + index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2; + trigger("transition", {}, { + dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth, + dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0 + }); + } + function endViewportAnimation() { + if (animating) { + updateViewport(animating.toPos); + animating = null; + } + } + function normalizeCurrentValue(current) { + const length = swiperContexts.value.length; + if (!length) { + return -1; + } + const index2 = (Math.round(current) % length + length) % length; + if (circularEnabled.value) { + if (length <= state.displayMultipleItems) { + return 0; + } + } else if (index2 > length - state.displayMultipleItems) { + return length - state.displayMultipleItems; + } + return index2; + } + function cancelViewportAnimation() { + animating = null; + } + function animateFrameFuncProto() { + if (!animating) { + requestedAnimation = false; + return; + } + const _animating = animating; + const toPos = _animating.toPos; + const acc = _animating.acc; + const endTime = _animating.endTime; + const source = _animating.source; + const time = endTime - Date.now(); + if (time <= 0) { + updateViewport(toPos); + animating = null; + requestedAnimation = false; + transitionStart = null; + const item = swiperContexts.value[state.current]; + if (item) { + const currentItemId = item.getItemId(); + trigger("animationfinish", {}, { + current: state.current, + currentItemId, + source + }); + } + return; + } + const s = acc * time * time / 2; + const l = toPos + s; + updateViewport(l); + requestAnimationFrame(animateFrameFuncProto); + } + function animateViewport(current, source, n) { + cancelViewportAnimation(); + const duration = state.duration; + const length = swiperContexts.value.length; + let position = viewportPosition; + if (circularEnabled.value) { + if (n < 0) { + for (; position < current; ) { + position += length; + } + for (; position - length > current; ) { + position -= length; + } + } else if (n > 0) { + for (; position > current; ) { + position -= length; + } + for (; position + length < current; ) { + position += length; + } + } else { + for (; position + length < current; ) { + position += length; + } + for (; position - length > current; ) { + position -= length; + } + if (position + length - current < current - position) { + position += length; + } + } + } + animating = { + toPos: current, + acc: 2 * (position - current) / (duration * duration), + endTime: Date.now() + duration, + source + }; + if (!requestedAnimation) { + requestedAnimation = true; + requestAnimationFrame(animateFrameFuncProto); + } + } + function scheduleAutoplay() { + cancelSchedule(); + const items = swiperContexts.value; + const callback = function() { + timer = null; + currentChangeSource = "autoplay"; + if (circularEnabled.value) { + state.current = normalizeCurrentValue(state.current + 1); + } else { + state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0; + } + animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0); + timer = setTimeout(callback, state.interval); + }; + if (!(invalid || items.length <= state.displayMultipleItems)) { + timer = setTimeout(callback, state.interval); + } + } + function resetLayout() { + cancelSchedule(); + endViewportAnimation(); + const items = swiperContexts.value; + for (let i2 = 0; i2 < items.length; i2++) { + items[i2].updatePosition(i2, props2.vertical); + } + viewportMoveRatio = 1; + const slideFrameEl = slideFrameRef.value; + if (state.displayMultipleItems === 1 && items.length) { + const itemRect = items[0].getBoundingClientRect(); + const slideFrameRect = slideFrameEl.getBoundingClientRect(); + viewportMoveRatio = itemRect.width / slideFrameRect.width; + if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) { + viewportMoveRatio = 1; + } + } + const position = viewportPosition; + viewportPosition = -2; + const current = state.current; + if (current >= 0) { + invalid = false; + if (state.userTracking) { + updateViewport(position + current - contentTrackViewport); + contentTrackViewport = current; + } else { + updateViewport(current); + if (props2.autoplay) { + scheduleAutoplay(); + } + } + } else { + invalid = true; + updateViewport(-state.displayMultipleItems - 1); + } + } + vue.watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => { + let current = -1; + if (props2.currentItemId) { + for (let i2 = 0, items = swiperContexts.value; i2 < items.length; i2++) { + const itemId = items[i2].getItemId(); + if (itemId === props2.currentItemId) { + current = i2; + break; + } + } + } + if (current < 0) { + current = Math.round(props2.current) || 0; + } + current = current < 0 ? 0 : current; + if (state.current !== current) { + currentChangeSource = ""; + state.current = current; + } + }); + vue.watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout); + vue.watch(() => state.interval, () => { + if (timer) { + cancelSchedule(); + scheduleAutoplay(); + } + }); + function currentChanged(current, history) { + const source = currentChangeSource; + currentChangeSource = ""; + const items = swiperContexts.value; + if (!source) { + const length = items.length; + animateViewport(current, "", circularEnabled.value && history + (length - current) % length > length / 2 ? 1 : 0); + } + const item = items[current]; + if (item) { + const currentItemId = state.currentItemId = item.getItemId(); + trigger("change", {}, { + current: state.current, + currentItemId, + source }); } } -}; -function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { - return vue.openBlock(), vue.createBlock("uni-swiper-item", _ctx.$attrs, [ - vue.renderSlot(_ctx.$slots, "default") - ], 16); + vue.watch(() => state.current, (val, oldVal) => { + currentChanged(val, oldVal); + emit2("update:current", val); + }); + vue.watch(() => state.currentItemId, (val) => { + emit2("update:currentItemId", val); + }); + function inintAutoplay(enable) { + if (enable) { + scheduleAutoplay(); + } else { + cancelSchedule(); + } + } + vue.watch(() => props2.autoplay && !state.userTracking, inintAutoplay); + inintAutoplay(props2.autoplay && !state.userTracking); + function onSwiperDotClick(index2) { + animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0); + } + return { + onSwiperDotClick + }; } -_sfc_main$3.render = _sfc_render$3; +var index$b = /* @__PURE__ */ vue.defineComponent({ + name: "Swiper", + props: props$a, + emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"], + setup(props2, { + slots, + emit: emit2 + }) { + const rootRef = vue.ref(null); + const trigger = useCustomEvent(rootRef, emit2); + const slidesWrapperRef = vue.ref(null); + const slideFrameRef = vue.ref(null); + const state = useState(props2); + const slidesStyle = vue.computed(() => { + let style = {}; + if (props2.nextMargin || props2.previousMargin) { + style = props2.vertical ? { + left: 0, + right: 0, + top: upx2pxStr(props2.previousMargin), + bottom: upx2pxStr(props2.nextMargin) + } : { + top: 0, + bottom: 0, + left: upx2pxStr(props2.previousMargin), + right: upx2pxStr(props2.nextMargin) + }; + } + return style; + }); + const slideFrameStyle = vue.computed(() => { + const value = Math.abs(100 / state.displayMultipleItems) + "%"; + return { + width: props2.vertical ? "100%" : value, + height: !props2.vertical ? "100%" : value + }; + }); + let swiperItems = []; + const originSwiperContexts = []; + const swiperContexts = vue.ref([]); + function updateSwiperContexts() { + const contexts = []; + for (let index2 = 0; index2 < swiperItems.length; index2++) { + const swiperItem = swiperItems[index2]; + const swiperContext = originSwiperContexts.find((context) => swiperItem.el === context.rootRef.value); + if (swiperContext) { + contexts.push(vue.markRaw(swiperContext)); + } + } + swiperContexts.value = contexts; + } + const addSwiperContext = function(swiperContext) { + originSwiperContexts.push(swiperContext); + updateSwiperContexts(); + }; + vue.provide("addSwiperContext", addSwiperContext); + const removeSwiperContext = function(swiperContext) { + const index2 = originSwiperContexts.indexOf(swiperContext); + if (index2 >= 0) { + originSwiperContexts.splice(index2, 1); + updateSwiperContexts(); + } + }; + vue.provide("removeSwiperContext", removeSwiperContext); + const { + onSwiperDotClick + } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger); + return () => { + const defaultSlots = slots.default && slots.default(); + swiperItems = defaultSlots || []; + return vue.createVNode("uni-swiper", { + ref: rootRef + }, [vue.createVNode("div", { + ref: slidesWrapperRef, + class: "uni-swiper-wrapper" + }, [vue.createVNode("div", { + class: "uni-swiper-slides", + style: slidesStyle.value + }, [vue.createVNode("div", { + ref: slideFrameRef, + class: "uni-swiper-slide-frame", + style: slideFrameStyle.value + }, [swiperItems], 4)], 4), props2.indicatorDots && vue.createVNode("div", { + class: ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"] + }, [swiperContexts.value.map((_, index2, array) => vue.createVNode("div", { + onClick: () => onSwiperDotClick(index2), + class: { + "uni-swiper-dot": true, + "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length + }, + style: { + background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor + } + }, null, 14, ["onClick"]))], 2)], 512)], 512); + }; + } +}); +const props$9 = { + itemId: { + type: String, + default: "" + } +}; +var index$a = /* @__PURE__ */ vue.defineComponent({ + name: "SwiperItem", + props: props$9, + setup(props2, { + slots + }) { + const rootRef = vue.ref(null); + return () => { + return vue.createVNode("uni-swiper-item", { + ref: rootRef, + style: { + position: "absolute", + width: "100%", + height: "100%" + } + }, [slots.default && slots.default()], 512); + }; + } +}); const props$8 = { name: { type: String, @@ -6584,7 +7124,7 @@ var index$8 = /* @__PURE__ */ vue.defineComponent({ }; } }); -const props$7 = /* @__PURE__ */ Object.assign({}, props$e, { +const props$7 = /* @__PURE__ */ Object.assign({}, props$g, { placeholderClass: { type: String, default: "input-placeholder" @@ -9469,32 +10009,33 @@ var index = /* @__PURE__ */ vue.defineComponent({ }); exports.AsyncErrorComponent = index$1; exports.AsyncLoadingComponent = index; -exports.Audio = _sfc_main$9; -exports.Button = index$k; -exports.Canvas = _sfc_main$8; -exports.Checkbox = index$h; -exports.CheckboxGroup = index$j; +exports.Audio = _sfc_main$8; +exports.Button = index$m; +exports.Canvas = _sfc_main$7; +exports.Checkbox = index$j; +exports.CheckboxGroup = index$l; exports.CoverImage = _sfc_main$1; exports.CoverView = _sfc_main$2; -exports.Editor = index$g; -exports.Form = index$l; -exports.Icon = index$f; -exports.Image = index$e; +exports.Editor = index$i; +exports.Form = index$n; +exports.Icon = index$h; +exports.Image = index$g; exports.Input = Input; -exports.Label = index$i; +exports.Label = index$k; exports.LayoutComponent = LayoutComponent; exports.Map = index$3; -exports.MovableView = _sfc_main$7; -exports.Navigator = _sfc_main$6; +exports.MovableView = _sfc_main$6; +exports.Navigator = _sfc_main$5; exports.PageComponent = index$2; -exports.Progress = index$d; -exports.Radio = index$b; -exports.RadioGroup = index$c; +exports.Progress = index$f; +exports.Radio = index$d; +exports.RadioGroup = index$e; exports.ResizeSensor = ResizeSensor; -exports.RichText = _sfc_main$5; -exports.ScrollView = _sfc_main$4; -exports.Slider = index$a; -exports.SwiperItem = _sfc_main$3; +exports.RichText = _sfc_main$4; +exports.ScrollView = _sfc_main$3; +exports.Slider = index$c; +exports.Swiper = index$b; +exports.SwiperItem = index$a; exports.Switch = index$9; exports.Text = index$8; exports.Textarea = index$7; @@ -9512,7 +10053,7 @@ exports.getStorageInfo = getStorageInfo; exports.getStorageInfoSync = getStorageInfoSync; exports.getStorageSync = getStorageSync; exports.getSystemInfoSync = getSystemInfoSync; -exports.plugin = index$m; +exports.plugin = index$o; exports.removeStorage = removeStorage; exports.removeStorageSync = removeStorageSync; exports.request = request; diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 31dcbbd61..669811750 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -15,7 +15,7 @@ var __assign = (a2, b) => { return a2; }; import {isFunction, extend, hyphenate, isPlainObject, isString, isArray, hasOwn, isObject, capitalize, toRawType, makeMap as makeMap$1, isPromise, invokeArrayFns as invokeArrayFns$1} from "@vue/shared"; -import {injectHook, withModifiers, createVNode, getCurrentInstance, inject, provide, reactive, computed, nextTick, onBeforeMount, onMounted, onBeforeActivate, onBeforeDeactivate, openBlock, createBlock, mergeProps, toDisplayString, ref, defineComponent, watch, onActivated, resolveComponent, toHandlers, renderSlot, onUnmounted, onBeforeUnmount, withDirectives, vShow, createCommentVNode, createTextVNode, shallowRef, watchEffect, renderList, onDeactivated, Fragment, Teleport, createApp, Transition, withCtx, KeepAlive, resolveDynamicComponent} from "vue"; +import {injectHook, withModifiers, createVNode, getCurrentInstance, inject, provide, reactive, computed, nextTick, onBeforeMount, onMounted, onBeforeActivate, onBeforeDeactivate, openBlock, createBlock, mergeProps, toDisplayString, ref, defineComponent, watch, onActivated, resolveComponent, toHandlers, renderSlot, onUnmounted, onBeforeUnmount, withDirectives, vShow, createCommentVNode, markRaw, createTextVNode, shallowRef, watchEffect, renderList, onDeactivated, Fragment, Teleport, createApp, Transition, withCtx, KeepAlive, resolveDynamicComponent} from "vue"; import {once, passive, normalizeTarget, isBuiltInComponent, invokeArrayFns, NAVBAR_HEIGHT, parseQuery, PRIMARY_COLOR, removeLeadingSlash, getLen, ON_REACH_BOTTOM_DISTANCE, decodedQuery, debounce, plusReady, updateElementStyle, addFont, scrollTo} from "@dcloudio/uni-shared"; import {initVueI18n, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT} from "@dcloudio/uni-i18n"; import {useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView} from "vue-router"; @@ -465,7 +465,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(() => { @@ -477,10 +477,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) { @@ -1164,7 +1164,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); @@ -4675,7 +4675,7 @@ function initHistory() { }); return history2; } -var index$m = { +var index$o = { install(app) { initApp$1(app); initView(app); @@ -4860,7 +4860,7 @@ function throttle(fn, wait) { }; return newFn; } -const _sfc_main$9 = { +const _sfc_main$8 = { name: "Audio", mixins: [subscriber], props: { @@ -4985,7 +4985,7 @@ const _hoisted_3$2 = {class: "uni-audio-time"}; const _hoisted_4$2 = {class: "uni-audio-info"}; const _hoisted_5$1 = {class: "uni-audio-name"}; const _hoisted_6$1 = {class: "uni-audio-author"}; -function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createBlock("uni-audio", mergeProps({ id: $props.id, controls: !!$props.controls @@ -5015,7 +5015,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { ]) ], 16, ["id", "controls"]); } -_sfc_main$9.render = _sfc_render$9; +_sfc_main$8.render = _sfc_render$8; const hoverProps = { hoverClass: { type: String, @@ -5100,7 +5100,7 @@ function useBooleanAttr(props2, keys) { }, Object.create(null)); } const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf"); -var index$l = /* @__PURE__ */ defineComponent({ +var index$n = /* @__PURE__ */ defineComponent({ name: "Form", setup(_props, { slots, @@ -5139,7 +5139,7 @@ function provideForm(emit2) { }); return fields; } -var index$k = /* @__PURE__ */ defineComponent({ +var index$m = /* @__PURE__ */ defineComponent({ name: "Button", props: { id: { @@ -5468,7 +5468,7 @@ function getTempCanvas(width = 0, height = 0) { tempCanvas.height = height; return tempCanvas; } -var _sfc_main$8 = { +var _sfc_main$7 = { name: "Canvas", inheritAttrs: false, components: { @@ -5930,7 +5930,7 @@ const _hoisted_1$5 = { height: "150" }; const _hoisted_2$2 = {style: {position: "absolute", top: "0", left: "0", width: "100%", height: "100%", overflow: "hidden"}}; -function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { const _component_ResizeSensor = resolveComponent("ResizeSensor"); return openBlock(), createBlock("uni-canvas", mergeProps({ "canvas-id": $props.canvasId, @@ -5946,7 +5946,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { }, null, 8, ["onResize"]) ], 16, ["canvas-id", "disable-scroll"]); } -_sfc_main$8.render = _sfc_render$8; +_sfc_main$7.render = _sfc_render$7; function useListeners(props2, listeners) { _addListeners(props2.id, listeners); watch(() => props2.id, (newId, oldId) => { @@ -6002,15 +6002,15 @@ function _removeListeners(id2, listeners, watch2) { }); } const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg"); -const props$m = { +const props$o = { name: { type: String, default: "" } }; -var index$j = /* @__PURE__ */ defineComponent({ +var index$l = /* @__PURE__ */ defineComponent({ name: "CheckboxGroup", - props: props$m, + props: props$o, emits: ["change"], setup(props2, { emit: emit2, @@ -6063,15 +6063,15 @@ function useProvideCheckGroup(props2, trigger) { return getFieldsValue; } const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul"); -const props$l = { +const props$n = { for: { type: String, default: "" } }; -var index$i = /* @__PURE__ */ defineComponent({ +var index$k = /* @__PURE__ */ defineComponent({ name: "Label", - props: props$l, + props: props$n, setup(props2, { emit: emit2, slots @@ -6116,7 +6116,7 @@ function useProvideLabel() { }); return handlers; } -const props$k = { +const props$m = { checked: { type: [Boolean, String], default: false @@ -6138,9 +6138,9 @@ const props$k = { default: "" } }; -var index$h = /* @__PURE__ */ defineComponent({ +var index$j = /* @__PURE__ */ defineComponent({ name: "Checkbox", - props: props$k, + props: props$m, setup(props2, { slots }) { @@ -6219,7 +6219,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) { let resetTimer; function iosHideKeyboard() { } -const props$j = { +const props$l = { cursorSpacing: { type: [Number, String], default: 0 @@ -6963,7 +6963,7 @@ function useQuill(props2, rootRef, trigger) { } }); } -const props$i = /* @__PURE__ */ Object.assign({}, props$j, { +const props$k = /* @__PURE__ */ Object.assign({}, props$l, { id: { type: String, default: "" @@ -6989,9 +6989,9 @@ const props$i = /* @__PURE__ */ Object.assign({}, props$j, { default: false } }); -var index$g = /* @__PURE__ */ defineComponent({ +var index$i = /* @__PURE__ */ defineComponent({ name: "Editor", - props: props$i, + props: props$k, emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1], setup(props2, { emit: emit2 @@ -7051,7 +7051,7 @@ const ICONS = { c: GREY_COLOR } }; -var index$f = /* @__PURE__ */ defineComponent({ +var index$h = /* @__PURE__ */ defineComponent({ name: "Icon", props: { type: { @@ -7073,7 +7073,7 @@ var index$f = /* @__PURE__ */ defineComponent({ return () => createVNode("uni-icon", null, [path.value.d && createSvgIconVNode(path.value.d, props2.color || path.value.c, rpx2px(props2.size))]); } }); -const props$h = { +const props$j = { src: { type: String, default: "" @@ -7110,9 +7110,9 @@ const IMAGE_MODES = { "bottom left": ["left bottom"], "bottom right": ["right bottom"] }; -var index$e = /* @__PURE__ */ defineComponent({ +var index$g = /* @__PURE__ */ defineComponent({ name: "Image", - props: props$h, + props: props$j, setup(props2, { emit: emit2 }) { @@ -7391,7 +7391,7 @@ function useFormField(nameKey, value) { function getValueString(value) { return value === null ? "" : String(value); } -const props$g = /* @__PURE__ */ Object.assign({}, { +const props$i = /* @__PURE__ */ Object.assign({}, { name: { type: String, default: "" @@ -7452,7 +7452,7 @@ const props$g = /* @__PURE__ */ Object.assign({}, { type: String, default: "done" } -}, props$j); +}, props$l); const emit = ["input", "focus", "blur", ...emit$1]; function useBase(props2, rootRef, emit2) { const fieldRef = ref(null); @@ -7637,7 +7637,7 @@ function useField(props2, rootRef, emit2, beforeInput) { trigger }; } -const props$f = /* @__PURE__ */ Object.assign({}, props$g, { +const props$h = /* @__PURE__ */ Object.assign({}, props$i, { placeholderClass: { type: String, default: "input-placeholder" @@ -7645,7 +7645,7 @@ const props$f = /* @__PURE__ */ Object.assign({}, props$g, { }); var Input = /* @__PURE__ */ defineComponent({ name: "Input", - props: props$f, + props: props$h, emit: ["confirm", ...emit], setup(props2, { emit: emit2 @@ -8208,7 +8208,7 @@ function g(e2, t2, n) { model: e2 }; } -const _sfc_main$7 = { +const _sfc_main$6 = { name: "MovableView", mixins: [touchtrack], props: { @@ -8760,16 +8760,16 @@ const _sfc_main$7 = { } } }; -function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { const _component_v_uni_resize_sensor = resolveComponent("v-uni-resize-sensor"); return openBlock(), createBlock("uni-movable-view", _ctx.$attrs, [ createVNode(_component_v_uni_resize_sensor, {onResize: $options.setParent}, null, 8, ["onResize"]), renderSlot(_ctx.$slots, "default") ], 16); } -_sfc_main$7.render = _sfc_render$7; +_sfc_main$6.render = _sfc_render$6; const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"]; -const _sfc_main$6 = { +const _sfc_main$5 = { name: "Navigator", props: { hoverClass: { @@ -8852,7 +8852,7 @@ const _sfc_main$6 = { }; } }; -function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { return $props.hoverClass && $props.hoverClass !== "none" ? (openBlock(), createBlock("uni-navigator", mergeProps({ key: 0, class: [$setup.hovering ? $props.hoverClass : ""] @@ -8867,13 +8867,13 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { renderSlot(_ctx.$slots, "default") ])); } -_sfc_main$6.render = _sfc_render$6; +_sfc_main$5.render = _sfc_render$5; const VALUES = { activeColor: "#007AFF", backgroundColor: "#EBEBEB", activeMode: "backwards" }; -const props$e = { +const props$g = { percent: { type: [Number, String], default: 0, @@ -8920,9 +8920,9 @@ const props$e = { } } }; -var index$d = /* @__PURE__ */ defineComponent({ +var index$f = /* @__PURE__ */ defineComponent({ name: "Progress", - props: props$e, + props: props$g, setup(props2) { const state = useProgressState(props2); _activeAnimation(state, props2); @@ -8993,15 +8993,15 @@ function _activeAnimation(state, props2) { } } const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg"); -const props$d = { +const props$f = { name: { type: String, default: "" } }; -var index$c = /* @__PURE__ */ defineComponent({ +var index$e = /* @__PURE__ */ defineComponent({ name: "RadioGroup", - props: props$d, + props: props$f, setup(props2, { emit: emit2, slots @@ -9080,7 +9080,7 @@ function useProvideRadioGroup(props2, trigger) { } return fields; } -const props$c = { +const props$e = { checked: { type: [Boolean, String], default: false @@ -9102,9 +9102,9 @@ const props$c = { default: "" } }; -var index$b = /* @__PURE__ */ defineComponent({ +var index$d = /* @__PURE__ */ defineComponent({ name: "Radio", - props: props$c, + props: props$e, setup(props2, { slots }) { @@ -9398,7 +9398,7 @@ function parseNodes(nodes, parentNode) { }); return parentNode; } -const _sfc_main$5 = { +const _sfc_main$4 = { name: "RichText", props: { nodes: { @@ -9428,12 +9428,12 @@ const _sfc_main$5 = { } }; const _hoisted_1$4 = /* @__PURE__ */ createVNode("div", null, null, -1); -function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createBlock("uni-rich-text", _ctx.$attrs, [ _hoisted_1$4 ], 16); } -_sfc_main$5.render = _sfc_render$5; +_sfc_main$4.render = _sfc_render$4; function Friction(e2) { this._drag = e2; this._dragLog = Math.log(e2); @@ -10125,7 +10125,7 @@ function disableScrollBounce({disable}) { } } const passiveOptions = passive(true); -const _sfc_main$4 = { +const _sfc_main$3 = { name: "ScrollView", mixins: [scroller], props: { @@ -10586,7 +10586,7 @@ const _hoisted_9 = /* @__PURE__ */ createVNode("circle", { style: {color: "#2bd009"}, "stroke-width": "3" }, null, -1); -function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { +function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createBlock("uni-scroll-view", _hoisted_1$3, [ createVNode("div", _hoisted_2$1, [ createVNode("div", { @@ -10634,7 +10634,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { ], 512) ], 512); } -_sfc_main$4.render = _sfc_render$4; +_sfc_main$3.render = _sfc_render$3; const addListenerToElement = function(element, type, callback2, capture) { element.addEventListener(type, ($event) => { if (typeof callback2 === "function") { @@ -10744,7 +10744,7 @@ function useTouchtrack(element, method, useCancel) { } }); } -const props$b = { +const props$d = { name: { type: String, default: "" @@ -10798,9 +10798,9 @@ const props$b = { default: false } }; -var index$a = /* @__PURE__ */ defineComponent({ +var index$c = /* @__PURE__ */ defineComponent({ name: "Slider", - props: props$b, + props: props$d, emits: ["changing", "change"], setup(props2, { emit: emit2 @@ -10965,33 +10965,647 @@ var computeController = { return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); } }; -const _sfc_main$3 = { - name: "SwiperItem", - props: { - itemId: { - type: String, - default: "" - } +const props$c = { + indicatorDots: { + type: [Boolean, String], + default: false }, - mounted: function() { - var $el = this.$el; - $el.style.position = "absolute"; - $el.style.width = "100%"; - $el.style.height = "100%"; - var callbacks2 = this.$vnode._callbacks; - if (callbacks2) { - callbacks2.forEach((callback2) => { - callback2(); + vertical: { + type: [Boolean, String], + default: false + }, + autoplay: { + type: [Boolean, String], + default: false + }, + circular: { + type: [Boolean, String], + default: false + }, + interval: { + type: [Number, String], + default: 5e3 + }, + duration: { + type: [Number, String], + default: 500 + }, + current: { + type: [Number, String], + default: 0 + }, + indicatorColor: { + type: String, + default: "" + }, + indicatorActiveColor: { + type: String, + default: "" + }, + previousMargin: { + type: String, + default: "" + }, + nextMargin: { + type: String, + default: "" + }, + currentItemId: { + type: String, + default: "" + }, + skipHiddenItemLayout: { + type: [Boolean, String], + default: false + }, + displayMultipleItems: { + type: [Number, String], + default: 1 + }, + disableTouch: { + type: [Boolean, String], + default: false + } +}; +function upx2pxStr(val) { + if (/\d+[ur]px$/i.test(val)) { + val.replace(/\d+[ur]px$/i, (text2) => { + return `${upx2px(parseFloat(text2))}px`; + }); + } + return val || ""; +} +function useState(props2) { + const interval = computed(() => { + const interval2 = Number(props2.interval); + return isNaN(interval2) ? 5e3 : interval2; + }); + const duration = computed(() => { + const duration2 = Number(props2.duration); + return isNaN(duration2) ? 500 : duration2; + }); + const displayMultipleItems = computed(() => { + const displayMultipleItems2 = Math.round(props2.displayMultipleItems); + return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2; + }); + const state = reactive({ + interval, + duration, + displayMultipleItems, + current: Math.round(props2.current) || 0, + currentItemId: props2.currentItemId, + userTracking: false + }); + return state; +} +function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger) { + function cancelSchedule() { + if (timer) { + clearTimeout(timer); + timer = null; + } + } + let timer = null; + let invalid = true; + let viewportPosition = 0; + let viewportMoveRatio = 1; + let animating = null; + let requestedAnimation = false; + let contentTrackViewport = 0; + let transitionStart; + let currentChangeSource = ""; + let animationFrame; + const circularEnabled = computed(() => props2.circular && swiperContexts.value.length > state.displayMultipleItems); + function checkCircularLayout(index2) { + if (!invalid) { + for (let items = swiperContexts.value, n = items.length, i2 = index2 + state.displayMultipleItems, r = 0; r < n; r++) { + const item = items[r]; + const s = Math.floor(index2 / n) * n + r; + const l = s + n; + const c = s - n; + const u = Math.max(index2 - (s + 1), s - i2, 0); + const d = Math.max(index2 - (l + 1), l - i2, 0); + const h = Math.max(index2 - (c + 1), c - i2, 0); + const p2 = Math.min(u, d, h); + const position = [s, l, c][[u, d, h].indexOf(p2)]; + item.updatePosition(position, props2.vertical); + } + } + } + function updateViewport(index2) { + if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) { + if (circularEnabled.value) { + checkCircularLayout(index2); + } + } + const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%"; + const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0"; + const transform = "translate(" + x + ", " + y + ") translateZ(0)"; + const slideFrame = slideFrameRef.value; + if (slideFrame) { + slideFrame.style.webkitTransform = transform; + slideFrame.style.transform = transform; + } + viewportPosition = index2; + if (!transitionStart) { + if (index2 % 1 === 0) { + return; + } + transitionStart = index2; + } + index2 -= Math.floor(transitionStart); + const items = swiperContexts.value; + if (index2 <= -(items.length - 1)) { + index2 += items.length; + } else if (index2 >= items.length) { + index2 -= items.length; + } + index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2; + trigger("transition", {}, { + dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth, + dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0 + }); + } + function endViewportAnimation() { + if (animating) { + updateViewport(animating.toPos); + animating = null; + } + } + function normalizeCurrentValue(current) { + const length = swiperContexts.value.length; + if (!length) { + return -1; + } + const index2 = (Math.round(current) % length + length) % length; + if (circularEnabled.value) { + if (length <= state.displayMultipleItems) { + return 0; + } + } else if (index2 > length - state.displayMultipleItems) { + return length - state.displayMultipleItems; + } + return index2; + } + function cancelViewportAnimation() { + animating = null; + } + function animateFrameFuncProto() { + if (!animating) { + requestedAnimation = false; + return; + } + const _animating = animating; + const toPos = _animating.toPos; + const acc = _animating.acc; + const endTime = _animating.endTime; + const source = _animating.source; + const time = endTime - Date.now(); + if (time <= 0) { + updateViewport(toPos); + animating = null; + requestedAnimation = false; + transitionStart = null; + const item = swiperContexts.value[state.current]; + if (item) { + const currentItemId = item.getItemId(); + trigger("animationfinish", {}, { + current: state.current, + currentItemId, + source + }); + } + return; + } + const s = acc * time * time / 2; + const l = toPos + s; + updateViewport(l); + animationFrame = requestAnimationFrame(animateFrameFuncProto); + } + function animateViewport(current, source, n) { + cancelViewportAnimation(); + const duration = state.duration; + const length = swiperContexts.value.length; + let position = viewportPosition; + if (circularEnabled.value) { + if (n < 0) { + for (; position < current; ) { + position += length; + } + for (; position - length > current; ) { + position -= length; + } + } else if (n > 0) { + for (; position > current; ) { + position -= length; + } + for (; position + length < current; ) { + position += length; + } + } else { + for (; position + length < current; ) { + position += length; + } + for (; position - length > current; ) { + position -= length; + } + if (position + length - current < current - position) { + position += length; + } + } + } + animating = { + toPos: current, + acc: 2 * (position - current) / (duration * duration), + endTime: Date.now() + duration, + source + }; + if (!requestedAnimation) { + requestedAnimation = true; + animationFrame = requestAnimationFrame(animateFrameFuncProto); + } + } + function scheduleAutoplay() { + cancelSchedule(); + const items = swiperContexts.value; + const callback2 = function() { + timer = null; + currentChangeSource = "autoplay"; + if (circularEnabled.value) { + state.current = normalizeCurrentValue(state.current + 1); + } else { + state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0; + } + animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0); + timer = setTimeout(callback2, state.interval); + }; + if (!(invalid || items.length <= state.displayMultipleItems)) { + timer = setTimeout(callback2, state.interval); + } + } + function resetLayout() { + cancelSchedule(); + endViewportAnimation(); + const items = swiperContexts.value; + for (let i2 = 0; i2 < items.length; i2++) { + items[i2].updatePosition(i2, props2.vertical); + } + viewportMoveRatio = 1; + const slideFrameEl = slideFrameRef.value; + if (state.displayMultipleItems === 1 && items.length) { + const itemRect = items[0].getBoundingClientRect(); + const slideFrameRect = slideFrameEl.getBoundingClientRect(); + viewportMoveRatio = itemRect.width / slideFrameRect.width; + if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) { + viewportMoveRatio = 1; + } + } + const position = viewportPosition; + viewportPosition = -2; + const current = state.current; + if (current >= 0) { + invalid = false; + if (state.userTracking) { + updateViewport(position + current - contentTrackViewport); + contentTrackViewport = current; + } else { + updateViewport(current); + if (props2.autoplay) { + scheduleAutoplay(); + } + } + } else { + invalid = true; + updateViewport(-state.displayMultipleItems - 1); + } + } + watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => { + let current = -1; + if (props2.currentItemId) { + for (let i2 = 0, items = swiperContexts.value; i2 < items.length; i2++) { + const itemId = items[i2].getItemId(); + if (itemId === props2.currentItemId) { + current = i2; + break; + } + } + } + if (current < 0) { + current = Math.round(props2.current) || 0; + } + current = current < 0 ? 0 : current; + if (state.current !== current) { + currentChangeSource = ""; + state.current = current; + } + }); + watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout); + watch(() => state.interval, () => { + if (timer) { + cancelSchedule(); + scheduleAutoplay(); + } + }); + function currentChanged(current, history2) { + const source = currentChangeSource; + currentChangeSource = ""; + const items = swiperContexts.value; + if (!source) { + const length = items.length; + animateViewport(current, "", circularEnabled.value && history2 + (length - current) % length > length / 2 ? 1 : 0); + } + const item = items[current]; + if (item) { + const currentItemId = state.currentItemId = item.getItemId(); + trigger("change", {}, { + current: state.current, + currentItemId, + source }); } } -}; -function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createBlock("uni-swiper-item", _ctx.$attrs, [ - renderSlot(_ctx.$slots, "default") - ], 16); + watch(() => state.current, (val, oldVal) => { + currentChanged(val, oldVal); + emit2("update:current", val); + }); + watch(() => state.currentItemId, (val) => { + emit2("update:currentItemId", val); + }); + function inintAutoplay(enable) { + if (enable) { + scheduleAutoplay(); + } else { + cancelSchedule(); + } + } + watch(() => props2.autoplay && !state.userTracking, inintAutoplay); + inintAutoplay(props2.autoplay && !state.userTracking); + onMounted(() => { + let userDirectionChecked = false; + let contentTrackSpeed = 0; + let contentTrackT = 0; + function handleTrackStart() { + cancelSchedule(); + contentTrackViewport = viewportPosition; + contentTrackSpeed = 0; + contentTrackT = Date.now(); + cancelViewportAnimation(); + } + function handleTrackMove(data) { + const oldContentTrackT = contentTrackT; + contentTrackT = Date.now(); + const length = swiperContexts.value.length; + const other = length - state.displayMultipleItems; + function calc(val) { + return 0.5 - 0.25 / (val + 0.5); + } + function move(oldVal, newVal) { + let val = contentTrackViewport + oldVal; + contentTrackSpeed = 0.6 * contentTrackSpeed + 0.4 * newVal; + if (!circularEnabled.value) { + if (val < 0 || val > other) { + if (val < 0) { + val = -calc(-val); + } else { + if (val > other) { + val = other + calc(val - other); + } + } + contentTrackSpeed = 0; + } + } + updateViewport(val); + } + const time = contentTrackT - oldContentTrackT || 1; + const slideFrameEl = slideFrameRef.value; + if (props2.vertical) { + move(-data.dy / slideFrameEl.offsetHeight, -data.ddy / time); + } else { + move(-data.dx / slideFrameEl.offsetWidth, -data.ddx / time); + } + } + function handleTrackEnd(isCancel) { + state.userTracking = false; + const t2 = contentTrackSpeed / Math.abs(contentTrackSpeed); + let n = 0; + if (!isCancel && Math.abs(contentTrackSpeed) > 0.2) { + n = 0.5 * t2; + } + const current = normalizeCurrentValue(viewportPosition + n); + if (isCancel) { + updateViewport(contentTrackViewport); + } else { + currentChangeSource = "touch"; + state.current = current; + animateViewport(current, "touch", n !== 0 ? n : current === 0 && circularEnabled.value && viewportPosition >= 1 ? 1 : 0); + } + } + useTouchtrack(slideFrameRef.value, (event) => { + if (props2.disableTouch) { + return; + } + if (!invalid) { + if (event.detail.state === "start") { + state.userTracking = true; + userDirectionChecked = false; + return handleTrackStart(); + } + if (event.detail.state === "end") { + return handleTrackEnd(false); + } + if (event.detail.state === "cancel") { + return handleTrackEnd(true); + } + if (state.userTracking) { + if (!userDirectionChecked) { + userDirectionChecked = true; + const t2 = Math.abs(event.detail.dx); + const n = Math.abs(event.detail.dy); + if (t2 >= n && props2.vertical) { + state.userTracking = false; + } else { + if (t2 <= n && !props2.vertical) { + state.userTracking = false; + } + } + if (!state.userTracking) { + if (props2.autoplay) { + scheduleAutoplay(); + } + return; + } + } + handleTrackMove(event.detail); + return false; + } + } + }); + }); + onUnmounted(() => { + cancelSchedule(); + cancelAnimationFrame(animationFrame); + }); + function onSwiperDotClick(index2) { + animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0); + } + return { + onSwiperDotClick + }; } -_sfc_main$3.render = _sfc_render$3; +var index$b = /* @__PURE__ */ defineComponent({ + name: "Swiper", + props: props$c, + emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"], + setup(props2, { + slots, + emit: emit2 + }) { + const rootRef = ref(null); + const trigger = useCustomEvent(rootRef, emit2); + const slidesWrapperRef = ref(null); + const slideFrameRef = ref(null); + const state = useState(props2); + const slidesStyle = computed(() => { + let style = {}; + if (props2.nextMargin || props2.previousMargin) { + style = props2.vertical ? { + left: 0, + right: 0, + top: upx2pxStr(props2.previousMargin), + bottom: upx2pxStr(props2.nextMargin) + } : { + top: 0, + bottom: 0, + left: upx2pxStr(props2.previousMargin), + right: upx2pxStr(props2.nextMargin) + }; + } + return style; + }); + const slideFrameStyle = computed(() => { + const value = Math.abs(100 / state.displayMultipleItems) + "%"; + return { + width: props2.vertical ? "100%" : value, + height: !props2.vertical ? "100%" : value + }; + }); + let swiperItems = []; + const originSwiperContexts = []; + const swiperContexts = ref([]); + function updateSwiperContexts() { + const contexts = []; + for (let index2 = 0; index2 < swiperItems.length; index2++) { + const swiperItem = swiperItems[index2]; + const swiperContext = originSwiperContexts.find((context) => swiperItem.el === context.rootRef.value); + if (swiperContext) { + contexts.push(markRaw(swiperContext)); + } + } + swiperContexts.value = contexts; + } + const addSwiperContext = function(swiperContext) { + originSwiperContexts.push(swiperContext); + updateSwiperContexts(); + }; + provide("addSwiperContext", addSwiperContext); + const removeSwiperContext = function(swiperContext) { + const index2 = originSwiperContexts.indexOf(swiperContext); + if (index2 >= 0) { + originSwiperContexts.splice(index2, 1); + updateSwiperContexts(); + } + }; + provide("removeSwiperContext", removeSwiperContext); + const { + onSwiperDotClick + } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger); + return () => { + const defaultSlots = slots.default && slots.default(); + swiperItems = defaultSlots || []; + return createVNode("uni-swiper", { + ref: rootRef + }, [createVNode("div", { + ref: slidesWrapperRef, + class: "uni-swiper-wrapper" + }, [createVNode("div", { + class: "uni-swiper-slides", + style: slidesStyle.value + }, [createVNode("div", { + ref: slideFrameRef, + class: "uni-swiper-slide-frame", + style: slideFrameStyle.value + }, [swiperItems], 4)], 4), props2.indicatorDots && createVNode("div", { + class: ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"] + }, [swiperContexts.value.map((_, index2, array) => createVNode("div", { + onClick: () => onSwiperDotClick(index2), + class: { + "uni-swiper-dot": true, + "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length + }, + style: { + background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor + } + }, null, 14, ["onClick"]))], 2)], 512)], 512); + }; + } +}); +const props$b = { + itemId: { + type: String, + default: "" + } +}; +var index$a = /* @__PURE__ */ defineComponent({ + name: "SwiperItem", + props: props$b, + setup(props2, { + slots + }) { + const rootRef = ref(null); + const context = { + rootRef, + getItemId() { + return props2.itemId; + }, + getBoundingClientRect() { + const el = rootRef.value; + return el.getBoundingClientRect(); + }, + updatePosition(position, vertical) { + const x = vertical ? "0" : 100 * position + "%"; + const y = vertical ? 100 * position + "%" : "0"; + const rootEl = rootRef.value; + const value = `translate(${x},${y}) translateZ(0)`; + if (rootEl) { + rootEl.style.webkitTransform = value; + rootEl.style.transform = value; + } + } + }; + onMounted(() => { + const addSwiperContext = inject("addSwiperContext"); + if (addSwiperContext) { + addSwiperContext(context); + } + }); + onUnmounted(() => { + const removeSwiperContext = inject("removeSwiperContext"); + if (removeSwiperContext) { + removeSwiperContext(context); + } + }); + return () => { + return createVNode("uni-swiper-item", { + ref: rootRef, + style: { + position: "absolute", + width: "100%", + height: "100%" + } + }, [slots.default && slots.default()], 512); + }; + } +}); const props$a = { name: { type: String, @@ -11170,7 +11784,7 @@ var index$8 = /* @__PURE__ */ defineComponent({ }; } }); -const props$9 = /* @__PURE__ */ Object.assign({}, props$g, { +const props$9 = /* @__PURE__ */ Object.assign({}, props$i, { placeholderClass: { type: String, default: "input-placeholder" @@ -13156,7 +13770,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; @@ -13269,12 +13883,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; @@ -13294,10 +13908,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 } }; }); @@ -16706,4 +17320,4 @@ var index = /* @__PURE__ */ defineComponent({ return openBlock(), createBlock("div", clazz, [loadingVNode]); } }); -export {index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, _sfc_main$9 as Audio, index$k as Button, _sfc_main$8 as Canvas, index$h as Checkbox, index$j as CheckboxGroup, _sfc_main$1 as CoverImage, _sfc_main$2 as CoverView, index$g as Editor, index$l as Form, index$f as Icon, index$e as Image, Input, index$i as Label, LayoutComponent, index$3 as Map, _sfc_main$7 as MovableView, _sfc_main$6 as Navigator, index$2 as PageComponent, index$d as Progress, index$b as Radio, index$c as RadioGroup, ResizeSensor, _sfc_main$5 as RichText, _sfc_main$4 as ScrollView, index$a as Slider, _sfc_main$3 as SwiperItem, index$9 as Switch, index$8 as Text, index$7 as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$5 as Video, index$6 as View, index$4 as WebView, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createMapContext, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLocation, getNetworkType, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getVideoInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, hideToast, loadFontFace, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, onAccelerometerChange, onCompassChange, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, openDocument, pageScrollTo, index$m as plugin, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeStorage, removeStorageSync, removeTabBarBadge, request, sendSocketMessage, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setupApp, setupPage, showLoading, showModal, showNavigationBarLoading, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startCompass, startPullDownRefresh, stopAccelerometer, stopCompass, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useAttrs, useCustomEvent, useNativeEvent, useOn, useSubscribe, useUserAction, vibrateLong, vibrateShort, withWebEvent}; +export {index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, _sfc_main$8 as Audio, index$m as Button, _sfc_main$7 as Canvas, index$j as Checkbox, index$l as CheckboxGroup, _sfc_main$1 as CoverImage, _sfc_main$2 as CoverView, index$i as Editor, index$n as Form, index$h as Icon, index$g as Image, Input, index$k as Label, LayoutComponent, index$3 as Map, _sfc_main$6 as MovableView, _sfc_main$5 as Navigator, index$2 as PageComponent, index$f as Progress, index$d as Radio, index$e as RadioGroup, ResizeSensor, _sfc_main$4 as RichText, _sfc_main$3 as ScrollView, index$c as Slider, index$b as Swiper, index$a as SwiperItem, index$9 as Switch, index$8 as Text, index$7 as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$5 as Video, index$6 as View, index$4 as WebView, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createMapContext, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLocation, getNetworkType, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getVideoInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, hideToast, loadFontFace, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, onAccelerometerChange, onCompassChange, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, openDocument, pageScrollTo, index$o as plugin, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeStorage, removeStorageSync, removeTabBarBadge, request, sendSocketMessage, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setupApp, setupPage, showLoading, showModal, showNavigationBarLoading, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startCompass, startPullDownRefresh, stopAccelerometer, stopCompass, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useAttrs, useCustomEvent, useNativeEvent, useOn, useSubscribe, useUserAction, vibrateLong, vibrateShort, withWebEvent}; -- GitLab