@therealtinhtute/baroiplayer 1.0.2 → 1.0.4

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,462 @@
1
+ /* BaroiPlayer Global Styles
2
+ * Modern media player with Tailwind CSS v4 integration
3
+ * Includes design tokens, accessibility features, and responsive design
4
+ */
5
+
6
+ /* Import Tailwind CSS base styles */
7
+ @import "tailwindcss";
8
+
9
+ /* Import design tokens from UI package if available */
10
+ @import "@rp/ui/styles/design-tokens.css";
11
+
12
+ /* ===== ROOT STYLES & CSS VARIABLES ===== */
13
+ :root {
14
+ /* Media Player Colors */
15
+ --media-primary: oklch(62% 0.25 240);
16
+ --media-secondary: oklch(75% 0.18 180);
17
+ --media-accent: oklch(85% 0.12 60);
18
+
19
+ /* Player Background */
20
+ --media-bg: oklch(8% 0.02 240);
21
+ --media-surface: oklch(12% 0.02 240);
22
+ --media-overlay: oklch(15% 0.02 240 / 0.9);
23
+
24
+ /* Text Colors */
25
+ --media-text-primary: oklch(95% 0.005 240);
26
+ --media-text-secondary: oklch(75% 0.008 240);
27
+ --media-text-muted: oklch(60% 0.01 240);
28
+
29
+ /* Control States */
30
+ --media-control-idle: oklch(68% 0.20 142);
31
+ --media-control-hover: oklch(85% 0.08 240);
32
+ --media-control-active: oklch(72% 0.15 30);
33
+ --media-control-disabled: oklch(45% 0.005 240);
34
+
35
+ /* Progress Bar */
36
+ --media-progress-bg: oklch(25% 0.02 240);
37
+ --media-progress-fill: oklch(75% 0.18 240);
38
+ --media-progress-buffered: oklch(60% 0.12 240);
39
+
40
+ /* Focus & Accessibility */
41
+ --media-focus-outline: 2px solid var(--media-secondary);
42
+ --media-focus-offset: 2px;
43
+
44
+ /* Animations */
45
+ --media-transition: 200ms;
46
+ --media-ease: cubic-bezier(0.4, 0, 0.2, 1);
47
+ }
48
+
49
+ /* Dark mode support */
50
+ @media (prefers-color-scheme: dark) {
51
+ :root {
52
+ --media-bg: oklch(6% 0.01 240);
53
+ --media-surface: oklch(10% 0.01 240);
54
+ --media-text-primary: oklch(98% 0.003 240);
55
+ }
56
+ }
57
+
58
+ /* ===== BASE STYLES ===== */
59
+ * {
60
+ box-sizing: border-box;
61
+ }
62
+
63
+ body {
64
+ margin: 0;
65
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
66
+ background-color: var(--media-bg);
67
+ color: var(--media-text-primary);
68
+ line-height: 1.5;
69
+ }
70
+
71
+ /* ===== MEDIA PLAYER COMPONENT STYLES ===== */
72
+
73
+ /* Base Player Container */
74
+ .media-player {
75
+ position: relative;
76
+ width: 100%;
77
+ height: 100%;
78
+ background-color: var(--media-bg);
79
+ border-radius: 0.5rem;
80
+ overflow: hidden;
81
+ }
82
+
83
+ /* Player Video Element */
84
+ .media-player video,
85
+ .media-player audio {
86
+ width: 100%;
87
+ height: 100%;
88
+ object-fit: contain;
89
+ }
90
+
91
+ /* Control Panel */
92
+ .media-player-controls {
93
+ position: absolute;
94
+ bottom: 0;
95
+ left: 0;
96
+ right: 0;
97
+ background: linear-gradient(to top, var(--media-overlay), transparent);
98
+ padding: 1rem;
99
+ display: flex;
100
+ align-items: center;
101
+ gap: 0.75rem;
102
+ transition: opacity var(--media-transition) var(--media-ease);
103
+ }
104
+
105
+ /* Play/Pause Button */
106
+ .media-player-play-button {
107
+ width: 2.5rem;
108
+ height: 2.5rem;
109
+ border-radius: 50%;
110
+ background-color: var(--media-control-idle);
111
+ border: none;
112
+ color: white;
113
+ cursor: pointer;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ transition: all var(--media-transition) var(--media-ease);
118
+ }
119
+
120
+ .media-player-play-button:hover {
121
+ background-color: var(--media-control-hover);
122
+ transform: scale(1.05);
123
+ }
124
+
125
+ .media-player-play-button:focus {
126
+ outline: var(--media-focus-outline);
127
+ outline-offset: var(--media-focus-offset);
128
+ }
129
+
130
+ /* Progress Bar */
131
+ .media-player-progress {
132
+ flex: 1;
133
+ height: 0.5rem;
134
+ background-color: var(--media-progress-bg);
135
+ border-radius: 0.25rem;
136
+ position: relative;
137
+ cursor: pointer;
138
+ overflow: hidden;
139
+ }
140
+
141
+ .media-player-progress-bar {
142
+ height: 100%;
143
+ background-color: var(--media-progress-fill);
144
+ border-radius: 0.25rem;
145
+ position: relative;
146
+ transition: width 0.1s linear;
147
+ }
148
+
149
+ .media-player-progress-buffered {
150
+ height: 100%;
151
+ background-color: var(--media-progress-buffered);
152
+ border-radius: 0.25rem;
153
+ position: absolute;
154
+ top: 0;
155
+ left: 0;
156
+ }
157
+
158
+ /* Volume Control */
159
+ .media-player-volume {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 0.5rem;
163
+ }
164
+
165
+ .media-player-volume-slider {
166
+ width: 6rem;
167
+ height: 0.25rem;
168
+ background-color: var(--media-progress-bg);
169
+ border-radius: 0.125rem;
170
+ outline: none;
171
+ cursor: pointer;
172
+ }
173
+
174
+ .media-player-volume-slider::-webkit-slider-thumb {
175
+ appearance: none;
176
+ width: 1rem;
177
+ height: 1rem;
178
+ border-radius: 50%;
179
+ background-color: var(--media-control-idle);
180
+ cursor: pointer;
181
+ }
182
+
183
+ /* Time Display */
184
+ .media-player-time {
185
+ font-size: 0.875rem;
186
+ color: var(--media-text-secondary);
187
+ font-variant-numeric: tabular-nums;
188
+ min-width: 5rem;
189
+ text-align: center;
190
+ }
191
+
192
+ /* Fullscreen Button */
193
+ .media-player-fullscreen-button {
194
+ width: 2rem;
195
+ height: 2rem;
196
+ border-radius: 0.25rem;
197
+ background-color: transparent;
198
+ border: 1px solid var(--media-control-idle);
199
+ color: var(--media-text-primary);
200
+ cursor: pointer;
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: center;
204
+ transition: all var(--media-transition) var(--media-ease);
205
+ }
206
+
207
+ .media-player-fullscreen-button:hover {
208
+ background-color: var(--media-control-hover);
209
+ }
210
+
211
+ /* Settings Menu */
212
+ .media-player-settings {
213
+ position: absolute;
214
+ bottom: 4rem;
215
+ right: 1rem;
216
+ background-color: var(--media-surface);
217
+ border: 1px solid var(--media-progress-bg);
218
+ border-radius: 0.5rem;
219
+ padding: 0.5rem;
220
+ min-width: 12rem;
221
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
222
+ }
223
+
224
+ .media-player-settings-item {
225
+ padding: 0.5rem 0.75rem;
226
+ border-radius: 0.25rem;
227
+ cursor: pointer;
228
+ color: var(--media-text-primary);
229
+ transition: background-color var(--media-transition) var(--media-ease);
230
+ }
231
+
232
+ .media-player-settings-item:hover {
233
+ background-color: var(--media-control-hover);
234
+ }
235
+
236
+ /* Loading Spinner */
237
+ .media-player-loading {
238
+ position: absolute;
239
+ top: 50%;
240
+ left: 50%;
241
+ transform: translate(-50%, -50%);
242
+ width: 3rem;
243
+ height: 3rem;
244
+ border: 3px solid var(--media-progress-bg);
245
+ border-top-color: var(--media-progress-fill);
246
+ border-radius: 50%;
247
+ animation: spin 1s linear infinite;
248
+ }
249
+
250
+ @keyframes spin {
251
+ to {
252
+ transform: translate(-50%, -50%) rotate(360deg);
253
+ }
254
+ }
255
+
256
+ /* Error Display */
257
+ .media-player-error {
258
+ position: absolute;
259
+ top: 50%;
260
+ left: 50%;
261
+ transform: translate(-50%, -50%);
262
+ background-color: var(--media-surface);
263
+ padding: 1.5rem;
264
+ border-radius: 0.5rem;
265
+ text-align: center;
266
+ max-width: 80%;
267
+ }
268
+
269
+ .media-player-error-title {
270
+ color: var(--media-text-primary);
271
+ font-weight: 600;
272
+ margin-bottom: 0.5rem;
273
+ }
274
+
275
+ .media-player-error-message {
276
+ color: var(--media-text-secondary);
277
+ font-size: 0.875rem;
278
+ }
279
+
280
+ /* Subtitle Display */
281
+ .media-player-subtitles {
282
+ position: absolute;
283
+ bottom: 4rem;
284
+ left: 0;
285
+ right: 0;
286
+ text-align: center;
287
+ padding: 0 1rem;
288
+ pointer-events: none;
289
+ }
290
+
291
+ .media-player-subtitle-text {
292
+ display: inline-block;
293
+ background-color: rgba(0, 0, 0, 0.8);
294
+ color: white;
295
+ padding: 0.25rem 0.5rem;
296
+ border-radius: 0.25rem;
297
+ font-size: 1rem;
298
+ line-height: 1.4;
299
+ }
300
+
301
+ /* Picture-in-Picture Button */
302
+ .media-player-pip-button {
303
+ width: 2rem;
304
+ height: 2rem;
305
+ border-radius: 0.25rem;
306
+ background-color: transparent;
307
+ border: 1px solid var(--media-control-idle);
308
+ color: var(--media-text-primary);
309
+ cursor: pointer;
310
+ display: flex;
311
+ align-items: center;
312
+ justify-content: center;
313
+ transition: all var(--media-transition) var(--media-ease);
314
+ }
315
+
316
+ .media-player-pip-button:hover {
317
+ background-color: var(--media-control-hover);
318
+ }
319
+
320
+ /* Responsive Design */
321
+ @media (max-width: 640px) {
322
+ .media-player-controls {
323
+ padding: 0.75rem;
324
+ gap: 0.5rem;
325
+ }
326
+
327
+ .media-player-play-button {
328
+ width: 2rem;
329
+ height: 2rem;
330
+ }
331
+
332
+ .media-player-volume-slider {
333
+ width: 4rem;
334
+ }
335
+
336
+ .media-player-time {
337
+ font-size: 0.75rem;
338
+ min-width: 4rem;
339
+ }
340
+
341
+ .media-player-fullscreen-button,
342
+ .media-player-pip-button {
343
+ width: 1.75rem;
344
+ height: 1.75rem;
345
+ }
346
+ }
347
+
348
+ /* ===== ACCESSIBILITY ENHANCEMENTS ===== */
349
+
350
+ /* Focus Management */
351
+ .media-player *:focus {
352
+ outline: var(--media-focus-outline);
353
+ outline-offset: var(--media-focus-offset);
354
+ }
355
+
356
+ /* High Contrast Mode */
357
+ @media (prefers-contrast: high) {
358
+ :root {
359
+ --media-focus-outline: 3px solid currentColor;
360
+ --media-focus-offset: 3px;
361
+ }
362
+
363
+ .media-player-play-button,
364
+ .media-player-fullscreen-button,
365
+ .media-player-pip-button {
366
+ border-width: 2px;
367
+ }
368
+ }
369
+
370
+ /* Reduced Motion */
371
+ @media (prefers-reduced-motion: reduce) {
372
+ * {
373
+ animation-duration: 0.01ms !important;
374
+ animation-iteration-count: 1 !important;
375
+ transition-duration: 0.01ms !important;
376
+ scroll-behavior: auto !important;
377
+ }
378
+ }
379
+
380
+ /* Screen Reader Only */
381
+ .sr-only {
382
+ position: absolute;
383
+ width: 1px;
384
+ height: 1px;
385
+ padding: 0;
386
+ margin: -1px;
387
+ overflow: hidden;
388
+ clip: rect(0, 0, 0, 0);
389
+ white-space: nowrap;
390
+ border: 0;
391
+ }
392
+
393
+ /* ===== MINIMAL PLAYER VARIANT ===== */
394
+
395
+ .minimal-player {
396
+ --minimal-bg: transparent;
397
+ --minimal-border: 1px solid rgba(255, 255, 255, 0.1);
398
+ }
399
+
400
+ .minimal-player .media-player-controls {
401
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
402
+ border-top: var(--minimal-border);
403
+ }
404
+
405
+ .minimal-player .media-player-play-button {
406
+ background-color: rgba(255, 255, 255, 0.1);
407
+ backdrop-filter: blur(8px);
408
+ }
409
+
410
+ .minimal-player .media-player-settings {
411
+ background-color: rgba(20, 20, 20, 0.95);
412
+ backdrop-filter: blur(12px);
413
+ }
414
+
415
+ /* ===== KEYBOARD NAVIGATION ===== */
416
+
417
+ /* Keyboard shortcut help */
418
+ .media-player-keyboard-help {
419
+ position: absolute;
420
+ top: 1rem;
421
+ right: 1rem;
422
+ background-color: var(--media-surface);
423
+ border: 1px solid var(--media-progress-bg);
424
+ border-radius: 0.5rem;
425
+ padding: 1rem;
426
+ min-width: 16rem;
427
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
428
+ z-index: 1000;
429
+ }
430
+
431
+ .media-player-keyboard-help h3 {
432
+ margin: 0 0 0.5rem 0;
433
+ color: var(--media-text-primary);
434
+ font-size: 0.875rem;
435
+ font-weight: 600;
436
+ }
437
+
438
+ .media-player-keyboard-help-item {
439
+ display: flex;
440
+ justify-content: space-between;
441
+ padding: 0.25rem 0;
442
+ font-size: 0.75rem;
443
+ }
444
+
445
+ .media-player-keyboard-help-key {
446
+ color: var(--media-text-secondary);
447
+ font-family: monospace;
448
+ }
449
+
450
+ /* ===== PRINT STYLES ===== */
451
+ @media print {
452
+ .media-player {
453
+ break-inside: avoid;
454
+ border: 1px solid currentColor;
455
+ }
456
+
457
+ .media-player-controls,
458
+ .media-player-loading,
459
+ .media-player-error {
460
+ display: none;
461
+ }
462
+ }
@@ -0,0 +1,46 @@
1
+ /* Pixel Art Styles for Media Player */
2
+ .pixel-button {
3
+ image-rendering: pixelated;
4
+ image-rendering: -moz-crisp-edges;
5
+ image-rendering: crisp-edges;
6
+ font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
7
+ letter-spacing: 0.05em;
8
+ }
9
+
10
+ .pixel-button svg {
11
+ image-rendering: pixelated;
12
+ image-rendering: -moz-crisp-edges;
13
+ image-rendering: crisp-edges;
14
+ filter: contrast(1.2) brightness(1.1);
15
+ }
16
+
17
+ .pixel-button:hover svg {
18
+ filter: contrast(1.3) brightness(1.2) drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
19
+ }
20
+
21
+ .pixel-progress {
22
+ image-rendering: pixelated;
23
+ image-rendering: -moz-crisp-edges;
24
+ image-rendering: crisp-edges;
25
+ }
26
+
27
+ .pixel-progress [role="slider"] {
28
+ image-rendering: pixelated;
29
+ image-rendering: -moz-crisp-edges;
30
+ image-rendering: crisp-edges;
31
+ box-shadow:
32
+ 0 0 0 1px rgba(0, 0, 0, 0.8),
33
+ inset 0 1px 0 rgba(255, 255, 255, 0.3),
34
+ 0 2px 4px rgba(0, 0, 0, 0.5);
35
+ }
36
+
37
+ .pixel-time-display {
38
+ text-shadow:
39
+ 1px 1px 0 rgba(0, 0, 0, 0.8),
40
+ -1px -1px 0 rgba(0, 0, 0, 0.8),
41
+ 1px -1px 0 rgba(0, 0, 0, 0.8),
42
+ -1px 1px 0 rgba(0, 0, 0, 0.8);
43
+ image-rendering: pixelated;
44
+ image-rendering: -moz-crisp-edges;
45
+ image-rendering: crisp-edges;
46
+ }
@@ -0,0 +1,100 @@
1
+ /* Import Video.js base styles */
2
+ @import 'video.js/dist/video-js.css';
3
+
4
+ /* Custom overrides for Video.js to work with Tailwind v4 */
5
+ .video-js {
6
+ font-family: inherit;
7
+ font-size: 1em;
8
+ color: #fff;
9
+ }
10
+
11
+ .video-js .vjs-big-play-button {
12
+ font-size: 3em;
13
+ line-height: 1.5em;
14
+ height: 1.5em;
15
+ width: 3em;
16
+ border: 0.06666em solid #fff;
17
+ border-radius: 0.3em;
18
+ left: 50%;
19
+ top: 50%;
20
+ margin-left: -1.5em;
21
+ margin-top: -0.75em;
22
+ }
23
+
24
+ .video-js:hover .vjs-big-play-button,
25
+ .video-js .vjs-big-play-button:focus {
26
+ background-color: rgba(0, 0, 0, 0.5);
27
+ }
28
+
29
+ .video-js .vjs-control-bar {
30
+ display: flex;
31
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
32
+ }
33
+
34
+ .video-js .vjs-progress-control {
35
+ position: absolute;
36
+ bottom: 2.5em;
37
+ left: 0;
38
+ right: 0;
39
+ width: 100%;
40
+ height: 0.3em;
41
+ }
42
+
43
+ .video-js .vjs-progress-holder {
44
+ margin: 0;
45
+ height: 0.3em;
46
+ }
47
+
48
+ .video-js .vjs-load-progress,
49
+ .video-js .vjs-play-progress {
50
+ height: 0.3em;
51
+ }
52
+
53
+ .video-js .vjs-menu-button-popup .vjs-menu {
54
+ background-color: rgba(0, 0, 0, 0.9);
55
+ border-radius: 0.3em;
56
+ }
57
+
58
+ /* Quality selector styling */
59
+ .vjs-quality-selector .vjs-menu-button {
60
+ order: 8;
61
+ }
62
+
63
+ .vjs-quality-selector .vjs-icon-placeholder:before {
64
+ content: "HD";
65
+ font-family: inherit;
66
+ font-weight: bold;
67
+ font-size: 0.8em;
68
+ }
69
+
70
+ /* Hide default controls when using custom controls */
71
+ .video-js.vjs-controls-disabled .vjs-control-bar {
72
+ display: none;
73
+ }
74
+
75
+ /* Subtitle styling */
76
+ .video-js .vjs-text-track-display {
77
+ pointer-events: none;
78
+ }
79
+
80
+ .video-js .vjs-text-track-cue {
81
+ background-color: rgba(0, 0, 0, 0.8);
82
+ border-radius: 0.2em;
83
+ padding: 0.2em 0.3em;
84
+ }
85
+
86
+ /* Loading spinner */
87
+ .video-js .vjs-loading-spinner {
88
+ border-color: rgba(255, 255, 255, 0.2);
89
+ border-top-color: #fff;
90
+ }
91
+
92
+ /* Error display */
93
+ .video-js .vjs-error-display {
94
+ background: rgba(0, 0, 0, 0.9);
95
+ }
96
+
97
+ .video-js .vjs-error-display .vjs-modal-dialog-content {
98
+ font-size: 1.2em;
99
+ text-align: center;
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@therealtinhtute/baroiplayer",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A customizable media player component library for React",
@@ -12,6 +12,8 @@
12
12
  },
