| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759 |
- <template>
- <div class="list-scroll-wrap" :style="{
- height: visibleData.length ? `${listHeight}px` : 'auto',
- maxHeight: visibleData.length ? `${maxListHeight}px` : `${listHeight}px`,
- transition: listWrapTransition
- }">
- <!-- 拖拽器 -->
- <div v-if="props.showDragger" class="list-dragger" ref="draggerRef" @touchstart="onDraggerTouchStart"
- @touchmove="onDraggerTouchMove" @touchend="onDraggerTouchEnd" @mousedown="onDraggerMouseDown" :style="{ top: 0 }">
- <div class="list-dragger-bar"></div>
- </div>
- <div class="list-scroller" ref="listRef" :style="{ height: '100%' }">
- <div class="list-wrap" :style="{
- paddingTop: `${paddingTop + topPaddingSize}px`,
- paddingBottom: `${bottomPaddingSize}px`,
- }" ref="listWrap">
- <template v-for="(item, index) in visibleData" :key="getStableItemKey(item, index)">
- <slot
- name="item"
- :data="item"
- :index="index"
- :isLast="index === visibleData.length - 1"
- v-bind="item"
- ></slot>
- </template>
- </div>
- </div>
- <!-- <div style="position: absolute; z-index: 100;top: 30%; left: 0;color: white;background: black;">
- s {{ scrollTopView }} p {{ paddingTop }} si {{ startIndex }} b {{ paddingBottom }} ei {{ endIndex }}
- </div> -->
- </div>
- </template>
- <script setup>
- import { computed, ref, onMounted, onBeforeUnmount, nextTick, watch } from "vue";
- import { useResizeObserver } from "@vueuse/core";
- import { sleep } from "../utils";
- const props = defineProps(["data", "height", "maxHeight", "showDragger", "bottomPadding", "topPadding", "nativeScrollMode", "smoothFollow"]);
- const emit = defineEmits(["scrollPositionChange"]);
- const listRef = ref(null);
- const listWrap = ref(null);
- const draggerRef = ref(null);
- const listSize = 20;
- const minListHeight = 100;
- const maxListHeight = computed(() => (props.maxHeight || 400));
- const bottomPaddingSize = computed(() => Math.max(0, Number(props.bottomPadding || 0)));
- const topPaddingSize = computed(() => Math.max(0, Number(props.topPadding || 0)));
- const listHeight = ref(props.height || 400);
- const startIndex = ref(0);
- const endIndex = ref(100);
- const paddingTop = ref(0);
- const paddingBottom = ref(0);
- let nextStableItemKey = 0;
- const stableItemKeys = new WeakMap();
- const scrollAnimationDurationMs = 300;
- let scrollAnimationFrameId = 0;
- let scrollAnimationRevision = 0;
- let isScrollAnimationActive = false;
- let scrollAnimationResolve = null;
- let lastScrollLogTop = null;
- let programmaticScrollKind = null;
- let programmaticScrollClearFrameId = 0;
- let isAutoScrollTopPinned = false;
- let isAutoScrollTopPinSuppressedByUser = false;
- const beginProgrammaticScroll = (kind) => {
- if (programmaticScrollClearFrameId) {
- cancelAnimationFrame(programmaticScrollClearFrameId);
- programmaticScrollClearFrameId = 0;
- }
- programmaticScrollKind = kind;
- if (kind === "single") {
- scheduleClearProgrammaticScroll();
- }
- };
- const clearProgrammaticScroll = () => {
- if (programmaticScrollClearFrameId) {
- cancelAnimationFrame(programmaticScrollClearFrameId);
- programmaticScrollClearFrameId = 0;
- }
- programmaticScrollKind = null;
- };
- const clearAutoScrollTopPin = () => {
- isAutoScrollTopPinned = false;
- };
- const setAutoScrollTopPinSuppressedByUser = (active) => {
- isAutoScrollTopPinSuppressedByUser = Boolean(active);
- };
- const setAutoScrollTopPinned = (active) => {
- isAutoScrollTopPinned = Boolean(active);
- };
- const isAutoScrollTopPinnedState = () => isAutoScrollTopPinned;
- const isAutoScrollTopPinSuppressedByUserState = () => isAutoScrollTopPinSuppressedByUser;
- const scheduleClearProgrammaticScroll = () => {
- if (programmaticScrollClearFrameId) {
- cancelAnimationFrame(programmaticScrollClearFrameId);
- }
- programmaticScrollClearFrameId = requestAnimationFrame(() => {
- programmaticScrollClearFrameId = 0;
- if (programmaticScrollKind === "single") {
- programmaticScrollKind = null;
- }
- });
- };
- function animateScrollTo(targetTop, duration = scrollAnimationDurationMs) {
- if (!listRef.value || !Number.isFinite(targetTop)) {
- return Promise.resolve();
- }
- cancelScrollAnimation();
- beginProgrammaticScroll("animated");
- const maxScrollTop = Math.max(0, listRef.value.scrollHeight - listRef.value.clientHeight);
- const startTop = listRef.value.scrollTop;
- const resolvedTargetTop = Math.max(0, Math.min(maxScrollTop, targetTop));
- if (resolvedTargetTop === startTop) {
- clearProgrammaticScroll();
- return Promise.resolve();
- }
- return new Promise((resolve) => {
- const startTime = performance.now();
- const revision = ++scrollAnimationRevision;
- isScrollAnimationActive = true;
- scrollAnimationResolve = resolve;
- const finish = () => {
- if (scrollAnimationResolve) {
- scrollAnimationResolve();
- scrollAnimationResolve = null;
- }
- scrollAnimationFrameId = 0;
- isScrollAnimationActive = false;
- clearProgrammaticScroll();
- };
- const animate = (now) => {
- if (revision !== scrollAnimationRevision || !listRef.value) {
- finish();
- return;
- }
- const progress = Math.min(1, (now - startTime) / duration);
- const eased = 1 - Math.pow(1 - progress, 3);
- listRef.value.scrollTop = startTop + (resolvedTargetTop - startTop) * eased;
- if (progress < 1) {
- scrollAnimationFrameId = requestAnimationFrame(animate);
- } else {
- finish();
- }
- };
- scrollAnimationFrameId = requestAnimationFrame(animate);
- });
- }
- const cancelScrollAnimation = () => {
- if (scrollAnimationFrameId) {
- cancelAnimationFrame(scrollAnimationFrameId);
- scrollAnimationFrameId = 0;
- }
- if (scrollAnimationResolve) {
- scrollAnimationResolve();
- scrollAnimationResolve = null;
- }
- scrollAnimationRevision += 1;
- isScrollAnimationActive = false;
- clearProgrammaticScroll();
- };
- const getStableItemKey = (item, index) => {
- if (!item || typeof item !== "object") {
- return `primitive-${index}`;
- }
- if (!stableItemKeys.has(item)) {
- stableItemKeys.set(item, `record-${nextStableItemKey++}`);
- }
- return stableItemKeys.get(item);
- };
- const visibleData = computed(() => {
- return props.data; //.slice(startIndex.value, endIndex.value)
- });
- const scrollTopView = ref(0);
- // 控制 transition
- const isDragging = ref(false);
- const listWrapTransition = computed(() =>
- isDragging.value ? "none" : "all 0.3s ease-in-out"
- );
- const updateVisibleData = () => {
- const { scrollTop } = listRef.value;
- let _startIndex = 0;
- let _endIndex = props.data.length - 1;
- let _paddingTop = 0;
- let _paddingBottom = 0;
- let onView = 0;
- let isTopEdgeTouched = false;
- let isBottomEdgeTouched = false;
- let _bufferZone = 500;
- let gap = 6;
- props.data.forEach((item, index) => {
- if (
- scrollTop > _paddingTop + (item.rect?.height || 0) + gap + _bufferZone &&
- !isTopEdgeTouched
- ) {
- _paddingTop += (item.rect?.height || 0) + gap;
- _startIndex = index + 1;
- } else {
- isTopEdgeTouched = true;
- }
- if (scrollTop + listHeight.value + _bufferZone > onView + (item.rect?.height || 0) + gap) {
- onView += (item.rect?.height || 0) + gap;
- } else {
- _paddingBottom += (item.rect?.height || 0) + gap;
- if (!isBottomEdgeTouched) {
- _endIndex = index + 1;
- isBottomEdgeTouched = true;
- }
- }
- });
- scrollTopView.value = scrollTop;
- if (startIndex.value != _startIndex) {
- startIndex.value = _startIndex;
- }
- if (endIndex.value != _endIndex) {
- endIndex.value = _endIndex;
- }
- if (paddingTop.value !== _paddingTop) {
- paddingTop.value = _paddingTop;
- }
- if (paddingBottom.value !== _paddingBottom) {
- paddingBottom.value = _paddingBottom;
- }
- };
- onMounted(() => {
- listRef.value.addEventListener("scroll", handleScrollEvent);
- if (!props.nativeScrollMode) {
- listRef.value.addEventListener("mousemove", handleMousemove);
- listRef.value.addEventListener("mousewheel", handleScroll);
- listRef.value.addEventListener("touchmove", handleTouchMove);
- listRef.value.addEventListener("touchstart", handleTouch);
- }
- window.addEventListener("mousemove", onDraggerMouseMove);
- window.addEventListener("mouseup", onDraggerMouseUp);
- });
- onBeforeUnmount(() => {
- listRef.value.removeEventListener("scroll", handleScrollEvent);
- if (!props.nativeScrollMode) {
- listRef.value.removeEventListener("touchstart", handleTouch);
- listRef.value.removeEventListener("mousemove", handleMousemove);
- listRef.value.removeEventListener("mousewheel", handleScroll);
- listRef.value.removeEventListener("touchmove", handleTouchMove);
- }
- window.removeEventListener("mousemove", onDraggerMouseMove);
- window.removeEventListener("mouseup", onDraggerMouseUp);
- stopScrollFollow();
- cancelScrollAnimation();
- });
- let lastFinger;
- let currentPoint = { x: 0, y: 0 };
- useResizeObserver(listWrap, (entry) => {
- if (isScrollAnimationActive) {
- return;
- }
- // 流式增长时这里每帧都会触发;走跟随方法,避免瞬时跳底抵消平滑。
- // smoothFollow 为假时该方法内部退化回原来的瞬时贴底。
- scrollToBottomFollow();
- });
- let requestId = null;
- function handleTouchMove(e) {
- if (e.target instanceof Element && e.target.classList.contains("half-chat-box-dragger")) {
- return;
- }
- if (requestId) {
- cancelAnimationFrame(requestId);
- }
- setAutoScrollTopPinSuppressedByUser(true);
- clearAutoScrollTopPin();
- if (e.touches.length) {
- const rect = listRef.value.getBoundingClientRect();
- const finger = e.touches[0];
- if (
- currentPoint.x > rect.left &&
- currentPoint.x < rect.left + rect.width &&
- currentPoint.y > rect.top &&
- currentPoint.y < rect.top + rect.height
- ) {
- if (currentPoint) {
- const deltaY = finger.pageY - lastFinger.y;
- const dampingFactor = 1; // Damping factor to simulate iOS-like scrolling
- const newScrollTop = listRef.value.scrollTop - deltaY * dampingFactor;
- // Apply easing effect
- listRef.value.style.transition = "scroll-top 0.2s ease-out";
- listRef.value.scrollTo({ top: newScrollTop });
- // Add inertia effect using requestAnimationFrame
- let velocity = deltaY;
- function applyInertia() {
- velocity *= 0.95; // Friction factor
- if (Math.abs(velocity) >= 0.1) {
- listRef.value.scrollTop -= velocity;
- requestId = requestAnimationFrame(applyInertia);
- }
- }
- requestId = requestAnimationFrame(applyInertia);
- }
- lastFinger = { x: finger.pageX, y: finger.pageY };
- }
- }
- }
- function handleMousemove(e) {
- currentPoint = { x: e.pageX, y: e.pageY };
- lastFinger = { ...currentPoint };
- }
- function handleTouch(e) {
- if (e.touches.length && e.touches.length == 1) {
- const finger = e.touches[0];
- currentPoint = { x: finger.pageX, y: finger.pageY };
- lastFinger = { ...currentPoint };
- }
- setAutoScrollTopPinSuppressedByUser(true);
- clearAutoScrollTopPin();
- cancelAutoScroll();
- }
- function handleScroll(e) {
- const rect = listRef.value.getBoundingClientRect();
- if (
- currentPoint.x > rect.left &&
- currentPoint.x < rect.left + rect.width &&
- currentPoint.y > rect.top &&
- currentPoint.y < rect.top + rect.height
- ) {
- setAutoScrollTopPinSuppressedByUser(true);
- listRef.value.scrollTo({ top: listRef.value.scrollTop + e.deltaY });
- e.preventDefault();
- }
- clearAutoScrollTopPin();
- cancelAutoScroll()
- }
- const isAutoScroll = ref(true);
- const handleScrollEvent = (event) => {
- const currentTop = listRef.value?.scrollTop ?? 0;
- if (lastScrollLogTop === currentTop) {
- return;
- }
- lastScrollLogTop = currentTop;
- const shouldSuppressUserScrollIntent =
- Boolean(event?.isTrusted) &&
- (isScrollAnimationActive || programmaticScrollKind !== null);
- if (shouldSuppressUserScrollIntent) {
- emit("scrollPositionChange", {
- scrollTop: currentTop,
- isTrusted: Boolean(event?.isTrusted),
- isProgrammaticScroll: true,
- });
- if (!isScrollAnimationActive && programmaticScrollKind === "single") {
- scheduleClearProgrammaticScroll();
- }
- return;
- }
- if (event?.isTrusted) {
- setAutoScrollTopPinSuppressedByUser(true);
- clearAutoScrollTopPin();
- cancelAutoScroll();
- }
- emit("scrollPositionChange", {
- scrollTop: currentTop,
- isTrusted: Boolean(event?.isTrusted),
- isProgrammaticScroll: false,
- });
- };
- const disableAutoScroll = () => {
- isAutoScroll.value = false;
- stopScrollFollow();
- };
- const scrollToBottom = () => {
- if (isAutoScroll.value) {
- beginProgrammaticScroll("single");
- listRef.value.scrollTo({
- top: listRef.value.scrollHeight,
- });
- }
- };
- // ── 流式贴底跟随(豆包式平滑滚动)──
- // smoothFollow 为真时用 rAF 缓动逼近底部;否则退化为原来的瞬时贴底。
- // ⚠️ 程序化设定 scrollTop 产生的是 trusted 滚动事件(Chromium),每帧都必须
- // beginProgrammaticScroll("single") 打标,否则自己的滚动会被当成用户滚动
- // → cancelAutoScroll → 循环自杀,且 pin 抑制标志会被污染。
- const FOLLOW_SCROLL_RATIO = 0.35;
- const FOLLOW_SNAP_DISTANCE = 1.5;
- let followFrameId = 0;
- const stopScrollFollow = () => {
- if (followFrameId) {
- cancelAnimationFrame(followFrameId);
- followFrameId = 0;
- }
- };
- const scrollToBottomFollow = () => {
- if (!listRef.value) {
- return;
- }
- if (!props.smoothFollow) {
- scrollToBottom();
- return;
- }
- // 幂等:已有一个循环在跑就交给它继续逼近;用户滚走后不再追。
- if (followFrameId || !isAutoScroll.value) {
- return;
- }
- const step = () => {
- followFrameId = 0;
- if (!listRef.value || !isAutoScroll.value || !props.smoothFollow) {
- clearProgrammaticScroll();
- return;
- }
- const maxScrollTop = Math.max(
- 0,
- listRef.value.scrollHeight - listRef.value.clientHeight
- );
- const distance = maxScrollTop - listRef.value.scrollTop;
- beginProgrammaticScroll("single");
- if (distance <= FOLLOW_SNAP_DISTANCE) {
- listRef.value.scrollTop = maxScrollTop;
- return;
- }
- listRef.value.scrollTop += distance * FOLLOW_SCROLL_RATIO;
- followFrameId = requestAnimationFrame(step);
- };
- followFrameId = requestAnimationFrame(step);
- };
- const scrollToBottomOnce = () => {
- const targetTop = Math.max(0, listRef.value.scrollHeight - listRef.value.clientHeight);
- return animateScrollTo(targetTop);
- };
- const scrollToBottomInstant = () => {
- beginProgrammaticScroll("single");
- listRef.value.scrollTo({
- top: listRef.value.scrollHeight,
- behavior: "auto"
- });
- };
- const scrollToPositionInstant = (top) => {
- if (!listRef.value || !Number.isFinite(top)) {
- return;
- }
- beginProgrammaticScroll("single");
- const maxScrollTop = Math.max(0, listRef.value.scrollHeight - listRef.value.clientHeight);
- const nextTop = Math.max(0, Math.min(maxScrollTop, top));
- listRef.value.scrollTo({
- top: nextTop,
- behavior: "auto",
- });
- };
- const scrollBy = (delta) => {
- if (!listRef.value || !Number.isFinite(delta) || delta === 0) {
- return;
- }
- beginProgrammaticScroll("single");
- const maxScrollTop = Math.max(0, listRef.value.scrollHeight - listRef.value.clientHeight);
- const nextTop = Math.max(0, Math.min(maxScrollTop, listRef.value.scrollTop + delta));
- listRef.value.scrollTo({
- top: nextTop,
- behavior: "auto",
- });
- };
- const scrollByAnimated = (delta, duration = scrollAnimationDurationMs) => {
- if (!listRef.value || !Number.isFinite(delta) || delta === 0) {
- return Promise.resolve();
- }
- const maxScrollTop = Math.max(0, listRef.value.scrollHeight - listRef.value.clientHeight);
- const startTop = listRef.value.scrollTop;
- const targetTop = Math.max(0, Math.min(maxScrollTop, startTop + delta));
- if (targetTop === startTop) {
- return Promise.resolve();
- }
- return animateScrollTo(targetTop, duration);
- };
- const getDistanceToBottom = () => {
- return Math.max(
- 0,
- listRef.value.scrollHeight - listRef.value.scrollTop - listRef.value.clientHeight
- );
- };
- const getScrollElement = () => listRef.value;
- const getScrollMetrics = () => {
- if (!listRef.value) {
- return null;
- }
- const scrollTop = listRef.value.scrollTop;
- const clientHeight = listRef.value.clientHeight;
- const scrollHeight = listRef.value.scrollHeight;
- return {
- scrollTop,
- clientHeight,
- scrollHeight,
- distanceToBottom: Math.max(0, scrollHeight - scrollTop - clientHeight),
- distanceToTop: Math.max(0, scrollTop),
- isAtBottom: scrollTop + clientHeight >= scrollHeight - 1,
- isAtTop: scrollTop <= 1,
- };
- };
- const isNearBottom = () => {
- if (!listRef.value) {
- return false;
- }
- return getDistanceToBottom() <= 1;
- };
- const cancelAutoScroll = () => {
- stopScrollFollow();
- cancelScrollAnimation();
- const isAtBottom = listRef.value.scrollTop + listRef.value.clientHeight >= listRef.value.scrollHeight;
- isAutoScroll.value = isAtBottom;
- };
- const enableAutoScroll = () => {
- isAutoScroll.value = true;
- if (isAutoScrollTopPinSuppressedByUser) {
- setAutoScrollTopPinSuppressedByUser(false);
- }
- };
- const isAutoScrollEnabled = () => isAutoScroll.value;
- const isProgrammaticScrollSuppressed = () => programmaticScrollKind !== null || isScrollAnimationActive;
- // 拖拽器相关
- let dragStartY = 0;
- let dragStartHeight = 0;
- function onDraggerTouchStart(e) {
- if (e.touches.length !== 1) return;
- isDragging.value = true;
- dragStartY = e.touches[0].clientY;
- dragStartHeight = listHeight.value;
- document.body.style.userSelect = "none";
- }
- function onDraggerTouchMove(e) {
- if (!isDragging.value) return;
- const deltaY = e.touches[0].clientY - dragStartY;
- let newHeight = dragStartHeight - deltaY;
- newHeight = Math.max(minListHeight, Math.min(maxListHeight.value, newHeight));
- listHeight.value = newHeight;
- }
- function onDraggerTouchEnd() {
- isDragging.value = false;
- document.body.style.userSelect = "";
- }
- function onDraggerMouseDown(e) {
- isDragging.value = true;
- dragStartY = e.clientY;
- dragStartHeight = listHeight.value;
- document.body.style.userSelect = "none";
- }
- function onDraggerMouseMove(e) {
- if (!isDragging.value) return;
- const deltaY = e.clientY - dragStartY;
- let newHeight = dragStartHeight + deltaY;
- newHeight = Math.max(minListHeight, Math.min(maxListHeight.value, newHeight));
- listHeight.value = newHeight;
- }
- function onDraggerMouseUp() {
- if (isDragging.value) {
- isDragging.value = false;
- document.body.style.userSelect = "";
- }
- }
- // 监听外部 height 变化
- watch(
- () => props.height,
- (val) => {
- if (typeof val === "number") {
- listHeight.value = val;
- }
- }
- );
- watch(
- () => bottomPaddingSize.value,
- async (nextBottomPadding, previousBottomPadding) => {
- if (nextBottomPadding <= previousBottomPadding) {
- return;
- }
- const shouldFollowBottom = isNearBottom();
- if (!shouldFollowBottom) {
- return;
- }
- await sleep(200);
- if (!listRef.value) {
- return;
- }
- scrollToBottomOnce();
- }
- );
- defineExpose({
- scrollToBottom,
- scrollToBottomFollow,
- scrollToBottomOnce,
- scrollToBottomInstant,
- scrollToPositionInstant,
- scrollBy,
- scrollByAnimated,
- getDistanceToBottom,
- getScrollElement,
- getScrollMetrics,
- enableAutoScroll,
- disableAutoScroll,
- isAutoScrollEnabled,
- isProgrammaticScrollSuppressed,
- setAutoScrollTopPinned,
- isAutoScrollTopPinned: isAutoScrollTopPinnedState,
- isAutoScrollTopPinSuppressedByUser: isAutoScrollTopPinSuppressedByUserState,
- cancelAutoScroll,
- cancelScrollAnimation,
- });
- </script>
- <style lang="scss">
- .list-scroll-container {
- position: relative;
- }
- .list-scroller {
- overflow: scroll;
- scrollbar-width: thin;
- scrollbar-color: transparent transparent;
- }
- .list-scroll-wrap:hover .list-scroller {
- scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
- }
- .list-scroll-wrap {
- box-sizing: border-box;
- pointer-events: initial;
- /* transition 由绑定的 style 控制 */
- position: relative;
- }
- .list-wrap {
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- transition: all 0.3s ease-in-out;
- }
- .list-dragger {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- height: 20px;
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 10;
- touch-action: none;
- cursor: ns-resize;
- transform: translateY(-100%);
- user-select: none;
- }
- .list-dragger-bar {
- margin: 0 auto;
- &::before {
- content: "";
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 64px;
- height: 2px;
- box-sizing: content-box;
- border-width: 2px;
- border-style: solid;
- border-color: hsla(0, 0%, 100%, 1);
- border-left: none;
- border-right: none;
- }
- }
- </style>
|