ueca-react 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +109 -119
- package/dist/index.d.ts +266 -4
- package/dist/ueca-react.js +1453 -0
- package/docs/Arrays and Reactivity in UECA-React.md +158 -0
- package/docs/Automatic onChange Events in UECA-React.md +142 -0
- package/docs/Automatic onChanging Events in UECA-React.md +157 -0
- package/docs/Automatic onPropChange and onPropChanging Events in UECA-React.md +112 -0
- package/docs/Component Extension in UECA-React.md +275 -0
- package/docs/Component IDs in UECA-React.md +181 -0
- package/docs/{component-intergation-model.md → Component Integration Model in UECA-React.md } +4 -3
- package/docs/{component-mental-model.md → Component Mental Model in UECA-React.md } +4 -3
- package/docs/Introduction to UECA-React Components.md +190 -0
- package/docs/Introduction to UECA-React.md +24 -0
- package/docs/Lifecycle Hooks in UECA-React.md +237 -0
- package/docs/Message Bus in UECA-React.md +260 -0
- package/docs/Model Caching in UECA-React.md +144 -0
- package/docs/Property Bindings in UECA-React.md +191 -0
- package/docs/State Management in UECA-React.md +128 -0
- package/docs/Technology of UECA-React.md +45 -0
- package/docs/Tracing in UECA-React.md +110 -0
- package/docs/code-template.md +53 -27
- package/docs/index.md +31 -11
- package/package.json +68 -72
- package/dist/componentModel.d.ts +0 -127
- package/dist/componentModel.js +0 -772
- package/dist/dynamicContent.d.ts +0 -22
- package/dist/dynamicContent.js +0 -80
- package/dist/index.js +0 -29
- package/dist/messageBus.d.ts +0 -46
- package/dist/messageBus.js +0 -141
- package/dist/utils.d.ts +0 -8
- package/dist/utils.js +0 -52
- package/docs/base-concepts.md +0 -192
- package/docs/bindings-overview.md +0 -164
- package/docs/general-code-structure.md +0 -177
- package/docs/introduction.md +0 -56
- package/docs/message-bus.md +0 -177
- package/docs/technology.md +0 -45
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,119 +1,109 @@
|
|
|
1
|
-
 and [documentation](/docs/index.md) to start building with `ueca-react`. For questions or contributions, feel free to reach out at [cranesoft@protonmail.com](mailto:cranesoft@protonmail.com).
|
|
1
|
+

