@flowplayer/spins 0.1.0-rc.4 → 0.1.0-rc.7
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.js +44 -18925
- package/dist/types.d.ts +75 -0
- package/package.json +17 -6
- package/dist/events.d.ts +0 -8
- package/dist/index.d.ts +0 -3
- package/dist/loader.d.ts +0 -3
- package/dist/ovp/types.d.ts +0 -18
- package/dist/ovp/utils.d.ts +0 -5
- package/dist/ovp/wants.d.ts +0 -5
- package/dist/schemas.d.ts +0 -49
- package/dist/scroll-handler.d.ts +0 -2
- package/dist/source.d.ts +0 -17
- package/dist/src-manager.d.ts +0 -4
- package/dist/ui/container.d.ts +0 -5
- package/dist/ui/menu-dialog.d.ts +0 -48
- package/dist/ui/player.d.ts +0 -13
- package/dist/ui/spin-container.d.ts +0 -4
- package/dist/utils.d.ts +0 -10
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Config } from '@flowplayer/player';
|
|
2
|
+
import { PlayerIMAConfig } from '@flowplayer/player/plugins/ads';
|
|
3
|
+
import { ConsentConfig } from '@flowplayer/player/plugins/consent';
|
|
4
|
+
import { ShareConfig } from '@flowplayer/player/plugins/share';
|
|
5
|
+
import { SubtitlesConfig } from '@flowplayer/player/plugins/subtitles';
|
|
6
|
+
import { ThumbnailsConfig } from '@flowplayer/player/plugins/thumbnails';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted when a new spin is created.
|
|
10
|
+
*/
|
|
11
|
+
declare const SPIN_CREATED = "spin:created";
|
|
12
|
+
/**
|
|
13
|
+
* Emitted when a different spin enters the viewport.
|
|
14
|
+
*/
|
|
15
|
+
declare const SPIN_IN_VIEWPORT = "spin:viewport";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* All supported plugin identifiers for configuring the player.
|
|
19
|
+
*/
|
|
20
|
+
declare const PlayerPlugins: readonly ["subtitles", "vtsel", "ads", "share", "thumbnails", "asel", "qsel"];
|
|
21
|
+
|
|
22
|
+
interface SpinsConfig {
|
|
23
|
+
playlist: string | Array<SpinItem>;
|
|
24
|
+
lang?: Config["lang"];
|
|
25
|
+
token?: Config["token"];
|
|
26
|
+
ui?: Config["ui"];
|
|
27
|
+
ima?: PlayerIMAConfig;
|
|
28
|
+
share?: ShareConfig["share"];
|
|
29
|
+
consent?: ConsentConfig["consent"];
|
|
30
|
+
/**
|
|
31
|
+
* A list of plugins to configure the player.
|
|
32
|
+
* @default ["subtitles", "vtsel", "ads", "share", "thumbnails", "asel"]
|
|
33
|
+
*/
|
|
34
|
+
plugins?: (typeof PlayerPlugins)[number][];
|
|
35
|
+
}
|
|
36
|
+
interface SpinItem {
|
|
37
|
+
url: string | {
|
|
38
|
+
src: string;
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
title?: Config["title"];
|
|
42
|
+
poster?: Config["poster"];
|
|
43
|
+
description?: Config["description"];
|
|
44
|
+
subtitles?: SubtitlesConfig["subtitles"];
|
|
45
|
+
thumbnails?: ThumbnailsConfig["thumbnails"];
|
|
46
|
+
}
|
|
47
|
+
type SpinEventData = {
|
|
48
|
+
config: SpinItem;
|
|
49
|
+
spin: HTMLElement;
|
|
50
|
+
};
|
|
51
|
+
interface SpinsContainer extends HTMLDivElement {
|
|
52
|
+
/**
|
|
53
|
+
* Ads a listener for the SpinsEvents["SPIN_CREATED"] event
|
|
54
|
+
*/
|
|
55
|
+
on(e: typeof SPIN_CREATED, handler: (e: CustomEvent<SpinEventData>) => void, options?: boolean | AddEventListenerOptions): void;
|
|
56
|
+
/**
|
|
57
|
+
* Ads a listener for the SpinsEvents["SPIN_IN_VIEWPORT"] event.
|
|
58
|
+
*/
|
|
59
|
+
on(e: typeof SPIN_IN_VIEWPORT, handler: (e: CustomEvent<SpinEventData>) => void, options?: boolean | AddEventListenerOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Removes a listener for the SpinsEvents["SPIN_IN_VIEWPORT"] event
|
|
62
|
+
*/
|
|
63
|
+
off<T>(e: typeof SPIN_IN_VIEWPORT, handler: (e: CustomEvent<T>) => void): void;
|
|
64
|
+
/**
|
|
65
|
+
* Removes a listener for the SpinsEvents["SPIN_CREATED"] event
|
|
66
|
+
*/
|
|
67
|
+
off<T>(e: typeof SPIN_CREATED, handler: (e: CustomEvent<T>) => void): void;
|
|
68
|
+
}
|
|
69
|
+
declare const events: {
|
|
70
|
+
SPIN_IN_VIEWPORT: typeof SPIN_IN_VIEWPORT;
|
|
71
|
+
SPIN_CREATED: typeof SPIN_CREATED;
|
|
72
|
+
};
|
|
73
|
+
declare function createSpins(config: SpinsConfig): SpinsContainer;
|
|
74
|
+
|
|
75
|
+
export { type SpinEventData, type SpinItem, type SpinsConfig, type SpinsContainer, createSpins, events };
|
package/package.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowplayer/spins",
|
|
3
3
|
"module": "dist/index.js",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.7",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"types": "./dist/types.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/types.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/**/*"
|
|
16
|
+
],
|
|
6
17
|
"scripts": {
|
|
7
|
-
"build": "rm -rf dist/ && bun ./build.ts && bun run build:dts",
|
|
8
|
-
"build:dts": "
|
|
18
|
+
"build": "rm -rf dist/ && bun ./bundler/bin/build.ts && bun run build:dts",
|
|
19
|
+
"build:dts": "tsup src/types.ts --dts-only --format esm",
|
|
9
20
|
"storybook": "storybook dev -p 6006",
|
|
10
21
|
"lint": "bunx @biomejs/biome check --write .",
|
|
11
22
|
"fix:unsafe": "bunx @biomejs/biome check --unsafe --write .",
|
|
@@ -14,9 +25,6 @@
|
|
|
14
25
|
"test": "bun run vitest",
|
|
15
26
|
"prepare": "bun run build"
|
|
16
27
|
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist/**/*"
|
|
19
|
-
],
|
|
20
28
|
"devDependencies": {
|
|
21
29
|
"@biomejs/biome": "2.1.1",
|
|
22
30
|
"@chromatic-com/storybook": "^4.0.1",
|
|
@@ -27,7 +35,9 @@
|
|
|
27
35
|
"@types/bun": "latest",
|
|
28
36
|
"@vitest/browser": "^3.2.4",
|
|
29
37
|
"@vitest/coverage-v8": "^3.2.4",
|
|
38
|
+
"chromatic": "^13.1.2",
|
|
30
39
|
"husky": "^9.1.7",
|
|
40
|
+
"tsup": "^8.5.0",
|
|
31
41
|
"lit": "^3.3.0",
|
|
32
42
|
"playwright": "^1.53.2",
|
|
33
43
|
"storybook": "^9.0.16",
|
|
@@ -38,6 +48,7 @@
|
|
|
38
48
|
},
|
|
39
49
|
"dependencies": {
|
|
40
50
|
"@flowplayer/player": "^3.28.2",
|
|
51
|
+
"@flowplayer/translations": "^2.2.0",
|
|
41
52
|
"zod": "^3.25.76"
|
|
42
53
|
}
|
|
43
54
|
}
|
package/dist/events.d.ts
DELETED
package/dist/index.d.ts
DELETED
package/dist/loader.d.ts
DELETED
package/dist/ovp/types.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SpinConfig } from "../types";
|
|
2
|
-
export type PlaylistResponse = {
|
|
3
|
-
playlist: VODResponse[];
|
|
4
|
-
};
|
|
5
|
-
export type VODResponse = SpinConfig & {
|
|
6
|
-
metadata: OVPMetadata;
|
|
7
|
-
};
|
|
8
|
-
type OVPMetadata = {
|
|
9
|
-
player_id?: string;
|
|
10
|
-
media_id?: string;
|
|
11
|
-
ad_keywords?: string;
|
|
12
|
-
title?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
category_name?: string;
|
|
15
|
-
duration?: number;
|
|
16
|
-
tags?: string;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
package/dist/ovp/utils.d.ts
DELETED
package/dist/ovp/wants.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SourceObj } from "@flowplayer/player";
|
|
2
|
-
export declare function match_flowplayer_ovp_id(src: string, data: SourceObj): boolean;
|
|
3
|
-
export declare function match_legacy_id(src: string, data?: SourceObj): boolean;
|
|
4
|
-
export declare function match_base64(data: SourceObj): boolean;
|
|
5
|
-
export declare function wants(src: string, data: SourceObj): boolean;
|
package/dist/schemas.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const FlowplayerPlaylistSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodString;
|
|
4
|
-
title: z.ZodString;
|
|
5
|
-
description: z.ZodOptional<z.ZodString>;
|
|
6
|
-
videos: z.ZodArray<z.ZodObject<{
|
|
7
|
-
id: z.ZodString;
|
|
8
|
-
title: z.ZodString;
|
|
9
|
-
duration: z.ZodNumber;
|
|
10
|
-
thumbnail: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
title: string;
|
|
13
|
-
duration: number;
|
|
14
|
-
id: string;
|
|
15
|
-
thumbnail: string;
|
|
16
|
-
}, {
|
|
17
|
-
title: string;
|
|
18
|
-
duration: number;
|
|
19
|
-
id: string;
|
|
20
|
-
thumbnail: string;
|
|
21
|
-
}>, "many">;
|
|
22
|
-
created_at: z.ZodString;
|
|
23
|
-
updated_at: z.ZodString;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
title: string;
|
|
26
|
-
id: string;
|
|
27
|
-
videos: {
|
|
28
|
-
title: string;
|
|
29
|
-
duration: number;
|
|
30
|
-
id: string;
|
|
31
|
-
thumbnail: string;
|
|
32
|
-
}[];
|
|
33
|
-
created_at: string;
|
|
34
|
-
updated_at: string;
|
|
35
|
-
description?: string | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
title: string;
|
|
38
|
-
id: string;
|
|
39
|
-
videos: {
|
|
40
|
-
title: string;
|
|
41
|
-
duration: number;
|
|
42
|
-
id: string;
|
|
43
|
-
thumbnail: string;
|
|
44
|
-
}[];
|
|
45
|
-
created_at: string;
|
|
46
|
-
updated_at: string;
|
|
47
|
-
description?: string | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
export type FlowplayerPlaylist = z.infer<typeof FlowplayerPlaylistSchema>;
|
package/dist/scroll-handler.d.ts
DELETED
package/dist/source.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { SourceList, SourceObj, SourceStr, UnsafeSource } from "@flowplayer/player";
|
|
2
|
-
import type { DRMSource } from "@flowplayer/player/plugins/drm";
|
|
3
|
-
/**
|
|
4
|
-
* fetches the extension name from a path
|
|
5
|
-
*/
|
|
6
|
-
export declare function extname(url: string): string | false;
|
|
7
|
-
/**
|
|
8
|
-
* map guessed mime types
|
|
9
|
-
* to valid mime types
|
|
10
|
-
*/
|
|
11
|
-
export declare function lookup(type: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* parses a source to a Array<{src, type}>
|
|
14
|
-
*/
|
|
15
|
-
export declare function parse(src: SourceStr): Array<DRMSource>;
|
|
16
|
-
export declare function from_obj({ src, type, ...rest }: SourceObj): Array<SourceObj>;
|
|
17
|
-
export declare function normalize_src(sources: UnsafeSource): SourceList;
|
package/dist/src-manager.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SpinConfig, SpinsContainer } from "./types";
|
|
2
|
-
import type { SpinsPlayer } from "./ui/player";
|
|
3
|
-
export declare function updatePrimaryPlayer(container: SpinsContainer, items: SpinConfig[], player: SpinsPlayer, index: number): void;
|
|
4
|
-
export declare function updateSecondaryPlayer(container: SpinsContainer, items: SpinConfig[], primaryPlayer: SpinsPlayer, secondaryPlayer: SpinsPlayer, index: number): void;
|
package/dist/ui/container.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SpinsContainer } from "../types";
|
|
2
|
-
import type { SpinsPlayer } from "./player";
|
|
3
|
-
export declare function createContainer(): SpinsContainer;
|
|
4
|
-
export declare function waitUntilInDOM(container: HTMLElement): Promise<void>;
|
|
5
|
-
export declare function onWindowResize(container: HTMLElement, players: SpinsPlayer[]): void;
|
package/dist/ui/menu-dialog.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { SpinsPlayer } from "./player";
|
|
2
|
-
export type FlowplayerMenu = HTMLElement & {
|
|
3
|
-
menu: HTMLDivElement;
|
|
4
|
-
menuHeader: HTMLElement;
|
|
5
|
-
};
|
|
6
|
-
declare enum FlowplayerSubtitlesMenuState {
|
|
7
|
-
main = 0,
|
|
8
|
-
tracks = 1,
|
|
9
|
-
style = 2,
|
|
10
|
-
styleOpt = 3
|
|
11
|
-
}
|
|
12
|
-
declare enum MenuType {
|
|
13
|
-
asel = 0,
|
|
14
|
-
subtitles = 1,
|
|
15
|
-
qsel = 2,
|
|
16
|
-
vtsel = 3,
|
|
17
|
-
speed = 4
|
|
18
|
-
}
|
|
19
|
-
type FlowplayerSubtitlesMenu = FlowplayerMenu & {
|
|
20
|
-
createMenu: (state: FlowplayerSubtitlesMenuState) => void;
|
|
21
|
-
};
|
|
22
|
-
export declare class MenuDialog extends HTMLElement {
|
|
23
|
-
menuContainer: HTMLDetailsElement;
|
|
24
|
-
summaryEle: HTMLElement;
|
|
25
|
-
mainMenu: HTMLDivElement;
|
|
26
|
-
menuHeader: HTMLDivElement;
|
|
27
|
-
menuTitle: HTMLHeadElement;
|
|
28
|
-
olEle: HTMLOListElement;
|
|
29
|
-
closeEle: HTMLSpanElement;
|
|
30
|
-
player: SpinsPlayer;
|
|
31
|
-
constructor(player: SpinsPlayer);
|
|
32
|
-
appendMenu(menuComponent: FlowplayerMenu): void;
|
|
33
|
-
createDialogOpt(menuComponent: FlowplayerMenu | FlowplayerSubtitlesMenu): void;
|
|
34
|
-
toggleDialogOpt(submenu: HTMLDivElement, dialogOpt: HTMLLIElement, type?: MenuType): void;
|
|
35
|
-
addSubMenuBackButton(menuHeader: HTMLElement): void;
|
|
36
|
-
openMenu(menu_to_open: HTMLElement): void;
|
|
37
|
-
toggleMenuDialog(open: boolean): void;
|
|
38
|
-
toggleVisibility(): void;
|
|
39
|
-
onMenuClick(ev: MouseEvent): void;
|
|
40
|
-
onFocus(ev: FocusEvent): void;
|
|
41
|
-
onOptClick(menuComponent: FlowplayerMenu, ev: MouseEvent): void;
|
|
42
|
-
onSubtitlesOptClick(menuComponent: FlowplayerSubtitlesMenu, ev: MouseEvent): void;
|
|
43
|
-
onRootClick(ev: MouseEvent): void;
|
|
44
|
-
onKeyboardCloseMenu(ev: Event): void;
|
|
45
|
-
detectSubMenuType(classList: DOMTokenList): MenuType | undefined;
|
|
46
|
-
findSubMenuOptionsEvent(type: MenuType): "" | "audio:tracks" | "quality:tracks" | "speed:options" | "subs:tracks" | "video:tracks";
|
|
47
|
-
}
|
|
48
|
-
export {};
|
package/dist/ui/player.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Config, FlowplayerUMDWithPlugins, Player, PlayerState } from "@flowplayer/player";
|
|
2
|
-
import type Hls from "hls.js";
|
|
3
|
-
export type SpinsPlayer = Player & {
|
|
4
|
-
hls?: Hls;
|
|
5
|
-
original_src: string;
|
|
6
|
-
hasState(state: PlayerState): boolean;
|
|
7
|
-
opts: Config & {
|
|
8
|
-
is_native?: boolean;
|
|
9
|
-
};
|
|
10
|
-
opt?<T>(key: string, fallback?: T): T;
|
|
11
|
-
};
|
|
12
|
-
export declare function createPlayer(umd: FlowplayerUMDWithPlugins, config: Config): SpinsPlayer;
|
|
13
|
-
export declare function adjustControlsBar(player: Player): void;
|
package/dist/utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Player } from "@flowplayer/player";
|
|
2
|
-
import type { SpinsPlayer } from "./ui/player";
|
|
3
|
-
export declare function getSpins(): HTMLElement[];
|
|
4
|
-
export declare function getPlayerSpin(player: Player): HTMLElement;
|
|
5
|
-
export declare function getSpinInViewportIndex(container: HTMLElement, spins: HTMLElement[]): number;
|
|
6
|
-
export declare function positionPlayerFromTop(player: SpinsPlayer, container: HTMLElement, spin: HTMLElement): void;
|
|
7
|
-
export declare function getPlayers(container: HTMLElement, currentSpinIndex: string): {
|
|
8
|
-
primaryPlayer: SpinsPlayer;
|
|
9
|
-
secondaryPlayer: SpinsPlayer;
|
|
10
|
-
};
|