@razaman2/reactive-view
Version:
This library enables you to build vue apps in an object oriented way. It provides a convenient approach to extend and override ui components. It provides a built in eventing system along with component data management.
122 lines (116 loc) • 4.19 kB
text/typescript
import * as vue from 'vue';
import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
type ComponentExtension = {
parent?: ComponentExtension;
self?: Record<string | symbol, any>;
access?: () => ComponentExtension;
value?: ComponentExtension;
};
type PropOptions = {
exclude: string | Array<string>;
include: Record<string, any>;
};
type SubscriptionItem = {
name: string;
handler: Function;
data?: any;
};
type PropExclusions = Array<string> | string;
declare class Subscription {
private subscriptions;
private data;
static create(): Subscription;
subscribe(name: string, handler: Function, data?: any): Subscription;
replace(name: string, handler: Function, data?: any): Subscription;
unsubscribe(subscription?: string): Subscription;
unsubscribe(subscriptions?: Array<string>): Subscription;
size(): number;
hasSubscription(name: string): boolean;
private remove;
private find;
private isNameAvailable;
registrations(): Array<SubscriptionItem>;
get(name: string): SubscriptionItem;
}
declare const setup: {
type: FunctionConstructor;
default: (parent?: {}, self?: {}) => {};
ReactiveView: boolean;
};
declare const _default: {
props: {
setup: {};
ReactiveView: {
type: BooleanConstructor;
default: boolean;
};
instance: {
default: vue.Ref<any, any>;
};
notifications: ObjectConstructor;
subscriptions: ObjectConstructor;
beforeSetData: FunctionConstructor;
data: {
default: {};
};
defaultData: {};
getDefaultData: {
type: FunctionConstructor;
default: (data: any) => any;
};
model: {};
defer: {};
logging: {
validator: (logging: boolean) => boolean;
};
modelName: {
type: StringConstructor;
default: string;
};
debug: {
type: BooleanConstructor;
default: boolean;
};
};
setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
};
declare function safeRequest(request: {
try: () => Promise<any> | any;
catch?: ((error: any) => Promise<any> | any) | false;
finally?: () => Promise<any> | any;
complete?: () => Promise<any> | any;
loading?: {
status: boolean;
message?: string;
};
message?: string;
alternative?: boolean;
}): Promise<any>;
declare function getProps(props: Record<string, any>, exclude: PropExclusions): Record<string, any>;
declare function getProps(props: Record<string, any>, options: PropOptions): Record<string, any>;
declare function getReactiveViewComponent(component: any, options?: Record<string, any>): vue.VNode<vue.RendererNode, vue.RendererElement, {
[key: string]: any;
}>;
declare function getDate(timestamp: {
toDate: () => Date;
} | Date, format?: string): string;
declare function getDate(timestamp: {
toDate: () => Date;
} | Date, options?: {
format?: string;
timezone?: string;
}): string;
declare function access(view?: ComponentExtension | UnwrapRef<any> | (() => ComponentExtension), alternative?: any): any;
declare function useSubscription(): {
addSubscription(name: string, handler?: () => boolean, data?: any): void;
replaceSubscription(name: string, handler?: () => boolean, data?: any): void;
removeSubscriptions(): void;
removeSubscription(name: string): void;
hasSubscription(name: string): boolean;
subscriptions: any[];
subscription: Subscription;
};
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
declare function MergeStyles(...params: any): any;
declare const extendVnode: (component: Record<string, any>, element: any) => Record<string, (props?: Record<string, any>, slots?: Record<string, any> | ((slots: Record<string, any>) => Record<string, any>)) => any>;
export { MergeStyles, StyleParser, access, _default as default, extendVnode, getDate, getProps, getReactiveViewComponent, safeRequest, setup, useSubscription };