@merkur/core 0.46.0-rc.0 → 0.46.0-rc.4
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/package.json +2 -2
- package/types.d.ts +16 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/core",
|
|
3
|
-
"version": "0.46.0-rc.
|
|
3
|
+
"version": "0.46.0-rc.4",
|
|
4
4
|
"description": "Merkur is tiny and extensible library for creating front-end microservices.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://merkur.js.org/",
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "f0910c6fab2206dceced9ad7e31da4ed65dd7098"
|
|
57
57
|
}
|
package/types.d.ts
CHANGED
|
@@ -34,12 +34,19 @@ export interface WidgetDefinition {
|
|
|
34
34
|
setup?: WidgetFunction;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
export interface RequiredWidgetKeys {
|
|
38
|
+
$dependencies: unknown;
|
|
39
|
+
$external: unknown;
|
|
40
|
+
create: WidgetFunction;
|
|
41
|
+
setup: WidgetFunction;
|
|
42
|
+
}
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
// Type used during initialization within `createMerkurWidget()`
|
|
45
|
+
// many properties are initialized with defaults, so we can rely on them being present
|
|
46
|
+
type WidgetWithRequiredIntermediary = WidgetDefinition &
|
|
47
|
+
Required<Pick<WidgetDefinition, keyof RequiredWidgetKeys>>;
|
|
48
|
+
export interface WidgetPartial extends WidgetWithRequiredIntermediary {
|
|
41
49
|
$in: WidgetInternal;
|
|
42
|
-
slot: Record<any, any>; // @merkur/core knows (incorrectly?) about slot and initializes it to an empty object.
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
export interface WidgetParams {}
|
|
@@ -89,13 +96,15 @@ export declare function createMerkurWidget<
|
|
|
89
96
|
>(widgetDefinition: T): Widget;
|
|
90
97
|
|
|
91
98
|
// `createMerkurWidget()` binds all WidgetFunctions to the widget instance using `bindWidgetToFunctions()`
|
|
92
|
-
// This series of types replicates that for the typing.
|
|
99
|
+
// This series of types replicates that for the typing.
|
|
93
100
|
type TupleTail<T extends any[]> = T extends [any, ...infer Rest] ? Rest : never;
|
|
94
101
|
type FunctionLike = (...args: any[]) => any;
|
|
95
|
-
type BoundWidgetFunction<T extends FunctionLike> = (
|
|
102
|
+
type BoundWidgetFunction<T extends FunctionLike> = (
|
|
103
|
+
...args: TupleTail<Parameters<T>>
|
|
104
|
+
) => ReturnType<T>;
|
|
96
105
|
type BoundWidget<T> = {
|
|
97
106
|
[K in keyof T]: T[K] extends FunctionLike ? BoundWidgetFunction<T[K]> : T[K];
|
|
98
|
-
}
|
|
107
|
+
};
|
|
99
108
|
export interface Widget extends BoundWidget<WidgetPartial> {}
|
|
100
109
|
|
|
101
110
|
export type MerkurCreate = (
|