UNPKG

uicore-ts

Version:

UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework tha

33 lines (32 loc) 1.74 kB
import { ValueOf } from "./UIObject"; import { UIViewController } from "./UIViewController"; export type PropType<TObj, TProp extends keyof TObj> = TObj[TProp]; export type UIRouteParameters<T = any> = { [key: string]: string; } | T; export interface UIRouteComponent<T = any> { name: string; parameters: UIRouteParameters<T>; } export declare class UIRoute extends Array<UIRouteComponent> { constructor(hash?: string); static get currentRoute(): UIRoute; apply(): void; applyByReplacingCurrentRouteInHistory(): void; copy(): UIRoute; routeByRemovingComponentsOtherThanOnesNamed(componentNames: string[]): UIRoute; routeByRemovingComponentNamed(componentName: string): UIRoute; routeByRemovingParameterInComponent(componentName: string, parameterName: string, removeComponentIfEmpty?: boolean): UIRoute; routeBySettingParameterInComponent(componentName: string, parameterName: string, valueToSet: string): UIRoute; routeWithViewControllerComponent<T extends typeof UIViewController>(viewController: T, parameters: UIRouteParameters<{ [P in keyof T["ParameterIdentifierName"]]: string; }>, extendParameters?: boolean): UIRoute; routeWithComponent(name: string, parameters: UIRouteParameters, extendParameters?: boolean): UIRoute; navigateBySettingComponent(name: string, parameters: UIRouteParameters, extendParameters?: boolean): void; componentWithViewController<T extends typeof UIViewController>(viewController: T): UIRouteComponent<{ [P in ValueOf<T["ParameterIdentifierName"]>]: string; }> | undefined; componentWithName(name: string): UIRouteComponent | undefined; get linkRepresentation(): string; get stringRepresentation(): string; }