@moq/ui-core 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.
@@ -0,0 +1,49 @@
1
+ import type { ProviderContext } from "../types";
2
+ import { BaseProvider } from "./base";
3
+ /**
4
+ * Provider for network metrics (connection type, bandwidth, latency)
5
+ */
6
+ export declare class NetworkProvider extends BaseProvider {
7
+ /** Polling interval in milliseconds */
8
+ private static readonly POLLING_INTERVAL_MS;
9
+ /** Display context for updating metrics */
10
+ private context;
11
+ /** Network information from navigator.connection */
12
+ private networkInfo?;
13
+ /** Polling interval ID */
14
+ private updateInterval?;
15
+ private readonly boundUpdateDisplayData;
16
+ /**
17
+ * Initialize network provider with connection listeners
18
+ */
19
+ setup(context: ProviderContext): void;
20
+ /**
21
+ * Clean up event listeners and polling interval
22
+ */
23
+ cleanup(): void;
24
+ /**
25
+ * Calculate and display current network metrics
26
+ */
27
+ private updateDisplayData;
28
+ /**
29
+ * Get formatted connection type
30
+ * @returns Connection type or null if unavailable
31
+ */
32
+ private getConnectionType;
33
+ /**
34
+ * Get formatted bandwidth in Mbps or Gbps
35
+ * @returns Bandwidth string or null if unavailable
36
+ */
37
+ private getEffectiveBandwidth;
38
+ /**
39
+ * Get formatted round-trip latency
40
+ * @returns Latency string or null if unavailable
41
+ */
42
+ private getLatency;
43
+ /**
44
+ * Get data saver mode status
45
+ * @returns Data saver indicator or null if disabled
46
+ */
47
+ private getSaveDataStatus;
48
+ }
49
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/stats/providers/network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAkCtC;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAChD,uCAAuC;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAO;IAClD,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAA8B;IAC7C,oDAAoD;IACpD,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,0BAA0B;IAC1B,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAqC;IAE5E;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAoBrC;;OAEG;IACM,OAAO,IAAI,IAAI;IAYxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAa7B;;;OAGG;IACH,OAAO,CAAC,UAAU;IAKlB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAGzB"}
@@ -0,0 +1,17 @@
1
+ import type { KnownStatsProviders, ProviderProps } from "../types";
2
+ import type { BaseProvider } from "./base";
3
+ /**
4
+ * Constructor type for metric provider classes
5
+ */
6
+ export type ProviderConstructor = new (props: ProviderProps) => BaseProvider;
7
+ /**
8
+ * Registry mapping metric types to their provider implementations
9
+ */
10
+ export declare const providers: Record<KnownStatsProviders, ProviderConstructor>;
11
+ /**
12
+ * Get provider class for a metric type
13
+ * @param statProvider - Metric type identifier
14
+ * @returns Provider constructor or undefined if not found
15
+ */
16
+ export declare function getStatsInformationProvider(statProvider: KnownStatsProviders): ProviderConstructor | undefined;
17
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/stats/providers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAK3C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,KAAK,EAAE,aAAa,KAAK,YAAY,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAKtE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS,CAE9G"}
@@ -0,0 +1,33 @@
1
+ import type { ProviderContext } from "../types";
2
+ import { BaseProvider } from "./base";
3
+ /**
4
+ * Provider for video stream metrics (resolution, frame rate, bitrate)
5
+ */
6
+ export declare class VideoProvider extends BaseProvider {
7
+ /** Polling interval in milliseconds */
8
+ private static readonly POLLING_INTERVAL_MS;
9
+ /** Display context for updating metrics */
10
+ private context;
11
+ /** Polling interval ID */
12
+ private updateInterval;
13
+ /** Bound callback for display updates */
14
+ /** Previous frame count for FPS calculation */
15
+ private previousFrameCount;
16
+ /** Previous bytes received for bitrate calculation */
17
+ private previousBytesReceived;
18
+ /** Previous timestamp for accurate elapsed time calculation in bitrate */
19
+ private previousWhen;
20
+ /**
21
+ * Initialize video provider with polling interval
22
+ */
23
+ setup(context: ProviderContext): void;
24
+ /**
25
+ * Calculate and display current video metrics
26
+ */
27
+ private updateDisplayData;
28
+ /**
29
+ * Clean up polling interval
30
+ */
31
+ cleanup(): void;
32
+ }
33
+ //# sourceMappingURL=video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/stats/providers/video.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC9C,uCAAuC;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAO;IAClD,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAA8B;IAC7C,0BAA0B;IAC1B,OAAO,CAAC,cAAc,CAAqB;IAC3C,yCAAyC;IACzC,+CAA+C;IAC/C,OAAO,CAAC,kBAAkB,CAAK;IAC/B,sDAAsD;IACtD,OAAO,CAAC,qBAAqB,CAAK;IAClC,0EAA0E;IAC1E,OAAO,CAAC,YAAY,CAAK;IAEzB;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAcrC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyDzB;;OAEG;IACM,OAAO,IAAI,IAAI;CAMxB"}
@@ -0,0 +1,53 @@
1
+ export type KnownStatsProviders = "network" | "video" | "audio" | "buffer";
2
+ /**
3
+ * A value that can be synchronously read via peek().
4
+ * Matches @moq/signals Getter interface structurally.
5
+ */
6
+ interface Peekable<T> {
7
+ peek(): T;
8
+ }
9
+ /**
10
+ * Context passed to providers for updating display data
11
+ */
12
+ export interface ProviderContext {
13
+ setDisplayData: (data: string) => void;
14
+ }
15
+ /**
16
+ * Structural interface for an audio backend, matching what stats providers need.
17
+ */
18
+ export interface AudioBackend {
19
+ source: {
20
+ track: Peekable<unknown>;
21
+ config: Peekable<{
22
+ sampleRate?: number;
23
+ numberOfChannels?: number;
24
+ codec?: string;
25
+ } | undefined>;
26
+ };
27
+ stats: Peekable<{
28
+ bytesReceived: number;
29
+ } | undefined>;
30
+ }
31
+ /**
32
+ * Structural interface for a video backend, matching what stats providers need.
33
+ */
34
+ export interface VideoBackend {
35
+ source: {
36
+ catalog: Peekable<{
37
+ display?: {
38
+ width: number;
39
+ height: number;
40
+ };
41
+ } | undefined>;
42
+ };
43
+ stats: Peekable<{
44
+ frameCount: number;
45
+ bytesReceived: number;
46
+ } | undefined>;
47
+ }
48
+ export type ProviderProps = {
49
+ audio: AudioBackend;
50
+ video: VideoBackend;
51
+ };
52
+ export {};
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stats/types.ts"],"names":[],"mappings":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