mediafuse 0.1.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/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2026, Bailey "monokrome" Stoner
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ import type { PluginContext } from "./types.js";
2
+ export type SetupFn = (ctx: PluginContext) => void;
3
+ export type DefinePluginFn = (name: string, setup: SetupFn) => void;
4
+ //# sourceMappingURL=define-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-plugin.d.ts","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,KACX,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=define-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-plugin.js","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type { DefinePluginFn, SetupFn } from "./define-plugin.js";
2
+ export type { StoredMessage, Track, States, PluginType, PluginEvent, PluginEventMap, CreateContext, PluginHandlers, PluginEntry, PluginManifest, RegisterFn, PluginContext, } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,YAAY,EACV,aAAa,EACb,KAAK,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ export interface StoredMessage {
2
+ title: string;
3
+ subtitle: string;
4
+ type: string | null;
5
+ timestamp: number;
6
+ expiresAt: number | null;
7
+ }
8
+ export interface Track {
9
+ artist: string;
10
+ title: string;
11
+ album: string;
12
+ }
13
+ export type States = Record<string, Record<string, unknown>>;
14
+ export type PluginType = "data" | "overlay";
15
+ export type PluginEventMap = {
16
+ message: StoredMessage | null;
17
+ nowPlaying: Track | null;
18
+ stateChange: States;
19
+ command: {
20
+ name: string;
21
+ data: unknown;
22
+ };
23
+ resize: {
24
+ width: number;
25
+ height: number;
26
+ };
27
+ tick: number;
28
+ config: PluginManifest;
29
+ };
30
+ export type PluginEvent = keyof PluginEventMap;
31
+ export interface CreateContext {
32
+ container: HTMLDivElement | null;
33
+ config: Record<string, unknown>;
34
+ states: States;
35
+ emit: (<E extends PluginEvent>(event: E, data: PluginEventMap[E]) => void) | null;
36
+ }
37
+ export type PluginHandlers = {
38
+ [E in PluginEvent as `on${Capitalize<E>}`]?: (data: PluginEventMap[E]) => void;
39
+ } & {
40
+ onCreate?: (ctx: CreateContext) => void;
41
+ onDestroy?: () => void;
42
+ };
43
+ export interface PluginEntry {
44
+ src: string;
45
+ name?: string;
46
+ allowTypes?: PluginType[];
47
+ config?: Record<string, unknown>;
48
+ }
49
+ export interface PluginManifest {
50
+ v: number;
51
+ plugins: PluginEntry[];
52
+ blocks: unknown[];
53
+ config: Record<string, unknown>;
54
+ }
55
+ export type RegisterFn = (type: PluginType, handlers: PluginHandlers) => boolean;
56
+ export interface PluginContext {
57
+ register: RegisterFn;
58
+ manifest: PluginManifest;
59
+ }
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG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AAG;IACF,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,cAAc,KACrB,OAAO,CAAC;AAEb,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;CAC1B"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "mediafuse",
3
+ "version": "0.1.0",
4
+ "description": "Plugin SDK for MediaFuse stream overlays",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "devDependencies": {
24
+ "@vitest/coverage-v8": "^4.0.18",
25
+ "typescript": "^5.7.0",
26
+ "vitest": "^4.0.18"
27
+ },
28
+ "license": "BSD-2-Clause",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/monokrome/mediafuse-sdk"
32
+ }
33
+ }