colocate typings
This commit is contained in:
Vendored
+7
@@ -1,5 +1,12 @@
|
|||||||
// See https://kit.svelte.dev/docs/types#app
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
// for information about these interfaces
|
// for information about these interfaces
|
||||||
|
|
||||||
|
declare module './lib/types' {
|
||||||
|
interface EpisodeDetails {
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace App {
|
namespace App {
|
||||||
// interface Error {}
|
// interface Error {}
|
||||||
|
|||||||
@@ -1,23 +1,12 @@
|
|||||||
import { audio_element, type AudioElementStore } from '$lib/audio/audio-element';
|
import { audio_element, type AudioElementStore } from '$lib/audio/audio-element';
|
||||||
import {
|
import { episode_details, type EpisodeDetailsStore } from '$lib/audio/episode-details';
|
||||||
episode_details,
|
|
||||||
type EpisodeDetails,
|
|
||||||
type EpisodeDetailsStore,
|
|
||||||
} from '$lib/audio/episode-details';
|
|
||||||
import { podcast_preferences } from '$lib/preferences';
|
import { podcast_preferences } from '$lib/preferences';
|
||||||
import { podcast_progress } from '$lib/progress';
|
import { podcast_progress } from '$lib/progress';
|
||||||
|
import type { EpisodeAttributes, EpisodeDetails } from '$lib/types';
|
||||||
import { warn } from '$lib/utility/package/log';
|
import { warn } from '$lib/utility/package/log';
|
||||||
import clamp from 'just-clamp';
|
import clamp from 'just-clamp';
|
||||||
import { derived, get } from 'svelte/store';
|
import { derived, get } from 'svelte/store';
|
||||||
|
|
||||||
type EpisodeAttributes = {
|
|
||||||
will_autoplay: boolean;
|
|
||||||
is_muted: boolean;
|
|
||||||
duration: number;
|
|
||||||
src: string;
|
|
||||||
start_at: number;
|
|
||||||
details: EpisodeDetails;
|
|
||||||
};
|
|
||||||
const default_episode_attributes = {
|
const default_episode_attributes = {
|
||||||
will_autoplay: false,
|
will_autoplay: false,
|
||||||
is_muted: false,
|
is_muted: false,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { EpisodeDetails } from '$lib/types';
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export type EpisodeDetails = Record<string, string | number | boolean> | null;
|
export const episode_details = writable<EpisodeDetails | null>(null);
|
||||||
export const episode_details = writable<EpisodeDetails>(null);
|
|
||||||
export type EpisodeDetailsStore = typeof episode_details;
|
export type EpisodeDetailsStore = typeof episode_details;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { audio_element, type AudioElementStore } from '$lib/audio/audio-element';
|
import { audio_element, type AudioElementStore } from '$lib/audio/audio-element';
|
||||||
|
import type { EpisodeProgress } from '$lib/types';
|
||||||
import { secondsToTimestamp } from '$lib/utility';
|
import { secondsToTimestamp } from '$lib/utility';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
|
|
||||||
type EpisodeProgress = { current_time: number; timestamp: string; has_ended: boolean };
|
|
||||||
|
|
||||||
const default_episode_progress = {
|
const default_episode_progress = {
|
||||||
current_time: 0,
|
current_time: 0,
|
||||||
timestamp: '00:00',
|
timestamp: '00:00',
|
||||||
|
|||||||
+13
-9
@@ -1,18 +1,22 @@
|
|||||||
export type AudioPlayerElement = HTMLAudioElement | undefined;
|
export interface EpisodeDetails {
|
||||||
|
[key: string]: string | number | boolean;
|
||||||
export interface AudioMetadata {
|
|
||||||
title?: string;
|
|
||||||
artwork?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AudioLoadData extends AudioMetadata {
|
export type EpisodeProgress = { current_time: number; timestamp: string; has_ended: boolean };
|
||||||
|
|
||||||
|
export type EpisodeAttributes = {
|
||||||
|
will_autoplay: boolean;
|
||||||
|
is_muted: boolean;
|
||||||
|
duration: number;
|
||||||
src: string;
|
src: string;
|
||||||
}
|
start_at: number;
|
||||||
|
details: EpisodeDetails | null;
|
||||||
|
};
|
||||||
|
|
||||||
export interface AudioLoadOptions {
|
export type AudioLoadOptions = {
|
||||||
autoplay: boolean;
|
autoplay: boolean;
|
||||||
start_at?: number;
|
start_at?: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface UserPreferences {
|
export interface UserPreferences {
|
||||||
playback_rate: number;
|
playback_rate: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user