-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcumbia.d.ts
117 lines (117 loc) · 4.27 KB
/
cumbia.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
declare module "example/counter/components/todo/messages" {
export enum MESSAGES {
ADD_TODO = "ADD_TODO"
}
export type MESSAGES_TYPE = {
[MESSAGES.ADD_TODO]: string;
};
}
declare module "src/_version" {
export const version = "0.0.11";
}
declare module "src/utils/message" {
const _default: {
error: (msg: any) => void;
warn: (msg: any) => void;
info: (msg: any) => void;
};
export default _default;
}
declare module "src/types/cumbiaTypes" {
type Initialisers = (elements: Array<HTMLElement>) => void;
type GlobalInitialisers = Array<Initialisers>;
export type CumbiaOptions = {
globalInitialisers: GlobalInitialisers;
};
export type ActionArgs = {
[key: string]: any | HTMLElement;
};
export type ComponentActions = {
[key: string]: (t: ActionArgs) => void;
};
export type ComponentInitializer = (t: BindedValues) => void;
export interface ComponentInstance {
actions?: ComponentActions;
init?: ComponentInitializer;
name: string;
}
export type actionableObject = {
el: HTMLElement;
value: string;
};
export type BindedValues = {
[key: string]: actionableObject;
};
export type Component = {
el: HTMLElement;
on: (topic: string, fn: any) => void;
emit: (topic: string, message: any) => void;
};
export type ComponentFactory = (component: Component) => ComponentInstance;
}
declare module "src/actionParser/utils/parseValues" {
import { BindedValues } from "src/types/cumbiaTypes";
const parseValues: (element: HTMLElement) => BindedValues;
export default parseValues;
}
declare module "src/actionParser/utils/caller" {
import { ComponentActions } from "src/types/cumbiaTypes";
export type CallerValues = {
prevent: boolean;
};
const callFnWithValues: (element: HTMLElement, fnActions: ComponentActions, actionName: string, { prevent }: CallerValues) => (e: Event) => void;
export default callFnWithValues;
}
declare module "src/actionParser/data-action" {
import { ComponentActions } from "src/types/cumbiaTypes";
const parseActions: (element: HTMLElement, fnActions: ComponentActions) => void;
export default parseActions;
}
declare module "src/actionParser/data-key" {
import { ComponentActions } from "src/types/cumbiaTypes";
const parseKey: (element: HTMLElement, fnActions: ComponentActions) => void;
export default parseKey;
}
declare module "src/actionParser/lifecycle" {
import { ComponentInstance } from "src/types/cumbiaTypes";
const parseLifecycle: (instance: ComponentInstance, element: HTMLElement) => void;
export default parseLifecycle;
}
declare module "src/core/pubsub" {
export const on: (topic: string, fn: any) => void;
type emitterType = <T>(topic: string, message: T) => void;
export const emit: emitterType;
const _default_1: {
on: (topic: string, fn: any) => void;
emit: emitterType;
};
export default _default_1;
}
declare module "src/core/componentExecutor" {
import { ComponentFactory } from "src/types/cumbiaTypes";
const componentExecutor: (element: HTMLElement, componentFactory: Map<string, ComponentFactory>, name: string) => void;
export default componentExecutor;
}
declare module "src/core/createApp" {
import { ComponentFactory } from "src/types/cumbiaTypes";
import { CumbiaOptions } from "src/types/cumbiaTypes";
export const initialisedComponent: Map<HTMLElement, boolean>;
export const componentFactory: Map<string, ComponentFactory>;
const createApp: (options?: CumbiaOptions | undefined) => void;
export default createApp;
}
declare module "src/utils/components/debug" {
const debug: (components: Array<HTMLElement>) => void;
export default debug;
}
declare module "src/cumbia" {
import { ComponentFactory, CumbiaOptions } from "src/types/cumbiaTypes";
import debug from "src/utils/components/debug";
const addComponents: (components: Record<string, ComponentFactory>, options?: CumbiaOptions | undefined) => void;
export { debug };
export default addComponents;
}
declare module "src/utils/tests/dispatch" {
export const dispatchContentLoaded: () => boolean;
}
declare module "src/__tests__/cumbia.spec" { }