/
index.ts
93 lines (81 loc) · 2.23 KB
/
index.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
import {
MACHINAT_FRAGMENT_TYPE,
MACHINAT_PAUSE_TYPE,
MACHINAT_PROVIDER_TYPE,
MACHINAT_THUNK_TYPE,
MACHINAT_RAW_TYPE,
} from './symbol';
import createMachinatElement from './createElement';
import App from './app';
import type {
AppConfig,
MachinatElement,
NativeComponent,
ContainerComponent,
AnyMachinatPlatform,
FragmentProps,
PauseProps,
ProviderProps,
ThunkProps,
RawProps,
} from './types';
export {
makeContainer,
makeInterface,
makeClassProvider,
makeFactoryProvider,
} from './service';
export { default as BasicBot } from './base/Bot';
export { default as BasicProfiler } from './base/Profiler';
export { default as StateController } from './base/StateController';
export { default as IntentRecognizer } from './base/IntentRecognizer';
export { default as Marshaler } from './base/Marshaler';
export { default as RenderingChannel } from './base/RenderingChannel';
export * from './types';
/**
* @category Root
*/
namespace Machinat {
export const createElement = createMachinatElement;
export const createApp = <Platform extends AnyMachinatPlatform>(
config: AppConfig<Platform>
): App<Platform> => {
const app = new App(config);
return app;
};
export const Fragment = MACHINAT_FRAGMENT_TYPE as unknown as (
props: FragmentProps
) => null;
export const Pause = MACHINAT_PAUSE_TYPE as unknown as (
props: PauseProps
) => null;
export const Provider = MACHINAT_PROVIDER_TYPE as unknown as (
props: ProviderProps
) => null;
export const Thunk = MACHINAT_THUNK_TYPE as unknown as (
props: ThunkProps
) => null;
export const Raw = MACHINAT_RAW_TYPE as unknown as (props: RawProps) => null;
export namespace JSX {
export type Element = MachinatElement<any, any>;
export type ElementClass =
| NativeComponent<any, any>
| ContainerComponent<any>;
export interface ElementAttributesProperty {
$$typeof: {};
}
export interface ElementChildrenAttribute {
children: {};
}
export type LibraryManagedAttributes<C, P> = C extends NativeComponent<
infer T,
any
>
? T
: C extends ContainerComponent<infer U>
? U
: P;
// interface IntrinsicElements {}
}
}
export default Machinat;