@ldelia/react-media 0.4.3 → 0.4.5

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 (28) hide show
  1. package/dist/components/__tests__/timeline/timeline.test.d.ts +1 -0
  2. package/dist/components/index.d.ts +2 -0
  3. package/dist/components/reproduction-widget/ReproductionWidget.d.ts +17 -0
  4. package/dist/components/reproduction-widget/index.d.ts +2 -0
  5. package/dist/components/reproduction-widget/index.js +1 -0
  6. package/dist/components/reproduction-widget/inner-players/PlayAlongInnerPlayer.d.ts +8 -0
  7. package/dist/components/reproduction-widget/inner-players/YouTubeInnerPlayer.d.ts +10 -0
  8. package/dist/components/reproduction-widget/models/Player/PlayAlongPlayer.d.ts +30 -0
  9. package/dist/components/reproduction-widget/models/Player/PlayerEvents.d.ts +4 -0
  10. package/dist/components/reproduction-widget/models/Player/YouTubePlayer.d.ts +30 -0
  11. package/dist/components/reproduction-widget/models/Reproduction.d.ts +66 -0
  12. package/dist/components/reproduction-widget/models/ReproductionBuilder.d.ts +16 -0
  13. package/dist/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.d.ts +8 -0
  14. package/dist/components/timeline/Timeline.d.ts +12 -0
  15. package/dist/components/timeline/TimelineCanvas/TickTime.d.ts +7 -0
  16. package/dist/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.d.ts +6 -0
  17. package/dist/components/timeline/TimelineCanvas/TimelineCanvas.d.ts +7 -0
  18. package/dist/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.d.ts +2 -0
  19. package/dist/components/timeline/TimelineValue/TimelineValue.d.ts +7 -0
  20. package/dist/components/timeline/ZoomContext/ZoomContext.d.ts +7 -0
  21. package/dist/components/timeline/constants.d.ts +1 -0
  22. package/dist/components/timeline/index.d.ts +1 -0
  23. package/dist/components/timeline/utils/utils.d.ts +7 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/setupTests.d.ts +1 -0
  26. package/dist/stories/reproduction-widget.stories.d.ts +4 -0
  27. package/dist/stories/timeline.stories.d.ts +9 -0
  28. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export * from './reproduction-widget';
