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