diff --git a/src/interfaces.d.ts b/src/interfaces.d.ts index 7e2dcb73..22d0a414 100644 --- a/src/interfaces.d.ts +++ b/src/interfaces.d.ts @@ -79,6 +79,8 @@ export interface Projection { update(updatedDNode: DNode): void; } +export type SupportedClassName = string | null | undefined; + export type DeferredVirtualProperties = (inserted: boolean) => VirtualDomProperties; export interface VirtualDomProperties { @@ -119,10 +121,9 @@ export interface VirtualDomProperties { */ readonly key?: Object; /** - * An object literal like `{important:true}` which allows css classes, like `important` to be added and removed - * dynamically. Can also take a function, that must return an object literal. + * An array of supported class names to be added to classList on a DOM node */ - readonly classes?: string | null | (undefined | null | string)[]; + readonly classes?: SupportedClassName | SupportedClassName[]; /** * An object literal like `{height:'100px'}` which allows styles to be changed dynamically. All values must be strings. */ diff --git a/src/mixins/Themed.ts b/src/mixins/Themed.ts index 5b4d70fc..74fffe4a 100644 --- a/src/mixins/Themed.ts +++ b/src/mixins/Themed.ts @@ -1,4 +1,4 @@ -import { Constructor, WidgetProperties } from './../interfaces'; +import { Constructor, WidgetProperties, SupportedClassName } from './../interfaces'; import { Registry } from './../Registry'; import { Injector } from './../Injector'; import { inject } from './../decorators/inject'; @@ -38,8 +38,8 @@ export const INJECTED_THEME_KEY = Symbol('theme'); * Interface for the ThemedMixin */ export interface ThemedMixin { - theme(classes: string): string | null; - theme(classes: (string | null)[]): (null | string)[]; + theme(classes: SupportedClassName): SupportedClassName; + theme(classes: SupportedClassName[]): SupportedClassName[]; properties: ThemedProperties; } @@ -124,14 +124,14 @@ export function ThemedMixin this._getThemeClass(className)); } return this._getThemeClass(classes); } @@ -145,22 +145,11 @@ export function ThemedMixin