Skip to content

Commit 741d607

Browse files
committed
fix: prettier format all elements files
1 parent a04b555 commit 741d607

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+933
-1314
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
name: "🐛 Bug Report"
2+
name: '🐛 Bug Report'
33
about: Report a reproducible bug or regression.
4-
title: "Bug: "
5-
labels: "bug, Status: Unconfirmed"
4+
title: 'Bug: '
5+
labels: 'bug, Status: Unconfirmed'
66
---
77

88
<!--

.github/ISSUE_TEMPLATE/docs_request.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
name: "📄 Docs Request"
2+
name: '📄 Docs Request'
33
about: Report a discrepancy in or an improvement to the docs.
4-
title: "Docs: "
5-
labels: "documentation"
4+
title: 'Docs: '
5+
labels: 'documentation'
66
---
77

88
<!--
@@ -22,9 +22,9 @@ labels: "documentation"
2222

2323
# Is this a discrepancy or an improvement?
2424

25-
<!--
25+
<!--
2626
Uncomment all that apply
27-
27+
2828
- discrepancy
2929
- improvement
3030
-->

.github/ISSUE_TEMPLATE/feature_request.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
name: "🎥 Feature Request"
2+
name: '🎥 Feature Request'
33
about: Create a feature request for one or more Mux Elements, or for a new Mux Element you'd like to see.
4-
title: "Feature: "
5-
labels: "enhancement"
4+
title: 'Feature: '
5+
labels: 'enhancement'
66
---
77

88
<!--

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
coverage
3+
dist
4+
node_modules
5+
examples

.prettierrc

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
2-
"trailingComma": "es5",
2+
"printWidth": 120,
3+
"singleQuote": true,
34
"tabWidth": 2,
4-
"singleQuote": true
5+
"useTabs": false,
6+
"semi": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "es5",
10+
"bracketSpacing": true,
11+
"jsxBracketSameLine": false,
12+
"arrowParens": "always"
513
}

codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ coverage:
3535

3636
# adding Flags to your `layout` configuration to show up in the PR comment
3737
comment:
38-
layout: "reach, diff, flags, files"
38+
layout: 'reach, diff, flags, files'
3939
behavior: default
4040
require_changes: false
4141
require_base: yes

packages/mux-audio-react/README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ npm i @mux-elements/mux-audio-react
3030
Then, import the library into your application with either `import` or `require`:
3131

3232
```js
33-
import "@mux-elements/mux-audio-react";
33+
import '@mux-elements/mux-audio-react';
3434
```
3535

3636
or
3737

3838
```js
39-
require("@mux-elements/mux-audio-react");
39+
require('@mux-elements/mux-audio-react');
4040
```
4141

