@firstnoodle-ui/bui 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bui.css +1 -1
- package/dist/components/horizontal-layout/Aside.vue.d.ts +2 -6
- package/dist/components/index.d.ts +1 -0
- package/dist/components/modal/Modal.vue.d.ts +9 -3
- package/dist/components/tree-list/InputNode.vue.d.ts +90 -0
- package/dist/components/tree-list/TreeList.vue.d.ts +27 -0
- package/dist/components/tree-list/index.d.ts +2 -0
- package/dist/components/tree-list/types.d.ts +14 -0
- package/dist/index.mjs +6595 -6371
- package/package.json +22 -11
- package/src/components/application-wrapper/ApplicationWrapper.vue +0 -8
- package/src/components/application-wrapper/index.ts +0 -1
- package/src/components/aside-section-label/AsideSectionLabel.vue +0 -16
- package/src/components/aside-section-label/index.ts +0 -1
- package/src/components/button/Button.vue +0 -246
- package/src/components/button/NotificationBadge.vue +0 -15
- package/src/components/button/components/button-label/ButtonLabel.vue +0 -9
- package/src/components/button/components/button-label/index.ts +0 -1
- package/src/components/button/components/index.ts +0 -3
- package/src/components/button/components/left-group/LeftGroup.vue +0 -5
- package/src/components/button/components/left-group/index.ts +0 -1
- package/src/components/button/components/notification-badge/NotificationBadge.vue +0 -17
- package/src/components/button/components/notification-badge/index.ts +0 -1
- package/src/components/button/index.ts +0 -1
- package/src/components/button-group/ButtonGroup.vue +0 -97
- package/src/components/button-group/index.ts +0 -1
- package/src/components/calendar-view/CalendarView.vue +0 -106
- package/src/components/calendar-view/components/DateButton.vue +0 -23
- package/src/components/calendar-view/components/DecadeView.vue +0 -50
- package/src/components/calendar-view/components/MonthView.vue +0 -72
- package/src/components/calendar-view/components/NavButton.vue +0 -16
- package/src/components/calendar-view/components/YearView.vue +0 -52
- package/src/components/calendar-view/composables/useCalendar.ts +0 -138
- package/src/components/calendar-view/index.ts +0 -1
- package/src/components/calendar-view/utils/enums.ts +0 -31
- package/src/components/calendar-view/utils/index.ts +0 -240
- package/src/components/calendar-view/utils/types.ts +0 -13
- package/src/components/calendar-view/utils/utils/calendar.ts +0 -70
- package/src/components/calendar-view/utils/utils/date.ts +0 -130
- package/src/components/calendar-view/utils/utils/format.ts +0 -61
- package/src/components/calendar-view/utils/utils/time.ts +0 -70
- package/src/components/checkbox/Checkbox.vue +0 -51
- package/src/components/checkbox/CircleIndicator.vue +0 -26
- package/src/components/checkbox/DefaultIndicator.vue +0 -19
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/collapse/Collapse.vue +0 -114
- package/src/components/collapse/index.ts +0 -1
- package/src/components/confirm-cancel/ConfirmCancel.vue +0 -66
- package/src/components/confirm-cancel/index.ts +0 -1
- package/src/components/confirm-cancel/types.ts +0 -18
- package/src/components/content-slider/ContentSlider.vue +0 -79
- package/src/components/content-slider/index.ts +0 -1
- package/src/components/data-point/DataPoint.vue +0 -5
- package/src/components/data-point/index.ts +0 -1
- package/src/components/delete-button/DeleteButton.vue +0 -19
- package/src/components/delete-button/index.ts +0 -1
- package/src/components/dialog/Dialog.vue +0 -70
- package/src/components/dialog/index.ts +0 -1
- package/src/components/fade-in-up/FadeInUp.vue +0 -17
- package/src/components/fade-in-up/index.ts +0 -1
- package/src/components/filter-chip/FilterChip.vue +0 -28
- package/src/components/filter-chip/index.ts +0 -1
- package/src/components/first-paint/FirstPaint.vue +0 -21
- package/src/components/first-paint/index.ts +0 -1
- package/src/components/first-paint/style.scss +0 -23
- package/src/components/flexbox/Flexbox.vue +0 -51
- package/src/components/flexbox/index.ts +0 -1
- package/src/components/horizontal-layout/Aside.vue +0 -114
- package/src/components/horizontal-layout/HorizontalLayout.vue +0 -118
- package/src/components/horizontal-layout/index.ts +0 -2
- package/src/components/icon/Icon.vue +0 -1263
- package/src/components/icon/index.ts +0 -1
- package/src/components/icon/utils/combine-svgs.cjs +0 -55
- package/src/components/icon/utils/combined-svgs.txt +0 -1150
- package/src/components/icon/utils/svgs/admin.svg +0 -16
- package/src/components/icon/utils/svgs/arrow-deviate.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-down-plus.svg +0 -4
- package/src/components/icon/utils/svgs/arrow-down.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-from.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-left.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-move.svg +0 -15
- package/src/components/icon/utils/svgs/arrow-right.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-sub.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-trend.svg +0 -15
- package/src/components/icon/utils/svgs/arrow-up-plus.svg +0 -4
- package/src/components/icon/utils/svgs/arrow-up.svg +0 -3
- package/src/components/icon/utils/svgs/authority.svg +0 -5
- package/src/components/icon/utils/svgs/beams.svg +0 -5
- package/src/components/icon/utils/svgs/bell.svg +0 -15
- package/src/components/icon/utils/svgs/bold.svg +0 -3
- package/src/components/icon/utils/svgs/box.svg +0 -5
- package/src/components/icon/utils/svgs/building.svg +0 -15
- package/src/components/icon/utils/svgs/bullet-list.svg +0 -8
- package/src/components/icon/utils/svgs/calendar.svg +0 -21
- package/src/components/icon/utils/svgs/camera.svg +0 -5
- package/src/components/icon/utils/svgs/categories.svg +0 -3
- package/src/components/icon/utils/svgs/check-circled.svg +0 -16
- package/src/components/icon/utils/svgs/check-outline.svg +0 -15
- package/src/components/icon/utils/svgs/check.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-down.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-left-double.svg +0 -4
- package/src/components/icon/utils/svgs/chevron-left.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-right-double.svg +0 -4
- package/src/components/icon/utils/svgs/chevron-right.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-up.svg +0 -3
- package/src/components/icon/utils/svgs/clock.svg +0 -4
- package/src/components/icon/utils/svgs/close-outline.svg +0 -3
- package/src/components/icon/utils/svgs/close.svg +0 -3
- package/src/components/icon/utils/svgs/columns.svg +0 -3
- package/src/components/icon/utils/svgs/conclusion.svg +0 -17
- package/src/components/icon/utils/svgs/copy.svg +0 -16
- package/src/components/icon/utils/svgs/crosshair.svg +0 -15
- package/src/components/icon/utils/svgs/dash.svg +0 -3
- package/src/components/icon/utils/svgs/dashboard.svg +0 -3
- package/src/components/icon/utils/svgs/delete.svg +0 -4
- package/src/components/icon/utils/svgs/delta.svg +0 -3
- package/src/components/icon/utils/svgs/download.svg +0 -3
- package/src/components/icon/utils/svgs/drag.svg +0 -8
- package/src/components/icon/utils/svgs/drilldown.svg +0 -8
- package/src/components/icon/utils/svgs/edit.svg +0 -16
- package/src/components/icon/utils/svgs/envelope.svg +0 -3
- package/src/components/icon/utils/svgs/error.svg +0 -3
- package/src/components/icon/utils/svgs/export-document.svg +0 -16
- package/src/components/icon/utils/svgs/filter.svg +0 -6
- package/src/components/icon/utils/svgs/filters.svg +0 -4
- package/src/components/icon/utils/svgs/flag.svg +0 -3
- package/src/components/icon/utils/svgs/folder.svg +0 -15
- package/src/components/icon/utils/svgs/frequency.svg +0 -3
- package/src/components/icon/utils/svgs/fullscreen-off.svg +0 -3
- package/src/components/icon/utils/svgs/fullscreen-on.svg +0 -3
- package/src/components/icon/utils/svgs/graduate.svg +0 -3
- package/src/components/icon/utils/svgs/hamburger.svg +0 -5
- package/src/components/icon/utils/svgs/handshake.svg +0 -15
- package/src/components/icon/utils/svgs/heading-1.svg +0 -4
- package/src/components/icon/utils/svgs/heading-2.svg +0 -4
- package/src/components/icon/utils/svgs/heading.svg +0 -3
- package/src/components/icon/utils/svgs/home.svg +0 -3
- package/src/components/icon/utils/svgs/id-card.svg +0 -6
- package/src/components/icon/utils/svgs/id.svg +0 -4
- package/src/components/icon/utils/svgs/indent-left.svg +0 -7
- package/src/components/icon/utils/svgs/indent-right.svg +0 -7
- package/src/components/icon/utils/svgs/information.svg +0 -17
- package/src/components/icon/utils/svgs/italics.svg +0 -3
- package/src/components/icon/utils/svgs/itenary.svg +0 -11
- package/src/components/icon/utils/svgs/keyboard.svg +0 -11
- package/src/components/icon/utils/svgs/lightning.svg +0 -15
- package/src/components/icon/utils/svgs/link.svg +0 -4
- package/src/components/icon/utils/svgs/list-collapse.svg +0 -6
- package/src/components/icon/utils/svgs/list-expand.svg +0 -6
- package/src/components/icon/utils/svgs/location.svg +0 -4
- package/src/components/icon/utils/svgs/lock-locked.svg +0 -4
- package/src/components/icon/utils/svgs/lock-unlocked.svg +0 -4
- package/src/components/icon/utils/svgs/magnifying-glass.svg +0 -15
- package/src/components/icon/utils/svgs/map.svg +0 -3
- package/src/components/icon/utils/svgs/megaphone.svg +0 -3
- package/src/components/icon/utils/svgs/message.svg +0 -15
- package/src/components/icon/utils/svgs/microscope.svg +0 -3
- package/src/components/icon/utils/svgs/moon.svg +0 -3
- package/src/components/icon/utils/svgs/new-document.svg +0 -4
- package/src/components/icon/utils/svgs/news.svg +0 -15
- package/src/components/icon/utils/svgs/numbered-list.svg +0 -7
- package/src/components/icon/utils/svgs/open-link.svg +0 -16
- package/src/components/icon/utils/svgs/options.svg +0 -5
- package/src/components/icon/utils/svgs/page.svg +0 -7
- package/src/components/icon/utils/svgs/paper-plane.svg +0 -15
- package/src/components/icon/utils/svgs/paper.svg +0 -3
- package/src/components/icon/utils/svgs/pen-and-paper.svg +0 -4
- package/src/components/icon/utils/svgs/phase.svg +0 -15
- package/src/components/icon/utils/svgs/photo.svg +0 -4
- package/src/components/icon/utils/svgs/pie-chart.svg +0 -3
- package/src/components/icon/utils/svgs/plus.svg +0 -3
- package/src/components/icon/utils/svgs/point-left.svg +0 -3
- package/src/components/icon/utils/svgs/point-up.svg +0 -3
- package/src/components/icon/utils/svgs/popup.svg +0 -16
- package/src/components/icon/utils/svgs/question.svg +0 -17
- package/src/components/icon/utils/svgs/radio-tower.svg +0 -3
- package/src/components/icon/utils/svgs/recycle.svg +0 -3
- package/src/components/icon/utils/svgs/redo.svg +0 -3
- package/src/components/icon/utils/svgs/refresh.svg +0 -3
- package/src/components/icon/utils/svgs/route.svg +0 -3
- package/src/components/icon/utils/svgs/rows.svg +0 -3
- package/src/components/icon/utils/svgs/scope.svg +0 -7
- package/src/components/icon/utils/svgs/settings.svg +0 -16
- package/src/components/icon/utils/svgs/share.svg +0 -11
- package/src/components/icon/utils/svgs/sign-in.svg +0 -4
- package/src/components/icon/utils/svgs/sign-up.svg +0 -3
- package/src/components/icon/utils/svgs/sort-down.svg +0 -20
- package/src/components/icon/utils/svgs/sort-up.svg +0 -20
- package/src/components/icon/utils/svgs/sort.svg +0 -7
- package/src/components/icon/utils/svgs/square-solid.svg +0 -3
- package/src/components/icon/utils/svgs/star-solid.svg +0 -15
- package/src/components/icon/utils/svgs/star.svg +0 -15
- package/src/components/icon/utils/svgs/stop-watch.svg +0 -5
- package/src/components/icon/utils/svgs/structure.svg +0 -3
- package/src/components/icon/utils/svgs/sun.svg +0 -23
- package/src/components/icon/utils/svgs/table.svg +0 -3
- package/src/components/icon/utils/svgs/tag.svg +0 -15
- package/src/components/icon/utils/svgs/team.svg +0 -15
- package/src/components/icon/utils/svgs/telescope.svg +0 -15
- package/src/components/icon/utils/svgs/trash.svg +0 -6
- package/src/components/icon/utils/svgs/triangle-angle.svg +0 -3
- package/src/components/icon/utils/svgs/triangle-side.svg +0 -3
- package/src/components/icon/utils/svgs/underline.svg +0 -4
- package/src/components/icon/utils/svgs/undo.svg +0 -3
- package/src/components/icon/utils/svgs/user.svg +0 -16
- package/src/components/icon/utils/svgs/venn.svg +0 -3
- package/src/components/icon/utils/svgs/video.svg +0 -3
- package/src/components/icon/utils/svgs/visibility-off-alt.svg +0 -19
- package/src/components/icon/utils/svgs/visibility-off.svg +0 -3
- package/src/components/icon/utils/svgs/visibility-on.svg +0 -16
- package/src/components/icon/utils/svgs/warning.svg +0 -5
- package/src/components/index.ts +0 -45
- package/src/components/input/Input.vue +0 -118
- package/src/components/input/index.ts +0 -1
- package/src/components/input-number/InputNumber.vue +0 -112
- package/src/components/input-number/StepButton.vue +0 -23
- package/src/components/input-number/index.ts +0 -1
- package/src/components/load-spinner/LoadSpinner.vue +0 -13
- package/src/components/load-spinner/index.ts +0 -1
- package/src/components/modal/Modal.vue +0 -111
- package/src/components/modal/index.ts +0 -1
- package/src/components/nav-item/NavItem.vue +0 -62
- package/src/components/nav-item/index.ts +0 -1
- package/src/components/notification/Notification.vue +0 -53
- package/src/components/notification/index.ts +0 -1
- package/src/components/notification-badge/NotificationBadge.vue +0 -7
- package/src/components/notification-badge/index.ts +0 -1
- package/src/components/pagination/Pagination.vue +0 -65
- package/src/components/pagination/index.ts +0 -1
- package/src/components/pop-confirm/PopConfirm.vue +0 -90
- package/src/components/pop-confirm/index.ts +0 -1
- package/src/components/pop-select/FooterButton.vue +0 -5
- package/src/components/pop-select/PopSelect.vue +0 -346
- package/src/components/pop-select/ResultFilters.vue +0 -28
- package/src/components/pop-select/enums.ts +0 -7
- package/src/components/pop-select/index.ts +0 -2
- package/src/components/pop-select/option.vue +0 -51
- package/src/components/popper/Popper.vue +0 -239
- package/src/components/popper/PopperContent.vue +0 -5
- package/src/components/popper/index.ts +0 -2
- package/src/components/popper/middleware.ts +0 -19
- package/src/components/screen-overlay/ScreenOverlay.vue +0 -53
- package/src/components/screen-overlay/index.ts +0 -1
- package/src/components/scrollbar/Bar.vue +0 -106
- package/src/components/scrollbar/ScrollBottomLoader.vue +0 -25
- package/src/components/scrollbar/Scrollbar.vue +0 -219
- package/src/components/scrollbar/enums.ts +0 -23
- package/src/components/scrollbar/index.ts +0 -3
- package/src/components/scrollbar/style.scss +0 -77
- package/src/components/scrollbar/types.ts +0 -32
- package/src/components/select-list/SelectList.vue +0 -476
- package/src/components/select-list/components/SelectListFilterChip.vue +0 -34
- package/src/components/select-list/components/index.ts +0 -3
- package/src/components/select-list/components/option-group/OptionGroup.vue +0 -20
- package/src/components/select-list/components/option-group/index.ts +0 -1
- package/src/components/select-list/components/select-list-option/SelectListOption.vue +0 -83
- package/src/components/select-list/components/select-list-option/index.ts +0 -1
- package/src/components/select-list/components/status-cards/error-card/ErrorCard.vue +0 -17
- package/src/components/select-list/components/status-cards/error-card/index.ts +0 -1
- package/src/components/select-list/components/status-cards/idle-card/IdleCard.vue +0 -11
- package/src/components/select-list/components/status-cards/idle-card/index.ts +0 -1
- package/src/components/select-list/components/status-cards/index.ts +0 -4
- package/src/components/select-list/components/status-cards/loading-card/LoadingCard.vue +0 -10
- package/src/components/select-list/components/status-cards/loading-card/index.ts +0 -1
- package/src/components/select-list/components/status-cards/no-match-card/NoMatchCard.vue +0 -15
- package/src/components/select-list/components/status-cards/no-match-card/index.ts +0 -1
- package/src/components/select-list/components/status-cards/status-card/StatusCard.vue +0 -25
- package/src/components/select-list/components/status-cards/status-card/index.ts +0 -1
- package/src/components/select-list/index.ts +0 -5
- package/src/components/select-list/types.ts +0 -49
- package/src/components/side-over/SideOver.vue +0 -87
- package/src/components/side-over/index.ts +0 -1
- package/src/components/status-select/StatusIndicator.vue +0 -78
- package/src/components/status-select/StatusSelect.vue +0 -62
- package/src/components/status-select/index.ts +0 -1
- package/src/components/switch/Switch.vue +0 -52
- package/src/components/switch/index.ts +0 -1
- package/src/components/tab/Tab.vue +0 -65
- package/src/components/tab/index.ts +0 -1
- package/src/components/tag/Tag.vue +0 -34
- package/src/components/tag/index.ts +0 -1
- package/src/components/text-editor/TextEditor.vue +0 -399
- package/src/components/text-editor/components/Dialog.vue +0 -11
- package/src/components/text-editor/components/FormattingButton.vue +0 -46
- package/src/components/text-editor/components/InsertLinkDialog.vue +0 -81
- package/src/components/text-editor/components/InsertTextDialog.vue +0 -36
- package/src/components/text-editor/components/index.ts +0 -3
- package/src/components/text-editor/index.ts +0 -1
- package/src/components/text-highlight/TextHighlight.vue +0 -113
- package/src/components/text-highlight/index.ts +0 -1
- package/src/components/text-viewer/TextViewer.vue +0 -5
- package/src/components/text-viewer/index.ts +0 -1
- package/src/components/toggle-button/ToggleButton.vue +0 -105
- package/src/components/toggle-button/index.ts +0 -1
- package/src/components/tooltip/Tooltip.vue +0 -54
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/types.ts +0 -232
- package/src/components/vertical-layout/RunningSection.vue +0 -54
- package/src/components/vertical-layout/VerticalLayout.vue +0 -37
- package/src/components/vertical-layout/index.ts +0 -3
- package/src/components/vertical-layout/types.ts +0 -2
- package/src/components/window-frame/WindowFrame.vue +0 -20
- package/src/components/window-frame/index.ts +0 -1
- package/src/composables/index.ts +0 -5
- package/src/composables/useClickOutside.ts +0 -48
- package/src/composables/useEscapeKey.ts +0 -12
- package/src/composables/useMounted.ts +0 -7
- package/src/composables/useNextFrame.ts +0 -10
- package/src/composables/useTrapFocus.ts +0 -61
- package/src/index.ts +0 -5
- package/src/main.css +0 -140
- package/src/utils/array.ts +0 -11
- package/src/utils/capitalizeFirstLetter.ts +0 -4
- package/src/utils/clamp.ts +0 -9
- package/src/utils/debounce.ts +0 -8
- package/src/utils/index.ts +0 -5
- package/src/utils/scrollIntoView.ts +0 -25
- package/src/utils/scrollbarWidth.ts +0 -27
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { size } from "@floating-ui/dom";
|
|
2
|
-
|
|
3
|
-
export const sameWidthAsTriggerMiddleware = size({
|
|
4
|
-
apply({ rects, elements }) {
|
|
5
|
-
Object.assign(elements.floating.style, {
|
|
6
|
-
width: `${rects.reference.width}px`,
|
|
7
|
-
});
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const sameWidthAsElementMiddleware = (element: HTMLElement) => {
|
|
12
|
-
return size({
|
|
13
|
-
apply({ elements }) {
|
|
14
|
-
Object.assign(elements.floating.style, {
|
|
15
|
-
width: `${element.offsetWidth}px`,
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { TOverlayType } from "../types";
|
|
3
|
-
import { onBeforeMount, reactive, ref } from "vue";
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
defineProps<{
|
|
7
|
-
show?: boolean;
|
|
8
|
-
type?: TOverlayType;
|
|
9
|
-
}>(),
|
|
10
|
-
{
|
|
11
|
-
show: false,
|
|
12
|
-
type: "default",
|
|
13
|
-
},
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits(["click", "close"]);
|
|
17
|
-
|
|
18
|
-
const classes = ref("");
|
|
19
|
-
const styles = reactive({ backdropFilter: "" });
|
|
20
|
-
|
|
21
|
-
onBeforeMount(() => {
|
|
22
|
-
if (props.type === "default") {
|
|
23
|
-
classes.value = "bg-black/25 dark:bg-black/50";
|
|
24
|
-
styles.backdropFilter = "";
|
|
25
|
-
}
|
|
26
|
-
else if (props.type === "blurred") {
|
|
27
|
-
classes.value = "bg-black/25";
|
|
28
|
-
styles.backdropFilter = "blur(3px)";
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<transition
|
|
35
|
-
enter-active-class="transform transition ease-in-out duration-200"
|
|
36
|
-
enter-from-class="opacity-0"
|
|
37
|
-
enter-to-class=""
|
|
38
|
-
leave-active-class="transform transition ease-in-out duration-500"
|
|
39
|
-
leave-class="translate-y-0 opacity-100"
|
|
40
|
-
leave-to-class="opacity-0"
|
|
41
|
-
@after-leave="emit('close')"
|
|
42
|
-
>
|
|
43
|
-
<div
|
|
44
|
-
v-show="show"
|
|
45
|
-
class="z-40 fixed w-screen h-screen top-0 left-0 flex items-start justify-center pointer-events-auto"
|
|
46
|
-
:class="classes"
|
|
47
|
-
:style="styles"
|
|
48
|
-
@mousedown.self="emit('click')"
|
|
49
|
-
>
|
|
50
|
-
<slot />
|
|
51
|
-
</div>
|
|
52
|
-
</transition>
|
|
53
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BScreenOverlay } from "./ScreenOverlay.vue";
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ThumbDragEvent } from "./types";
|
|
3
|
-
import { ref } from "vue";
|
|
4
|
-
import { horizontalProperties, verticalProperties } from "./enums";
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
vertical: Boolean,
|
|
8
|
-
size: String,
|
|
9
|
-
move: Number,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const emit = defineEmits(["update"]);
|
|
13
|
-
|
|
14
|
-
const scrollbarRef = ref<HTMLDivElement>();
|
|
15
|
-
const thumbRef = ref<HTMLDivElement>();
|
|
16
|
-
const dragging = ref(false);
|
|
17
|
-
const bar = props.vertical ? verticalProperties : horizontalProperties;
|
|
18
|
-
const position = ref(0);
|
|
19
|
-
|
|
20
|
-
const onDocumentMouseMove = (event: MouseEvent) => {
|
|
21
|
-
if (!dragging.value) return;
|
|
22
|
-
|
|
23
|
-
const prevPage = position.value;
|
|
24
|
-
if (!prevPage) return;
|
|
25
|
-
|
|
26
|
-
const rect = scrollbarRef.value!.getBoundingClientRect();
|
|
27
|
-
if (rect) {
|
|
28
|
-
const offset = ((rect[bar.direction as keyof DOMRect] as number || 0) - (event[bar.client as keyof MouseEvent] as number || 0)) * -1;
|
|
29
|
-
const thumbClickPosition = thumbRef.value && typeof thumbRef.value[bar.offset as keyof HTMLDivElement] === "number"
|
|
30
|
-
? (thumbRef.value[bar.offset as keyof HTMLDivElement] as number) - prevPage
|
|
31
|
-
: 0;
|
|
32
|
-
const scrollbarOffset = scrollbarRef.value ? Number(scrollbarRef.value[bar.offset as keyof HTMLDivElement]) : 0;
|
|
33
|
-
const thumbPositionPercentage = scrollbarOffset ? ((offset - thumbClickPosition) * 100) / scrollbarOffset : 0;
|
|
34
|
-
|
|
35
|
-
emit("update", {
|
|
36
|
-
scrollReference: bar.scroll,
|
|
37
|
-
positionPercentage: thumbPositionPercentage,
|
|
38
|
-
scrollSize: bar.scrollSize,
|
|
39
|
-
} as unknown as ThumbDragEvent);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const onDocumentMouseUp = () => {
|
|
44
|
-
dragging.value = false;
|
|
45
|
-
position.value = 0;
|
|
46
|
-
document.removeEventListener("mousemove", onDocumentMouseMove);
|
|
47
|
-
document.onselectstart = null;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const startDrag = (event: MouseEvent) => {
|
|
51
|
-
event.stopImmediatePropagation();
|
|
52
|
-
dragging.value = true;
|
|
53
|
-
document.addEventListener("mousemove", onDocumentMouseMove);
|
|
54
|
-
document.addEventListener("mouseup", onDocumentMouseUp);
|
|
55
|
-
document.onselectstart = () => false;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const onThumbClick = (event: MouseEvent) => {
|
|
59
|
-
// prevent click event of right button
|
|
60
|
-
if (event.ctrlKey || event.button === 2) return;
|
|
61
|
-
startDrag(event);
|
|
62
|
-
|
|
63
|
-
if (event.currentTarget) {
|
|
64
|
-
|
|
65
|
-
const offset: number = (event.currentTarget as HTMLDivElement)[bar.offset as keyof HTMLDivElement] as number;
|
|
66
|
-
const axis: number = event[bar.client as keyof MouseEvent] as number;
|
|
67
|
-
const rect: DOMRect = (event.currentTarget as HTMLDivElement).getBoundingClientRect();
|
|
68
|
-
const side = rect[bar.direction as keyof DOMRect] as unknown as number;
|
|
69
|
-
position.value = offset - (axis - side);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const onTrackClick = (event: MouseEvent) => {
|
|
74
|
-
const rect = (event.target as HTMLDivElement).getBoundingClientRect();
|
|
75
|
-
if (rect) {
|
|
76
|
-
const rectDirection = rect[bar.direction as keyof DOMRect];
|
|
77
|
-
const eventClient = event[bar.client as keyof MouseEvent];
|
|
78
|
-
const offset = Math.abs((rectDirection ? Number(rectDirection) : 0) - (eventClient ? Number(eventClient) : 0));
|
|
79
|
-
const thumbHalf = thumbRef.value![bar.offset as keyof HTMLDivElement] as number / 2;
|
|
80
|
-
const scrollbarOffset = scrollbarRef.value ? Number(scrollbarRef.value[bar.offset as keyof HTMLDivElement]) : 0;
|
|
81
|
-
const thumbPositionPercentage = scrollbarOffset ? ((offset - thumbHalf) * 100) / scrollbarOffset : 0;
|
|
82
|
-
|
|
83
|
-
emit("update", {
|
|
84
|
-
scrollReference: bar.scroll,
|
|
85
|
-
positionPercentage: thumbPositionPercentage,
|
|
86
|
-
scrollSize: bar.scrollSize,
|
|
87
|
-
} as unknown as ThumbDragEvent);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const renderThumbStyle = () => {
|
|
92
|
-
const translate = `translate${bar.axis}(${props.move}%)`;
|
|
93
|
-
return {
|
|
94
|
-
[bar.size]: props.size,
|
|
95
|
-
transform: translate,
|
|
96
|
-
msTransform: translate,
|
|
97
|
-
webkitTransform: translate,
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
</script>
|
|
101
|
-
|
|
102
|
-
<template>
|
|
103
|
-
<div ref="scrollbarRef" :class="`scrollbar__bar is-${bar.key}`" @click.stop.prevent @mousedown.stop.prevent="onTrackClick">
|
|
104
|
-
<div ref="thumbRef" :style="renderThumbStyle()" class="scrollbar__thumb" @click.stop.prevent @mousedown.stop.prevent="onThumbClick" />
|
|
105
|
-
</div>
|
|
106
|
-
</template>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted, onUnmounted, ref } from "vue";
|
|
3
|
-
import { BLoadSpinner } from "../";
|
|
4
|
-
|
|
5
|
-
const emit = defineEmits(["intersect"]);
|
|
6
|
-
const triggerRef = ref<HTMLDivElement>();
|
|
7
|
-
const observer = ref<IntersectionObserver | null>(null);
|
|
8
|
-
|
|
9
|
-
onMounted(() => {
|
|
10
|
-
observer.value = new IntersectionObserver(
|
|
11
|
-
([e]) => e.isIntersecting && emit("intersect"),
|
|
12
|
-
{ threshold: 0.01 },
|
|
13
|
-
);
|
|
14
|
-
observer.value.observe(triggerRef.value!);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
onUnmounted(() => observer.value && observer.value.disconnect());
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div ref="triggerRef" class="w-full h-16 flex items-center justify-center bg-white">
|
|
22
|
-
<slot v-if="$slots.default" />
|
|
23
|
-
<BLoadSpinner v-else class="w-6 h-6 text-granite-grey" />
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ScrollIntersectionEvent, ScrollTrigger, ThumbDragEvent } from "./types";
|
|
3
|
-
import { nextTick, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
|
4
|
-
import Bar from "./Bar.vue";
|
|
5
|
-
import "./style.scss";
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
disableX?: boolean;
|
|
10
|
-
disableY?: boolean;
|
|
11
|
-
wrapClass?: string;
|
|
12
|
-
viewClass?: string;
|
|
13
|
-
viewHeightClass?: string;
|
|
14
|
-
noresize?: boolean;
|
|
15
|
-
show?: boolean;
|
|
16
|
-
tag?: string;
|
|
17
|
-
triggers?: ScrollTrigger[];
|
|
18
|
-
windowResize?: boolean;
|
|
19
|
-
}>(),
|
|
20
|
-
{
|
|
21
|
-
disableX: false,
|
|
22
|
-
disableY: false,
|
|
23
|
-
wrapClass: "",
|
|
24
|
-
viewClass: "h-full",
|
|
25
|
-
viewHeightClass: "h-full",
|
|
26
|
-
noresize: false,
|
|
27
|
-
show: false,
|
|
28
|
-
tag: "div",
|
|
29
|
-
windowResize: false,
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const emit = defineEmits<{
|
|
34
|
-
intersect: [ScrollIntersectionEvent];
|
|
35
|
-
scroll: [value: number];
|
|
36
|
-
scrollXActive: [value: boolean];
|
|
37
|
-
scrollYActive: [value: boolean];
|
|
38
|
-
}>();
|
|
39
|
-
|
|
40
|
-
let mutationObserver: MutationObserver;
|
|
41
|
-
|
|
42
|
-
const gutterWidth = ref(6);
|
|
43
|
-
const moveX = ref(0);
|
|
44
|
-
const moveY = ref(0);
|
|
45
|
-
const previousY = ref(0);
|
|
46
|
-
const sizeHeight = ref("0");
|
|
47
|
-
const sizeWidth = ref("0");
|
|
48
|
-
const wrapStyle = reactive({
|
|
49
|
-
marginRight: "",
|
|
50
|
-
marginBottom: "",
|
|
51
|
-
});
|
|
52
|
-
const cachedSizePercentages = { height: 100, width: 100 };
|
|
53
|
-
|
|
54
|
-
const wrapClasses = ["scrollbar__wrap"];
|
|
55
|
-
!gutterWidth.value && wrapClasses.push("scrollbar__wrap--hidden-default");
|
|
56
|
-
props.wrapClass && wrapClasses.push(props.wrapClass);
|
|
57
|
-
|
|
58
|
-
const wrapRef = ref();
|
|
59
|
-
const contentRef = ref();
|
|
60
|
-
|
|
61
|
-
const onScroll = () => {
|
|
62
|
-
moveY.value = (wrapRef.value.scrollTop * 100) / wrapRef.value.clientHeight;
|
|
63
|
-
moveX.value = (wrapRef.value.scrollLeft * 100) / wrapRef.value.clientWidth;
|
|
64
|
-
emit("scroll", wrapRef.value.scrollTop);
|
|
65
|
-
|
|
66
|
-
const thumbBottomY = wrapRef.value.scrollTop + wrapRef.value.clientHeight;
|
|
67
|
-
const scrollBottom = wrapRef.value.scrollHeight;
|
|
68
|
-
|
|
69
|
-
if (previousY.value > 0 && wrapRef.value.scrollTop === 0) {
|
|
70
|
-
emit("intersect", { edge: "top", hit: true });
|
|
71
|
-
}
|
|
72
|
-
else if (previousY.value === 0 && wrapRef.value.scrollTop > 0) {
|
|
73
|
-
emit("intersect", { edge: "top", hit: false });
|
|
74
|
-
}
|
|
75
|
-
else if (previousY.value + wrapRef.value.clientHeight < scrollBottom && thumbBottomY === scrollBottom) {
|
|
76
|
-
emit("intersect", { edge: "bottom", hit: true });
|
|
77
|
-
}
|
|
78
|
-
else if (previousY.value + wrapRef.value.clientHeight === scrollBottom && thumbBottomY < scrollBottom) {
|
|
79
|
-
emit("intersect", { edge: "bottom", hit: false });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (props.triggers) {
|
|
83
|
-
for (const trigger of props.triggers) {
|
|
84
|
-
if (previousY.value < trigger.px && wrapRef.value.scrollTop >= trigger.px) {
|
|
85
|
-
trigger.callback(trigger, "down");
|
|
86
|
-
}
|
|
87
|
-
else if (previousY.value > trigger.px && wrapRef.value.scrollTop <= trigger.px) {
|
|
88
|
-
trigger.callback(trigger, "up");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
previousY.value = wrapRef.value.scrollTop;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const updateSizePercentages = () => {
|
|
97
|
-
return {
|
|
98
|
-
heightPercentage: (wrapRef.value.clientHeight * 100) / wrapRef.value.scrollHeight,
|
|
99
|
-
widthPercentage: (wrapRef.value.clientWidth * 100) / wrapRef.value.scrollWidth,
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const update = async () => {
|
|
104
|
-
if (!wrapRef.value) return;
|
|
105
|
-
|
|
106
|
-
await nextTick();
|
|
107
|
-
|
|
108
|
-
const { heightPercentage, widthPercentage } = updateSizePercentages();
|
|
109
|
-
|
|
110
|
-
if (!heightPercentage && !widthPercentage) return;
|
|
111
|
-
|
|
112
|
-
if (!props.disableX) {
|
|
113
|
-
if (cachedSizePercentages.width === 100 && widthPercentage < 100) {
|
|
114
|
-
emit("scrollXActive", true);
|
|
115
|
-
}
|
|
116
|
-
else if (widthPercentage === 100 && cachedSizePercentages.width < 100) {
|
|
117
|
-
emit("scrollXActive", false);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (widthPercentage === 100) {
|
|
121
|
-
wrapStyle.marginBottom = `0px`;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
if (gutterWidth.value) {
|
|
125
|
-
wrapStyle.marginBottom = `-${gutterWidth.value}px`;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
cachedSizePercentages.width = widthPercentage;
|
|
129
|
-
sizeWidth.value = widthPercentage < 100 ? `${widthPercentage}%` : "";
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!props.disableY) {
|
|
133
|
-
if (cachedSizePercentages.height === 100 && heightPercentage < 100) {
|
|
134
|
-
emit("scrollYActive", true);
|
|
135
|
-
}
|
|
136
|
-
else if (heightPercentage === 100 && cachedSizePercentages.height < 100) {
|
|
137
|
-
emit("scrollYActive", false);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (heightPercentage === 100) {
|
|
141
|
-
wrapStyle.marginRight = `0px`;
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
if (gutterWidth.value) {
|
|
145
|
-
wrapStyle.marginRight = `-${gutterWidth.value}px`;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
cachedSizePercentages.height = heightPercentage;
|
|
149
|
-
sizeHeight.value = heightPercentage < 100 ? `${heightPercentage}%` : "";
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
onScroll();
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
onMounted(async () => {
|
|
156
|
-
await nextTick(update);
|
|
157
|
-
|
|
158
|
-
if (cachedSizePercentages.height === 100) {
|
|
159
|
-
emit("intersect", { edge: "top", hit: true });
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
props.windowResize && window.addEventListener("resize", update);
|
|
163
|
-
if (!props.noresize) {
|
|
164
|
-
mutationObserver = new MutationObserver(update);
|
|
165
|
-
mutationObserver.observe(contentRef.value, {
|
|
166
|
-
childList: true,
|
|
167
|
-
subtree: true,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
onBeforeUnmount(() => {
|
|
173
|
-
!props.noresize && mutationObserver.disconnect();
|
|
174
|
-
props.windowResize && window.removeEventListener("resize", update);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const onBarUpdate = (event: ThumbDragEvent) => {
|
|
178
|
-
wrapRef.value[event.scrollReference] = (event.positionPercentage * wrapRef.value[event.scrollSize]) / 100;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const scrollToPercentage = (axis: "x" | "y", percentage: number) => {
|
|
182
|
-
if (axis === "x") {
|
|
183
|
-
wrapRef.value.scrollTo({ left: (wrapRef.value.scrollWidth * percentage) / 100, behavior: "smooth" });
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
wrapRef.value.scrollTo({ top: (wrapRef.value.scrollHeight * percentage) / 100, behavior: "smooth" });
|
|
187
|
-
}
|
|
188
|
-
onScroll();
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const jumpToPercentage = (axis: "x" | "y", percentage: number) => {
|
|
192
|
-
if (axis === "x") {
|
|
193
|
-
wrapRef.value.scrollLeft = (wrapRef.value.scrollWidth * percentage) / 100;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
wrapRef.value.scrollTop = (wrapRef.value.scrollHeight * percentage) / 100;
|
|
197
|
-
}
|
|
198
|
-
onScroll();
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const reset = () => {
|
|
202
|
-
wrapRef.value.scrollTop = 0;
|
|
203
|
-
onScroll();
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
defineExpose({ handleScroll: onScroll, reset, jumpToPercentage, scrollToPercentage, update });
|
|
207
|
-
</script>
|
|
208
|
-
|
|
209
|
-
<template>
|
|
210
|
-
<main class="scrollbar scroll-hidden" :class="[viewHeightClass, { show }]">
|
|
211
|
-
<div id="wrapRef" ref="wrapRef" :class="[wrapClasses]" :style="wrapStyle" @scroll="onScroll">
|
|
212
|
-
<component :is="props.tag" ref="contentRef" class="scrollbar__view" :class="[viewClass]">
|
|
213
|
-
<slot />
|
|
214
|
-
</component>
|
|
215
|
-
</div>
|
|
216
|
-
<Bar v-if="!disableX" :move="moveX" :size="sizeWidth" @update="onBarUpdate" />
|
|
217
|
-
<Bar v-if="!disableY" :move="moveY" :size="sizeHeight" vertical @update="onBarUpdate" />
|
|
218
|
-
</main>
|
|
219
|
-
</template>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { BarProperties } from "./types";
|
|
2
|
-
|
|
3
|
-
export const horizontalProperties: BarProperties = {
|
|
4
|
-
offset: "offsetWidth",
|
|
5
|
-
scroll: "scrollLeft",
|
|
6
|
-
scrollSize: "scrollWidth",
|
|
7
|
-
size: "width",
|
|
8
|
-
key: "horizontal",
|
|
9
|
-
axis: "X",
|
|
10
|
-
client: "clientX",
|
|
11
|
-
direction: "left",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const verticalProperties: BarProperties = {
|
|
15
|
-
offset: "offsetHeight",
|
|
16
|
-
scroll: "scrollTop",
|
|
17
|
-
scrollSize: "scrollHeight",
|
|
18
|
-
size: "height",
|
|
19
|
-
key: "vertical",
|
|
20
|
-
axis: "Y",
|
|
21
|
-
client: "clientY",
|
|
22
|
-
direction: "top",
|
|
23
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
.scrollbar {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
position: relative;
|
|
4
|
-
|
|
5
|
-
&:hover,
|
|
6
|
-
&:active,
|
|
7
|
-
&:focus {
|
|
8
|
-
> .scrollbar__bar {
|
|
9
|
-
opacity: 1;
|
|
10
|
-
transition: opacity 340ms ease-out;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&__wrap {
|
|
15
|
-
overflow: auto;
|
|
16
|
-
height: 100%;
|
|
17
|
-
|
|
18
|
-
&.hidden-default {
|
|
19
|
-
scrollbar-width: none;
|
|
20
|
-
&::-webkit-scrollbar {
|
|
21
|
-
width: 0;
|
|
22
|
-
height: 0;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// using css to set the width so negative margin can be set in Scrollbar.vue (gutterWidth)
|
|
27
|
-
&__wrap::-webkit-scrollbar {
|
|
28
|
-
width: 6px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&__view {
|
|
32
|
-
height: 100%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__thumb {
|
|
36
|
-
position: relative;
|
|
37
|
-
display: block;
|
|
38
|
-
width: 0;
|
|
39
|
-
height: 0;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
border-radius: inherit;
|
|
42
|
-
background-color: #909399; // opacity 0.3
|
|
43
|
-
transition: .3s background-color;
|
|
44
|
-
|
|
45
|
-
&:hover {
|
|
46
|
-
background-color: #909399; // opacity 0.5
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&__bar {
|
|
51
|
-
position: absolute;
|
|
52
|
-
right: 2px;
|
|
53
|
-
bottom: 2px;
|
|
54
|
-
z-index: 1;
|
|
55
|
-
border-radius: 4px;
|
|
56
|
-
opacity: 0;
|
|
57
|
-
transition: opacity 120ms ease-out;
|
|
58
|
-
|
|
59
|
-
&.is-vertical {
|
|
60
|
-
width: 6px;
|
|
61
|
-
top: 2px;
|
|
62
|
-
|
|
63
|
-
> div {
|
|
64
|
-
width: 100%;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&.is-horizontal {
|
|
69
|
-
height: 6px;
|
|
70
|
-
left: 2px;
|
|
71
|
-
|
|
72
|
-
> div {
|
|
73
|
-
height: 100%;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export type BarProperties = {
|
|
2
|
-
offset: string;
|
|
3
|
-
scroll: string;
|
|
4
|
-
scrollSize: string;
|
|
5
|
-
size: string;
|
|
6
|
-
key: string;
|
|
7
|
-
axis: string;
|
|
8
|
-
client: string;
|
|
9
|
-
direction: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type ThumbDragEvent = {
|
|
13
|
-
scrollReference: string;
|
|
14
|
-
positionPercentage: number;
|
|
15
|
-
scrollSize: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const egdes = ["top", "bottom", "left", "right"] as const;
|
|
19
|
-
export type ScrollEdge = (typeof egdes)[number];
|
|
20
|
-
|
|
21
|
-
export type ScrollIntersectionEvent = {
|
|
22
|
-
edge: ScrollEdge;
|
|
23
|
-
hit: boolean;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const scrollDirections = ["up", "down", "left", "right"] as const;
|
|
27
|
-
export type ScrollDirection = (typeof scrollDirections)[number];
|
|
28
|
-
|
|
29
|
-
export type ScrollTrigger = {
|
|
30
|
-
px: number;
|
|
31
|
-
callback: (trigger: ScrollTrigger, direction: ScrollDirection) => void;
|
|
32
|
-
};
|