webamp 1.5.0 → 2.0.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.
Files changed (154) hide show
  1. package/README.md +14 -4
  2. package/built/types/js/Disposable.d.ts +11 -0
  3. package/built/types/js/actionCreators/equalizer.d.ts +8 -0
  4. package/built/types/js/actionCreators/files.d.ts +24 -0
  5. package/built/types/js/actionCreators/index.d.ts +22 -0
  6. package/built/types/js/actionCreators/media.d.ts +20 -0
  7. package/built/types/js/actionCreators/milkdrop.d.ts +13 -0
  8. package/built/types/js/actionCreators/playlist.d.ts +16 -0
  9. package/built/types/js/actionCreators/windows.d.ts +27 -0
  10. package/built/types/js/actionTypes.d.ts +87 -0
  11. package/built/types/js/components/App.d.ts +12 -0
  12. package/built/types/js/components/Balance.d.ts +8 -0
  13. package/built/types/js/components/Character.d.ts +9 -0
  14. package/built/types/js/components/CharacterString.d.ts +6 -0
  15. package/built/types/js/components/ClickedDiv.d.ts +8 -0
  16. package/built/types/js/components/ClipPaths.d.ts +8 -0
  17. package/built/types/js/components/ContextMenu.d.ts +31 -0
  18. package/built/types/js/components/ContextMenuTarget.d.ts +9 -0
  19. package/built/types/js/components/ContextMenuWrapper.d.ts +7 -0
  20. package/built/types/js/components/Css.d.ts +7 -0
  21. package/built/types/js/components/DropTarget.d.ts +13 -0
  22. package/built/types/js/components/EqualizerWindow/Band.d.ts +14 -0
  23. package/built/types/js/components/EqualizerWindow/EqAuto.d.ts +3 -0
  24. package/built/types/js/components/EqualizerWindow/EqGraph.d.ts +2 -0
  25. package/built/types/js/components/EqualizerWindow/EqOn.d.ts +2 -0
  26. package/built/types/js/components/EqualizerWindow/EqTitleButtons.d.ts +1 -0
  27. package/built/types/js/components/EqualizerWindow/EqualizerShade.d.ts +2 -0
  28. package/built/types/js/components/EqualizerWindow/PresetsContextMenu.d.ts +2 -0
  29. package/built/types/js/components/EqualizerWindow/index.d.ts +2 -0
  30. package/built/types/js/components/EqualizerWindow/spline.d.ts +1 -0
  31. package/built/types/js/components/FFTNullsoft.d.ts +16 -0
  32. package/built/types/js/components/FocusTarget.d.ts +9 -0
  33. package/built/types/js/components/Fullscreen.d.ts +8 -0
  34. package/built/types/js/components/GenWindow/index.d.ts +14 -0
  35. package/built/types/js/components/MainWindow/ActionButtons.d.ts +3 -0
  36. package/built/types/js/components/MainWindow/Close.d.ts +3 -0
  37. package/built/types/js/components/MainWindow/ClutterBar.d.ts +3 -0
  38. package/built/types/js/components/MainWindow/Eject.d.ts +3 -0
  39. package/built/types/js/components/MainWindow/EqToggleButton.d.ts +3 -0
  40. package/built/types/js/components/MainWindow/Kbps.d.ts +3 -0
  41. package/built/types/js/components/MainWindow/Khz.d.ts +3 -0
  42. package/built/types/js/components/MainWindow/MainBalance.d.ts +4 -0
  43. package/built/types/js/components/MainWindow/MainContextMenu.d.ts +7 -0
  44. package/built/types/js/components/MainWindow/MainVolume.d.ts +3 -0
  45. package/built/types/js/components/MainWindow/Marquee.d.ts +7 -0
  46. package/built/types/js/components/MainWindow/Minimize.d.ts +3 -0
  47. package/built/types/js/components/MainWindow/MonoStereo.d.ts +3 -0
  48. package/built/types/js/components/MainWindow/PlaylistToggleButton.d.ts +3 -0
  49. package/built/types/js/components/MainWindow/Position.d.ts +3 -0
  50. package/built/types/js/components/MainWindow/Repeat.d.ts +3 -0
  51. package/built/types/js/components/MainWindow/Shade.d.ts +3 -0
  52. package/built/types/js/components/MainWindow/Shuffle.d.ts +3 -0
  53. package/built/types/js/components/MainWindow/Time.d.ts +3 -0
  54. package/built/types/js/components/MainWindow/index.d.ts +8 -0
  55. package/built/types/js/components/MilkdropWindow/Background.d.ts +7 -0
  56. package/built/types/js/components/MilkdropWindow/Desktop.d.ts +7 -0
  57. package/built/types/js/components/MilkdropWindow/MilkdropContextMenu.d.ts +6 -0
  58. package/built/types/js/components/MilkdropWindow/PresetOverlay.d.ts +7 -0
  59. package/built/types/js/components/MilkdropWindow/Visualizer.d.ts +7 -0
  60. package/built/types/js/components/MilkdropWindow/index.d.ts +5 -0
  61. package/built/types/js/components/MiniTime.d.ts +2 -0
  62. package/built/types/js/components/OptionsContextMenu.d.ts +2 -0
  63. package/built/types/js/components/PlaybackContextMenu.d.ts +2 -0
  64. package/built/types/js/components/PlaylistWindow/AddMenu.d.ts +2 -0
  65. package/built/types/js/components/PlaylistWindow/ListMenu.d.ts +1 -0
  66. package/built/types/js/components/PlaylistWindow/MiscMenu.d.ts +2 -0
  67. package/built/types/js/components/PlaylistWindow/MiscOptionsContextMenu.d.ts +2 -0
  68. package/built/types/js/components/PlaylistWindow/PlaylistActionArea.d.ts +2 -0
  69. package/built/types/js/components/PlaylistWindow/PlaylistMenu.d.ts +8 -0
  70. package/built/types/js/components/PlaylistWindow/PlaylistMenuEntry.d.ts +7 -0
  71. package/built/types/js/components/PlaylistWindow/PlaylistResizeTarget.d.ts +5 -0
  72. package/built/types/js/components/PlaylistWindow/PlaylistScrollBar.d.ts +1 -0
  73. package/built/types/js/components/PlaylistWindow/PlaylistShade.d.ts +2 -0
  74. package/built/types/js/components/PlaylistWindow/RemoveMenu.d.ts +2 -0
  75. package/built/types/js/components/PlaylistWindow/RunningTimeDisplay.d.ts +2 -0
  76. package/built/types/js/components/PlaylistWindow/SelectionMenu.d.ts +1 -0
  77. package/built/types/js/components/PlaylistWindow/SortContextMenu.d.ts +1 -0
  78. package/built/types/js/components/PlaylistWindow/TrackCell.d.ts +9 -0
  79. package/built/types/js/components/PlaylistWindow/TrackList.d.ts +2 -0
  80. package/built/types/js/components/PlaylistWindow/TrackTitle.d.ts +6 -0
  81. package/built/types/js/components/PlaylistWindow/index.d.ts +5 -0
  82. package/built/types/js/components/ResizeTarget.d.ts +11 -0
  83. package/built/types/js/components/Skin.d.ts +1 -0
  84. package/built/types/js/components/SkinsContextMenu.d.ts +2 -0
  85. package/built/types/js/components/VerticalSlider.d.ts +15 -0
  86. package/built/types/js/components/Vis.d.ts +5 -0
  87. package/built/types/js/components/VisPainter.d.ts +147 -0
  88. package/built/types/js/components/Volume.d.ts +8 -0
  89. package/built/types/js/components/WinampButton.d.ts +23 -0
  90. package/built/types/js/components/WindowManager.d.ts +8 -0
  91. package/built/types/js/constants.d.ts +38 -0
  92. package/built/types/js/emitter.d.ts +9 -0
  93. package/built/types/js/fileUtils.d.ts +15 -0
  94. package/built/types/js/hooks.d.ts +21 -0
  95. package/built/types/js/hotkeys.d.ts +2 -0
  96. package/built/types/js/loadQueue.d.ts +9 -0
  97. package/built/types/js/marqueeUtils.d.ts +6 -0
  98. package/built/types/js/marqueeUtils.test.d.ts +1 -0
  99. package/built/types/js/media/StereoBalanceNode.d.ts +3 -0
  100. package/built/types/js/media/elementSource.d.ts +26 -0
  101. package/built/types/js/media/index.d.ts +43 -0
  102. package/built/types/js/mediaMiddleware.d.ts +4 -0
  103. package/built/types/js/playlistHtml.d.ts +10 -0
  104. package/built/types/js/reducers/display.d.ts +26 -0
  105. package/built/types/js/reducers/equalizer.d.ts +10 -0
  106. package/built/types/js/reducers/index.d.ts +4 -0
  107. package/built/types/js/reducers/media.d.ts +14 -0
  108. package/built/types/js/reducers/milkdrop.d.ts +15 -0
  109. package/built/types/js/reducers/network.d.ts +6 -0
  110. package/built/types/js/reducers/playlist.d.ts +9 -0
  111. package/built/types/js/reducers/settings.d.ts +6 -0
  112. package/built/types/js/reducers/tracks.d.ts +7 -0
  113. package/built/types/js/reducers/tracks.test.d.ts +1 -0
  114. package/built/types/js/reducers/userInput.d.ts +9 -0
  115. package/built/types/js/reducers/windows.d.ts +34 -0
  116. package/built/types/js/regionParser.d.ts +6 -0
  117. package/built/types/js/resizeUtils.d.ts +23 -0
  118. package/built/types/js/resizeUtils.test.d.ts +1 -0
  119. package/built/types/js/selectors.d.ts +184 -0
  120. package/built/types/js/selectors.test.d.ts +1 -0
  121. package/built/types/js/serialization.test.d.ts +1 -0
  122. package/built/types/js/serializedStates/v1Types.d.ts +64 -0
  123. package/built/types/js/skinParser.d.ts +12 -0
  124. package/built/types/js/skinParserUtils.d.ts +19 -0
  125. package/built/types/js/skinSelectors.d.ts +6 -0
  126. package/built/types/js/skinSprites.d.ts +17 -0
  127. package/built/types/js/snapUtils.d.ts +32 -0
  128. package/built/types/js/snapUtils.test.d.ts +1 -0
  129. package/built/types/js/spinParserUtils.test.d.ts +1 -0
  130. package/built/types/js/store.d.ts +4 -0
  131. package/built/types/js/trackUtils.d.ts +3 -0
  132. package/built/types/js/types.d.ts +734 -0
  133. package/built/types/js/utils.d.ts +71 -0
  134. package/built/types/js/utils.test.d.ts +1 -0
  135. package/built/types/js/webamp.d.ts +6 -0
  136. package/built/types/js/webampLazy.d.ts +156 -0
  137. package/built/types/scripts/postcss-optimize-data-uri-pngs.d.ts +2 -0
  138. package/built/types/scripts/rollupPlugins.d.mts +8 -0
  139. package/built/types/vite.config.d.ts +2 -0
  140. package/built/webamp.bundle.js +43629 -36192
  141. package/built/webamp.bundle.js.map +1 -0
  142. package/built/webamp.bundle.min.js +43 -71
  143. package/built/webamp.bundle.min.js.map +1 -1
  144. package/built/webamp.bundle.min.mjs +44 -0
  145. package/built/webamp.bundle.min.mjs.map +1 -0
  146. package/built/webamp.lazy-bundle.js +14215 -19001
  147. package/built/webamp.lazy-bundle.js.map +1 -0
  148. package/built/webamp.lazy-bundle.min.js +41 -50
  149. package/built/webamp.lazy-bundle.min.js.map +1 -1
  150. package/built/webamp.lazy-bundle.min.mjs +42 -0
  151. package/built/webamp.lazy-bundle.min.mjs.map +1 -0
  152. package/package.json +68 -75
  153. package/CHANGELOG.md +0 -200
  154. package/index.d.ts +0 -277
