parent
a093963b04
commit
201a4efb26
@ -1,71 +0,0 @@
|
||||
import type { Direction } from './component';
|
||||
|
||||
// ── Translator ───────────────────────────────────────────────────────────────
|
||||
|
||||
export type SomaTranslationModule = unknown;
|
||||
export type SomaTranslationParams = Record<string, unknown>;
|
||||
export type SomaTranslationFallback = string | Record<string, string>;
|
||||
export type SomaTranslationDescriptor = {
|
||||
path: string;
|
||||
fallback?: SomaTranslationFallback;
|
||||
params?: SomaTranslationParams;
|
||||
};
|
||||
export type SomaTranslationValue = SomaTranslationFallback | SomaTranslationDescriptor;
|
||||
|
||||
export interface SomaTranslator {
|
||||
getLocale(): string;
|
||||
translate(value: SomaTranslationValue): string;
|
||||
translatePath(path: string, ...args: unknown[]): string;
|
||||
extend?: (...args: any[]) => void;
|
||||
}
|
||||
|
||||
// ── Logger ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface SomaLogger {
|
||||
debug(message: string, context?: Record<string, unknown>): void;
|
||||
info(message: string, context?: Record<string, unknown>): void;
|
||||
warn(message: string, context?: Record<string, unknown>): void;
|
||||
error(message: string, context?: Record<string, unknown>): void;
|
||||
}
|
||||
|
||||
// ── Formatter ────────────────────────────────────────────────────────────────
|
||||
|
||||
export type SomaFormatter = {
|
||||
format: (...args: unknown[]) => string;
|
||||
};
|
||||
|
||||
export type SomaNumberFormatter = SomaFormatter;
|
||||
export type SomaCurrencyFormatter = SomaFormatter;
|
||||
export type SomaUnitFormatter = SomaFormatter;
|
||||
|
||||
// ── DateTimeFormatter ────────────────────────────────────────────────────────
|
||||
|
||||
export type { DateOrder, HourCycle } from '$soma/external/dates';
|
||||
|
||||
export interface SomaDateTimeFormatter {
|
||||
getDateOrder(): import('$soma/external/dates').DateOrder | undefined;
|
||||
getHourCycle(): import('$soma/external/dates').HourCycle | undefined;
|
||||
}
|
||||
|
||||
// ── Prefs ────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface SomaPrefsConfig {
|
||||
dir?: Direction;
|
||||
dateTimeFormatter?: SomaDateTimeFormatter;
|
||||
numberFormatter?: SomaNumberFormatter;
|
||||
currencyFormatter?: SomaCurrencyFormatter;
|
||||
unitFormatter?: SomaUnitFormatter;
|
||||
}
|
||||
|
||||
// ── Soma props ───────────────────────────────────────────────────────────────
|
||||
|
||||
export interface SomaPropsWithoutChildren {
|
||||
portalTo?: string | HTMLElement;
|
||||
translator?: SomaTranslator;
|
||||
prefs?: SomaPrefsConfig;
|
||||
logger?: SomaLogger;
|
||||
}
|
||||
|
||||
export interface SomaProps extends SomaPropsWithoutChildren {
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
Loading…
Reference in new issue