indicator-ui 1.0.48 → 1.0.50
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/index.cjs +11 -11
- package/dist/index.js +10470 -10148
- package/dist/types/src/hooks/elementsRefsAdapteers/useElementRefAdapter.d.ts +2 -2
- package/dist/types/src/hooks/feed/index.d.ts +2 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/state/index.d.ts +2 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/state/useFeed.d.ts +13 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/state/useFeedManager.d.ts +19 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/useInfinityFeed.d.ts +24 -0
- package/dist/types/src/hooks/feed/infinityFeed/hooks/useScrollManager.d.ts +25 -0
- package/dist/types/src/hooks/feed/infinityFeed/index.d.ts +1 -0
- package/dist/types/src/hooks/feed/infinityFeed/utils/index.d.ts +1 -0
- package/dist/types/src/hooks/feed/wheel/classes/baseFunction.d.ts +7 -0
- package/dist/types/src/hooks/feed/wheel/classes/coordinateSystemTransformer.d.ts +41 -0
- package/dist/types/src/hooks/feed/wheel/classes/index.d.ts +4 -0
- package/dist/types/src/hooks/feed/wheel/classes/normalizeAngle.d.ts +3 -0
- package/dist/types/src/hooks/feed/wheel/classes/parabola.d.ts +10 -0
- package/dist/types/src/hooks/feed/wheel/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/feed/wheel/hooks/useParabolicVerticalFeed.d.ts +5 -0
- package/dist/types/src/hooks/feed/wheel/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/scroll/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/scroll/hooks/scrollHandler/index.d.ts +1 -0
- package/dist/types/src/hooks/scroll/hooks/{useScrollHandler.d.ts → scrollHandler/useScrollHandler.d.ts} +9 -7
- package/dist/types/src/hooks/scroll/hooks/scrollHandler/useScrollMinDelta.d.ts +11 -0
- package/dist/types/src/hooks/scroll/hooks/useScrollSync.d.ts +2 -0
- package/dist/types/src/hooks/scroll/utils/index.d.ts +1 -0
- package/dist/types/src/ui/Dropdown/ui/Dropdown.d.ts +1 -0
- package/dist/types/src/ui/DropdownItem/ui/DropdownItem.d.ts +1 -0
- package/package.json +4 -1
- package/dist/types/src/ui/visual/ScrollHint/hooks/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/hooks/useContainer.d.ts +0 -7
- package/dist/types/src/ui/visual/ScrollHint/hooks/useHintPosition.d.ts +0 -13
- package/dist/types/src/ui/visual/ScrollHint/hooks/useScrollHint.d.ts +0 -3
- package/dist/types/src/ui/visual/ScrollHint/hooks/useScrollListener.d.ts +0 -7
- package/dist/types/src/ui/visual/ScrollHint/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/styles/components/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/styles/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/types/index.d.ts +0 -8
- package/dist/types/src/ui/visual/ScrollHint/ui/ScrollHint.d.ts +0 -5
- package/dist/types/src/ui/visual/ScrollHint/ui/components/Hint.d.ts +0 -4
- package/dist/types/src/ui/visual/ScrollHint/ui/components/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/ui/index.d.ts +0 -1
- package/dist/types/src/ui/visual/ScrollHint/utils/index.d.ts +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export type
|
|
3
|
-
export declare function useElementRefAdapter<T extends HTMLElement>(
|
|
2
|
+
export type ElementRefAdapter<T extends HTMLElement> = React.RefObject<T> | T | null;
|
|
3
|
+
export declare function useElementRefAdapter(): <T extends HTMLElement>(instance: ElementRefAdapter<T>) => T | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useInfinityFeed';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useAsyncState } from '../../../..';
|
|
2
|
+
export type FeedState<T> = Array<T>;
|
|
3
|
+
type PropsType<T> = {
|
|
4
|
+
feedState: ReturnType<typeof useAsyncState<FeedState<T>>>;
|
|
5
|
+
};
|
|
6
|
+
export declare function useFeed<T>(props: PropsType<T>): {
|
|
7
|
+
setFeed: {
|
|
8
|
+
asyncEffect: (value: import('react').SetStateAction<FeedState<T>>) => Promise<FeedState<T>>;
|
|
9
|
+
asyncLayout: (value: import('react').SetStateAction<FeedState<T>>) => Promise<FeedState<T>>;
|
|
10
|
+
asyncDom: (value: import('react').SetStateAction<FeedState<T>>) => Promise<FeedState<T>>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useFeed, FeedState } from './useFeed';
|
|
2
|
+
type PropsType<T> = Pick<ReturnType<typeof useFeed<T>>, 'setFeed'> & {
|
|
3
|
+
/** Получение элементов перед `instance`. Возвращаемое значение - [firstElementOfNewList, instance) */
|
|
4
|
+
getElementsBefore: (instance: T, prev: FeedState<T>) => FeedState<T>;
|
|
5
|
+
/** Получение элементов после `instance`. Возвращаемое значение - (instance, lastElementOfNewList) */
|
|
6
|
+
getElementsAfter: (instance: T, prev: FeedState<T>) => FeedState<T>;
|
|
7
|
+
/** Удаление элементов перед `lastElement`. Возвращаемое значение - [..., someElementBeforeLastElement] */
|
|
8
|
+
removeElementsBefore: (lastElement: T, prev: FeedState<T>) => FeedState<T>;
|
|
9
|
+
/** Удаление элементов перед `firstElement`. Возвращаемое значение - [someElementAfterFirstElement, ...] */
|
|
10
|
+
removeElementsAfter: (firstElement: T, prev: FeedState<T>) => FeedState<T>;
|
|
11
|
+
};
|
|
12
|
+
export declare function useFeedManager<T>(props: PropsType<T>): {
|
|
13
|
+
push: () => Promise<FeedState<T>>;
|
|
14
|
+
unshift: () => Promise<FeedState<T>>;
|
|
15
|
+
shift: () => Promise<FeedState<T>>;
|
|
16
|
+
pop: () => Promise<FeedState<T>>;
|
|
17
|
+
set: (target: T) => Promise<FeedState<T>>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useFeed, useFeedManager } from './state';
|
|
2
|
+
import { useScrollManager } from './useScrollManager';
|
|
3
|
+
type UseFeedProps<T> = Parameters<typeof useFeed<T>>[number];
|
|
4
|
+
type UseFeedManagerProps<T> = Parameters<typeof useFeedManager<T>>[number];
|
|
5
|
+
type UseScrollManagerProps<T, F extends HTMLElement> = Parameters<typeof useScrollManager<T, F>>[number];
|
|
6
|
+
type PropsType<T, F extends HTMLElement> = Pick<UseFeedProps<T>, 'feedState'> & Pick<UseFeedManagerProps<T>, 'getElementsAfter' | 'getElementsBefore' | 'removeElementsAfter' | 'removeElementsBefore'> & Pick<UseScrollManagerProps<T, F>, 'feedRef' | 'getElementByItem'>;
|
|
7
|
+
export declare function useInfinityFeed<T, F extends HTMLElement>(props: PropsType<T, F>): {
|
|
8
|
+
onScrollToStart: (ev: import('../../..').ScrollInfoEvent<HTMLElement> & {
|
|
9
|
+
origin: Event;
|
|
10
|
+
commitScroll: () => import('../../..').ScrollAnchorCommit;
|
|
11
|
+
revertScroll: (commit: import('../../..').ScrollAnchorCommit) => import('../../..').ScrollAnchorCommit;
|
|
12
|
+
}) => void | undefined;
|
|
13
|
+
onScrollToEnd: (ev: import('../../..').ScrollInfoEvent<HTMLElement> & {
|
|
14
|
+
origin: Event;
|
|
15
|
+
commitScroll: () => import('../../..').ScrollAnchorCommit;
|
|
16
|
+
revertScroll: (commit: import('../../..').ScrollAnchorCommit) => import('../../..').ScrollAnchorCommit;
|
|
17
|
+
}) => void | undefined;
|
|
18
|
+
scrollToElement: (instance: T, options?: {
|
|
19
|
+
offset?: number;
|
|
20
|
+
block?: ScrollLogicalPosition;
|
|
21
|
+
behavior?: ScrollBehavior;
|
|
22
|
+
} | undefined) => Promise<void> | undefined;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ElementRefAdapter } from '../../..';
|
|
2
|
+
import { useFeedManager } from './state';
|
|
3
|
+
type ScrollToOptions = {
|
|
4
|
+
offset?: number;
|
|
5
|
+
block?: ScrollLogicalPosition;
|
|
6
|
+
behavior?: ScrollBehavior;
|
|
7
|
+
};
|
|
8
|
+
type PropsType<T, F extends HTMLElement> = Pick<ReturnType<typeof useFeedManager<T>>, 'pop' | 'push' | 'shift' | 'unshift' | 'set'> & {
|
|
9
|
+
getElementByItem: (item: T) => HTMLElement | null;
|
|
10
|
+
feedRef: ElementRefAdapter<F>;
|
|
11
|
+
};
|
|
12
|
+
export declare function useScrollManager<T, F extends HTMLElement>(props: PropsType<T, F>): {
|
|
13
|
+
onScrollToStart: (ev: import('../../..').ScrollInfoEvent<HTMLElement> & {
|
|
14
|
+
origin: Event;
|
|
15
|
+
commitScroll: () => import('../../..').ScrollAnchorCommit;
|
|
16
|
+
revertScroll: (commit: import('../../..').ScrollAnchorCommit) => import('../../..').ScrollAnchorCommit;
|
|
17
|
+
}) => void | undefined;
|
|
18
|
+
onScrollToEnd: (ev: import('../../..').ScrollInfoEvent<HTMLElement> & {
|
|
19
|
+
origin: Event;
|
|
20
|
+
commitScroll: () => import('../../..').ScrollAnchorCommit;
|
|
21
|
+
revertScroll: (commit: import('../../..').ScrollAnchorCommit) => import('../../..').ScrollAnchorCommit;
|
|
22
|
+
}) => void | undefined;
|
|
23
|
+
scrollToElement: (instance: T, options?: ScrollToOptions | undefined) => Promise<void> | undefined;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertHTMLElement(el: any): asserts el is HTMLElement;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { vec3, mat3, mat4 } from 'gl-matrix';
|
|
2
|
+
/**
|
|
3
|
+
* CoordinateSystem
|
|
4
|
+
*
|
|
5
|
+
* Описывает 3D систему координат и предоставляет
|
|
6
|
+
* переходы между локальной и глобальной СК.
|
|
7
|
+
*
|
|
8
|
+
* Используется классическая линейная алгебра:
|
|
9
|
+
* - базис (оси)
|
|
10
|
+
* - матрицы перехода
|
|
11
|
+
* - обратная матрица
|
|
12
|
+
*/
|
|
13
|
+
export declare class CoordinateSystem {
|
|
14
|
+
/** Начало локальной СК в глобальной */
|
|
15
|
+
readonly origin: vec3;
|
|
16
|
+
/** Локальные оси, выраженные в глобальной СК */
|
|
17
|
+
readonly xAxis: vec3;
|
|
18
|
+
readonly yAxis: vec3;
|
|
19
|
+
readonly zAxis: vec3;
|
|
20
|
+
/** Матрица ориентации (3×3) */
|
|
21
|
+
readonly rotation: mat3;
|
|
22
|
+
/** Матрица перехода L → G */
|
|
23
|
+
readonly localToWorld: mat4;
|
|
24
|
+
/** Матрица перехода G → L */
|
|
25
|
+
readonly worldToLocal: mat4;
|
|
26
|
+
/**
|
|
27
|
+
* @param origin начало локальной СК в глобальной
|
|
28
|
+
* @param xAxis направление оси Xₗ в глобальной
|
|
29
|
+
* @param yAxis направление оси Yₗ в глобальной
|
|
30
|
+
* @param zAxis направление оси Zₗ в глобальной
|
|
31
|
+
*/
|
|
32
|
+
constructor(origin: vec3, xAxis: vec3, yAxis: vec3, zAxis: vec3);
|
|
33
|
+
/**
|
|
34
|
+
* Перевод точки из локальной СК в глобальную
|
|
35
|
+
*/
|
|
36
|
+
localToGlobal(point: vec3): vec3;
|
|
37
|
+
/**
|
|
38
|
+
* Перевод точки из глобальной СК в локальную
|
|
39
|
+
*/
|
|
40
|
+
globalToLocal(point: vec3): vec3;
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
|
+
import { BaseFunction2D } from './baseFunction';
|
|
3
|
+
export declare class Parabola extends BaseFunction2D {
|
|
4
|
+
private a;
|
|
5
|
+
private b;
|
|
6
|
+
private c;
|
|
7
|
+
constructor(a?: number, b?: number, c?: number);
|
|
8
|
+
calcPoint(x: number): vec2;
|
|
9
|
+
derivative(x: number): vec2;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useParabolicVerticalFeed';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useScrollHandler';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ScrollAnchorCommit } from '
|
|
3
|
-
import { useScrollAnchor } from '
|
|
4
|
-
import { useScrollInfo } from '
|
|
1
|
+
import { ElementRefAdapter, ScrollInfoEvent } from '../../..';
|
|
2
|
+
import { ScrollAnchorCommit } from '../../types';
|
|
3
|
+
import { useScrollAnchor } from '../useScrollAnchor';
|
|
4
|
+
import { useScrollInfo } from '../useScrollInfo';
|
|
5
|
+
import { useScrollMinDelta } from './useScrollMinDelta';
|
|
5
6
|
type ScrollEvent<T extends HTMLElement> = ScrollInfoEvent<T> & {
|
|
7
|
+
origin: Event;
|
|
6
8
|
commitScroll: () => ScrollAnchorCommit;
|
|
7
9
|
revertScroll: (commit: ScrollAnchorCommit) => ScrollAnchorCommit;
|
|
8
10
|
};
|
|
9
|
-
type Options<T extends HTMLElement> = Parameters<typeof useScrollInfo<T>>[number]
|
|
11
|
+
type Options<T extends HTMLElement> = Parameters<typeof useScrollInfo<T>>[number] & Parameters<typeof useScrollAnchor<T>>[number] & Parameters<typeof useScrollMinDelta>[number];
|
|
10
12
|
type Callback<T extends HTMLElement> = (ev: ScrollEvent<T>) => void;
|
|
11
|
-
export declare function useScrollHandler<T extends HTMLElement>(ref:
|
|
13
|
+
export declare function useScrollHandler<T extends HTMLElement>(ref: ElementRefAdapter<T>, callback: Callback<T>, options?: Options<T>): {
|
|
12
14
|
getInfo: () => ScrollInfoEvent<T>;
|
|
13
|
-
getObj: () =>
|
|
15
|
+
getObj: <T_1 extends HTMLElement>(instance: ElementRefAdapter<T_1>) => T_1 | null;
|
|
14
16
|
commitScroll: () => ScrollAnchorCommit;
|
|
15
17
|
revertScroll: (commit: ScrollAnchorCommit) => ScrollAnchorCommit;
|
|
16
18
|
reinit: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type MinScrollDeltaOption = {
|
|
2
|
+
scrollTop: number;
|
|
3
|
+
scrollLeft: number;
|
|
4
|
+
};
|
|
5
|
+
type PropsType = {
|
|
6
|
+
minScrollDelta?: MinScrollDeltaOption | number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useScrollMinDelta(props: PropsType): {
|
|
9
|
+
canCallCallback: (event: Event) => boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DropdownPropsType } from '../types';
|
|
3
|
+
/** @deprecated используйте {@link DropdownV2} */
|
|
3
4
|
export declare const Dropdown: <T = unknown>(props: DropdownPropsType<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"react-components",
|
|
12
12
|
"ui-kit"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.0.
|
|
14
|
+
"version": "1.0.50",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./dist/types/index.d.ts",
|
|
@@ -75,5 +75,8 @@
|
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": ">=18.0.0",
|
|
77
77
|
"react-dom": ">=18.0.0"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"gl-matrix": "^3.4.4"
|
|
78
81
|
}
|
|
79
82
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useScrollHint';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { InstanceRef, PropsType as _PropsType } from '../types';
|
|
3
|
-
type PropsType<T extends ElementType> = Pick<_PropsType<T>, "instanceRef">;
|
|
4
|
-
export declare function useContainer<T extends ElementType>(props: PropsType<T>): {
|
|
5
|
-
containerRef: import('react').RefObject<InstanceRef<T>>;
|
|
6
|
-
};
|
|
7
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ScrollDirectionOptions } from '../../../../hooks';
|
|
2
|
-
type PropsType = ScrollDirectionOptions;
|
|
3
|
-
export declare function useHintPosition(props: PropsType): {
|
|
4
|
-
calcHorizontalHintPosition: (scroll: number, scrollSize: number, clientSize: number) => {
|
|
5
|
-
start: number;
|
|
6
|
-
end: number;
|
|
7
|
-
};
|
|
8
|
-
calcVerticalHintPosition: (scroll: number, scrollSize: number, clientSize: number) => {
|
|
9
|
-
start: number;
|
|
10
|
-
end: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { useContainer } from './useContainer';
|
|
3
|
-
type PropsType<T extends ElementType> = Pick<ReturnType<typeof useContainer<T>>, 'containerRef'> & {
|
|
4
|
-
onScrollHandler: (ev: Event) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare function useScrollListener<T extends ElementType>(props: PropsType<T>): {};
|
|
7
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ui';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as HintStyle } from './Hint.module.scss';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ScrollHintStyle } from './ScrollHint.module.scss';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { default as React, ElementType } from 'react';
|
|
2
|
-
import { AsProps } from '../../../../types';
|
|
3
|
-
export type DefaultElementType = 'div';
|
|
4
|
-
export type InstanceRef<T extends ElementType> = React.ComponentRef<T>;
|
|
5
|
-
export type PropsType<T extends ElementType> = AsProps<T, {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
}, InstanceRef<T>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { useScrollHint } from '../hooks';
|
|
3
|
-
type PropsType<T extends ElementType> = Parameters<typeof useScrollHint<T>>[number];
|
|
4
|
-
export declare function ScrollHint<T extends ElementType>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Hint';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ScrollHint';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function assertHTMLElement(instance: any): asserts instance is HTMLElement;
|