13
13
  "./globals.css": "./dist/index.css",
14
14
  "./minimal-player.css": "./dist/minimal-components.css",
15
+ "./dist/styles/minimal-player.css": "./dist/minimal-components.css",
16
+ "./styles/minimal-player.css": "./dist/minimal-components.css",
15
17
  "./dist/*": "./dist/*",
16
18
  "./lib/*": "./src/lib/*.ts",
17
19
  "./components/*": "./src/components/*.tsx",
@@ -33,7 +35,7 @@
33
35
  "build:skip-types": "vite build --mode production",
34
36
  "build:analyze": "vite build --mode analyze",
35
37
  "build:watch": "vite build --watch",
36
- "dev": "vite build --watch",
38
+ "dev": "node build-simple.js",
37
39
  "prepublishOnly": "bun run build && bun run lint",
38
40
  "publish:beta": "npm publish --tag beta",
39
41
  "publish:next": "npm publish --tag next",
@@ -429,16 +429,16 @@ export function useEnhancedMediaPlayer(options: UseEnhancedMediaPlayerOptions) {
429
429
 
430
430
  // Computed state
431
431
  const computedState = useMemo(() => ({
432
- isPlaying: optimisticState?.isPlaying ?? isPlaying,
433
- currentTime: optimisticState?.currentTime ?? currentTime,
434
- duration: optimisticState?.duration ?? duration,
435
- volume: optimisticState?.volume ?? optimisticVolume,
436
- isMuted: optimisticState?.isMuted ?? isMuted,
437
- isLoading: optimisticState?.isBuffering ?? isLoading,
438
- isBuffering: optimisticState?.isBuffering ?? isBuffering,
439
- error: optimisticState?.error ?? error,
440
- buffered: optimisticState?.buffered ?? buffered,
441
- isFullscreen: optimisticState?.isFullscreen ?? isFullscreen,
432
+ isPlaying: optimisticState?.state?.isPlaying ?? isPlaying,
433
+ currentTime: optimisticState?.state?.currentTime ?? currentTime,
434
+ duration: optimisticState?.state?.duration ?? duration,
435
+ volume: optimisticState?.state?.volume ?? optimisticVolume,
436
+ isMuted: optimisticState?.state?.isMuted ?? isMuted,
437
+ isLoading: optimisticState?.state?.isBuffering ?? isLoading,
438
+ isBuffering: optimisticState?.state?.isBuffering ?? isBuffering,
439
+ error: optimisticState?.state?.error ?? error,
440
+ buffered: optimisticState?.state?.buffered ?? buffered,
441
+ isFullscreen: optimisticState?.state?.isFullscreen ?? isFullscreen,
442
442
  progress: duration > 0 ? currentTime / duration : 0,
443
443
  isTransitioning: isPending || isSeeking,
444
444
  canPlay: !isLoading && !isBuffering && !error
@@ -475,8 +475,8 @@ export function useEnhancedMediaPlayer(options: UseEnhancedMediaPlayerOptions) {
475
475
  isTransitioning: isPending || isSeeking,
476
476
 
477
477
  // Enhanced features
478
- actions: optimisticState?.actions,
479
- actionState: optimisticState?.actionState,
478
+ actions: optimisticState, // The optimisticState object contains all the actions
479
+ actionState: optimisticState?.state,
480
480
 
481
481
  // Optimistic features
482
482
  optimisticState,