@vkontakte/videoplayer-interactive 1.0.30-dev.a221ed50.0 → 1.0.30-dev.b736679d.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.
Files changed (37) hide show
  1. package/es2015.cjs.js +233 -5
  2. package/es2015.esm.js +234 -6
  3. package/es2018.cjs.js +234 -6
  4. package/es2018.esm.js +233 -5
  5. package/esnext.cjs.js +234 -6
  6. package/esnext.esm.js +234 -6
  7. package/evergreen.esm.js +234 -6
  8. package/package.json +4 -4
  9. package/types/modules/Interactives/Interactives.d.ts +19 -9
  10. package/types/modules/Interactives/Layout.d.ts +4 -0
  11. package/types/modules/Interactives/containers/ChoiceContainer.d.ts +16 -7
  12. package/types/modules/Interactives/containers/Container.d.ts +9 -6
  13. package/types/modules/Interactives/controls/AreaControl.d.ts +22 -2
  14. package/types/modules/Interactives/controls/ButtonControl.d.ts +27 -2
  15. package/types/modules/Interactives/controls/Control.d.ts +22 -9
  16. package/types/modules/Interactives/controls/types.d.ts +21 -7
  17. package/types/modules/Interactives/index.d.ts +69 -4
  18. package/types/modules/Interactives/styles.d.ts +1 -0
  19. package/types/modules/Interactives/types.d.ts +12 -12
  20. package/types/modules/Interactives/utils/BlinkAnimationReference.d.ts +2 -0
  21. package/types/modules/Interactives/utils/FillAnimation.d.ts +30 -0
  22. package/types/modules/Interactives/utils/GameController.d.ts +16 -12
  23. package/types/modules/Interactives/utils/InteractiveEvents.d.ts +3 -3
  24. package/types/modules/Interactives/utils/SelectBranches.d.ts +2 -1
  25. package/types/modules/Interactives/utils/SelectBranches.types.d.ts +1 -0
  26. package/types/modules/Interactives/utils/TapElement.d.ts +10 -0
  27. package/types/modules/Interactives/utils/events.d.ts +0 -1
  28. package/types/modules/Interactives/utils/events.types.d.ts +3 -1
  29. package/types/modules/Interactives/utils/gameUtils.d.ts +1 -2
  30. package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -5
  31. package/types/modules/Interactives/utils/renderingUtils.d.ts +15 -3
  32. package/types/utils/AverageColor/FrameAverageColor.d.ts +19 -0
  33. package/types/utils/AverageColor/helpers.d.ts +17 -0
  34. package/types/utils/AverageColor/index.d.ts +2 -0
  35. package/types/utils/getVideoContentSize.d.ts +1 -1
  36. package/types/utils/Binding.d.ts +0 -34
  37. package/types/utils/EventManager.d.ts +0 -13
@@ -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 evaluateContainerEventStatus: (container: ChapterContainer, gameControllers: GameController[]) => IgnoreExpectState;
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: Subject[];
3
+ subjects: string[];
8
4
  range: [number, number];
9
5
  };
10
6
  export type InteractiveRanges = Array<InteractiveRange>;
@@ -2,20 +2,23 @@ import { type Control } from '../../../manifest';
2
2
  import { type Dimensions } from '../../../modules/Interactives/controls';
3
3
  export declare const classnamesPrefix = "interactive";
4
4
  export declare const rootElClassName = "interactive-controls-container";
5
- export declare const getRootEl: () => Element | null;
6
- export declare const DISABLE_OPACITY = 0.4;
7
5
  export declare const controlStylesFallbacks: {
8
6
  textColor: string;
9
7
  textSize: number;
10
8
  textContent: string;
11
9
  roundCorners: number;
12
10
  borderWidth: number;
11
+ borderWidthRawValue: string;
12
+ roundCornersRawValue: string;
13
13
  borderColor: string;
14
14
  borderAlpha: number;
15
15
  backgroundColor: string;
16
16
  backgroundAlpha: number;
17
17
  innerSizesDependOn: string;
18
18
  angle: number;
19
+ shadowColorLight: string;
20
+ shadowColorDark: string;
21
+ shadowColorAlpha: number;
19
22
  };
20
23
  type ControlStylesFallbacks = typeof controlStylesFallbacks;