4242
## Features and benefits
@@ -59,12 +59,12 @@ const MuxAudioExample = () => {
5959
<div>
6060
<h1>Simple MuxAudio Example</h1>
6161
<MuxAudio
62-
style={{ height: "100%", maxWidth: "100%" }}
62+
style={{ height: '100%', maxWidth: '100%' }}
6363
playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
6464
metadata={{
65-
video_id: "audio-id-123456",
66-
video_title: "Super Interesting Audio",
67-
viewer_user_id: "user-id-bc-789",
65+
video_id: 'audio-id-123456',
66+
video_title: 'Super Interesting Audio',
67+
viewer_user_id: 'user-id-bc-789',
6868
}}
6969
envKey="YOUR_MUX_DATA_ENV_KEY"
7070
streamType="on-demand"
@@ -101,9 +101,9 @@ If you prefer to use the in-code MSE-based engine (currently hls.js) whenever po
101101
<MuxAudio
102102
playback-id="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
103103
metadata={{
104-
video_id: "audio-id-123456",
105-
video_title: "Super Interesting Audio",
106-
viewer_user_id: "user-id-bc-789",
104+
video_id: 'audio-id-123456',
105+
video_title: 'Super Interesting Audio',
106+
viewer_user_id: 'user-id-bc-789',
107107
}}
108108
envKey="YOUR_MUX_DATA_ENV_KEY"
109109
preferMse
@@ -119,9 +119,9 @@ By default `<MuxAudio/>` will try to figure out the type of media you're trying
119119
<MuxAudio
120120
src="https://stream.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/high.mp4"
121121
metadata={{
122-
video_id: "audio-id-123456",
123-
video_title: "Super Interesting Audio",
124-
viewer_user_id: "user-id-bc-789",
122+
video_id: 'audio-id-123456',
123+
video_title: 'Super Interesting Audio',
124+
viewer_user_id: 'user-id-bc-789',
125125
}}
126126
envKey="YOUR_MUX_DATA_ENV_KEY"
127127
controls
@@ -135,9 +135,9 @@ Sometimes, however, your `src` URL may not have an identifiable extension. In th
135135
src="https://stream.notmux.com/path/to/an/hls/source/playlist"
136136
type="application/vnd.apple.mpegurl"
137137
metadata={{
138-
video_id: "video-id-123456",
139-
video_title: "Super Interesting Video",
140-
viewer_user_id: "user-id-bc-789",
138+
video_id: 'video-id-123456',
139+
video_title: 'Super Interesting Video',
140+
viewer_user_id: 'user-id-bc-789',
141141
}}
142142
envKey="YOUR_MUX_DATA_ENV_KEY"
143143
controls
@@ -151,9 +151,9 @@ Or, for convenience, we also support the shorthand `type="hls`:
151151
src="https://stream.notmux.com/path/to/an/hls/source/playlist"
152152
type="hls"
153153
metadata={{
154-
video_id: "audio-id-123456",
155-
video_title: "Super Interesting Audio",
156-
viewer_user_id: "user-id-bc-789",
154+
video_id: 'audio-id-123456',
155+
video_title: 'Super Interesting Audio',
156+
viewer_user_id: 'user-id-bc-789',
157157
}}
158158
envKey="YOUR_MUX_DATA_ENV_KEY"
159159
controls

packages/mux-audio-react/src/env.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
export const isMaybeBrowser = () => typeof window != "undefined";
1+
export const isMaybeBrowser = () => typeof window != 'undefined';
22
// @ts-ignore
3-
export const isMaybeServer = () => typeof global != "undefined";
3+
export const isMaybeServer = () => typeof global != 'undefined';
44

55
const getEnvPlayerVersion = () => {
66
try {
77
// @ts-ignore
88
return PLAYER_VERSION as string;
99
} catch {}
10-
return "UNKNOWN";
10+
return 'UNKNOWN';
1111
};
1212

1313
const player_version: string = getEnvPlayerVersion();

packages/mux-audio-react/src/index.tsx

+56-69
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import useCombinedRefs from "./use-combined-refs";
2-
import React, { useEffect, useRef, useState } from "react";
3-
import PropTypes from "prop-types";
1+
import useCombinedRefs from './use-combined-refs';
2+
import React, { useEffect, useRef, useState } from 'react';
3+
import PropTypes from 'prop-types';
44
import {
55
allMediaTypes,
66
initialize,
@@ -12,87 +12,74 @@ import {
1212
toMuxVideoURL,
1313
PlaybackEngine,
1414
generatePlayerInitTime,
15-
} from "@mux-elements/playback-core";
16-
import { getPlayerVersion } from "./env";
15+
} from '@mux-elements/playback-core';
16+
import { getPlayerVersion } from './env';
1717

1818
export type Props = Omit<
19-
React.DetailedHTMLProps<
20-
React.AudioHTMLAttributes<HTMLAudioElement>,
21-
HTMLAudioElement
22-
>,
23-
"autoPlay"
19+
React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>,
20+
'autoPlay'
2421
> &
2522
MuxMediaProps;
2623

2724
const playerSoftwareVersion = getPlayerVersion();
28-
const playerSoftwareName = "mux-audio-react";
25+
const playerSoftwareName = 'mux-audio-react';
2926

30-
const MuxAudio = React.forwardRef<HTMLAudioElement | undefined, Partial<Props>>(
31-
(props, ref) => {
32-
const {
33-
envKey,
34-
debug,
35-
beaconDomain,
36-
playbackId,
37-
preferMse,
38-
type,
39-
streamType,
40-
startTime,
41-
src: outerSrc,
42-
children,
43-
autoPlay,
44-
...restProps
45-
} = props;
27+
const MuxAudio = React.forwardRef<HTMLAudioElement | undefined, Partial<Props>>((props, ref) => {
28+
const {
29+
envKey,
30+
debug,
31+
beaconDomain,
32+
playbackId,
33+
preferMse,
34+
type,
35+
streamType,
36+
startTime,
37+
src: outerSrc,
38+
children,
39+
autoPlay,
40+
...restProps
41+
} = props;
4642

47-
const [playerInitTime] = useState(generatePlayerInitTime());
43+
const [playerInitTime] = useState(generatePlayerInitTime());
4844

49-
const [src, setSrc] = useState<MuxMediaProps["src"]>(
50-
toMuxVideoURL(playbackId) ?? outerSrc
51-
);
45+
const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);
5246

53-
const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined);
54-
const innerMediaElRef = useRef<HTMLAudioElement>(null);
47+
const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined);
48+
const innerMediaElRef = useRef<HTMLAudioElement>(null);
5549

56-
const mediaElRef = useCombinedRefs(innerMediaElRef, ref);
57-
const updateAutoplayRef = useRef<UpdateAutoplay | undefined>(undefined);
58-
const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});
50+
const mediaElRef = useCombinedRefs(innerMediaElRef, ref);
51+
const updateAutoplayRef = useRef<UpdateAutoplay | undefined>(undefined);
52+
const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});
5953

