sygnal 4.0.1 → 4.0.2
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/dist/index.d.ts +14 -14
- package/package.json +1 -1
- package/src/index.d.ts +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -51,22 +51,22 @@ type Event<DATA=any> = { type: string, data: DATA }
|
|
|
51
51
|
* - true: Whatever value is received from the intent for this action is passed on as-is.
|
|
52
52
|
* - Function: A reducer
|
|
53
53
|
*/
|
|
54
|
-
type SinkValue<STATE, PROPS, ACTIONS, DATA, RETURN> = true | Reducer<STATE, PROPS, ACTIONS, DATA, RETURN>
|
|
54
|
+
type SinkValue<STATE, PROPS, ACTIONS, DATA, RETURN, CALCULATED> = true | Reducer<STATE & CALCULATED, PROPS, ACTIONS, DATA, RETURN>
|
|
55
55
|
|
|
56
|
-
type DefaultSinks<STATE, PROPS, ACTIONS, DATA> = {
|
|
57
|
-
STATE?: SinkValue<STATE, PROPS, ACTIONS, DATA, STATE>;
|
|
58
|
-
EVENTS?: SinkValue<STATE, PROPS, ACTIONS, DATA, Event>;
|
|
59
|
-
LOG?: SinkValue<STATE, PROPS, ACTIONS, DATA, any>;
|
|
60
|
-
PARENT?: SinkValue<STATE, PROPS, ACTIONS, DATA, any>;
|
|
56
|
+
type DefaultSinks<STATE, PROPS, ACTIONS, DATA, CALCULATED> = {
|
|
57
|
+
STATE?: SinkValue<STATE, PROPS, ACTIONS, DATA, STATE, CALCULATED>;
|
|
58
|
+
EVENTS?: SinkValue<STATE, PROPS, ACTIONS, DATA, Event, CALCULATED>;
|
|
59
|
+
LOG?: SinkValue<STATE, PROPS, ACTIONS, DATA, any, CALCULATED>;
|
|
60
|
+
PARENT?: SinkValue<STATE, PROPS, ACTIONS, DATA, any, CALCULATED>;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
type CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY> = keyof DRIVERS extends never ? {
|
|
64
|
-
[driver: string]: SinkValue<STATE, PROPS, ACTIONS, any, any>;
|
|
63
|
+
type CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED> = keyof DRIVERS extends never ? {
|
|
64
|
+
[driver: string]: SinkValue<STATE, PROPS, ACTIONS, any, any, CALCULATED>;
|
|
65
65
|
} : {
|
|
66
|
-
[DRIVER_KEY in keyof DRIVERS]: SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, DRIVERS[DRIVER_KEY] extends { source: any, sink: any } ? DRIVERS[DRIVER_KEY]["sink"] : any>;
|
|
66
|
+
[DRIVER_KEY in keyof DRIVERS]: SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, DRIVERS[DRIVER_KEY] extends { source: any, sink: any } ? DRIVERS[DRIVER_KEY]["sink"] : any, CALCULATED>;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
type ModelEntry<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY> = SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, STATE> | Partial<DefaultSinks<STATE, PROPS, ACTIONS, ACTION_ENTRY> & CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY>>;
|
|
69
|
+
type ModelEntry<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED> = SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, STATE, CALCULATED> | Partial<DefaultSinks<STATE, PROPS, ACTIONS, ACTION_ENTRY, CALCULATED> & CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED>>;
|
|
70
70
|
|
|
71
71
|
type WithDefaultActions<STATE, ACTIONS> = ACTIONS & {
|
|
72
72
|
BOOTSTRAP?: never;
|
|
@@ -74,10 +74,10 @@ type WithDefaultActions<STATE, ACTIONS> = ACTIONS & {
|
|
|
74
74
|
HYDRATE?: any;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
type ComponentModel<STATE, PROPS, DRIVERS, ACTIONS> = keyof ACTIONS extends never ? {
|
|
78
|
-
[action: string]: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, { [action: string]: any }>, any>;
|
|
77
|
+
type ComponentModel<STATE, PROPS, DRIVERS, ACTIONS, CALCULATED> = keyof ACTIONS extends never ? {
|
|
78
|
+
[action: string]: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, { [action: string]: any }>, any, CALCULATED>;
|
|
79
79
|
} : {
|
|
80
|
-
[ACTION_KEY in keyof WithDefaultActions<STATE, ACTIONS>]?: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, ACTIONS>, WithDefaultActions<STATE, ACTIONS>[ACTION_KEY]>;
|
|
80
|
+
[ACTION_KEY in keyof WithDefaultActions<STATE, ACTIONS>]?: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, ACTIONS>, WithDefaultActions<STATE, ACTIONS>[ACTION_KEY], CALCULATED>;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
type ChildSource = {
|
|
@@ -167,7 +167,7 @@ type Component<STATE=any, PROPS={[prop: string]: any}, DRIVERS={}, ACTIONS={}, C
|
|
|
167
167
|
DOMSourceName?: string;
|
|
168
168
|
stateSourceName?: string;
|
|
169
169
|
requestSourceName?: string;
|
|
170
|
-
model?: ComponentModel<STATE
|
|
170
|
+
model?: ComponentModel<STATE, PROPS, FixDrivers<DRIVERS>, ACTIONS, CALCULATED>;
|
|
171
171
|
intent?: ComponentIntent<STATE & CALCULATED, FixDrivers<DRIVERS>, ACTIONS>;
|
|
172
172
|
initialState?: STATE;
|
|
173
173
|
calculated?: Calculated<STATE, CALCULATED>;
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -51,22 +51,22 @@ export type Event<DATA=any> = { type: string, data: DATA }
|
|
|
51
51
|
* - true: Whatever value is received from the intent for this action is passed on as-is.
|
|
52
52
|
* - Function: A reducer
|
|
53
53
|
*/
|
|
54
|
-
type SinkValue<STATE, PROPS, ACTIONS, DATA, RETURN> = true | Reducer<STATE, PROPS, ACTIONS, DATA, RETURN>
|
|
54
|
+
type SinkValue<STATE, PROPS, ACTIONS, DATA, RETURN, CALCULATED> = true | Reducer<STATE & CALCULATED, PROPS, ACTIONS, DATA, RETURN>
|
|
55
55
|
|
|
56
|
-
type DefaultSinks<STATE, PROPS, ACTIONS, DATA> = {
|
|
57
|
-
STATE?: SinkValue<STATE, PROPS, ACTIONS, DATA, STATE>;
|
|
58
|
-
EVENTS?: SinkValue<STATE, PROPS, ACTIONS, DATA, Event>;
|
|
59
|
-
LOG?: SinkValue<STATE, PROPS, ACTIONS, DATA, any>;
|
|
60
|
-
PARENT?: SinkValue<STATE, PROPS, ACTIONS, DATA, any>;
|
|
56
|
+
type DefaultSinks<STATE, PROPS, ACTIONS, DATA, CALCULATED> = {
|
|
57
|
+
STATE?: SinkValue<STATE, PROPS, ACTIONS, DATA, STATE, CALCULATED>;
|
|
58
|
+
EVENTS?: SinkValue<STATE, PROPS, ACTIONS, DATA, Event, CALCULATED>;
|
|
59
|
+
LOG?: SinkValue<STATE, PROPS, ACTIONS, DATA, any, CALCULATED>;
|
|
60
|
+
PARENT?: SinkValue<STATE, PROPS, ACTIONS, DATA, any, CALCULATED>;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
type CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY> = keyof DRIVERS extends never ? {
|
|
64
|
-
[driver: string]: SinkValue<STATE, PROPS, ACTIONS, any, any>;
|
|
63
|
+
type CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED> = keyof DRIVERS extends never ? {
|
|
64
|
+
[driver: string]: SinkValue<STATE, PROPS, ACTIONS, any, any, CALCULATED>;
|
|
65
65
|
} : {
|
|
66
|
-
[DRIVER_KEY in keyof DRIVERS]: SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, DRIVERS[DRIVER_KEY] extends { source: any, sink: any } ? DRIVERS[DRIVER_KEY]["sink"] : any>;
|
|
66
|
+
[DRIVER_KEY in keyof DRIVERS]: SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, DRIVERS[DRIVER_KEY] extends { source: any, sink: any } ? DRIVERS[DRIVER_KEY]["sink"] : any, CALCULATED>;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
type ModelEntry<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY> = SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, STATE> | Partial<DefaultSinks<STATE, PROPS, ACTIONS, ACTION_ENTRY> & CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY>>;
|
|
69
|
+
type ModelEntry<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED> = SinkValue<STATE, PROPS, ACTIONS, ACTION_ENTRY, STATE, CALCULATED> | Partial<DefaultSinks<STATE, PROPS, ACTIONS, ACTION_ENTRY, CALCULATED> & CustomDriverSinks<STATE, PROPS, DRIVERS, ACTIONS, ACTION_ENTRY, CALCULATED>>;
|
|
70
70
|
|
|
71
71
|
type WithDefaultActions<STATE, ACTIONS> = ACTIONS & {
|
|
72
72
|
BOOTSTRAP?: never;
|
|
@@ -74,10 +74,10 @@ type WithDefaultActions<STATE, ACTIONS> = ACTIONS & {
|
|
|
74
74
|
HYDRATE?: any;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
type ComponentModel<STATE, PROPS, DRIVERS, ACTIONS> = keyof ACTIONS extends never ? {
|
|
78
|
-
[action: string]: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, { [action: string]: any }>, any>;
|
|
77
|
+
type ComponentModel<STATE, PROPS, DRIVERS, ACTIONS, CALCULATED> = keyof ACTIONS extends never ? {
|
|
78
|
+
[action: string]: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, { [action: string]: any }>, any, CALCULATED>;
|
|
79
79
|
} : {
|
|
80
|
-
[ACTION_KEY in keyof WithDefaultActions<STATE, ACTIONS>]?: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, ACTIONS>, WithDefaultActions<STATE, ACTIONS>[ACTION_KEY]>;
|
|
80
|
+
[ACTION_KEY in keyof WithDefaultActions<STATE, ACTIONS>]?: ModelEntry<STATE, PROPS, DRIVERS, WithDefaultActions<STATE, ACTIONS>, WithDefaultActions<STATE, ACTIONS>[ACTION_KEY], CALCULATED>;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
type ChildSource = {
|
|
@@ -167,7 +167,7 @@ export type Component<STATE=any, PROPS={[prop: string]: any}, DRIVERS={}, ACTION
|
|
|
167
167
|
DOMSourceName?: string;
|
|
168
168
|
stateSourceName?: string;
|
|
169
169
|
requestSourceName?: string;
|
|
170
|
-
model?: ComponentModel<STATE
|
|
170
|
+
model?: ComponentModel<STATE, PROPS, FixDrivers<DRIVERS>, ACTIONS, CALCULATED>;
|
|
171
171
|
intent?: ComponentIntent<STATE & CALCULATED, FixDrivers<DRIVERS>, ACTIONS>;
|
|
172
172
|
initialState?: STATE;
|
|
173
173
|
calculated?: Calculated<STATE, CALCULATED>;
|