2
+ export * from './timeline';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Reproduction } from './models/Reproduction';
3
+ interface BaseProps {
4
+ trainingMode: boolean;
5
+ onInit: (reproduction: Reproduction) => void;
6
+ }
7
+ interface TrainingProps extends BaseProps {
8
+ trainingMode: true;
9
+ videoId: string;
10
+ }
11
+ interface NonTrainingProps extends BaseProps {
12
+ trainingMode: false;
13
+ videoId?: never;
14
+ }
15
+ export type ReproductionWidgetProps = TrainingProps | NonTrainingProps;
16
+ export declare const ReproductionWidget: ({ trainingMode, videoId, onInit, }: ReproductionWidgetProps) => React.JSX.Element;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './models/Reproduction';
2
+ export * from './ReproductionWidget';
@@ -1 +1,2 @@
1
+ export * from './models/Reproduction';
1
2
  export * from './ReproductionWidget';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ onReady: (event: {
4
+ target: string;
5
+ }) => void;
6
+ }
7
+ export declare const PlayAlongInnerPlayer: ({ onReady }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { YouTubePlayer as InnerYouTubePlayer } from 'react-youtube';
3
+ interface Props {
4
+ videoId: string;
5
+ onReady: (event: {
6
+ target: InnerYouTubePlayer;
7
+ }) => void;
8
+ }
9
+ export declare const YouTubeInnerPlayer: ({ videoId, onReady }: Props) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,30 @@
1
+ declare const dispatchOnReadyHandlers: unique symbol;
2
+ declare const dispatchOnFinishHandlers: unique symbol;
3
+ export declare class PlayAlongPlayer {
4
+ private readonly duration;
5
+ private currentTime;
6
+ private isRunning;
7
+ private currentPlaybackRate;
8
+ private innerPlayer;
9
+ private interval;
10
+ private [dispatchOnReadyHandlers];
11
+ private [dispatchOnFinishHandlers];
12
+ static get EVENTS(): {
13
+ readonly READY: "READY";
14
+ readonly FINISH: "FINISH";
15
+ };
16
+ constructor(duration: number, innerPlayer: string);
17
+ private setInnerPlayer;
18
+ play(): void;
19
+ pause(): void;
20
+ stop(): void;
21
+ seekTo(seconds: number): void;
22
+ getCurrentTime(): number;
23
+ getDuration(): number;
24
+ isAvailable(): boolean;
25
+ getAvailablePlaybackRates(): number[];
26
+ setPlaybackRate(playbackRate: number): void;
27
+ on(eventName: keyof typeof PlayAlongPlayer.EVENTS, handler: () => void): number | undefined;
28
+ dispatch(eventName: keyof typeof PlayAlongPlayer.EVENTS): void;
29
+ }
30
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const PLAYER_EVENTS: {
2
+ readonly READY: "READY";
3
+ readonly FINISH: "FINISH";
4
+ };
@@ -0,0 +1,30 @@
1
+ import { YouTubePlayer as InnerYouTubePlayer } from 'react-youtube';
2
+ import { PlayAlongPlayer } from './PlayAlongPlayer';
3
+ declare const dispatchOnReadyHandlers: unique symbol;
4
+ declare const dispatchOnFinishHandlers: unique symbol;
5
+ export declare class YouTubePlayer {
6
+ private currentTime;
7
+ private isRunning;
8
+ private innerPlayer;
9
+ private [dispatchOnReadyHandlers];
10
+ private [dispatchOnFinishHandlers];
11
+ static get EVENTS(): {
12
+ readonly READY: "READY";
13
+ readonly FINISH: "FINISH";
14
+ };
15
+ constructor(innerPlayer: InnerYouTubePlayer);
16
+ private setInnerPlayer;
17
+ getInnerPlayer(): any;
18
+ play(): void;
19
+ pause(): void;
20
+ stop(): void;
21
+ seekTo(seconds: number): void;
22
+ getCurrentTime(): any;
23
+ getDuration(): any;
24
+ getAvailablePlaybackRates(): any;
25
+ setPlaybackRate(playbackRate: number): void;
26
+ isAvailable(): boolean;
27
+ on(eventName: keyof typeof PlayAlongPlayer.EVENTS, handler: () => void): number | undefined;
28
+ dispatch(eventName: keyof typeof PlayAlongPlayer.EVENTS): void;
29
+ }
30
+ export {};
@@ -0,0 +1,66 @@
1
+ import { ReproductionBuilder } from './ReproductionBuilder';
2
+ import { PlayAlongPlayer } from './Player/PlayAlongPlayer';
3
+ import { YouTubePlayer } from './Player/YouTubePlayer';
4
+ type Player = PlayAlongPlayer | YouTubePlayer;
5
+ declare const dispatchOnReadyHandlers: unique symbol;
6
+ declare const dispatchOnSongStartHandlers: unique symbol;
7
+ declare const dispatchOnCountingInHandlers: unique symbol;
8
+ declare const dispatchOnPlayHandlers: unique symbol;
9
+ declare const dispatchOnPlayingHandlers: unique symbol;
10
+ declare const dispatchOnPausedHandlers: unique symbol;
11
+ declare const dispatchOnFinishHandlers: unique symbol;
12
+ export declare class Reproduction {
13
+ private player;
14
+ private requiresCountingIn;
15
+ private songTempo;
16
+ private state;
17
+ private ready;
18
+ private interval;
19
+ private countingInCounter;
20
+ private [dispatchOnReadyHandlers];
21
+ private [dispatchOnSongStartHandlers];
22
+ private [dispatchOnCountingInHandlers];
23
+ private [dispatchOnPlayHandlers];
24
+ private [dispatchOnPlayingHandlers];
25
+ private [dispatchOnPausedHandlers];
26
+ private [dispatchOnFinishHandlers];
27
+ static get EVENTS(): {
28
+ readonly READY: "READY";
29
+ readonly START: "START";
30
+ readonly COUNTING_IN: "COUNTING_IN";
31
+ readonly PLAY: "PLAY";
32
+ readonly PLAYING: "PLAYING";
33
+ readonly PAUSED: "PAUSED";
34
+ readonly FINISH: "FINISH";
35
+ };
36
+ static get STATES(): {
37
+ STOPPED: number;
38
+ COUNTING_IN: number;
39
+ PLAYING: number;
40
+ PAUSED: number;
41
+ };
42
+ constructor(player: Player, requiresCountingIn: boolean, songTempo: number);
43
+ on(eventName: keyof typeof Reproduction.EVENTS, handler: () => void): number | undefined;
44
+ dispatch(eventName: keyof typeof Reproduction.EVENTS): void;
45
+ private countIn;
46
+ start(): void;
47
+ play(): void;
48
+ pause(): void;
49
+ stop(): void;
50
+ isReady(): boolean;
51
+ isPlaying(): boolean;
52
+ isStopped(): boolean;
53
+ isPaused(): boolean;
54
+ isCountingIn(): boolean;
55
+ getPlayer(): Player;
56
+ getTempo(): number;
57
+ getCurrentTime(): any;
58
+ getDuration(): any;
59
+ seekTo(seconds: number): void;
60
+ getAvailablePlaybackRates(): any;
61
+ setPlaybackRate(playbackRate: number): void;
62
+ isAvailable(): boolean;
63
+ getBPMInterval(): number;
64
+ static newBuilder(): ReproductionBuilder;
65
+ }
66
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Reproduction } from './Reproduction';
2
+ import { YouTubePlayer as InnerYouTubePlayer } from 'react-youtube';
3
+ export declare class ReproductionBuilder {
4
+ private trainingMode;
5
+ private requiresCountingIn;
6
+ private songDuration;
7
+ private songTempo;
8
+ private innerPlayer;
9
+ constructor();
10
+ withSongDuration(songDuration: number): this;
11
+ withSongTempo(songTempo: number): this;
12
+ withTrainingMode(trainingMode: boolean): this;
13
+ withCountingIn(requiresCountingIn: boolean): this;
14
+ withInnerPlayer(innerPlayer: InnerYouTubePlayer | string): this;
15
+ createReproduction(): Reproduction;
16
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface RangeSelectorCanvasProps {
3
+ selectedRange: number[];
4
+ onChange: (value: number) => void;
5
+ onRangeChange: (value: number[]) => void;
6
+ }
7
+ declare const _default: React.NamedExoticComponent<RangeSelectorCanvasProps>;
8
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface TimelineProps {
3
+ duration: number;
4
+ value: number;
5
+ zoomLevel?: number;
6
+ className?: string;
7
+ selectedRange?: number[];
8
+ withTimeBlocks?: boolean;
9
+ onChange?: (value: number) => void;
10
+ onRangeChange?: (value: number[]) => void;
11
+ }
12
+ export declare const Timeline: React.FC<TimelineProps>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export type Props = {
3
+ start: number;
4
+ leftPosition: string;
5
+ };
6
+ declare const TickTime: React.FC<Props>;
7
+ export default TickTime;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface TickTimeCollectionDisplayProps {
3
+ tickTimes: number[];
4
+ }
5
+ declare const TickTimeCollectionDisplay: React.FC<TickTimeCollectionDisplayProps>;
6
+ export default TickTimeCollectionDisplay;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface VaLueLineCanvasProps {
3
+ duration: number;
4
+ withTimeBlocks: boolean;
5
+ }
6
+ declare const TimelineCanvas: React.ForwardRefExoticComponent<VaLueLineCanvasProps & React.RefAttributes<HTMLCanvasElement>>;
7
+ export default TimelineCanvas;
@@ -0,0 +1,2 @@
1
+ import { ZoomContextType } from '../ZoomContext/ZoomContext';
2
+ export declare const drawTimeBlocksOnCanvas: (canvas: HTMLCanvasElement, blockStartingTimes: number[], zoomContextValue: ZoomContextType) => void;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ canvasRef: React.RefObject<HTMLCanvasElement>;
4
+ value: number;
5
+ }
6
+ export declare const TimelineValue: React.FC<Props>;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export type ZoomContextType = {
3
+ blockOffset: number;
4
+ pixelsInSecond: number;
5
+ timelineWrapperWidth: number;
6
+ };
7
+ export declare const ZoomContext: React.Context<ZoomContextType>;
@@ -0,0 +1 @@
1
+ export declare const zoomLevelConfigurations: number[][];
@@ -0,0 +1 @@
1
+ export * from './Timeline';
@@ -0,0 +1,7 @@
1
+ import { ZoomContextType } from '../ZoomContext/ZoomContext';
2
+ export declare const secondsToPixel: (zoomContextValue: ZoomContextType, seconds: number) => number;
3
+ export declare const pixelToSeconds: (zoomContextValue: ZoomContextType, pixel: number) => number;
4
+ export declare const getComputedElementWidth: (element: HTMLElement) => number;
5
+ export declare const numberToPxString: (number: number) => string;
6
+ export declare const getTimelineWrapperWidth: (timeLineContainerWidth: number, zoomLevel: number) => number;
7
+ export declare function getBlockOffsetForZoomLevel(zoomLevel: number, duration: number, timelineWrapperWidth: number): number;
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,4 @@
1
+ import { ReproductionWidgetProps } from '../components/reproduction-widget';
2
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
3
+ export default _default;
4
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, ReproductionWidgetProps>;
@@ -0,0 +1,9 @@
1
+ import { TimelineProps } from '../components/timeline';
2
+ import './timeline.stories.custom.css';
3
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
4
+ export default _default;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, TimelineProps>;
6
+ export declare const WithSelectedRange: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, TimelineProps>;
7
+ export declare const WithCustomClassName: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, TimelineProps>;
8
+ export declare const WithoutTimeBlocks: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, TimelineProps>;
9
+ export declare const Minimalist: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-a5624094").R, TimelineProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldelia/react-media",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "A React components collection for media-related features.",
5
5
  "private": false,
6
6
  "keywords": [