@flowplayer/spins 0.1.0-rc.10
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/README.md +220 -0
- package/dist/index.js +209 -0
- package/dist/types.d.ts +79 -0
- package/package.json +54 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
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 HTMLElement {
|
|
52
|
+
/**
|
|
53
|
+
* Adds 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
|
+
* Adds 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(e: typeof SPIN_IN_VIEWPORT, handler: (e?: CustomEvent<SpinEventData>) => void): void;
|
|
64
|
+
/**
|
|
65
|
+
* Removes a listener for the SpinsEvents["SPIN_CREATED"] event
|
|
66
|
+
*/
|
|
67
|
+
off(e: typeof SPIN_CREATED, handler: (e?: CustomEvent<SpinEventData>) => void): void;
|
|
68
|
+
/**
|
|
69
|
+
* Add more spins dynamically.
|
|
70
|
+
*/
|
|
71
|
+
addSpins(spins: SpinItem[]): void;
|
|
72
|
+
}
|
|
73
|
+
declare const events: {
|
|
74
|
+
SPIN_IN_VIEWPORT: typeof SPIN_IN_VIEWPORT;
|
|
75
|
+
SPIN_CREATED: typeof SPIN_CREATED;
|
|
76
|
+
};
|
|
77
|
+
declare function createSpins(config: SpinsConfig): SpinsContainer;
|
|
78
|
+
|
|
79
|
+
export { type SpinEventData, type SpinItem, type SpinsConfig, type SpinsContainer, createSpins, events };
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowplayer/spins",
|
|
3
|
+
"module": "dist/index.js",
|
|
4
|
+
"version": "0.1.0-rc.10",
|
|
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
|
+
],
|
|
17
|
+
"scripts": {
|
|
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",
|
|
20
|
+
"storybook": "storybook dev -p 6006",
|
|
21
|
+
"lint": "bunx @biomejs/biome check --write .",
|
|
22
|
+
"fix:unsafe": "bunx @biomejs/biome check --unsafe --write .",
|
|
23
|
+
"dev": "bun run storybook",
|
|
24
|
+
"build-storybook": "storybook build",
|
|
25
|
+
"test": "bun run vitest",
|
|
26
|
+
"prepare": "bun run build"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@biomejs/biome": "2.1.1",
|
|
30
|
+
"@chromatic-com/storybook": "^4.0.1",
|
|
31
|
+
"@storybook/addon-a11y": "^9.0.16",
|
|
32
|
+
"@storybook/addon-docs": "^9.0.16",
|
|
33
|
+
"@storybook/addon-vitest": "^9.0.16",
|
|
34
|
+
"@storybook/web-components-vite": "^9.0.16",
|
|
35
|
+
"@types/bun": "latest",
|
|
36
|
+
"@vitest/browser": "^3.2.4",
|
|
37
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
38
|
+
"chromatic": "^13.1.2",
|
|
39
|
+
"husky": "^9.1.7",
|
|
40
|
+
"tsup": "^8.5.0",
|
|
41
|
+
"lit": "^3.3.0",
|
|
42
|
+
"playwright": "^1.53.2",
|
|
43
|
+
"storybook": "^9.0.16",
|
|
44
|
+
"vitest": "^3.2.4"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"typescript": "5"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@flowplayer/player": "^3.28.2",
|
|
51
|
+
"@flowplayer/translations": "^2.2.0",
|
|
52
|
+
"zod": "^3.25.76"
|
|
53
|
+
}
|
|
54
|
+
}
|