@storybook/angular 7.0.1 → 7.1.0-alpha.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.
|
@@ -9,16 +9,16 @@ export declare abstract class AbstractRenderer {
|
|
|
9
9
|
/**
|
|
10
10
|
* Wait and destroy the platform
|
|
11
11
|
*/
|
|
12
|
-
static resetApplications(): void;
|
|
12
|
+
static resetApplications(domNode?: HTMLElement): void;
|
|
13
13
|
/**
|
|
14
14
|
* Reset compiled components because we often want to compile the same component with
|
|
15
15
|
* more than one NgModule.
|
|
16
16
|
*/
|
|
17
17
|
protected static resetCompiledComponents: () => Promise<void>;
|
|
18
|
-
protected previousStoryRenderInfo: StoryRenderInfo
|
|
18
|
+
protected previousStoryRenderInfo: Map<HTMLElement, StoryRenderInfo>;
|
|
19
19
|
protected storyProps$: Subject<ICollection | undefined>;
|
|
20
20
|
constructor(storyId: string);
|
|
21
|
-
protected abstract beforeFullRender(): Promise<void>;
|
|
21
|
+
protected abstract beforeFullRender(domNode?: HTMLElement): Promise<void>;
|
|
22
22
|
protected abstract afterFullRender(): Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Bootstrap main angular module with main component or send only new `props` with storyProps$
|
|
@@ -33,21 +33,22 @@ const StorybookModule_1 = require("./StorybookModule");
|
|
|
33
33
|
const StorybookProvider_1 = require("./StorybookProvider");
|
|
34
34
|
const StorybookWrapperComponent_1 = require("./StorybookWrapperComponent");
|
|
35
35
|
const PropertyExtractor_1 = require("./utils/PropertyExtractor");
|
|
36
|
-
const applicationRefs = new
|
|
36
|
+
const applicationRefs = new Map();
|
|
37
37
|
class AbstractRenderer {
|
|
38
38
|
/**
|
|
39
39
|
* Wait and destroy the platform
|
|
40
40
|
*/
|
|
41
|
-
static resetApplications() {
|
|
41
|
+
static resetApplications(domNode) {
|
|
42
42
|
StorybookWrapperComponent_1.componentNgModules.clear();
|
|
43
|
-
applicationRefs.forEach((appRef) => {
|
|
44
|
-
if (!appRef.destroyed) {
|
|
43
|
+
applicationRefs.forEach((appRef, appDOMNode) => {
|
|
44
|
+
if (!appRef.destroyed && (!domNode || appDOMNode === domNode)) {
|
|
45
45
|
appRef.destroy();
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
constructor(storyId) {
|
|
50
50
|
this.storyId = storyId;
|
|
51
|
+
this.previousStoryRenderInfo = new Map();
|
|
51
52
|
if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
|
|
52
53
|
try {
|
|
53
54
|
// platform should be set after enableProdMode()
|
|
@@ -73,6 +74,7 @@ class AbstractRenderer {
|
|
|
73
74
|
const targetSelector = this.generateTargetSelectorFromStoryId(targetDOMNode.id);
|
|
74
75
|
const newStoryProps$ = new rxjs_1.BehaviorSubject(storyFnAngular.props);
|
|
75
76
|
if (!this.fullRendererRequired({
|
|
77
|
+
targetDOMNode,
|
|
76
78
|
storyFnAngular,
|
|
77
79
|
moduleMetadata: {
|
|
78
80
|
...storyFnAngular.moduleMetadata,
|
|
@@ -82,7 +84,7 @@ class AbstractRenderer {
|
|
|
82
84
|
this.storyProps$.next(storyFnAngular.props);
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
|
-
await this.beforeFullRender();
|
|
87
|
+
await this.beforeFullRender(targetDOMNode);
|
|
86
88
|
// Complete last BehaviorSubject and set a new one for the current module
|
|
87
89
|
if (this.storyProps$) {
|
|
88
90
|
this.storyProps$.complete();
|
|
@@ -104,7 +106,7 @@ class AbstractRenderer {
|
|
|
104
106
|
...(storyFnAngular.applicationConfig?.providers ?? []),
|
|
105
107
|
],
|
|
106
108
|
});
|
|
107
|
-
applicationRefs.
|
|
109
|
+
applicationRefs.set(targetDOMNode, applicationRef);
|
|
108
110
|
await this.afterFullRender();
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
@@ -130,13 +132,13 @@ class AbstractRenderer {
|
|
|
130
132
|
targetDOMNode.innerHTML = '';
|
|
131
133
|
targetDOMNode.appendChild(document.createElement(targetSelector));
|
|
132
134
|
}
|
|
133
|
-
fullRendererRequired({ storyFnAngular, moduleMetadata, forced, }) {
|
|
134
|
-
const
|
|
135
|
+
fullRendererRequired({ targetDOMNode, storyFnAngular, moduleMetadata, forced, }) {
|
|
136
|
+
const previousStoryRenderInfo = this.previousStoryRenderInfo.get(targetDOMNode);
|
|
135
137
|
const currentStoryRender = {
|
|
136
138
|
storyFnAngular,
|
|
137
139
|
moduleMetadataSnapshot: (0, telejson_1.stringify)(moduleMetadata),
|
|
138
140
|
};
|
|
139
|
-
this.previousStoryRenderInfo
|
|
141
|
+
this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender);
|
|
140
142
|
if (
|
|
141
143
|
// check `forceRender` of story RenderContext
|
|
142
144
|
!forced ||
|
|
@@ -8,6 +8,6 @@ export declare class DocsRenderer extends AbstractRenderer {
|
|
|
8
8
|
parameters: Parameters;
|
|
9
9
|
targetDOMNode: HTMLElement;
|
|
10
10
|
}): Promise<void>;
|
|
11
|
-
beforeFullRender(): Promise<void>;
|
|
11
|
+
beforeFullRender(domNode?: HTMLElement): Promise<void>;
|
|
12
12
|
afterFullRender(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -30,8 +30,8 @@ class DocsRenderer extends AbstractRenderer_1.AbstractRenderer {
|
|
|
30
30
|
});
|
|
31
31
|
await super.render({ ...options, forced: false });
|
|
32
32
|
}
|
|
33
|
-
async beforeFullRender() {
|
|
34
|
-
DocsRenderer.resetApplications();
|
|
33
|
+
async beforeFullRender(domNode) {
|
|
34
|
+
DocsRenderer.resetApplications(domNode);
|
|
35
35
|
}
|
|
36
36
|
async afterFullRender() {
|
|
37
37
|
await AbstractRenderer_1.AbstractRenderer.resetCompiledComponents();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.0",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"prep": "../../../scripts/prepare/tsc.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@storybook/builder-webpack5": "7.0.
|
|
40
|
-
"@storybook/cli": "7.0.
|
|
41
|
-
"@storybook/client-logger": "7.0.
|
|
42
|
-
"@storybook/core-client": "7.0.
|
|
43
|
-
"@storybook/core-common": "7.0.
|
|
44
|
-
"@storybook/core-events": "7.0.
|
|
45
|
-
"@storybook/core-server": "7.0.
|
|
46
|
-
"@storybook/core-webpack": "7.0.
|
|
47
|
-
"@storybook/docs-tools": "7.0.
|
|
39
|
+
"@storybook/builder-webpack5": "7.1.0-alpha.0",
|
|
40
|
+
"@storybook/cli": "7.1.0-alpha.0",
|
|
41
|
+
"@storybook/client-logger": "7.1.0-alpha.0",
|
|
42
|
+
"@storybook/core-client": "7.1.0-alpha.0",
|
|
43
|
+
"@storybook/core-common": "7.1.0-alpha.0",
|
|
44
|
+
"@storybook/core-events": "7.1.0-alpha.0",
|
|
45
|
+
"@storybook/core-server": "7.1.0-alpha.0",
|
|
46
|
+
"@storybook/core-webpack": "7.1.0-alpha.0",
|
|
47
|
+
"@storybook/docs-tools": "7.1.0-alpha.0",
|
|
48
48
|
"@storybook/global": "^5.0.0",
|
|
49
|
-
"@storybook/manager-api": "7.0.
|
|
50
|
-
"@storybook/node-logger": "7.0.
|
|
51
|
-
"@storybook/preview-api": "7.0.
|
|
52
|
-
"@storybook/types": "7.0.
|
|
49
|
+
"@storybook/manager-api": "7.1.0-alpha.0",
|
|
50
|
+
"@storybook/node-logger": "7.1.0-alpha.0",
|
|
51
|
+
"@storybook/preview-api": "7.1.0-alpha.0",
|
|
52
|
+
"@storybook/types": "7.1.0-alpha.0",
|
|
53
53
|
"@types/node": "^16.0.0",
|
|
54
54
|
"@types/react": "^16.14.34",
|
|
55
55
|
"@types/react-dom": "^16.9.14",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"bundler": {
|
|
124
124
|
"tsConfig": "tsconfig.build.json"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "8ff2938f8ac0c2d524ae653cd89251e5cd4721a4"
|
|
127
127
|
}
|