first commit
This commit is contained in:
71
node_modules/vant/es/notice-bar/NoticeBar.d.ts
generated
vendored
Normal file
71
node_modules/vant/es/notice-bar/NoticeBar.d.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import { type PropType, type ExtractPropTypes } from 'vue';
|
||||
import { NoticeBarMode } from './types';
|
||||
export declare const noticeBarProps: {
|
||||
text: StringConstructor;
|
||||
mode: PropType<NoticeBarMode>;
|
||||
color: StringConstructor;
|
||||
delay: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
speed: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
leftIcon: StringConstructor;
|
||||
wrapable: BooleanConstructor;
|
||||
background: StringConstructor;
|
||||
scrollable: {
|
||||
type: PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
};
|
||||
export type NoticeBarProps = ExtractPropTypes<typeof noticeBarProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
text: StringConstructor;
|
||||
mode: PropType<NoticeBarMode>;
|
||||
color: StringConstructor;
|
||||
delay: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
speed: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
leftIcon: StringConstructor;
|
||||
wrapable: BooleanConstructor;
|
||||
background: StringConstructor;
|
||||
scrollable: {
|
||||
type: PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "replay")[], "close" | "replay", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
text: StringConstructor;
|
||||
mode: PropType<NoticeBarMode>;
|
||||
color: StringConstructor;
|
||||
delay: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
speed: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
leftIcon: StringConstructor;
|
||||
wrapable: BooleanConstructor;
|
||||
background: StringConstructor;
|
||||
scrollable: {
|
||||
type: PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onClose?: ((...args: any[]) => any) | undefined;
|
||||
onReplay?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
scrollable: boolean | null;
|
||||
delay: string | number;
|
||||
speed: string | number;
|
||||
wrapable: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
165
node_modules/vant/es/notice-bar/NoticeBar.mjs
generated
vendored
Normal file
165
node_modules/vant/es/notice-bar/NoticeBar.mjs
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
import { ref, watch, reactive, defineComponent, createVNode as _createVNode, vShow as _vShow, withDirectives as _withDirectives } from "vue";
|
||||
import { isDef, createNamespace, makeNumericProp } from "../utils/index.mjs";
|
||||
import { raf, useRect, doubleRaf, useEventListener, onMountedOrActivated } from "@vant/use";
|
||||
import { useExpose } from "../composables/use-expose.mjs";
|
||||
import { onPopupReopen } from "../composables/on-popup-reopen.mjs";
|
||||
import { Icon } from "../icon/index.mjs";
|
||||
const [name, bem] = createNamespace("notice-bar");
|
||||
const noticeBarProps = {
|
||||
text: String,
|
||||
mode: String,
|
||||
color: String,
|
||||
delay: makeNumericProp(1),
|
||||
speed: makeNumericProp(60),
|
||||
leftIcon: String,
|
||||
wrapable: Boolean,
|
||||
background: String,
|
||||
scrollable: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
}
|
||||
};
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: noticeBarProps,
|
||||
emits: ["close", "replay"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
let wrapWidth = 0;
|
||||
let contentWidth = 0;
|
||||
let startTimer;
|
||||
const wrapRef = ref();
|
||||
const contentRef = ref();
|
||||
const state = reactive({
|
||||
show: true,
|
||||
offset: 0,
|
||||
duration: 0
|
||||
});
|
||||
const renderLeftIcon = () => {
|
||||
if (slots["left-icon"]) {
|
||||
return slots["left-icon"]();
|
||||
}
|
||||
if (props.leftIcon) {
|
||||
return _createVNode(Icon, {
|
||||
"class": bem("left-icon"),
|
||||
"name": props.leftIcon
|
||||
}, null);
|
||||
}
|
||||
};
|
||||
const getRightIconName = () => {
|
||||
if (props.mode === "closeable") {
|
||||
return "cross";
|
||||
}
|
||||
if (props.mode === "link") {
|
||||
return "arrow";
|
||||
}
|
||||
};
|
||||
const onClickRightIcon = (event) => {
|
||||
if (props.mode === "closeable") {
|
||||
state.show = false;
|
||||
emit("close", event);
|
||||
}
|
||||
};
|
||||
const renderRightIcon = () => {
|
||||
if (slots["right-icon"]) {
|
||||
return slots["right-icon"]();
|
||||
}
|
||||
const name2 = getRightIconName();
|
||||
if (name2) {
|
||||
return _createVNode(Icon, {
|
||||
"name": name2,
|
||||
"class": bem("right-icon"),
|
||||
"onClick": onClickRightIcon
|
||||
}, null);
|
||||
}
|
||||
};
|
||||
const onTransitionEnd = () => {
|
||||
state.offset = wrapWidth;
|
||||
state.duration = 0;
|
||||
raf(() => {
|
||||
doubleRaf(() => {
|
||||
state.offset = -contentWidth;
|
||||
state.duration = (contentWidth + wrapWidth) / +props.speed;
|
||||
emit("replay");
|
||||
});
|
||||
});
|
||||
};
|
||||
const renderMarquee = () => {
|
||||
const ellipsis = props.scrollable === false && !props.wrapable;
|
||||
const style = {
|
||||
transform: state.offset ? `translateX(${state.offset}px)` : "",
|
||||
transitionDuration: `${state.duration}s`
|
||||
};
|
||||
return _createVNode("div", {
|
||||
"ref": wrapRef,
|
||||
"role": "marquee",
|
||||
"class": bem("wrap")
|
||||
}, [_createVNode("div", {
|
||||
"ref": contentRef,
|
||||
"style": style,
|
||||
"class": [bem("content"), {
|
||||
"van-ellipsis": ellipsis
|
||||
}],
|
||||
"onTransitionend": onTransitionEnd
|
||||
}, [slots.default ? slots.default() : props.text])]);
|
||||
};
|
||||
const reset = () => {
|
||||
const {
|
||||
delay,
|
||||
speed,
|
||||
scrollable
|
||||
} = props;
|
||||
const ms = isDef(delay) ? +delay * 1e3 : 0;
|
||||
wrapWidth = 0;
|
||||
contentWidth = 0;
|
||||
state.offset = 0;
|
||||
state.duration = 0;
|
||||
clearTimeout(startTimer);
|
||||
startTimer = setTimeout(() => {
|
||||
if (!wrapRef.value || !contentRef.value || scrollable === false) {
|
||||
return;
|
||||
}
|
||||
const wrapRefWidth = useRect(wrapRef).width;
|
||||
const contentRefWidth = useRect(contentRef).width;
|
||||
if (scrollable || contentRefWidth > wrapRefWidth) {
|
||||
doubleRaf(() => {
|
||||
wrapWidth = wrapRefWidth;
|
||||
contentWidth = contentRefWidth;
|
||||
state.offset = -contentWidth;
|
||||
state.duration = contentWidth / +speed;
|
||||
});
|
||||
}
|
||||
}, ms);
|
||||
};
|
||||
onPopupReopen(reset);
|
||||
onMountedOrActivated(reset);
|
||||
useEventListener("pageshow", reset);
|
||||
useExpose({
|
||||
reset
|
||||
});
|
||||
watch(() => [props.text, props.scrollable], reset);
|
||||
return () => {
|
||||
const {
|
||||
color,
|
||||
wrapable,
|
||||
background
|
||||
} = props;
|
||||
return _withDirectives(_createVNode("div", {
|
||||
"role": "alert",
|
||||
"class": bem({
|
||||
wrapable
|
||||
}),
|
||||
"style": {
|
||||
color,
|
||||
background
|
||||
}
|
||||
}, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[_vShow, state.show]]);
|
||||
};
|
||||
}
|
||||
});
|
||||
export {
|
||||
stdin_default as default,
|
||||
noticeBarProps
|
||||
};
|
||||
1
node_modules/vant/es/notice-bar/index.css
generated
vendored
Normal file
1
node_modules/vant/es/notice-bar/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-notice-bar-height: 40px;--van-notice-bar-padding: 0 var(--van-padding-md);--van-notice-bar-wrapable-padding: var(--van-padding-xs) var(--van-padding-md);--van-notice-bar-text-color: var(--van-orange-dark);--van-notice-bar-font-size: var(--van-font-size-md);--van-notice-bar-line-height: 24px;--van-notice-bar-background: var(--van-orange-light);--van-notice-bar-icon-size: 16px;--van-notice-bar-icon-min-width: 24px}.van-notice-bar{position:relative;display:flex;align-items:center;height:var(--van-notice-bar-height);padding:var(--van-notice-bar-padding);color:var(--van-notice-bar-text-color);font-size:var(--van-notice-bar-font-size);line-height:var(--van-notice-bar-line-height);background:var(--van-notice-bar-background)}.van-notice-bar__left-icon,.van-notice-bar__right-icon{min-width:var(--van-notice-bar-icon-min-width);font-size:var(--van-notice-bar-icon-size)}.van-notice-bar__right-icon{text-align:right;cursor:pointer}.van-notice-bar__wrap{position:relative;display:flex;flex:1;align-items:center;height:100%;overflow:hidden}.van-notice-bar__content{position:absolute;white-space:nowrap;transition-timing-function:linear}.van-notice-bar__content.van-ellipsis{max-width:100%}.van-notice-bar--wrapable{height:auto;padding:var(--van-notice-bar-wrapable-padding)}.van-notice-bar--wrapable .van-notice-bar__wrap{height:auto}.van-notice-bar--wrapable .van-notice-bar__content{position:relative;white-space:normal;word-wrap:break-word}
|
||||
57
node_modules/vant/es/notice-bar/index.d.ts
generated
vendored
Normal file
57
node_modules/vant/es/notice-bar/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import { NoticeBarProps } from './NoticeBar';
|
||||
export declare const NoticeBar: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
text: StringConstructor;
|
||||
mode: import("vue").PropType<import("./types").NoticeBarMode>;
|
||||
color: StringConstructor;
|
||||
delay: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
speed: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
leftIcon: StringConstructor;
|
||||
wrapable: BooleanConstructor;
|
||||
background: StringConstructor;
|
||||
scrollable: {
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "replay")[], "close" | "replay", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
text: StringConstructor;
|
||||
mode: import("vue").PropType<import("./types").NoticeBarMode>;
|
||||
color: StringConstructor;
|
||||
delay: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
speed: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
leftIcon: StringConstructor;
|
||||
wrapable: BooleanConstructor;
|
||||
background: StringConstructor;
|
||||
scrollable: {
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onClose?: ((...args: any[]) => any) | undefined;
|
||||
onReplay?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
scrollable: boolean | null;
|
||||
delay: string | number;
|
||||
speed: string | number;
|
||||
wrapable: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default NoticeBar;
|
||||
export { noticeBarProps } from './NoticeBar';
|
||||
export type { NoticeBarProps };
|
||||
export type { NoticeBarMode, NoticeBarInstance, NoticeBarThemeVars, } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanNoticeBar: typeof NoticeBar;
|
||||
}
|
||||
}
|
||||
10
node_modules/vant/es/notice-bar/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/notice-bar/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _NoticeBar from "./NoticeBar.mjs";
|
||||
const NoticeBar = withInstall(_NoticeBar);
|
||||
var stdin_default = NoticeBar;
|
||||
import { noticeBarProps } from "./NoticeBar.mjs";
|
||||
export {
|
||||
NoticeBar,
|
||||
stdin_default as default,
|
||||
noticeBarProps
|
||||
};
|
||||
1
node_modules/vant/es/notice-bar/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/notice-bar/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
4
node_modules/vant/es/notice-bar/style/index.mjs
generated
vendored
Normal file
4
node_modules/vant/es/notice-bar/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import "../../style/base.css";
|
||||
import "../../badge/index.css";
|
||||
import "../../icon/index.css";
|
||||
import "../index.css";
|
||||
18
node_modules/vant/es/notice-bar/types.d.ts
generated
vendored
Normal file
18
node_modules/vant/es/notice-bar/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { NoticeBarProps } from './NoticeBar';
|
||||
export type NoticeBarMode = 'closeable' | 'link';
|
||||
export type NoticeBarExpose = {
|
||||
reset: () => void;
|
||||
};
|
||||
export type NoticeBarInstance = ComponentPublicInstance<NoticeBarProps, NoticeBarExpose>;
|
||||
export type NoticeBarThemeVars = {
|
||||
noticeBarHeight?: string;
|
||||
noticeBarPadding?: string;
|
||||
noticeBarWrapablePadding?: string;
|
||||
noticeBarTextColor?: string;
|
||||
noticeBarFontSize?: string;
|
||||
noticeBarLineHeight?: number | string;
|
||||
noticeBarBackground?: string;
|
||||
noticeBarIconSize?: string;
|
||||
noticeBarIconMinWidth?: string;
|
||||
};
|
||||
0
node_modules/vant/es/notice-bar/types.mjs
generated
vendored
Normal file
0
node_modules/vant/es/notice-bar/types.mjs
generated
vendored
Normal file
Reference in New Issue
Block a user