diff --git a/biome.json b/biome.json index 842e6a7c..246c74e8 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.4.2/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.6/schema.json", "html": { "experimentalFullSupportEnabled": false }, @@ -125,10 +125,13 @@ "includes": [ "**", "!**/.astro", + "!**/.netlify", "!**/.vercel", "!**/.turbo", "!**/.next", + "!**/.opencode", "!**/.github", + "!build", "!**/dist", "!**/examples", "!**/styles/vjs.css", diff --git a/packages/core/src/core/ui/types.ts b/packages/core/src/core/ui/types.ts index c1124e06..9d07a3d4 100644 --- a/packages/core/src/core/ui/types.ts +++ b/packages/core/src/core/ui/types.ts @@ -3,14 +3,14 @@ export type StateAttrMap = { }; /** Constraint for core UI classes that compute component state. */ -export interface UIComponent { +export interface UIComponent { getState(): State; setProps?(props: Props): void; getAttrs?(state: State): object; } /** Constraint for core UI classes that derive component state from media state. */ -export interface MediaUIComponent extends UIComponent { +export interface MediaUIComponent extends UIComponent { setMedia(media: object): void; } diff --git a/packages/html/src/store/container-mixin.ts b/packages/html/src/store/container-mixin.ts index d90c6021..6210c205 100644 --- a/packages/html/src/store/container-mixin.ts +++ b/packages/html/src/store/container-mixin.ts @@ -92,7 +92,8 @@ export function createContainerMixin(context: PlayerC const store = this.#contextStore ?? this.store; if (!store) return; - const media = this.querySelector('video, audio, [data-media-element]') ?? this.#getSlottedMedia(); + const media = + this.querySelector('video, audio, [data-media-element]') ?? this.#getSlottedMedia(); if (!media) { this.#detach(); diff --git a/packages/spf/scripts/measure-size.js b/packages/spf/scripts/measure-size.js index bfc6b8c8..fa81b94a 100755 --- a/packages/spf/scripts/measure-size.js +++ b/packages/spf/scripts/measure-size.js @@ -76,7 +76,7 @@ try { const percentOfTarget = ((gzippedSize / 1024 / targetKB) * 100).toFixed(1); // Display results - console.log('\n' + '='.repeat(50)); + console.log(`\n${'='.repeat(50)}`); console.log(`📊 Bundle Size Report - ${label}`); console.log('='.repeat(50)); console.log(`Minified: ${formatSize(minifiedSize)}`); @@ -85,7 +85,7 @@ try { console.log(`Target: ${targetKB} KB (minified + gzipped)`); console.log(`Used: ${percentOfTarget}%`); console.log(`Remaining: ${formatSize(targetKB * 1024 - gzippedSize)}`); - console.log('='.repeat(50) + '\n'); + console.log(`${'='.repeat(50)}\n`); // Status indicator if (gzippedSize / 1024 > targetKB) { diff --git a/packages/spf/src/core/state/create-state.ts b/packages/spf/src/core/state/create-state.ts index 982ac680..875ca3d0 100644 --- a/packages/spf/src/core/state/create-state.ts +++ b/packages/spf/src/core/state/create-state.ts @@ -151,7 +151,6 @@ class StateContainer implements WritableState { // Apply partial updates with change detection for (const key in partial) { - // biome-ignore lint/suspicious/noExplicitAny: T may be a primitive; `partial` is object-shaped at this branch if (!Object.hasOwn(partial as any, key)) continue; const value = (partial as Partial)[key as keyof T]; diff --git a/packages/spf/src/dom/features/end-of-stream.ts b/packages/spf/src/dom/features/end-of-stream.ts index 53cebb28..a0adc5d8 100644 --- a/packages/spf/src/dom/features/end-of-stream.ts +++ b/packages/spf/src/dom/features/end-of-stream.ts @@ -205,7 +205,7 @@ function getMaxBufferedEnd(owners: EndOfStreamOwners): number { */ const endOfStreamTask = async ( { currentOwners }: { currentOwners: EndOfStreamOwners }, - _context: {} + _context: object ): Promise => { const { mediaSource } = currentOwners; diff --git a/packages/spf/src/dom/features/update-duration.ts b/packages/spf/src/dom/features/update-duration.ts index 55cb4737..4f7728ba 100644 --- a/packages/spf/src/dom/features/update-duration.ts +++ b/packages/spf/src/dom/features/update-duration.ts @@ -65,7 +65,7 @@ export function shouldUpdateDuration(state: DurationUpdateState, owners: Duratio // task or by endOfStreamTask from buffered.end()), we leave it alone — attempting // to re-sync a slight drift between mediaSource.duration and presentation.duration // races with concurrent appendBuffer() calls from loadSegmentsTask. - return isNaN(mediaSource!.duration); + return Number.isNaN(mediaSource!.duration); } /** @@ -76,7 +76,7 @@ export function shouldUpdateDuration(state: DurationUpdateState, owners: Duratio */ function waitForSourceBuffersReady(owners: DurationUpdateOwners): Promise { const updating = [owners.videoSourceBuffer, owners.audioSourceBuffer].filter( - (buf): buf is SourceBuffer => buf !== undefined && buf.updating + (buf): buf is SourceBuffer => buf?.updating === true ); if (updating.length === 0) return Promise.resolve(); diff --git a/packages/spf/src/dom/media/tests/buffer-flusher.test.ts b/packages/spf/src/dom/media/tests/buffer-flusher.test.ts index 6af7c047..ae14d2e9 100644 --- a/packages/spf/src/dom/media/tests/buffer-flusher.test.ts +++ b/packages/spf/src/dom/media/tests/buffer-flusher.test.ts @@ -8,7 +8,7 @@ function makeSourceBuffer(): SourceBuffer { updating: false, remove: vi.fn(() => { setTimeout(() => { - for (const listener of listeners['updateend'] ?? []) { + for (const listener of listeners.updateend ?? []) { listener(new Event('updateend')); } }, 0); @@ -45,7 +45,7 @@ describe('flushBuffer', () => { updating: true, remove: vi.fn(() => { setTimeout(() => { - for (const listener of listeners['updateend'] ?? []) { + for (const listener of listeners.updateend ?? []) { listener(new Event('updateend')); } }, 0); @@ -82,7 +82,7 @@ describe('flushBuffer', () => { updating: false, remove: vi.fn(() => { setTimeout(() => { - for (const listener of listeners['error'] ?? []) { + for (const listener of listeners.error ?? []) { listener(new Event('error')); } }, 0); diff --git a/site/src/components/docs/demos/buffering-indicator/html/css/BasicUsage.css b/site/src/components/docs/demos/buffering-indicator/html/css/BasicUsage.css index 55048621..3157945a 100644 --- a/site/src/components/docs/demos/buffering-indicator/html/css/BasicUsage.css +++ b/site/src/components/docs/demos/buffering-indicator/html/css/BasicUsage.css @@ -15,14 +15,6 @@ z-index: 30; } -.html-buffering-indicator-basic__overlay .html-buffering-indicator-basic__spinner { - display: none; -} - -.html-buffering-indicator-basic__overlay[data-visible] .html-buffering-indicator-basic__spinner { - display: block; -} - .html-buffering-indicator-basic__spinner { width: 48px; height: 48px; @@ -30,6 +22,11 @@ border-top-color: white; border-radius: 50%; animation: buffering-spin 0.8s linear infinite; + display: none; +} + +.html-buffering-indicator-basic__overlay[data-visible] .html-buffering-indicator-basic__spinner { + display: block; } @keyframes buffering-spin { diff --git a/site/src/components/docs/demos/buffering-indicator/react/css/BasicUsage.css b/site/src/components/docs/demos/buffering-indicator/react/css/BasicUsage.css index 89f9766b..849159ad 100644 --- a/site/src/components/docs/demos/buffering-indicator/react/css/BasicUsage.css +++ b/site/src/components/docs/demos/buffering-indicator/react/css/BasicUsage.css @@ -15,14 +15,6 @@ z-index: 30; } -.react-buffering-indicator-basic__overlay .react-buffering-indicator-basic__spinner { - display: none; -} - -.react-buffering-indicator-basic__overlay[data-visible] .react-buffering-indicator-basic__spinner { - display: block; -} - .react-buffering-indicator-basic__spinner { width: 48px; height: 48px; @@ -30,6 +22,11 @@ border-top-color: white; border-radius: 50%; animation: buffering-spin 0.8s linear infinite; + display: none; +} + +.react-buffering-indicator-basic__overlay[data-visible] .react-buffering-indicator-basic__spinner { + display: block; } @keyframes buffering-spin { diff --git a/site/src/components/home/HeroVideo.tsx b/site/src/components/home/HeroVideo.tsx index 68121825..818b9794 100644 --- a/site/src/components/home/HeroVideo.tsx +++ b/site/src/components/home/HeroVideo.tsx @@ -1,6 +1,5 @@ import { useStore } from '@nanostores/react'; import { createPlayer, Poster } from '@videojs/react'; -import { HlsVideo } from '@videojs/react/media/hls-video'; import { MinimalVideoSkin, Video, VideoSkin, videoFeatures } from '@videojs/react/video'; import { VJS10_DEMO_VIDEO } from '@/consts'; import { skin } from '@/stores/homePageDemos'; @@ -27,7 +26,6 @@ export default function HeroVideo({ className={className} style={{ '--media-border-radius': `calc(var(--spacing) * 6)`, ...style } as React.CSSProperties} > - {/**/}