@toife/vue 3.3.11 → 3.4.1

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.
@@ -23,6 +23,7 @@ export * from './segmented-field';
23
23
  export * from './container';
24
24
  export * from './refresher';
25
25
  export * from './route';
26
+ export * from './scrollbar';
26
27
  export * from './page';
27
28
  export * from './collapse';
28
29
  export * from './form-group';
@@ -0,0 +1 @@
1
+ export { default as Scrollbar } from './scrollbar.vue';
@@ -0,0 +1,28 @@
1
+ import { ScrollbarProps } from '../../core';
2
+ declare const _default: import('vue').DefineComponent<ScrollbarProps, {
3
+ /** The element that actually scrolls. */
4
+ scrollport: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
5
+ /** Re-measure after a change no observer can see. */
6
+ update: () => void;
7
+ metrics: {
8
+ clientWidth: number;
9
+ clientHeight: number;
10
+ scrollWidth: number;
11
+ scrollHeight: number;
12
+ scrollLeft: number;
13
+ scrollTop: number;
14
+ };
15
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
16
+ scroll: (event: Event) => any;
17
+ }, string, import('vue').PublicProps, Readonly<ScrollbarProps> & Readonly<{
18
+ onScroll?: ((event: Event) => any) | undefined;
19
+ }>, {
20
+ role: string;
21
+ size: number;
22
+ direction: import('../../core').ScrollbarDirection;
23
+ thumbSize: number;
24
+ minThumb: number;
25
+ autoHide: boolean;
26
+ hideDelay: number;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
@@ -21,6 +21,7 @@ export * from './present';
21
21
  export * from './radio';
22
22
  export * from './refresher';
23
23
  export * from './route';
24
+ export * from './scrollbar';
24
25
  export * from './segmented-field';
25
26
  export * from './select';
26
27
  export * from './skeleton';
@@ -0,0 +1,3 @@
1
+ export * from './scrollbar.constants';
2
+ export * from './scrollbar.type';
3
+ export * from './scrollbar.logic';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Scrollbar Default Props
3
+ */
4
+ export declare const SCROLLBAR_DEFAULT_PROPS: {
5
+ readonly direction: "vertical";
6
+ readonly size: 10;
7
+ readonly thumbSize: 6;
8
+ readonly minThumb: 24;
9
+ readonly autoHide: true;
10
+ readonly hideDelay: 500;
11
+ readonly role: "";
12
+ };
13
+ /** Overflow of 1px or less is rounding noise, not something worth a scrollbar. */
14
+ export declare const SCROLLBAR_OVERFLOW_EPSILON = 1;
15
+ /** `WheelEvent.deltaMode: 1` is lines; browsers expose no size for one. */
16
+ export declare const SCROLLBAR_WHEEL_LINE = 16;
17
+ /** A `click` this soon after a drag is that drag's release, not a new click. */
18
+ export declare const SCROLLBAR_CLICK_AFTER_DRAG = 200;
@@ -0,0 +1,51 @@
1
+ import { ScrollbarAttrOptions, ScrollbarAxis, ScrollbarAxisGeometry, ScrollbarDirection, ScrollbarGeometryOptions, ScrollbarMetrics, ScrollbarThumbAttrOptions, ScrollbarTrackAttrOptions } from './scrollbar.type';
2
+ export declare const getScrollbarAttrs: (options: ScrollbarAttrOptions) => {
3
+ class: (string | {
4
+ visible: boolean;
5
+ dragging: boolean;
6
+ })[];
7
+ style: {
8
+ [x: string]: string;
9
+ };
10
+ };
11
+ export declare const getScrollbarContentAttrs: () => {
12
+ class: string[];
13
+ };
14
+ export declare const getScrollbarTrackAttrs: (options: ScrollbarTrackAttrOptions) => {
15
+ class: (string | {
16
+ [x: string]: boolean;
17
+ })[];
18
+ style: {
19
+ [x: string]: string;
20
+ };
21
+ };
22
+ export declare const getScrollbarThumbAttrs: (options: ScrollbarThumbAttrOptions) => {
23
+ class: string[];
24
+ style: {
25
+ [x: string]: string;
26
+ };
27
+ };
28
+ /** Hit-testing a press against the thumb needs the class as a selector. */
29
+ export declare const getScrollbarThumbSelector: () => string;
30
+ /** Read the scrollport in one go — every number the geometry needs. */
31
+ export declare const getScrollbarMetrics: (element: Element) => ScrollbarMetrics;
32
+ /** Is this axis both allowed by `direction` and actually overflowing? */
33
+ export declare const hasScrollbarAxis: (axis: ScrollbarAxis, direction: ScrollbarDirection, metrics: ScrollbarMetrics) => boolean;
34
+ /**
35
+ * Everything the track and thumb need for one axis. The thumb is the visible
36
+ * share of the content, floored at `minThumb` so long documents keep a grabbable
37
+ * handle.
38
+ */
39
+ export declare const getScrollbarGeometry: (axis: ScrollbarAxis, metrics: ScrollbarMetrics, options: ScrollbarGeometryOptions) => ScrollbarAxisGeometry;
40
+ /**
41
+ * Scroll offset that centers the thumb on `point`, measured in px from the start
42
+ * of the track — what a click on the empty part of the track jumps to.
43
+ */
44
+ export declare const getScrollbarScrollFromPoint: (geometry: ScrollbarAxisGeometry, point: number) => number;
45
+ /**
46
+ * Scroll offset for a drag that has moved `delta` px since it grabbed the thumb
47
+ * at `origin`. One px of thumb travel is `maxScroll / travel` px of content.
48
+ */
49
+ export declare const getScrollbarScrollFromDelta: (geometry: ScrollbarAxisGeometry, origin: number, delta: number) => number;
50
+ /** Wheel deltas arrive in px, lines or pages depending on the device. */
51
+ export declare const getScrollbarWheelScale: (deltaMode: number, page: number) => number;
@@ -0,0 +1,61 @@
1
+ export type ScrollbarDirection = "vertical" | "horizontal" | "both";
2
+ export type ScrollbarAxis = "x" | "y";
3
+ export type ScrollbarProps = {
4
+ direction?: ScrollbarDirection;
5
+ /** Gutter width in px — the hit area of the track. */
6
+ size?: number;
7
+ /** Painted thumb width in px, centered inside the gutter. */
8
+ thumbSize?: number;
9
+ /** Shortest the thumb may get on very long content. */
10
+ minThumb?: number;
11
+ /** Fade the tracks out when idle. */
12
+ autoHide?: boolean;
13
+ /** Idle time in ms before fading out after a scroll. */
14
+ hideDelay?: number;
15
+ role?: string;
16
+ };
17
+ export type ScrollbarEvent = {
18
+ (e: "scroll", event: Event): void;
19
+ };
20
+ /** Live geometry of the scrollport, read straight off the element. */
21
+ export type ScrollbarMetrics = {
22
+ clientWidth: number;
23
+ clientHeight: number;
24
+ scrollWidth: number;
25
+ scrollHeight: number;
26
+ scrollLeft: number;
27
+ scrollTop: number;
28
+ };
29
+ export type ScrollbarGeometryOptions = {
30
+ /** Px taken off the track end so the two tracks never meet in the corner. */
31
+ inset: number;
32
+ minThumb: number;
33
+ };
34
+ /** One axis of `ScrollbarMetrics`, resolved into px the track can be drawn from. */
35
+ export type ScrollbarAxisGeometry = {
36
+ /** Length of the track. */
37
+ track: number;
38
+ /** Length of the thumb. */
39
+ thumb: number;
40
+ /** How far the thumb can travel — the scale between thumb px and content px. */
41
+ travel: number;
42
+ /** How far the content can scroll. */
43
+ maxScroll: number;
44
+ /** Where the thumb sits right now. */
45
+ offset: number;
46
+ };
47
+ export type ScrollbarAttrOptions = {
48
+ role: string;
49
+ size: number;
50
+ thumbSize: number;
51
+ visible: boolean;
52
+ dragging: boolean;
53
+ };
54
+ export type ScrollbarTrackAttrOptions = {
55
+ axis: ScrollbarAxis;
56
+ inset: number;
57
+ };
58
+ export type ScrollbarThumbAttrOptions = {
59
+ length: number;
60
+ offset: number;
61
+ };
@@ -0,0 +1,7 @@
1
+ export declare function createFullscreen(): {
2
+ isFullscreen: () => boolean;
3
+ enter: (element: HTMLElement) => Promise<void>;
4
+ exit: () => Promise<void>;
5
+ toggle: (element: HTMLElement) => Promise<void>;
6
+ subscribe: (listener: (isFullscreen: boolean) => void) => () => void;
7
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './element';
2
2
  export * from './events';
3
3
  export * from './style';
4
+ export * from './fullscreen';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './factory';
2
2
  export * from './components';
3
+ export * from './utils';
3
4
  export * from './core';