diff --git a/index.d.ts b/index.d.ts
index b4a95786..d17cf65a 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -18,10 +18,10 @@
// blits file type reference
///
-import {type ShaderEffect as RendererShaderEffect, type WebGlCoreShader, type RendererMainSettings} from '@lightningjs/renderer'
-
declare module '@lightningjs/blits' {
-
+ type RendererShaderEffect = import('@lightningjs/renderer').ShaderEffect
+ type WebGlCoreShader = import('@lightningjs/renderer').WebGlCoreShader
+ type RendererMainSettings = import('@lightningjs/renderer').RendererMainSettings
export interface AnnouncerUtteranceOptions {
/**
@@ -209,7 +209,7 @@ declare module '@lightningjs/blits' {
}
export interface Input {
- [key: string]: (event: KeyboardEvent) => void | undefined | unknown,
+ [key: string]: ((event: KeyboardEvent) => unknown) | undefined,
/**
* Catch all input function
*
@@ -371,6 +371,29 @@ declare module '@lightningjs/blits' {
// Empty by design: extend in your app via TypeScript module augmentation.
}
+ export interface LanguagePlugin {
+ translate(key: string, ...replacements: any[]): string
+ readonly language: string
+ set(language: string): void
+ translations(translationsObject: Record): void
+ load(file: string): Promise
+ }
+
+ export interface ThemePlugin {
+ get(key: string): T | undefined
+ get(key: string, fallback: T): T
+ set(theme: string): void
+ }
+
+ export interface StoragePlugin {
+ get(key: string): T | null
+ set(key: string, value: unknown): boolean
+ remove(key: string): void
+ clear(): void
+ }
+
+ export type AppStatePlugin = Record> = TState
+
export interface ComponentBase extends CustomComponentProperties {
/**
* Indicates whether the component currently has focus
@@ -633,7 +656,7 @@ declare module '@lightningjs/blits' {
}
export interface RouterHooks {
- init?: () => Promise<> | void;
+ init?: () => Promise | void;
beforeEach?: (to: Route, from: Route) => string | Route | Promise | void;
error?: (err: string) => string | Route | Promise | void;
}
@@ -1301,3 +1324,32 @@ declare module '@lightningjs/blits' {
export default Blits;
}
+
+declare module '@lightningjs/blits/plugins' {
+ import type {
+ AppStatePlugin,
+ LanguagePlugin,
+ StoragePlugin,
+ ThemePlugin,
+ } from '@lightningjs/blits'
+
+ export const language: {
+ name: 'language'
+ plugin: (options?: Record) => LanguagePlugin
+ }
+
+ export const theme: {
+ name: 'theme'
+ plugin: (config?: Record) => ThemePlugin
+ }
+
+ export const appState: {
+ name: 'appState'
+ plugin: >(state?: TState) => AppStatePlugin
+ }
+
+ export const storage: {
+ name: 'storage'
+ plugin: () => StoragePlugin
+ }
+}