@vkontakte/videoplayer-interactive 1.0.31-dev.684e92f5.0 → 1.0.31-dev.a8108f50.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 +43 -6
- package/es2015.esm.js +43 -6
- package/es2018.cjs.js +43 -6
- package/es2018.esm.js +43 -6
- package/esnext.cjs.js +43 -6
- package/esnext.esm.js +43 -6
- package/evergreen.esm.js +43 -6
- package/package.json +4 -4
- package/types/modules/Interactives/Interactives.d.ts +0 -1
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +8 -8
- package/types/modules/Interactives/containers/Container.d.ts +7 -5
- package/types/modules/Interactives/containers/index.d.ts +2 -0
- package/types/modules/Interactives/containers/types.d.ts +9 -0
- package/types/modules/Interactives/containers/utils.d.ts +6 -0
- package/types/modules/Interactives/controls/AreaControl.d.ts +11 -2
- package/types/modules/Interactives/controls/ButtonControl.d.ts +11 -2
- package/types/modules/Interactives/controls/Control.d.ts +12 -9
- package/types/modules/Interactives/controls/TextControl.d.ts +11 -2
- package/types/modules/Interactives/controls/index.d.ts +4 -2
- package/types/modules/Interactives/controls/types.d.ts +17 -8
- package/types/modules/Interactives/controls/utils.d.ts +9 -0
- package/types/modules/Interactives/index.d.ts +39 -4
- package/types/modules/Interactives/styles.d.ts +1 -0
- package/types/modules/Interactives/types.d.ts +4 -12
- package/types/modules/Interactives/utils/GameController.d.ts +5 -9
- package/types/modules/Interactives/utils/InteractiveEvents.d.ts +1 -1
- package/types/modules/Interactives/utils/events.d.ts +1 -3
- package/types/modules/Interactives/utils/events.types.d.ts +0 -2
- package/types/modules/Interactives/utils/gameUtils.d.ts +1 -2
- package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -5
- package/types/modules/Interactives/utils/renderingUtils.d.ts +0 -3
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
|
|
2
|
-
import Control from '../../../modules/Interactives/controls/Control';
|
|
2
|
+
import type { Control } from '../../../modules/Interactives/controls/Control';
|
|
3
|
+
import { AnimationsFeatureToggles } from '../../../modules/Interactives/types';
|
|
3
4
|
export { TControl };
|
|
5
|
+
export declare const CONTROLLER_PREFIX = "int";
|
|
4
6
|
export declare enum CONTROLLER_IDS {
|
|
5
7
|
AREA = "int_area",
|
|
6
8
|
TEXT = "int_text",
|
|
7
9
|
BUTTON = "int_bttn"
|
|
8
10
|
}
|
|
9
|
-
export type Dimensions = {
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
11
|
+
export type Dimensions<T = string> = {
|
|
12
|
+
width: T;
|
|
13
|
+
height: T;
|
|
12
14
|
};
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
+
export type Callbacks = {
|
|
16
|
+
setControlLayout: (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
|
|
17
|
+
};
|
|
18
|
+
export type ControlCreateViewParams = {
|
|
15
19
|
parentElement: HTMLElement;
|
|
16
|
-
|
|
20
|
+
callbacks: Callbacks;
|
|
21
|
+
};
|
|
22
|
+
export type Options = Record<string, unknown>;
|
|
23
|
+
export type ControlOptions = {
|
|
24
|
+
features: Pick<AnimationsFeatureToggles, never>;
|
|
17
25
|
};
|
|
26
|
+
export declare function isControlOptions(options: Options): options is ControlOptions;
|
|
18
27
|
type ControlEventCallbackParams = {
|
|
19
28
|
action: ControlEvent['action'];
|
|
20
29
|
controlId: string;
|
|
21
30
|
controlType: TControl['type'];
|
|
22
31
|
};
|
|
23
32
|
export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
|
|
24
|
-
export type ControlCreator = (control: TControl) =>
|
|
33
|
+
export type ControlCreator<O extends Options = Options, C extends Control = Control> = (control: TControl, options?: O) => C | undefined;
|
|
@@ -6,9 +6,44 @@ export { isLastChapter, hasEndTemplate, isOneTextCtrlContainer } from './utils/g
|
|
|
6
6
|
export type { InteractiveRange } from './utils/getInteractiveRanges';
|
|
7
7
|
export declare const utils: {
|
|
8
8
|
Container: typeof Container;
|
|
9
|
-
createChoiceContainer: (container: import("@interactiveplatform/movika-manifest").ChapterContainer, rootElement: HTMLElement) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
|
|
10
|
-
createAreaControl: import("./controls").ControlCreator
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
createChoiceContainer: (container: import("@interactiveplatform/movika-manifest").ChapterContainer, rootElement: HTMLElement, options?: import("./containers/types").ChoiceContainerOptions) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
|
|
10
|
+
createAreaControl: import("./controls").ControlCreator<import("./controls").ControlOptions, {
|
|
11
|
+
createView({ parentElement, callbacks }: import("./controls").ControlCreateViewParams): void;
|
|
12
|
+
disable(): void;
|
|
13
|
+
enable(): void;
|
|
14
|
+
getElement(): Nullable<HTMLElement>;
|
|
15
|
+
container: Nullable<{
|
|
16
|
+
element: HTMLElement;
|
|
17
|
+
dimensions: import("./controls").Dimensions;
|
|
18
|
+
}>;
|
|
19
|
+
controlElement: Nullable<HTMLElement>;
|
|
20
|
+
clickListener: Nullable<(event: MouseEvent) => void>;
|
|
21
|
+
control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
|
|
22
|
+
options?: import("./controls").Options;
|
|
23
|
+
createContainerElement(callbacks: import("./controls").Callbacks): void;
|
|
24
|
+
createClickListener(callback: AnyFn): (event: MouseEvent) => void;
|
|
25
|
+
featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): false | undefined;
|
|
26
|
+
setEvents(callback: import("./controls").ControlEventCallback): void;
|
|
27
|
+
removeListeners(): void;
|
|
28
|
+
}>;
|
|
29
|
+
createButtonControl: import("./controls").ControlCreator<import("./controls").ControlOptions, {
|
|
30
|
+
createView({ parentElement, callbacks }: import("./controls").ControlCreateViewParams): void;
|
|
31
|
+
disable(): void;
|
|
32
|
+
enable(): void;
|
|
33
|
+
getElement(): Nullable<HTMLElement>;
|
|
34
|
+
container: Nullable<{
|
|
35
|
+
element: HTMLElement;
|
|
36
|
+
dimensions: import("./controls").Dimensions;
|
|
37
|
+
}>;
|
|
38
|
+
controlElement: Nullable<HTMLElement>;
|
|
39
|
+
clickListener: Nullable<(event: MouseEvent) => void>;
|
|
40
|
+
control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
|
|
41
|
+
options?: import("./controls").Options;
|
|
42
|
+
createContainerElement(callbacks: import("./controls").Callbacks): void;
|
|
43
|
+
createClickListener(callback: AnyFn): (event: MouseEvent) => void;
|
|
44
|
+
featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): false | undefined;
|
|
45
|
+
setEvents(callback: import("./controls").ControlEventCallback): void;
|
|
46
|
+
removeListeners(): void;
|
|
47
|
+
}>;
|
|
13
48
|
classnamesPrefix: string;
|
|
14
49
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const applyStyles: (attachToElement: HTMLElement) => void;
|
|
@@ -19,6 +19,7 @@ export type RequiredOptions = 'parentElement' | 'fullscreenTargetElement';
|
|
|
19
19
|
export type IOptionalInteractiveOptions = Partial<Omit<IInteractiveOptions, RequiredOptions | 'config'>> & Required<Pick<IInteractiveOptions, RequiredOptions>> & {
|
|
20
20
|
config?: Partial<IInteractiveOptions['config']>;
|
|
21
21
|
};
|
|
22
|
+
export type AnimationsFeatureToggles = {};
|
|
22
23
|
export interface IInteractiveOptions {
|
|
23
24
|
parentElement: HTMLElement;
|
|
24
25
|
fullscreenTargetElement: HTMLElement;
|
|
@@ -31,7 +32,6 @@ export interface IInteractiveOptions {
|
|
|
31
32
|
lastFrame: boolean;
|
|
32
33
|
initSeamless: boolean;
|
|
33
34
|
permanentTextControls: boolean;
|
|
34
|
-
interactiveTimeOpenUri: boolean;
|
|
35
35
|
loaders: Partial<Loaders>;
|
|
36
36
|
initChapterId?: string;
|
|
37
37
|
projectInfo?: InteractiveProjectInfo;
|
|
@@ -41,9 +41,10 @@ export interface IInteractiveOptions {
|
|
|
41
41
|
vkVideoLoader?: (owner_id: string, video_id: string) => unknown;
|
|
42
42
|
createOneStat?: (video: any, configOverwrite?: any) => IOneStat | undefined;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* @deprecated
|
|
45
|
+
* */
|
|
46
46
|
disableControlsOnPause?: boolean;
|
|
47
|
+
animationFeatureToggles?: AnimationsFeatureToggles;
|
|
47
48
|
}
|
|
48
49
|
export type ChapterChangedData = {
|
|
49
50
|
chapter: Chapter;
|
|
@@ -60,12 +61,3 @@ export interface EachTickData {
|
|
|
60
61
|
currentTime: number;
|
|
61
62
|
isInteractiveTime: boolean;
|
|
62
63
|
}
|
|
63
|
-
export type IgnoreExpectState = {
|
|
64
|
-
isExpectTime: boolean;
|
|
65
|
-
hasOtherExpect: boolean;
|
|
66
|
-
hasOpenURIEvent: boolean;
|
|
67
|
-
hasOpenURIEventInCurrentContainer: boolean;
|
|
68
|
-
isAllOpenURIEventsValid: boolean;
|
|
69
|
-
isExpectEventForCurrentContainer: boolean;
|
|
70
|
-
hasShouldOpenNowEvent: boolean;
|
|
71
|
-
};
|
|
@@ -3,9 +3,8 @@ import { type IPlayer } from '@vkontakte/videoplayer-core';
|
|
|
3
3
|
import type { InteractiveEventsType } from './InteractiveEvents';
|
|
4
4
|
import type { ChapterBranch } from '../../../manifest';
|
|
5
5
|
import type { EventEmitter } from '../../../utils/EventEmitter';
|
|
6
|
+
import type { ChoiceContainer } from '../../../modules/Interactives/containers';
|
|
6
7
|
import type { SelectBranchesType } from './SelectBranches';
|
|
7
|
-
import type { IgnoreExpectState } from '../../../modules/Interactives/types';
|
|
8
|
-
import type { ChoiceContainer } from "../../../modules/Interactives/containers";
|
|
9
8
|
import { type GlobalEvents } from './events';
|
|
10
9
|
import { GameStates } from './gameUtils';
|
|
11
10
|
type ConstructorArg = {
|
|
@@ -16,9 +15,8 @@ type ConstructorArg = {
|
|
|
16
15
|
interactiveEvents: InteractiveEventsType;
|
|
17
16
|
globalEventEmitter: EventEmitter;
|
|
18
17
|
globalEvents: GlobalEvents;
|
|
19
|
-
|
|
18
|
+
ignoreContainerEvent: () => boolean;
|
|
20
19
|
permanentTextControls: boolean;
|
|
21
|
-
interactiveTimeOpenUri: boolean;
|
|
22
20
|
disabledControls$: IValueSubject<boolean>;
|
|
23
21
|
onRemove: () => void;
|
|
24
22
|
};
|
|
@@ -29,9 +27,8 @@ export declare class GameController {
|
|
|
29
27
|
subscription: ISubscription;
|
|
30
28
|
player: IPlayer;
|
|
31
29
|
interactiveEvents: InteractiveEventsType;
|
|
32
|
-
|
|
30
|
+
ignoreContainerEvent: () => boolean;
|
|
33
31
|
isPermanentText: boolean;
|
|
34
|
-
interactiveTimeOpenUri: boolean;
|
|
35
32
|
disabledControls$: IValueSubject<boolean>;
|
|
36
33
|
onRemove: () => void;
|
|
37
34
|
globalEventEmitter: EventEmitter;
|
|
@@ -39,7 +36,7 @@ export declare class GameController {
|
|
|
39
36
|
isSelectedControlEvent: boolean;
|
|
40
37
|
isSelectedContainerEvent: boolean;
|
|
41
38
|
globalEvents: GlobalEvents;
|
|
42
|
-
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter,
|
|
39
|
+
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }: ConstructorArg);
|
|
43
40
|
private emitContainerVisibilityEvent;
|
|
44
41
|
registerEvents(): void;
|
|
45
42
|
hide: () => void;
|
|
@@ -51,8 +48,7 @@ export declare class GameController {
|
|
|
51
48
|
onEndOfVideo: () => void;
|
|
52
49
|
whilePlaying: () => void;
|
|
53
50
|
reset(): void;
|
|
54
|
-
removeView(
|
|
55
|
-
fakeRemoveView(remove?: boolean): void;
|
|
51
|
+
removeView(): void;
|
|
56
52
|
destroy(): void;
|
|
57
53
|
}
|
|
58
54
|
export {};
|
|
@@ -7,7 +7,7 @@ type RemoveMethodParamType = Parameters<TGroupsStack['remove']>[0];
|
|
|
7
7
|
/**
|
|
8
8
|
* Executes an events at different times of the current chapter
|
|
9
9
|
*/
|
|
10
|
-
export declare function InteractiveEvents(player: IPlayer
|
|
10
|
+
export declare function InteractiveEvents(player: IPlayer): {
|
|
11
11
|
setPlayer: (player: IPlayer) => void;
|
|
12
12
|
add: (args: AddMethodParamType) => void;
|
|
13
13
|
remove: (args: RemoveMethodParamType) => void;
|
|
@@ -2,7 +2,7 @@ import type { Subject } from '@vkontakte/videoplayer-shared';
|
|
|
2
2
|
import type { ChapterChangedData, EachTickData, PlayerChangedData } from '../../../modules/Interactives/types';
|
|
3
3
|
import type { CustomError } from '../../../utils/Error';
|
|
4
4
|
import type { Manifest } from '../../../manifest';
|
|
5
|
-
import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved,
|
|
5
|
+
import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, SubjectName, TInteractivesVisibility } from './events.types';
|
|
6
6
|
export interface GlobalEvents {
|
|
7
7
|
noInteraction$: Subject<void>;
|
|
8
8
|
graphVisibilityChanged$: Subject<boolean>;
|
|
@@ -14,7 +14,6 @@ export interface GlobalEvents {
|
|
|
14
14
|
manifestChanged$: Subject<Manifest>;
|
|
15
15
|
interactiveRangeEnded$: Subject<TInteractiveRangeEndedEvent>;
|
|
16
16
|
interactiveContainerRemoved$: Subject<TInteractivesContainerRemoved>;
|
|
17
|
-
interactiveContainerFakeRemoved$: Subject<TInteractivesContainerFakeRemoved>;
|
|
18
17
|
interactiveActionExecution$: Subject<TInteractivesActionExecutionEvent<SubjectName>>;
|
|
19
18
|
interactiveActionChoice$: Subject<TInteractivesActionChoiceEvent<SubjectName>>;
|
|
20
19
|
interactiveVisibilityChanged$: Subject<TInteractivesVisibility<'container'>>;
|
|
@@ -74,6 +73,5 @@ export declare enum InteractivesEventTypes {
|
|
|
74
73
|
ACTION_EXECUTION = "action-execution",
|
|
75
74
|
VISIBILITY = "visibility",
|
|
76
75
|
CONTAINER_REMOVED = "container-removed",
|
|
77
|
-
CONTAINER_FAKE_REMOVED = "container-fake-removed",
|
|
78
76
|
RANGE_ENDED = "range-ended"
|
|
79
77
|
}
|
|
@@ -12,7 +12,6 @@ type InteractiveEventType<T extends SubjectName> = T extends 'container' ? Inter
|
|
|
12
12
|
type TInteractiveCommon<T extends SubjectName, U extends InteractiveEventType<T>> = {
|
|
13
13
|
subjectId: string;
|
|
14
14
|
subjectName: T;
|
|
15
|
-
removeAllOpenURI?: boolean;
|
|
16
15
|
type: U;
|
|
17
16
|
};
|
|
18
17
|
export type TInteractivesVisibility<T extends Exclude<SubjectName, 'chapter'>> = TInteractiveCommon<T, InteractivesEventTypes.VISIBILITY> & {
|
|
@@ -48,4 +47,3 @@ export type TInteractivesActionChoiceEvent<T extends SubjectName> = TInteractive
|
|
|
48
47
|
payload: TInteractivesActionChoiceEventPayload<T>;
|
|
49
48
|
};
|
|
50
49
|
export type TInteractivesContainerRemoved = TInteractiveCommon<'container', InteractivesEventTypes.CONTAINER_REMOVED>;
|
|
51
|
-
export type TInteractivesContainerFakeRemoved = TInteractiveCommon<'container', InteractivesEventTypes.CONTAINER_FAKE_REMOVED>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Control, type Chapter, type ChapterContainer } from '../../../manifest';
|
|
2
2
|
import type { GameController } from './GameController';
|
|
3
|
-
import type { IgnoreExpectState } from '../../../modules/Interactives/types';
|
|
4
3
|
export declare enum GameStates {
|
|
5
4
|
nothing = 0,
|
|
6
5
|
beforeInteractive = 1,
|
|
@@ -25,5 +24,5 @@ export declare function excludeTextControl(containers?: ChapterContainer[]): Cha
|
|
|
25
24
|
export declare const isEOVEndTime: (target: HTMLVideoElement, endTime: ChapterContainer["endTime"]) => boolean;
|
|
26
25
|
export declare function partial<T extends unknown[], U extends unknown[], R>(fn: (...args: [...T, ...U]) => R, ...presetArgs: T): (...laterArgs: U) => R;
|
|
27
26
|
export declare function partial<T extends Record<string, unknown>, P extends Partial<T>>(fn: (args: T) => unknown, presetArgs: P): (laterArgs: Omit<T, keyof P>) => ReturnType<typeof fn>;
|
|
28
|
-
export declare const
|
|
27
|
+
export declare const shouldIgnoreContainerEvent: (container: ChapterContainer, gameControllers: GameController[]) => boolean;
|
|
29
28
|
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { type Container } from '../../../manifest';
|
|
2
|
-
export type Subject = {
|
|
3
|
-
id: string;
|
|
4
|
-
isRemoved: boolean;
|
|
5
|
-
};
|
|
6
2
|
export type InteractiveRange = {
|
|
7
|
-
subjects:
|
|
3
|
+
subjects: string[];
|
|
8
4
|
range: [number, number];
|
|
9
5
|
};
|
|
10
6
|
export type InteractiveRanges = Array<InteractiveRange>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { type Control } from '../../../manifest';
|
|
2
2
|
import { type Dimensions } from '../../../modules/Interactives/controls';
|
|
3
3
|
export declare const classnamesPrefix = "interactive";
|
|
4
|
-
export declare const rootElClassName = "interactive-controls-container";
|
|
5
|
-
export declare const getRootEl: () => Element | null;
|
|
6
|
-
export declare const DISABLE_OPACITY = 0.4;
|
|
7
4
|
export declare const controlStylesFallbacks: {
|
|
8
5
|
textColor: string;
|
|
9
6
|
textSize: number;
|