@vkontakte/videoplayer-interactive 1.0.37-dev.4a00817b.0 → 1.0.37-dev.5157aa89.0
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/es2015.cjs.js +111 -6
- package/es2015.esm.js +111 -6
- package/es2018.cjs.js +111 -6
- package/es2018.esm.js +111 -6
- package/es2024.cjs.js +111 -6
- package/es2024.esm.js +111 -6
- package/esnext.cjs.js +111 -6
- package/esnext.esm.js +111 -6
- package/evergreen.esm.js +111 -6
- package/package.json +4 -4
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +2 -1
- package/types/modules/Interactives/containers/types.d.ts +3 -1
- package/types/modules/Interactives/controls/AreaControl.d.ts +2 -1
- package/types/modules/Interactives/controls/ButtonControl.d.ts +7 -2
- package/types/modules/Interactives/controls/Control.d.ts +10 -2
- package/types/modules/Interactives/controls/TextControl.d.ts +2 -0
- package/types/modules/Interactives/controls/types.d.ts +3 -1
- package/types/modules/Interactives/controls/utils.d.ts +1 -0
- package/types/modules/Interactives/index.d.ts +20 -3
- package/types/modules/Interactives/types.d.ts +4 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/ControlFillAnimation.d.ts +34 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/index.d.ts +1 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/utils.d.ts +12 -0
- package/types/modules/Interactives/utils/ControlTap/ControlTap.d.ts +17 -0
- package/types/modules/Interactives/utils/ControlTap/index.d.ts +1 -0
- package/types/modules/Interactives/utils/ControlTap/utils.d.ts +6 -0
- package/types/modules/Interactives/utils/GameController.d.ts +3 -1
- package/types/modules/Interactives/utils/angleUtils.d.ts +25 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Control } from './Control';
|
|
2
2
|
import { type ControlCreator, type ControlCreateViewParams, type TControl, type ControlOptions } from './types';
|
|
3
|
+
import { ControlFillAnimation } from '../utils/ControlFillAnimation';
|
|
3
4
|
export declare const createButtonControl: ControlCreator<ControlOptions, ButtonControl>;
|
|
4
5
|
declare class ButtonControl extends Control {
|
|
6
|
+
startTime?: number;
|
|
7
|
+
endTime?: number;
|
|
8
|
+
controlFillAnimation?: ControlFillAnimation;
|
|
5
9
|
constructor(control: TControl, options?: ControlOptions);
|
|
6
10
|
createView({ parentElement, callbacks }: ControlCreateViewParams): void;
|
|
7
11
|
registerEvents(): void;
|
|
@@ -11,8 +15,9 @@ declare class ButtonControl extends Control {
|
|
|
11
15
|
toggleBlinkAnimation(enable?: boolean): void;
|
|
12
16
|
syncBlinkAnimation(refAnim: HTMLElement): void;
|
|
13
17
|
onBlinkHovering(): void;
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
updateFillAnimationDimensions(): void;
|
|
19
|
+
setShowTimeRange(startTime: number, endTime: number): void;
|
|
20
|
+
onProgress(currentTime: number): void;
|
|
16
21
|
onResize(): void;
|
|
17
22
|
updateShadowStyles(): void;
|
|
18
23
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Subject, Subscription } from '@vkontakte/videoplayer-shared';
|
|
1
|
+
import { Subject, Subscription, ValueSubject } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { ControlTap } from '../utils/ControlTap';
|
|
2
3
|
import type { ControlEventCallback, ControlCreateViewParams, Dimensions, Callbacks, Options, TControl, ControlOptions } from './types';
|
|
3
4
|
import { CustomError } from '../../../utils/Error';
|
|
4
5
|
import { Nullable } from '@vkontakte/videoplayer-shared';
|
|
5
6
|
type ControlContainer = {
|
|
6
7
|
element: HTMLElement;
|
|
7
8
|
dimensions: Dimensions;
|
|
9
|
+
isManifestContainerDisabled: () => boolean;
|
|
8
10
|
};
|
|
9
11
|
type ClickListener = (event: MouseEvent) => void;
|
|
10
12
|
export declare abstract class Control {
|
|
@@ -14,6 +16,8 @@ export declare abstract class Control {
|
|
|
14
16
|
controlElement: Nullable<HTMLElement>;
|
|
15
17
|
subscriptions: Subscription;
|
|
16
18
|
error$: Subject<CustomError>;
|
|
19
|
+
isInteracted$: ValueSubject<boolean>;
|
|
20
|
+
controlTap?: ControlTap;
|
|
17
21
|
constructor(control: TControl, options?: Options | undefined);
|
|
18
22
|
abstract createView(params: ControlCreateViewParams): void;
|
|
19
23
|
abstract getElement(): Nullable<HTMLElement>;
|
|
@@ -21,12 +25,16 @@ export declare abstract class Control {
|
|
|
21
25
|
abstract enable(): void;
|
|
22
26
|
abstract onProgress(currentTimeMs: number): void;
|
|
23
27
|
abstract onResize(): void;
|
|
24
|
-
abstract
|
|
28
|
+
abstract setShowTimeRange(startTime: number, endTime: number): void;
|
|
29
|
+
abstract updateFillAnimationDimensions(): void;
|
|
25
30
|
abstract updateShadowStyles(isDark?: boolean): void;
|
|
26
31
|
abstract toggleBlinkAnimation(enable?: boolean): void;
|
|
32
|
+
onError(message: string | undefined, error: unknown): void;
|
|
33
|
+
addControlTap(controlElement: HTMLElement): void;
|
|
27
34
|
createContainerElement(callbacks: Callbacks): void;
|
|
28
35
|
createClickListener(callback: AnyFn): ClickListener;
|
|
29
36
|
featureIsEnabled(name: keyof ControlOptions['features']): boolean | undefined;
|
|
37
|
+
isTouch(): boolean | undefined;
|
|
30
38
|
setEvents(callback: ControlEventCallback): void;
|
|
31
39
|
removeListeners(): void;
|
|
32
40
|
}
|
|
@@ -14,6 +14,7 @@ export type Dimensions<T = string> = {
|
|
|
14
14
|
};
|
|
15
15
|
export type Callbacks = {
|
|
16
16
|
setControlLayout: (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
|
|
17
|
+
isContainerDisabled: () => boolean;
|
|
17
18
|
};
|
|
18
19
|
export type ControlCreateViewParams = {
|
|
19
20
|
parentElement: HTMLElement;
|
|
@@ -21,7 +22,8 @@ export type ControlCreateViewParams = {
|
|
|
21
22
|
};
|
|
22
23
|
export type Options = Record<string, unknown>;
|
|
23
24
|
export type ControlOptions = {
|
|
24
|
-
|
|
25
|
+
isTouch: boolean;
|
|
26
|
+
features: Pick<AnimationsFeatureToggles, 'controlsExpectTimeBlinkAnimation' | 'controlsTapPlace' | 'controlsFillAnimation'>;
|
|
25
27
|
};
|
|
26
28
|
export declare function isControlOptions(options: Options): options is ControlOptions;
|
|
27
29
|
type ControlEventCallbackParams = {
|
|
@@ -17,25 +17,35 @@ export declare const utils: {
|
|
|
17
17
|
toggleBlinkAnimation(enable?: boolean): void;
|
|
18
18
|
syncBlinkAnimation(refAnim: HTMLElement): void;
|
|
19
19
|
onBlinkHovering(): void;
|
|
20
|
-
|
|
20
|
+
setShowTimeRange(): void;
|
|
21
|
+
updateFillAnimationDimensions(): void;
|
|
21
22
|
onProgress(): void;
|
|
22
23
|
onResize(): void;
|
|
23
24
|
container: import("@vkontakte/videoplayer-shared").Nullable<{
|
|
24
25
|
element: HTMLElement;
|
|
25
26
|
dimensions: import("./controls").Dimensions;
|
|
27
|
+
isManifestContainerDisabled: () => boolean;
|
|
26
28
|
}>;
|
|
27
29
|
controlElement: import("@vkontakte/videoplayer-shared").Nullable<HTMLElement>;
|
|
28
30
|
subscriptions: import("@vkontakte/videoplayer-shared").Subscription;
|
|
29
31
|
error$: import("@vkontakte/videoplayer-shared").Subject<import("../..").CustomError>;
|
|
32
|
+
isInteracted$: import("@vkontakte/videoplayer-shared").ValueSubject<boolean>;
|
|
33
|
+
controlTap?: import("./utils/ControlTap").ControlTap;
|
|
30
34
|
control: import("@interactiveplatform/movika-manifest/dist/chapter-DI_7rDZW").e;
|
|
31
35
|
options?: import("./controls").Options | undefined;
|
|
36
|
+
onError(message: string | undefined, error: unknown): void;
|
|
37
|
+
addControlTap(controlElement: HTMLElement): void;
|
|
32
38
|
createContainerElement(callbacks: import("./controls").Callbacks): void;
|
|
33
39
|
createClickListener(callback: AnyFn): (event: MouseEvent) => void;
|
|
34
40
|
featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): boolean | undefined;
|
|
41
|
+
isTouch(): boolean | undefined;
|
|
35
42
|
setEvents(callback: import("./controls").ControlEventCallback): void;
|
|
36
43
|
removeListeners(): void;
|
|
37
44
|
}>;
|
|
38
45
|
createButtonControl: import("./controls").ControlCreator<import("./controls").ControlOptions, {
|
|
46
|
+
startTime?: number;
|
|
47
|
+
endTime?: number;
|
|
48
|
+
controlFillAnimation?: import("./utils/ControlFillAnimation").ControlFillAnimation;
|
|
39
49
|
createView({ parentElement, callbacks }: import("./controls").ControlCreateViewParams): void;
|
|
40
50
|
registerEvents(): void;
|
|
41
51
|
disable(): void;
|
|
@@ -44,22 +54,29 @@ export declare const utils: {
|
|
|
44
54
|
toggleBlinkAnimation(enable?: boolean): void;
|
|
45
55
|
syncBlinkAnimation(refAnim: HTMLElement): void;
|
|
46
56
|
onBlinkHovering(): void;
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
updateFillAnimationDimensions(): void;
|
|
58
|
+
setShowTimeRange(startTime: number, endTime: number): void;
|
|
59
|
+
onProgress(currentTime: number): void;
|
|
49
60
|
onResize(): void;
|
|
50
61
|
updateShadowStyles(): void;
|
|
51
62
|
container: import("@vkontakte/videoplayer-shared").Nullable<{
|
|
52
63
|
element: HTMLElement;
|
|
53
64
|
dimensions: import("./controls").Dimensions;
|
|
65
|
+
isManifestContainerDisabled: () => boolean;
|
|
54
66
|
}>;
|
|
55
67
|
controlElement: import("@vkontakte/videoplayer-shared").Nullable<HTMLElement>;
|
|
56
68
|
subscriptions: import("@vkontakte/videoplayer-shared").Subscription;
|
|
57
69
|
error$: import("@vkontakte/videoplayer-shared").Subject<import("../..").CustomError>;
|
|
70
|
+
isInteracted$: import("@vkontakte/videoplayer-shared").ValueSubject<boolean>;
|
|
71
|
+
controlTap?: import("./utils/ControlTap").ControlTap;
|
|
58
72
|
control: import("@interactiveplatform/movika-manifest/dist/chapter-DI_7rDZW").e;
|
|
59
73
|
options?: import("./controls").Options | undefined;
|
|
74
|
+
onError(message: string | undefined, error: unknown): void;
|
|
75
|
+
addControlTap(controlElement: HTMLElement): void;
|
|
60
76
|
createContainerElement(callbacks: import("./controls").Callbacks): void;
|
|
61
77
|
createClickListener(callback: AnyFn): (event: MouseEvent) => void;
|
|
62
78
|
featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): boolean | undefined;
|
|
79
|
+
isTouch(): boolean | undefined;
|
|
63
80
|
setEvents(callback: import("./controls").ControlEventCallback): void;
|
|
64
81
|
removeListeners(): void;
|
|
65
82
|
}>;
|
|
@@ -18,6 +18,8 @@ export type IOptionalInteractiveOptions = Partial<Omit<IInteractiveOptions, Requ
|
|
|
18
18
|
export type AnimationsFeatureToggles = Partial<{
|
|
19
19
|
areaControlShadow: boolean;
|
|
20
20
|
controlsExpectTimeBlinkAnimation: boolean;
|
|
21
|
+
controlsTapPlace: boolean;
|
|
22
|
+
controlsFillAnimation: boolean;
|
|
21
23
|
}>;
|
|
22
24
|
export interface IInteractiveOptions {
|
|
23
25
|
parentElement: HTMLElement;
|
|
@@ -44,6 +46,8 @@ export interface IInteractiveOptions {
|
|
|
44
46
|
* @deprecated
|
|
45
47
|
* */
|
|
46
48
|
disableControlsOnPause?: boolean;
|
|
49
|
+
disableTextControlContainerVisibilityEvents?: boolean;
|
|
50
|
+
isTouch?: boolean;
|
|
47
51
|
animationsFeatureToggles?: AnimationsFeatureToggles;
|
|
48
52
|
}
|
|
49
53
|
export type ChapterChangedData = {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
startTime: number;
|
|
3
|
+
endTime: number;
|
|
4
|
+
rotateAngle: number;
|
|
5
|
+
borderRadius: string;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class ControlFillAnimation {
|
|
9
|
+
fillAnimationElement: HTMLDivElement;
|
|
10
|
+
private fillAnimationFillerElement;
|
|
11
|
+
private fillAnimationFillerWrapperElement;
|
|
12
|
+
private startTime;
|
|
13
|
+
private endTime;
|
|
14
|
+
private shouldFillHeight;
|
|
15
|
+
private widthExpansionCoef;
|
|
16
|
+
private isDebug;
|
|
17
|
+
private fromLeft;
|
|
18
|
+
private useSkew;
|
|
19
|
+
private rotateAngle;
|
|
20
|
+
constructor(opts: Options);
|
|
21
|
+
updateDimension(opts: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
borderWidth: number;
|
|
25
|
+
}): void;
|
|
26
|
+
updateAnimation(currentTime: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Когда мы применяем scew для контрол, расстояние между крайними left & right
|
|
29
|
+
* точками становится больше. Это значит, что нужно увеличивать
|
|
30
|
+
* элемент-заполнитель, чтобы он заполнял контрол полностью. Этот метод
|
|
31
|
+
* возвращает коэффцицент увеличения для элемента-заполнителя.
|
|
32
|
+
*/
|
|
33
|
+
private calcWidthExpansionCoef;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ControlFillAnimation';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CONTROL_FILL_ANIMATION_CLASSNAME_PREFIX = "interactive-control-fill-animation";
|
|
2
|
+
export declare const controlFillAnimationClassNames: {
|
|
3
|
+
common: string;
|
|
4
|
+
fillerWrapper: string;
|
|
5
|
+
filler: string;
|
|
6
|
+
fillHeight: string;
|
|
7
|
+
fillWidth: string;
|
|
8
|
+
fromTop: string;
|
|
9
|
+
fromBottom: string;
|
|
10
|
+
fromLeft: string;
|
|
11
|
+
fromRight: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
controlRotateAngleRad: number;
|
|
3
|
+
circleDiameterPx?: number;
|
|
4
|
+
useDimensionsBasedSize?: boolean;
|
|
5
|
+
clickCancelCondition: () => boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class ControlTap {
|
|
8
|
+
element: HTMLDivElement;
|
|
9
|
+
controlRotateAngleRad: number;
|
|
10
|
+
clickCancelCondition: () => boolean;
|
|
11
|
+
circleDiameterPx: number;
|
|
12
|
+
useDimensionsBasedSize: boolean;
|
|
13
|
+
constructor({ controlRotateAngleRad, clickCancelCondition, circleDiameterPx, useDimensionsBasedSize, }: Options);
|
|
14
|
+
onElementClick: (e: MouseEvent) => void;
|
|
15
|
+
onAnimationEnd: (e: TransitionEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ControlTap';
|
|
@@ -23,6 +23,7 @@ type ConstructorArg = {
|
|
|
23
23
|
disabledControls$: IValueSubject<boolean>;
|
|
24
24
|
onRemove: () => void;
|
|
25
25
|
onError: (error: CustomError) => void;
|
|
26
|
+
disableTextControlContainerVisibilityEvents?: boolean;
|
|
26
27
|
};
|
|
27
28
|
export declare class GameController {
|
|
28
29
|
container: ChoiceContainer;
|
|
@@ -42,7 +43,8 @@ export declare class GameController {
|
|
|
42
43
|
isSelectedContainerEvent: boolean;
|
|
43
44
|
globalEvents: GlobalEvents;
|
|
44
45
|
onError: ConstructorArg['onError'];
|
|
45
|
-
|
|
46
|
+
disableTextControlContainerVisibilityEvents: boolean;
|
|
47
|
+
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, getContainerEventState, permanentTextControls, interactiveTimeOpenUri, disabledControls$, onRemove, onError, disableTextControlContainerVisibilityEvents, }: ConstructorArg);
|
|
46
48
|
private emitContainerVisibilityEvent;
|
|
47
49
|
registerEvents(): void;
|
|
48
50
|
hide: () => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* use normalizeRadians before use
|
|
3
|
+
*/
|
|
4
|
+
export declare function isPositiveXAxis(angle: number): angle is 0;
|
|
5
|
+
/**
|
|
6
|
+
* use normalizeRadians before use
|
|
7
|
+
*/
|
|
8
|
+
export declare function isPositiveYAxis(angle: number): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* use normalizeRadians before use
|
|
11
|
+
*/
|
|
12
|
+
export declare function isNegativeXAxis(angle: number): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* use normalizeRadians before use
|
|
15
|
+
*/
|
|
16
|
+
export declare function isNegativeYAxis(angle: number): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* normalizes to [0, 2π)
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeRadians(rad: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* use normalizeRadians before use
|
|
23
|
+
*/
|
|
24
|
+
export declare function getQuadrant(rad: number): number | null;
|
|
25
|
+
export declare function radiansToDegrees(rad: number): number;
|