@merkur/plugin-component 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 +3 -3
- package/types.d.ts +61 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/plugin-component",
|
|
3
|
-
"version": "0.46.0-rc.
|
|
3
|
+
"version": "0.46.0-rc.4",
|
|
4
4
|
"description": "Merkur component plugin.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
},
|
|
62
62
|
"homepage": "https://merkur.js.org/",
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@merkur/core": "0.46.0-rc.
|
|
64
|
+
"@merkur/core": "0.46.0-rc.4"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@merkur/core": "*"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f0910c6fab2206dceced9ad7e31da4ed65dd7098"
|
|
70
70
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Widget,
|
|
3
|
+
type WidgetFunction,
|
|
4
|
+
type WidgetPartial,
|
|
5
|
+
type WidgetPlugin,
|
|
6
|
+
} from '@merkur/core';
|
|
2
7
|
|
|
3
8
|
export interface ViewType {
|
|
4
9
|
(widget: WidgetPartial): any;
|
|
@@ -31,11 +36,53 @@ export type SSRMountResult = {
|
|
|
31
36
|
export interface WidgetState {}
|
|
32
37
|
export interface WidgetProps {}
|
|
33
38
|
|
|
39
|
+
export interface SlotDefinition {
|
|
40
|
+
name: string;
|
|
41
|
+
View: ViewType;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ViewDefinition {
|
|
45
|
+
View: ViewType;
|
|
46
|
+
ErrorView?: ViewType;
|
|
47
|
+
slotFactories: ((
|
|
48
|
+
widget: Widget,
|
|
49
|
+
) => SlotDefinition | Promise<SlotDefinition>)[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ViewFactoryResult {
|
|
53
|
+
View: ViewType;
|
|
54
|
+
ErrorView?: ViewType;
|
|
55
|
+
slot?: Record<string, ViewFactorySlotType>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ViewFactorySlotType {
|
|
59
|
+
name: string;
|
|
60
|
+
containerSelector?: string;
|
|
61
|
+
View: ViewType;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ViewFactory = (widget: Widget) => Promise<ViewFactoryResult>;
|
|
65
|
+
export type SlotFactory = (widget: WidgetPartial) => Promise<SlotDefinition>;
|
|
66
|
+
|
|
67
|
+
export declare function createSlotFactory(
|
|
68
|
+
creator: (widget: WidgetPartial) => SlotDefinition | Promise<SlotDefinition>,
|
|
69
|
+
): SlotFactory;
|
|
70
|
+
|
|
71
|
+
export declare function createViewFactory(
|
|
72
|
+
creator: (widget: WidgetPartial) => ViewDefinition | Promise<ViewDefinition>,
|
|
73
|
+
): ViewFactory;
|
|
74
|
+
|
|
75
|
+
export declare function componentPlugin(): WidgetPlugin;
|
|
76
|
+
|
|
34
77
|
declare module '@merkur/core' {
|
|
35
78
|
interface DefineWidgetArgs {
|
|
36
79
|
viewFactory: ViewFactory;
|
|
37
80
|
}
|
|
38
81
|
|
|
82
|
+
interface Widget {}
|
|
83
|
+
|
|
84
|
+
interface WidgetPlugin {}
|
|
85
|
+
|
|
39
86
|
interface WidgetDefinition {
|
|
40
87
|
bootstrap?: (widget: WidgetPartial) => void;
|
|
41
88
|
container?: Element;
|
|
@@ -46,6 +93,16 @@ declare module '@merkur/core' {
|
|
|
46
93
|
unmount?: (widget: WidgetPartial) => Promise<void>;
|
|
47
94
|
}
|
|
48
95
|
|
|
96
|
+
interface RequiredWidgetKeys {
|
|
97
|
+
bootstrap: unknown;
|
|
98
|
+
container: unknown;
|
|
99
|
+
info: unknown;
|
|
100
|
+
mount: unknown;
|
|
101
|
+
shouldHydrate: unknown;
|
|
102
|
+
update: unknown;
|
|
103
|
+
unmount: unknown;
|
|
104
|
+
}
|
|
105
|
+
|
|
49
106
|
interface WidgetPartial {
|
|
50
107
|
slot: Record<
|
|
51
108
|
string,
|
|
@@ -59,11 +116,12 @@ declare module '@merkur/core' {
|
|
|
59
116
|
>;
|
|
60
117
|
state: WidgetState;
|
|
61
118
|
props: WidgetProps;
|
|
62
|
-
setState: (newState: WidgetState) => void;
|
|
119
|
+
setState: (widget: WidgetPartial, newState: WidgetState) => void;
|
|
120
|
+
setProps: (widget: WidgetPartial, newProps: WidgetProps) => void;
|
|
63
121
|
}
|
|
64
122
|
interface WidgetInternal {
|
|
65
123
|
component: {
|
|
66
|
-
lifeCycle: Record<string,
|
|
124
|
+
lifeCycle: Record<string, WidgetFunction>;
|
|
67
125
|
isMounted: boolean;
|
|
68
126
|
isHydrated: boolean;
|
|
69
127
|
suspendedTasks: Array<() => Promise<void>>;
|
|
@@ -71,41 +129,3 @@ declare module '@merkur/core' {
|
|
|
71
129
|
};
|
|
72
130
|
}
|
|
73
131
|
}
|
|
74
|
-
|
|
75
|
-
export interface SlotDefinition {
|
|
76
|
-
name: string;
|
|
77
|
-
View: ViewType;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface ViewDefinition {
|
|
81
|
-
View: ViewType;
|
|
82
|
-
ErrorView?: ViewType;
|
|
83
|
-
slotFactories: ((
|
|
84
|
-
widget: Widget,
|
|
85
|
-
) => SlotDefinition | Promise<SlotDefinition>)[];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface ViewFactoryResult {
|
|
89
|
-
View: ViewType;
|
|
90
|
-
ErrorView?: ViewType;
|
|
91
|
-
slot?: Record<string, ViewFactorySlotType>;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface ViewFactorySlotType {
|
|
95
|
-
name: string;
|
|
96
|
-
containerSelector?: string;
|
|
97
|
-
View: ViewType;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type ViewFactory = (widget: Widget) => Promise<ViewFactoryResult>;
|
|
101
|
-
export type SlotFactory = (widget: WidgetPartial) => Promise<SlotDefinition>;
|
|
102
|
-
|
|
103
|
-
export declare function createSlotFactory(
|
|
104
|
-
creator: (widget: WidgetPartial) => SlotDefinition | Promise<SlotDefinition>,
|
|
105
|
-
): SlotFactory;
|
|
106
|
-
|
|
107
|
-
export declare function createViewFactory(
|
|
108
|
-
creator: (widget: WidgetPartial) => ViewDefinition | Promise<ViewDefinition>,
|
|
109
|
-
): ViewFactory;
|
|
110
|
-
|
|
111
|
-
export declare function componentPlugin(): WidgetPlugin;
|