60-
useEffect(() => {
61-
const src = toMuxVideoURL(playbackId) ?? outerSrc;
62-
setSrc(src);
63-
}, [outerSrc, playbackId]);
54+
useEffect(() => {
55+
const src = toMuxVideoURL(playbackId) ?? outerSrc;
56+
setSrc(src);
57+
}, [outerSrc, playbackId]);
6458

65-
useEffect(() => {
66-
const propsWithState = {
67-
...props,
68-
src,
69-
playerInitTime,
70-
playerSoftwareName,
71-
playerSoftwareVersion,
72-
autoplay: autoPlay,
73-
};
74-
const nextPlaybackEngineRef = initialize(
75-
propsWithState,
76-
mediaElRef.current,
77-
playbackEngineRef.current
78-
);
79-
playbackEngineRef.current = nextPlaybackEngineRef;
80-
setUpdateAutoplay(() =>
81-
setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current)
82-
);
83-
}, [src]);
59+
useEffect(() => {
60+
const propsWithState = {
61+
...props,
62+
src,
63+
playerInitTime,
64+
playerSoftwareName,
65+
playerSoftwareVersion,
66+
autoplay: autoPlay,
67+
};
68+
const nextPlaybackEngineRef = initialize(propsWithState, mediaElRef.current, playbackEngineRef.current);
69+
playbackEngineRef.current = nextPlaybackEngineRef;
70+
setUpdateAutoplay(() => setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current));
71+
}, [src]);
8472

85-
useEffect(() => {
86-
updateAutoplay(autoPlay);
87-
}, [autoPlay]);
73+
useEffect(() => {
74+
updateAutoplay(autoPlay);
75+
}, [autoPlay]);
8876

89-
return (
90-
<audio ref={mediaElRef} {...restProps}>
91-
{children}
92-
</audio>
93-
);
94-
}
95-
);
77+
return (
78+
<audio ref={mediaElRef} {...restProps}>
79+
{children}
80+
</audio>
81+
);
82+
});
9683

9784
MuxAudio.propTypes = {
9885
envKey: PropTypes.string,

packages/mux-audio-react/src/use-combined-refs.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, MutableRefObject } from "react";
1+
import { useEffect, useRef, MutableRefObject } from 'react';
22

33
type Maybe<T> = T | null | undefined;
44
type RefCb<T> = (instance: Maybe<T>) => void;
@@ -15,7 +15,7 @@ export const useCombinedRefs: useCombinedRefs = (...refs) => {
1515
refs.forEach((ref) => {
1616
if (!ref) return;
1717

18-
if (typeof ref === "function") {
18+
if (typeof ref === 'function') {
1919
ref(targetRef.current);
2020
} else {
2121
ref.current = targetRef.current;

packages/mux-audio/README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ npm i @mux-elements/mux-audio
3030
Then, import the library into your application with either `import` or `require`:
3131

3232
```js
33-
import "@mux-elements/mux-audio";
33+
import '@mux-elements/mux-audio';
3434
```
3535

3636
or
3737

3838
```js
39-
require("@mux-elements/mux-audio");
39+
require('@mux-elements/mux-audio');
4040
```
4141

4242
## CDN option
@@ -64,10 +64,7 @@ interface MuxAudioHTMLAttributes<T> extends React.AudioHTMLAttributes<T> {
6464
declare global {
6565
namespace JSX {
6666
interface IntrinsicElements {
67-
"mux-audio": React.DetailedHTMLProps<
68-
MuxAudioHTMLAttributes<HTMLAudioElement>,
69-
HTMLAudioElement
70-
>;
67+
'mux-audio': React.DetailedHTMLProps<MuxAudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
7168
}
7269
}
7370
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
/** @TODO Add type defs to custom-video-element directly */
2-
export default class CustomAudioElement<
3-
V extends HTMLAudioElement = HTMLAudioElement
4-
>
2+
export default class CustomAudioElement<V extends HTMLAudioElement = HTMLAudioElement>
53
// NOTE: "lying" here since we programmatically merge props/methods from HTMLAudioElement into the CustomAudioElement's prototype in an attempt to make it "look like"
64
// it extends an HTMLAudioElement.
75
extends HTMLAudioElement
86
implements HTMLAudioElement
97
{
108
static readonly observedAttributes: Array<string>;
119
readonly nativeEl: V;
12-
attributeChangedCallback(
13-
attrName: string,
14-
oldValue?: string | null,
15-
newValue?: string | null
16-
): void;
10+
attributeChangedCallback(attrName: string, oldValue?: string | null, newValue?: string | null): void;
1711
}

0 commit comments

Comments
 (0)