@@ -0,0 +1,71 @@
1
+ /// <reference types="react" />
2
+ import { WindowInfo } from "./types";
3
+ interface Time {
4
+ minutesFirstDigit: string;
5
+ minutesSecondDigit: string;
6
+ secondsFirstDigit: string;
7
+ secondsSecondDigit: string;
8
+ }
9
+ interface IniData {
10
+ [section: string]: {
11
+ [key: string]: string;
12
+ };
13
+ }
14
+ export declare function imgFromUrl(url: string): Promise<HTMLImageElement>;
15
+ export declare const getTimeObj: (time: number | null) => Time;
16
+ export declare const getTimeStr: (time: number | null, truncate?: boolean) => string;
17
+ export declare const parseViscolors: (text: string) => string[];
18
+ export declare const parseIni: (text: string) => IniData;
19
+ export declare const clamp: (value: number, min: number, max: number) => number;
20
+ export declare const sum: (values: number[]) => number;
21
+ export declare function base64FromDataArray(dataArray: Uint8Array): string;
22
+ export declare const base64FromArrayBuffer: (arrayBuffer: ArrayBuffer) => string;
23
+ export declare function downloadURI(uri: string, name: string): void;
24
+ export declare const toPercent: (min: number, max: number, value: number) => number;
25
+ export declare const percentToRange: (percent: number, min: number, max: number) => number;
26
+ export declare const percentToIndex: (percent: number, length: number) => number;
27
+ export declare const normalizeEqBand: (oldValue: number) => number;
28
+ export declare const denormalizeEqBand: (oldValue: number) => number;
29
+ export declare function merge<T extends object, S extends object>(target: T, source: S): T & S;
30
+ export declare function segment<V>(min: number, max: number, value: number, newValues: V[]): V;
31
+ export declare function shuffle<T>(array: T[]): T[];
32
+ export declare function sort<T>(array: T[], iteratee: (value: T) => number | string): T[];
33
+ export declare function moveSelected<V>(arr: V[], isSelected: (index: number) => boolean, offset: number): V[];
34
+ export declare function spliceIn<T>(original: T[], start: number, newValues: T[]): T[];
35
+ export declare function replaceAtIndex<T>(arr: T[], index: number, newValue: T): T[];
36
+ export declare function debounce(func: Function, delay: number): Function;
37
+ export declare function throttle(func: Function, delay: number): Function;
38
+ export declare function uniqueId(): number;
39
+ export declare function objectForEach<V>(obj: {
40
+ [key: string]: V;
41
+ }, cb: (value: V, key: string) => void): void;
42
+ export declare function objectMap<V, N>(obj: {
43
+ [key: string]: V;
44
+ }, cb: (value: V, key: string) => N): {
45
+ [key: string]: N;
46
+ };
47
+ export declare function objectFilter<V>(obj: {
48
+ [key: string]: V;
49
+ }, predicate: (value: V, key: string) => boolean): {
50
+ [key: string]: V;
51
+ };
52
+ export declare const calculateBoundingBox: (windows: WindowInfo[]) => {
53
+ left: number;
54
+ top: number;
55
+ bottom: number;
56
+ right: number;
57
+ } | null;
58
+ export declare function findLastIndex<T>(arr: T[], cb: (val: T) => boolean): number;
59
+ export declare function getWindowSize(): {
60
+ width: number;
61
+ height: number;
62
+ };
63
+ export declare function getScreenSize(): {
64
+ width: number;
65
+ height: number;
66
+ };
67
+ type PosEvent = MouseEvent | TouchEvent | React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>;
68
+ export declare function getX(e: PosEvent): number;
69
+ export declare function getY(e: PosEvent): number;
70
+ export declare function weakMapMemoize<T extends object, R>(func: (value: T) => R): (value: T) => R;
71
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Options } from "./types";
2
+ import WebampLazy, { PrivateOptions } from "./webampLazy";
3
+ export type * from "./types";
4
+ export default class Webamp extends WebampLazy {
5
+ constructor(options: Options & PrivateOptions);
6
+ }
@@ -0,0 +1,156 @@
1
+ import ReactDOM from "react-dom/client";
2
+ import { Store, Track, LoadedURLTrack, Middleware, ButterchurnOptions, PartialState, Options, MediaStatus } from "./types";
3
+ import Media from "./media";
4
+ import Emitter from "./emitter";
5
+ import { SerializedStateV1 } from "./serializedStates/v1Types";
6
+ import Disposable from "./Disposable";
7
+ export interface PrivateOptions {
8
+ __initialState?: PartialState;
9
+ __customMiddlewares?: Middleware[];
10
+ __butterchurnOptions?: ButterchurnOptions;
11
+ __customMediaClass?: typeof Media;
12
+ }
13
+ export interface InjectableDependencies {
14
+ requireJSZip: () => Promise<any>;
15
+ requireMusicMetadata: () => Promise<any>;
16
+ }
17
+ declare class Webamp {
18
+ static VERSION: string;
19
+ _actionEmitter: Emitter;
20
+ _root: ReactDOM.Root | null;
21
+ _disposable: Disposable;
22
+ options: Options & PrivateOptions & InjectableDependencies;
23
+ media: Media;
24
+ store: Store;
25
+ /**
26
+ * Returns a true if the current browser supports the features that Webamp depends upon.
27
+ *
28
+ * It is recommended to check this before you attempt to instantiate an instance of Winamp.
29
+ */
30
+ static browserIsSupported(): boolean;
31
+ constructor(options: Options & PrivateOptions & InjectableDependencies);
32
+ /**
33
+ * Play the current tack
34
+ */
35
+ play(): void;
36
+ /**
37
+ * Pause the current tack
38
+ */
39
+ pause(): void;
40
+ /**
41
+ * Stop the currently playing audio. Equivalent to pressing the "stop" button
42
+ */
43
+ stop(): void;
44
+ /**
45
+ * Set volume from 0 - 100
46
+ */
47
+ setVolume(volume: number): void;
48
+ /**
49
+ * Seek backward n seconds in the curent track
50
+ */
51
+ seekBackward(seconds: number): void;
52
+ /**
53
+ * Seek forward n seconds in the curent track
54
+ */
55
+ seekForward(seconds: number): void;
56
+ /**
57
+ * Seek to a given time within the current track
58
+ */
59
+ seekToTime(seconds: number): void;
60
+ /**
61
+ * Play the next track
62
+ */
63
+ nextTrack(): void;
64
+ /**
65
+ * Play the previous track
66
+ */
67
+ previousTrack(): void;
68
+ /**
69
+ * Add an array of `Track`s to the end of the playlist.
70
+ */
71
+ appendTracks(tracks: Track[]): void;
72
+ /**
73
+ * Replace the playlist with an array of `Track`s and begin playing the first track.
74
+ */
75
+ setTracksToPlay(tracks: Track[]): void;
76
+ /**
77
+ * Get the current "playing" status.
78
+ */
79
+ getMediaStatus(): MediaStatus | null;
80
+ /**
81
+ * A callback which will be called when Webamp is _about to_ close. Returns an
82
+ * "unsubscribe" function. The callback will be passed a `cancel` function
83
+ * which you can use to conditionally prevent Webamp from being closed.
84
+ *
85
+ * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events.
86
+ */
87
+ onWillClose(cb: (cancel: () => void) => void): () => void;
88
+ /**
89
+ * A callback which will be called when Webamp is closed.
90
+ *
91
+ * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events.
92
+ */
93
+ onClose(cb: () => void): () => void;
94
+ /**
95
+ * Equivalent to selection "Close" from Webamp's options menu. Once closed,
96
+ * you can open it again with `.reopen()`.
97
+ */
98
+ close(): void;
99
+ /**
100
+ * After `.close()`ing this instance, you can reopen it by calling this method.
101
+ */
102
+ reopen(): void;
103
+ /**
104
+ * A callback which will be called when a new track starts loading.
105
+ *
106
+ * This can happen on startup when the first track starts buffering, or when a subsequent track starts playing.
107
+ * The callback will be called with an object `({url: 'https://example.com/track.mp3'})` containing the URL of the track.
108
+ * Note: If the user drags in a track, the URL may be an ObjectURL.
109
+ *
110
+ * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events.
111
+ */
112
+ onTrackDidChange(cb: (trackInfo: LoadedURLTrack | null) => void): () => void;
113
+ /**
114
+ * A callback which will be called when Webamp is minimized.
115
+ *
116
+ * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events.
117
+ */
118
+ onMinimize(cb: () => void): () => void;
119
+ /**
120
+ * Set the skin to use. This can be a URL or a base64 encoded string. The skin
121
+ * will be loaded asynchronously.
122
+ *
123
+ * NOTE: If the URL is not on the same domain as the page, you will need to consider CORS.
124
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
125
+ */
126
+ setSkinFromUrl(url: string): void;
127
+ /**
128
+ * Returns a promise that resolves when the skin is done loading.
129
+ */
130
+ skinIsLoaded(): Promise<void>;
131
+ /**
132
+ * Webamp will wait until it has fetched the skin and fully parsed it and then render itself.
133
+ *
134
+ * Webamp is rendered into a new DOM node at the end of the <body> tag with the id `#webamp`.
135
+ *
136
+ * If a domNode is passed, Webamp will place itself in the center of that DOM node.
137
+ *
138
+ * @returns A promise is returned which will resolve after the render is complete.
139
+ */
140
+ renderWhenReady(node: HTMLElement): Promise<void>;
141
+ /**
142
+ * **Note:** _This method is not fully functional. It is currently impossible to
143
+ * clean up a Winamp instance. This method makes an effort, but it still leaks
144
+ * the whole instance. In the future the behavior of this method will improve,
145
+ * so you might as well call it._
146
+ *
147
+ * When you are done with a Webamp instance, call this method and Webamp will
148
+ * attempt to clean itself up to avoid memory leaks.
149
+ */
150
+ dispose(): void;
151
+ __loadSerializedState(serializedState: SerializedStateV1): void;
152
+ __getSerializedState(): SerializedStateV1;
153
+ __onStateChange(cb: () => void): () => void;
154
+ _bufferTracks(tracks: Track[]): void;
155
+ }
156
+ export default Webamp;
@@ -0,0 +1,2 @@
1
+ declare const _exports: any;
2
+ export = _exports;
@@ -0,0 +1,8 @@
1
+ export function getPlugins({ minify, outputFile, vite }: {
2
+ minify: any;
3
+ outputFile: any;
4
+ vite: any;
5
+ }): (import("rollup").Plugin<any> | {
6
+ name: string;
7
+ resolveId(source: any, importer: any): string | null;
8
+ } | null)[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig & Promise<import("vite").UserConfig> & import("vite").UserConfigFnObject & import("vite").UserConfigExport;
2
+ export default _default;