refactor(packages): derive default props from core classes (#488)

This commit is contained in:
rahim
2026-02-10 15:10:35 +11:00
committed by GitHub
parent 5f27a6bc94
commit 6aac00280a
8 changed files with 13 additions and 13 deletions
@@ -20,8 +20,8 @@ export class FullscreenButtonElement extends MediaElement {
disabled: { type: Boolean },
};
label = '';
disabled = false;
label = FullscreenButtonCore.defaultProps.label;
disabled = FullscreenButtonCore.defaultProps.disabled;
readonly #core = new FullscreenButtonCore();
readonly #state = new PlayerController(this, playerContext, selectFullscreen);
@@ -20,8 +20,8 @@ export class MuteButtonElement extends MediaElement {
disabled: { type: Boolean },
};
label = '';
disabled = false;
label = MuteButtonCore.defaultProps.label;
disabled = MuteButtonCore.defaultProps.disabled;
readonly #core = new MuteButtonCore();
readonly #state = new PlayerController(this, playerContext, selectVolume);
@@ -20,8 +20,8 @@ export class PlayButtonElement extends MediaElement {
disabled: { type: Boolean },
};
label = '';
disabled = false;
label = PlayButtonCore.defaultProps.label;
disabled = PlayButtonCore.defaultProps.disabled;
readonly #core = new PlayButtonCore();
readonly #state = new PlayerController(this, playerContext, selectPlayback);
+3 -3
View File
@@ -15,9 +15,9 @@ export class TimeElement extends MediaElement {
label: { type: String },
};
type: TimeType = 'current';
negativeSign = '-';
label = '';
type: TimeType = TimeCore.defaultProps.type;
negativeSign = TimeCore.defaultProps.negativeSign;
label = TimeCore.defaultProps.label;
readonly #core = new TimeCore();
readonly #state = new PlayerController(this, playerContext, selectTime);
@@ -18,7 +18,7 @@ export const FullscreenButton = forwardRef(function FullscreenButton(
componentProps: FullscreenButtonProps,
forwardedRef: ForwardedRef<HTMLButtonElement>
) {
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
const { render, className, style, label, disabled, ...elementProps } = componentProps;
const fullscreen = usePlayer(selectFullscreen);
@@ -19,7 +19,7 @@ export const MuteButton = forwardRef(function MuteButton(
componentProps: MuteButtonProps,
forwardedRef: ForwardedRef<HTMLButtonElement>
) {
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
const { render, className, style, label, disabled, ...elementProps } = componentProps;
const volume = usePlayer(selectVolume);
@@ -32,7 +32,7 @@ export const PlayButton = forwardRef(function PlayButton(
componentProps: PlayButtonProps,
forwardedRef: ForwardedRef<HTMLButtonElement>
) {
const { render, className, style, label, disabled = false, ...elementProps } = componentProps;
const { render, className, style, label, disabled, ...elementProps } = componentProps;
const playback = usePlayer(selectPlayback);
+1 -1
View File
@@ -41,7 +41,7 @@ export const Value = forwardRef(function Value(
const content = state.negative ? (
<>
<span aria-hidden="true">{negativeSign ?? '-'}</span>
<span aria-hidden="true">{negativeSign ?? TimeCore.defaultProps.negativeSign}</span>
{state.text}
</>
) : (