|
|
2
|
+
# UECA-React
|
|
3
|
+
|
|
4
|
+
> **⚠️ NOTICE: This is a test publication for early testing and feedback. The API may change before the stable release. Not recommended for production use yet.**
|
|
5
|
+
|
|
6
|
+
UECA-React is a framework for building scalable React applications with a unified and encapsulated component architecture. It simplifies development by hiding the complexities of React and MobX behind a consistent component pattern.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
To install UECA-React, run the following command:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install ueca-react
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Ensure that your project also has the following dependencies installed:
|
|
17
|
+
|
|
18
|
+
- react
|
|
19
|
+
- react-dom
|
|
20
|
+
- mobx
|
|
21
|
+
- mobx-react
|
|
22
|
+
|
|
23
|
+
Compatible React versions: 16.8.0–19.1.0. Make sure your react-dom version matches your react version.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Here's a simple example of a UECA component:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import * as UECA from "ueca-react";
|
|
31
|
+
|
|
32
|
+
type ButtonStruct = UECA.ComponentStruct<{
|
|
33
|
+
props: {
|
|
34
|
+
caption: string;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
events: {
|
|
39
|
+
onClick: () => void;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
type ButtonParams = UECA.ComponentParams<ButtonStruct>;
|
|
44
|
+
type ButtonModel = UECA.ComponentModel<ButtonStruct>;
|
|
45
|
+
|
|
46
|
+
function useButton(params?: ButtonParams): ButtonModel {
|
|
47
|
+
const struct: ButtonStruct = {
|
|
48
|
+
props: {
|
|
49
|
+
caption: "MyButton",
|
|
50
|
+
disabled: false
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
events: {
|
|
54
|
+
onChangeDisabled: (value) => {
|
|
55
|
+
console.log(`Button id=${model.fullId()} disabled=${value}`);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
View: () => (
|
|
60
|
+
<button id={model.htmlId()} disabled={model.disabled} onClick={() => model.onClick?.()}>
|
|
61
|
+
{model.caption}
|
|
62
|
+
</button>
|
|
63
|
+
)
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const model = UECA.useComponent(struct, params);
|
|
67
|
+
return model;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const Button = UECA.getFC(useButton);
|
|
71
|
+
export { ButtonModel, useButton, Button };
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For more detailed information, check out the [full documentation](./docs/index.md).
|
|
75
|
+
|
|
76
|
+
## Features
|
|
77
|
+
|
|
78
|
+
- **Unified Component Pattern**: Consistent structure for all components
|
|
79
|
+
- **Type-Safe**: Full TypeScript support with comprehensive type definitions
|
|
80
|
+
- **MobX Integration**: Automatic reactivity without manual state management
|
|
81
|
+
- **Automatic onChange Events**: Auto-generated event handlers for every property (e.g., `onChangeCaption` for `caption` prop)
|
|
82
|
+
- **Lifecycle Hooks**: Built-in lifecycle management (constr, init, mount, draw, erase, unmount, deinit)
|
|
83
|
+
- **Message Bus**: Decoupled inter-component communication
|
|
84
|
+
- **Property Bindings**: Bidirectional data binding between components
|
|
85
|
+
- **AI-Friendly**: Designed for easy code generation and AI assistance
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
Comprehensive documentation is available in the [docs](./docs) folder:
|
|
90
|
+
- [Introduction to UECA-React](./docs/Introduction%20to%20UECA-React.md)
|
|
91
|
+
- [Component Guide](./docs/Introduction%20to%20UECA-React%20Components.md)
|
|
92
|
+
- [State Management](./docs/State%20Management%20in%20UECA-React.md)
|
|
93
|
+
- [Message Bus](./docs/Message%20Bus%20in%20UECA-React.md)
|
|
94
|
+
- [Lifecycle Hooks](./docs/Lifecycle%20Hooks%20in%20UECA-React.md)
|
|
95
|
+
- [Property Bindings](./docs/Property%20Bindings%20in%20UECA-React.md)
|
|
96
|
+
|
|
97
|
+
## Support
|
|
98
|
+
|
|
99
|
+
For questions, issues, or feature requests, please use the [GitHub issue tracker](https://github.com/nekutuzov/ueca-react-npm/issues).
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
This project is licensed under the ISC License - see the [LICENSE](./LICENSE) file for details.
|
|
104
|
+
|
|
105
|
+
## Author
|
|
106
|
+
|
|
107
|
+
**Aleksey Suvorov**
|
|
108
|
+
Email: cranesoft@protonmail.com
|
|
109
|
+
GitHub: [nekutuzov/ueca-react-npm](https://github.com/nekutuzov/ueca-react-npm)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,266 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import * as React_2 from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const $: unique symbol;
|
|
4
|
+
|
|
5
|
+
export declare const $name = "$";
|
|
6
|
+
|
|
7
|
+
export declare type AnyComponentModel = ComponentModel<AnyComponentStruct>;
|
|
8
|
+
|
|
9
|
+
export declare type AnyComponentParams = ComponentParams<AnyComponentStruct>;
|
|
10
|
+
|
|
11
|
+
export declare type AnyComponentStruct = ComponentStruct<ComponentStructBase<BusMessages>>;
|
|
12
|
+
|
|
13
|
+
export declare function bind<T extends NonNullable<unknown>, P extends keyof T>(obj: () => T, prop: P): Bond<T[P]>;
|
|
14
|
+
|
|
15
|
+
export declare function bind<T>(get: () => T, set: ((value: T) => void) | undefined): Bond<T>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use the `bind` function instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare function bindProp<T extends NonNullable<unknown>, P extends keyof T>(obj: () => T, prop: P): Bond<T[P]>;
|
|
21
|
+
|
|
22
|
+
export declare type Bond<T> = [(() => T) | undefined, ((value: T) => void) | undefined];
|
|
23
|
+
|
|
24
|
+
export declare type BusMessageHandlers<TMsg extends BusMessages> = {
|
|
25
|
+
[Msg in keyof TMsg]?: ParamIn<TMsg, Msg> extends undefined ? MessageHandlerNoPar<TMsg, Msg> : MessageHandler<TMsg, Msg>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export declare type BusMessages = Record<MessageID, InParam | OutParam | InParam & OutParam> | EmptyObject;
|
|
29
|
+
|
|
30
|
+
export declare function clone<T>(obj: T): T | undefined;
|
|
31
|
+
|
|
32
|
+
declare type ComponentChildren<TStruct extends GeneralComponentStruct> = NonNullable<TStruct["children"]>;
|
|
33
|
+
|
|
34
|
+
declare type ComponentEvents<TStruct extends GeneralComponentStruct> = Partial<NonNullable<TStruct["events"]>>;
|
|
35
|
+
|
|
36
|
+
declare type ComponentMessages<TStruct extends ComponentStructBase<TMsg>, TMsg extends BusMessages> = NonNullable<TStruct["messages"]>;
|
|
37
|
+
|
|
38
|
+
declare type ComponentMethods<TStruct extends GeneralComponentStruct> = NonNullable<TStruct["methods"]>;
|
|
39
|
+
|
|
40
|
+
export declare type ComponentModel<TStruct extends ComponentStruct<ComponentStructBase<TMsg>, TMsg>, TMsg extends BusMessages = BusMessages> = ComponentProps<NonNullable<TStruct["__struct"]>> & Readonly<ComponentChildren<NonNullable<TStruct["__struct"]>>> & Readonly<ComponentMethods<NonNullable<TStruct["__struct"]>>> & ComponentStructEvents<ComponentProps<NonNullable<TStruct["__struct"]>>> & ComponentEvents<NonNullable<TStruct["__struct"]>> & {
|
|
41
|
+
readonly $: ComponentPrivateMembers;
|
|
42
|
+
readonly bus: MessageBus<TMsg>;
|
|
43
|
+
readonly View: ComponentView;
|
|
44
|
+
readonly BaseView: ComponentView;
|
|
45
|
+
readonly disableOnChange: () => void;
|
|
46
|
+
readonly enableOnChange: () => void;
|
|
47
|
+
readonly changeNotifyDisabled: () => boolean;
|
|
48
|
+
readonly fullId: () => string;
|
|
49
|
+
readonly htmlId: () => string | undefined;
|
|
50
|
+
readonly birthMark: () => string;
|
|
51
|
+
readonly clearModelCache: () => void;
|
|
52
|
+
readonly getChildrenModels: GetChildrenModels;
|
|
53
|
+
readonly invalidateView: () => void;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export declare type ComponentParams<TStruct extends ComponentStruct<ComponentStructBase<TMsg>, TMsg>, TMsg extends BusMessages = BusMessages> = ComponentProps<TStruct> & ComponentEvents<TStruct> & {
|
|
57
|
+
constr?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
58
|
+
init?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
59
|
+
deinit?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
60
|
+
mount?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
61
|
+
unmount?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
62
|
+
draw?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
63
|
+
erase?: (model: ComponentModel<TStruct, TMsg>) => void;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare type ComponentPrivateMembers = {
|
|
67
|
+
__status: {
|
|
68
|
+
initPhase?: "constructing" | "constructed" | "initializing" | "initialized" | "unmount-deinit" | "deinitializing";
|
|
69
|
+
mountPhase?: "init-mount" | "mounting" | "mounted" | "unmounting";
|
|
70
|
+
cached: boolean;
|
|
71
|
+
initCount: number;
|
|
72
|
+
mountCount: number;
|
|
73
|
+
baseResult: unknown;
|
|
74
|
+
};
|
|
75
|
+
__settersInProgress: string[];
|
|
76
|
+
__owner: AnyComponentModel;
|
|
77
|
+
__struct: AnyComponentStruct;
|
|
78
|
+
__params: AnyComponentParams;
|
|
79
|
+
__assignParams: (params: AnyComponentParams) => void;
|
|
80
|
+
__dynamicChildrenIds: string[];
|
|
81
|
+
__staticChildrenCache: AnyComponentModel[];
|
|
82
|
+
__proxy: AnyComponentModel;
|
|
83
|
+
__initializeModel: (params?: AnyComponentParams) => void;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare type ComponentProps<TStruct extends GeneralComponentStruct> = Partial<NonNullable<TStruct["props"]>>;
|
|
87
|
+
|
|
88
|
+
export declare type ComponentStruct<TStruct extends GeneralComponentStruct, TMsg extends BusMessages = BusMessages> = PartialGeneralComponentStruct<ComponentStructBase<TMsg>, TMsg> & Omit<TStruct & ComponentStructBase<TMsg>, "props" | "children" | "methods" | "events" | "messages"> & PartialGeneralComponentStruct<TStruct, TMsg> & {
|
|
89
|
+
__struct?: TStruct;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare type ComponentStructBase<TMsg extends BusMessages> = GeneralComponentStruct & {
|
|
93
|
+
props?: {
|
|
94
|
+
id?: string;
|
|
95
|
+
cacheable?: boolean;
|
|
96
|
+
};
|
|
97
|
+
messages?: BusMessageHandlers<TMsg>;
|
|
98
|
+
View?: ComponentView;
|
|
99
|
+
BaseView?: ComponentView;
|
|
100
|
+
constr?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
101
|
+
init?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
102
|
+
deinit?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
103
|
+
mount?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
104
|
+
unmount?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
105
|
+
draw?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
106
|
+
erase?: (model: ComponentModel<ComponentStructBase<TMsg>, TMsg>) => MaybePromise;
|
|
107
|
+
} & {
|
|
108
|
+
__struct?: ComponentStructBase<TMsg>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare type ComponentStructEvents<TProps> = {
|
|
112
|
+
onPropChanging?: (prop: keyof TProps | string, newValue: unknown, oldValue: unknown) => unknown;
|
|
113
|
+
onPropChange?: (prop: keyof TProps | string, value: unknown, oldValue: unknown) => void;
|
|
114
|
+
} & {
|
|
115
|
+
[Evt in keyof TProps as `onChanging${Capitalize<Evt & string>}`]?: (newValue: TProps[Evt], oldValue: TProps[Evt]) => TProps[Evt];
|
|
116
|
+
} & {
|
|
117
|
+
[Evt in keyof TProps as `onChange${Capitalize<Evt & string>}`]?: (value: TProps[Evt], oldValue: TProps[Evt]) => void;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare type ComponentView = (params?: ViewParams) => ReactElement;
|
|
121
|
+
|
|
122
|
+
export declare function defaultMessageBus<TMsg extends BusMessages>(): MessageBus<TMsg>;
|
|
123
|
+
|
|
124
|
+
export declare type DynamicChildren = Record<string, AnyComponentModel>;
|
|
125
|
+
|
|
126
|
+
export declare type EmptyObject = Record<never, never>;
|
|
127
|
+
|
|
128
|
+
export declare type ErrorHandler = (error: Error) => void;
|
|
129
|
+
|
|
130
|
+
export declare function errorIf(condition: boolean, errorMessage?: string): void;
|
|
131
|
+
|
|
132
|
+
export declare function errorIfNot(condition: boolean, errorMessage?: string): void;
|
|
133
|
+
|
|
134
|
+
export declare type GeneralComponentStruct = {
|
|
135
|
+
props?: EmptyObject;
|
|
136
|
+
children?: EmptyObject;
|
|
137
|
+
methods?: EmptyObject;
|
|
138
|
+
events?: EmptyObject;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
declare type GetChildrenModels = (childrenTypeFilter?: ModelType) => AnyComponentModel[];
|
|
142
|
+
|
|
143
|
+
export declare function getFC<TStruct extends ComponentStruct<ComponentStructBase<TMsg>, TMsg>, TMsg extends BusMessages>(modelHook: (params: ComponentParams<TStruct, TMsg>) => ComponentModel<TStruct, TMsg>): (params: ComponentParams<TStruct, TMsg>) => React_2.JSX.Element;
|
|
144
|
+
|
|
145
|
+
declare type GlobalSettings = {
|
|
146
|
+
traceLog: boolean;
|
|
147
|
+
hashHtmlId: boolean;
|
|
148
|
+
modelCacheMode: "no-cache" | "cache" | "auto-cache";
|
|
149
|
+
errorHandler?: ErrorHandler;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export declare const globalSettings: GlobalSettings;
|
|
153
|
+
|
|
154
|
+
export declare function IF(props: {
|
|
155
|
+
condition: boolean;
|
|
156
|
+
children: React_2.ReactNode;
|
|
157
|
+
}): React_2.JSX.Element;
|
|
158
|
+
|
|
159
|
+
declare type InParam = {
|
|
160
|
+
in: unknown;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export declare function intersection(a: unknown[], b: unknown[]): unknown[];
|
|
164
|
+
|
|
165
|
+
export declare function isArray(value: unknown): value is unknown[];
|
|
166
|
+
|
|
167
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
168
|
+
|
|
169
|
+
export declare function isComponentModel(obj: unknown): boolean;
|
|
170
|
+
|
|
171
|
+
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
172
|
+
|
|
173
|
+
export declare function isFunction(value: unknown): value is () => unknown;
|
|
174
|
+
|
|
175
|
+
export declare function isMap(value: unknown): value is Map<unknown, unknown>;
|
|
176
|
+
|
|
177
|
+
export declare function isNull(value: unknown): value is null;
|
|
178
|
+
|
|
179
|
+
export declare function isNumber(value: unknown): value is number;
|
|
180
|
+
|
|
181
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
182
|
+
|
|
183
|
+
export declare function isString(value: unknown): value is string;
|
|
184
|
+
|
|
185
|
+
export declare function isSymbol(value: unknown): value is symbol;
|
|
186
|
+
|
|
187
|
+
export declare function isUndefined(value: unknown): value is undefined;
|
|
188
|
+
|
|
189
|
+
export declare type MaybePromise = void | Promise<void>;
|
|
190
|
+
|
|
191
|
+
export declare type MessageBus<TMsg extends BusMessages> = {
|
|
192
|
+
readonly name?: string;
|
|
193
|
+
subscribe(subscriber: Subscriber<TMsg>): void;
|
|
194
|
+
unsubscribe(subscriber: Subscriber<TMsg>): void;
|
|
195
|
+
broadcast<Msg extends keyof TMsg>(modelId: string | RegExp | null, message: Msg, param: ParamIn<TMsg, Msg>): Promise<ParamOut<TMsg, Msg>[]>;
|
|
196
|
+
castTo<Msg extends keyof TMsg>(modelId: string, message: Msg, param: ParamIn<TMsg, Msg>): Promise<ParamOut<TMsg, Msg>>;
|
|
197
|
+
unicast<Msg extends keyof TMsg>(message: Msg, param: ParamIn<TMsg, Msg>): Promise<ParamOut<TMsg, Msg>>;
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Use the `unicast` function instead.
|
|
200
|
+
*/
|
|
201
|
+
getAsync<Msg extends keyof TMsg>(message: Msg, param: ParamIn<TMsg, Msg>): Promise<ParamOut<TMsg, Msg>>;
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Use the `unicast` function instead.
|
|
204
|
+
*/
|
|
205
|
+
postAsync<Msg extends keyof TMsg>(message: Msg, param: ParamIn<TMsg, Msg>): Promise<ParamOut<TMsg, Msg>>;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare type MessageHandler<TMsg extends BusMessages, Msg extends keyof TMsg> = (param: ParamIn<TMsg, Msg>) => Promise<ParamOut<TMsg, Msg> extends undefined ? void : ParamOut<TMsg, Msg>>;
|
|
209
|
+
|
|
210
|
+
declare type MessageHandlerNoPar<TMsg extends BusMessages, Msg extends keyof TMsg> = () => Promise<ParamOut<TMsg, Msg> extends undefined ? void : ParamOut<TMsg, Msg>>;
|
|
211
|
+
|
|
212
|
+
declare type MessageID = string;
|
|
213
|
+
|
|
214
|
+
declare type ModelType = "static" | "dynamic";
|
|
215
|
+
|
|
216
|
+
export declare function observe<T extends object>(value: T): T;
|
|
217
|
+
|
|
218
|
+
declare type OutParam = {
|
|
219
|
+
out: unknown;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
declare type ParamIn<TMsg extends BusMessages, Msg extends keyof TMsg> = TMsg[Msg] extends InParam ? TMsg[Msg][keyof InParam] : undefined;
|
|
223
|
+
|
|
224
|
+
declare type ParamOut<TMsg extends BusMessages, Msg extends keyof TMsg> = TMsg[Msg] extends OutParam ? TMsg[Msg][keyof OutParam] : void;
|
|
225
|
+
|
|
226
|
+
declare type PartialGeneralComponentStruct<TStruct extends GeneralComponentStruct, TMsg extends BusMessages> = {
|
|
227
|
+
props?: Partial<StructProps<ComponentProps<TStruct>>>;
|
|
228
|
+
children?: Partial<ComponentChildren<TStruct>>;
|
|
229
|
+
methods?: Partial<ComponentMethods<TStruct>>;
|
|
230
|
+
events?: Partial<ComponentStructEvents<ComponentProps<TStruct>>> & Partial<ComponentEvents<TStruct>>;
|
|
231
|
+
messages?: Partial<ComponentMessages<TStruct, TMsg>>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export declare type ReactCSS = React_2.CSSProperties;
|
|
235
|
+
|
|
236
|
+
export declare type ReactElement = React_2.JSX.Element;
|
|
237
|
+
|
|
238
|
+
export declare const RenderNode: (props: {
|
|
239
|
+
node: React_2.ReactNode | React_2.ComponentType;
|
|
240
|
+
render?: boolean;
|
|
241
|
+
}) => React_2.JSX.Element;
|
|
242
|
+
|
|
243
|
+
export declare function renderNode(node: React_2.ReactNode | React_2.ComponentType): React_2.ReactNode;
|
|
244
|
+
|
|
245
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
246
|
+
|
|
247
|
+
declare type StructProp<T> = T | (() => T) | Bond<T>;
|
|
248
|
+
|
|
249
|
+
declare type StructProps<TProps extends object> = {
|
|
250
|
+
[Prop in keyof TProps]: StructProp<TProps[Prop]>;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
declare type Subscriber<TMsg extends BusMessages> = ComponentModel<ComponentStructBase<TMsg>, TMsg>;
|
|
254
|
+
|
|
255
|
+
export declare function useComponent<TStruct extends ComponentStruct<ComponentStructBase<TMsg>, TMsg>, TMsg extends BusMessages>(struct: TStruct, params?: ComponentParams<TStruct, TMsg>): ComponentModel<TStruct, TMsg>;
|
|
256
|
+
|
|
257
|
+
export declare function useExtendedComponent<TStruct extends ComponentStruct<ComponentStructBase<TMsg>, TMsg>, TMsg extends BusMessages>(struct: ComponentStruct<ComponentStructBase<TMsg>, TMsg>, extStruct: TStruct, params?: ComponentParams<TStruct, TMsg>, modelHook?: (struct: TStruct, params?: ComponentParams<TStruct, TMsg>) => ComponentModel<TStruct, TMsg>): ComponentModel<TStruct, TMsg>;
|
|
258
|
+
|
|
259
|
+
export declare function useMessaging<TMsg extends BusMessages>(model: Subscriber<TMsg>): MessageBus<TMsg>;
|
|
260
|
+
|
|
261
|
+
declare type ViewParams = {
|
|
262
|
+
render?: boolean;
|
|
263
|
+
children?: React_2.ReactNode;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export { }
|