21
24
  export declare enum ALIGN_ITEMS {
@@ -58,8 +61,17 @@ type SetBorderStylesProps = {
58
61
  props: Control['props'];
59
62
  fallback: ControlStylesFallbacks;
60
63
  dependsOn: Dimensions;
64
+ useRawValues?: boolean;
61
65
  };
62
- export declare const setBorderStyles: ({ target, props, fallback, dependsOn }: SetBorderStylesProps) => void;
66
+ export declare const setBorderStyles: ({ target, props, fallback, dependsOn, useRawValues }: SetBorderStylesProps) => void;
67
+ type SetShadowStylesProps = {
68
+ target: HTMLElement;
69
+ props?: Control['props'];
70
+ fallback: ControlStylesFallbacks;
71
+ frameToneIsDark: boolean;
72
+ baseDimension: string;
73
+ };
74
+ export declare const setShadowStyles: ({ target, frameToneIsDark, baseDimension, fallback }: SetShadowStylesProps) => void;
63
75
  type SetAngleProps = {
64
76
  target: HTMLElement;
65
77
  fallback: ControlStylesFallbacks;
@@ -0,0 +1,19 @@
1
+ import { type Options } from './helpers';
2
+ export declare class FrameAverageColor {
3
+ canvas: HTMLCanvasElement | OffscreenCanvas | null;
4
+ ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;
5
+ getColorAsync(resource: HTMLVideoElement, options: Options): Promise<{
6
+ rgba: string;
7
+ isDark: boolean;
8
+ error: Error | undefined;
9
+ }>;
10
+ getColor(resource: HTMLVideoElement, options: Options): {
11
+ rgba: string;
12
+ isDark: boolean;
13
+ error: Error | undefined;
14
+ };
15
+ private getColorFromArray;
16
+ private sqrtAlgorithm;
17
+ private prepareResult;
18
+ destroy(): void;
19
+ }
@@ -0,0 +1,17 @@
1
+ export type Color = [number, number, number, number];
2
+ export type Options = {
3
+ width: number;
4
+ height: number;
5
+ step?: number;
6
+ defaultColor?: Color;
7
+ debug?: boolean;
8
+ };
9
+ export declare function makeCanvas(): OffscreenCanvas | HTMLCanvasElement | null;
10
+ export declare function isDark(color: Color): boolean;
11
+ export declare const DEFAULT_COLOR: Color;
12
+ export declare const DEFAULT_STEP = 1;
13
+ export declare function getError(message: string): Error;
14
+ export declare function getVideoContentSize(element: HTMLElement): {
15
+ width: number;
16
+ height: number;
17
+ };
@@ -0,0 +1,2 @@
1
+ export { FrameAverageColor } from './FrameAverageColor';
2
+ export { getVideoContentSize } from './helpers';
@@ -1,5 +1,5 @@
1
1
  import type { IPlayer } from '@vkontakte/videoplayer-core';
2
- export declare const getVideoContentSize: (containerEl: Element, player: IPlayer) => {
2
+ export declare const getVideoContentSize: (player: IPlayer) => {
3
3
  videoContentHeight: number;
4
4
  videoContentWidth: number;
5
5
  };
@@ -1,34 +0,0 @@
1
- import type { Nullable } from '@vkontakte/videoplayer-shared';
2
- import type { HtmlEventType } from '../types';
3
- type OptionsType = undefined | boolean | AddEventListenerOptions;
4
- export declare class Binding {
5
- target: Nullable<Element>;
6
- type: Nullable<HtmlEventType>;
7
- listener: Nullable<EventListener>;
8
- options: Nullable<OptionsType>;
9
- /**
10
- * passive = true -> function never call preventDefault()
11
- */
12
- constructor(target: Element, type: HtmlEventType, listener: EventListener, options: OptionsType);
13
- /**
14
- * Detaches the event listener from the event target. This does nothing if
15
- * the event listener is already detached.
16
- */
17
- unlisten(): void;
18
- /**
19
- * Converts the provided options value into a value accepted by the browser.
20
- * Some browsers (e.g. Tizen) don't support passing options as an
21
- * object. So this detects this case and converts it.
22
- */
23
- private static _convertOptions;
24
- /**
25
- * Checks whether the browser supports passing objects as the third argument
26
- * to addEventListener. This caches the result value in a static field to
27
- * avoid a bunch of checks.
28
- *
29
- * See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
30
- */
31
- private static _supportsObject;
32
- private static _doesSupportObject;
33
- }
34
- export {};
@@ -1,13 +0,0 @@
1
- import { Binding } from './Binding';
2
- import { MultiMap } from './MultiMap';
3
- import type { HtmlEventType } from '../types';
4
- type OptionsType = boolean | AddEventListenerOptions;
5
- export declare class EventManager {
6
- bindingMap: MultiMap<Binding> | null;
7
- release(): void;
8
- listen(target: Element, type: HtmlEventType, listener: EventListener, options?: OptionsType): void;
9
- listenOnce(target: Element, type: HtmlEventType, listener: EventListener, options?: OptionsType): void;
10
- unlisten(target: Element, type: HtmlEventType, listener: EventListener): void;
11
- removeAll(): void;
12
- }
13
- export {};