@storybook/angular 6.5.0-alpha.4 → 6.5.0-alpha.40
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/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +4 -2
- package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +2 -1
- package/dist/ts3.4/server/framework-preset-angular.d.ts +3 -2
- package/dist/ts3.9/builders/build-storybook/index.js +33 -84
- package/dist/ts3.9/builders/start-storybook/index.js +40 -91
- package/dist/ts3.9/builders/utils/build-standalone-errors-handler.js +13 -11
- package/dist/ts3.9/builders/utils/run-compodoc.js +45 -20
- package/dist/ts3.9/client/preview/angular/app.token.js +1 -1
- package/dist/ts3.9/client/preview/angular/components/app.component.js +55 -59
- package/dist/ts3.9/client/preview/angular/helpers.js +66 -80
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +77 -125
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +18 -81
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.js +75 -69
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +41 -127
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +30 -66
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +42 -46
- package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.js +15 -17
- package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.js +63 -92
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +4 -2
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +30 -77
- package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.js +10 -14
- package/dist/ts3.9/client/preview/decorateStory.js +16 -36
- package/dist/ts3.9/client/preview/decorators.js +22 -37
- package/dist/ts3.9/client/preview/globals.js +2 -2
- package/dist/ts3.9/client/preview/index.js +8 -21
- package/dist/ts3.9/client/preview/render.js +17 -56
- package/dist/ts3.9/demo/button.component.js +31 -22
- package/dist/ts3.9/demo/welcome.component.js +85 -18
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/tsconfig.json +7 -2
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +7 -2
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +4 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +4 -1
- package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +38 -81
- package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +42 -85
- package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +2 -1
- package/dist/ts3.9/server/angular-cli-webpack-older.js +77 -123
- package/dist/ts3.9/server/angular-devkit-build-webpack.js +72 -133
- package/dist/ts3.9/server/angular-read-workspace.js +44 -78
- package/dist/ts3.9/server/build.js +10 -47
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +2 -2
- package/dist/ts3.9/server/framework-preset-angular-cli.js +111 -179
- package/dist/ts3.9/server/framework-preset-angular-ivy.js +35 -92
- package/dist/ts3.9/server/framework-preset-angular.d.ts +3 -2
- package/dist/ts3.9/server/framework-preset-angular.js +88 -62
- package/dist/ts3.9/server/index.js +2 -2
- package/dist/ts3.9/server/ngx-template-loader/index.js +15 -15
- package/dist/ts3.9/server/options.js +1 -1
- package/dist/ts3.9/server/preset.js +4 -13
- package/dist/ts3.9/server/ts_config.js +5 -5
- package/dist/ts3.9/server/utils/filter-out-styling-rules.js +4 -4
- package/dist/ts3.9/server/utils/module-is-available.js +1 -1
- package/dist/ts3.9/server/utils/normalize-asset-patterns.js +16 -31
- package/dist/ts3.9/server/utils/normalize-optimization.js +3 -3
- package/package.json +13 -21
- package/standalone.d.ts +3 -5
|
@@ -18,103 +18,100 @@ exports.AppComponent = void 0;
|
|
|
18
18
|
// to provide @Inputs and subscribe to @Outputs, see
|
|
19
19
|
// https://github.com/angular/angular/issues/15360
|
|
20
20
|
// For the time being, the ViewContainerRef approach works pretty well.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const core_1 = require("@angular/core");
|
|
22
|
+
const rxjs_1 = require("rxjs");
|
|
23
|
+
const operators_1 = require("rxjs/operators");
|
|
24
|
+
const app_token_1 = require("../app.token");
|
|
25
|
+
let AppComponent = class AppComponent {
|
|
26
|
+
constructor(cfr, changeDetectorRef, data) {
|
|
27
27
|
this.cfr = cfr;
|
|
28
28
|
this.changeDetectorRef = changeDetectorRef;
|
|
29
29
|
this.data = data;
|
|
30
30
|
this.previousValues = {};
|
|
31
31
|
this.propSubscriptions = new Map();
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var instance = componentRef.instance;
|
|
33
|
+
ngOnInit() {
|
|
34
|
+
this.data.pipe(operators_1.first()).subscribe((data) => {
|
|
35
|
+
this.target.clear();
|
|
36
|
+
const compFactory = this.cfr.resolveComponentFactory(data.component);
|
|
37
|
+
const componentRef = this.target.createComponent(compFactory);
|
|
38
|
+
const { instance } = componentRef;
|
|
40
39
|
// For some reason, manual change detection ref is only working when getting the ref from the injector (rather than componentRef.changeDetectorRef)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const childChangeDetectorRef = componentRef.injector.get(core_1.ChangeDetectorRef);
|
|
41
|
+
this.subscription = this.data.subscribe((newData) => {
|
|
42
|
+
this.setProps(instance, newData);
|
|
44
43
|
childChangeDetectorRef.markForCheck();
|
|
45
44
|
// Must detect changes on the current component in order to update any changes in child component's @HostBinding properties (angular/angular#22560)
|
|
46
|
-
|
|
45
|
+
this.changeDetectorRef.detectChanges();
|
|
47
46
|
});
|
|
48
47
|
});
|
|
49
|
-
}
|
|
50
|
-
|
|
48
|
+
}
|
|
49
|
+
ngOnDestroy() {
|
|
51
50
|
this.target.clear();
|
|
52
51
|
if (this.subscription) {
|
|
53
52
|
this.subscription.unsubscribe();
|
|
54
53
|
}
|
|
55
|
-
this.propSubscriptions.forEach(
|
|
54
|
+
this.propSubscriptions.forEach((v) => {
|
|
56
55
|
if (!v.sub.closed) {
|
|
57
56
|
v.sub.unsubscribe();
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
59
|
this.propSubscriptions.clear();
|
|
61
|
-
}
|
|
60
|
+
}
|
|
62
61
|
/**
|
|
63
62
|
* Set inputs and outputs
|
|
64
63
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var value = props[key];
|
|
72
|
-
var instanceProperty = instance[key];
|
|
64
|
+
setProps(instance, { props = {} }) {
|
|
65
|
+
const changes = {};
|
|
66
|
+
const hasNgOnChangesHook = !!instance.ngOnChanges;
|
|
67
|
+
Object.keys(props).forEach((key) => {
|
|
68
|
+
const value = props[key];
|
|
69
|
+
const instanceProperty = instance[key];
|
|
73
70
|
if (!(instanceProperty instanceof core_1.EventEmitter) && value !== undefined && value !== null) {
|
|
74
71
|
// eslint-disable-next-line no-param-reassign
|
|
75
72
|
instance[key] = value;
|
|
76
73
|
if (hasNgOnChangesHook) {
|
|
77
|
-
|
|
74
|
+
const previousValue = this.previousValues[key];
|
|
78
75
|
if (previousValue !== value) {
|
|
79
|
-
changes[key] = new core_1.SimpleChange(previousValue, value, !Object.prototype.hasOwnProperty.call(
|
|
80
|
-
|
|
76
|
+
changes[key] = new core_1.SimpleChange(previousValue, value, !Object.prototype.hasOwnProperty.call(this.previousValues, key));
|
|
77
|
+
this.previousValues[key] = value;
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
81
|
else if (typeof value === 'function' && key !== 'ngModelChange') {
|
|
85
|
-
|
|
82
|
+
this.setPropSubscription(key, instanceProperty, value);
|
|
86
83
|
}
|
|
87
84
|
});
|
|
88
85
|
this.callNgOnChangesHook(instance, changes);
|
|
89
86
|
this.setNgModel(instance, props);
|
|
90
|
-
}
|
|
87
|
+
}
|
|
91
88
|
/**
|
|
92
89
|
* Manually call 'ngOnChanges' hook because angular doesn't do that for dynamic components
|
|
93
90
|
* Issue: [https://github.com/angular/angular/issues/8903]
|
|
94
91
|
*/
|
|
95
|
-
|
|
92
|
+
callNgOnChangesHook(instance, changes) {
|
|
96
93
|
if (Object.keys(changes).length) {
|
|
97
94
|
instance.ngOnChanges(changes);
|
|
98
95
|
}
|
|
99
|
-
}
|
|
96
|
+
}
|
|
100
97
|
/**
|
|
101
98
|
* If component implements ControlValueAccessor interface try to set ngModel
|
|
102
99
|
*/
|
|
103
|
-
|
|
100
|
+
setNgModel(instance, props) {
|
|
104
101
|
if (props.ngModel) {
|
|
105
102
|
instance.writeValue(props.ngModel);
|
|
106
103
|
}
|
|
107
104
|
if (typeof props.ngModelChange === 'function') {
|
|
108
105
|
instance.registerOnChange(props.ngModelChange);
|
|
109
106
|
}
|
|
110
|
-
}
|
|
107
|
+
}
|
|
111
108
|
/**
|
|
112
109
|
* Store ref to subscription for cleanup in 'ngOnDestroy' and check if
|
|
113
110
|
* observable needs to be resubscribed to, before creating a new subscription.
|
|
114
111
|
*/
|
|
115
|
-
|
|
112
|
+
setPropSubscription(key, instanceProperty, value) {
|
|
116
113
|
if (this.propSubscriptions.has(key)) {
|
|
117
|
-
|
|
114
|
+
const v = this.propSubscriptions.get(key);
|
|
118
115
|
if (v.prop === value) {
|
|
119
116
|
// Prop hasn't changed, so the existing subscription can stay.
|
|
120
117
|
return;
|
|
@@ -124,23 +121,22 @@ var AppComponent = /** @class */ (function () {
|
|
|
124
121
|
v.sub.unsubscribe();
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
|
-
|
|
128
|
-
this.propSubscriptions.set(key, { prop: value, sub
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}());
|
|
124
|
+
const sub = instanceProperty.subscribe(value);
|
|
125
|
+
this.propSubscriptions.set(key, { prop: value, sub });
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
__decorate([
|
|
129
|
+
core_1.ViewChild('target', { read: core_1.ViewContainerRef, static: true }),
|
|
130
|
+
__metadata("design:type", core_1.ViewContainerRef)
|
|
131
|
+
], AppComponent.prototype, "target", void 0);
|
|
132
|
+
AppComponent = __decorate([
|
|
133
|
+
core_1.Component({
|
|
134
|
+
selector: 'storybook-dynamic-app-root',
|
|
135
|
+
template: '<ng-template #target></ng-template>',
|
|
136
|
+
}),
|
|
137
|
+
__param(2, core_1.Inject(app_token_1.STORY)),
|
|
138
|
+
__metadata("design:paramtypes", [core_1.ComponentFactoryResolver,
|
|
139
|
+
core_1.ChangeDetectorRef,
|
|
140
|
+
rxjs_1.Observable])
|
|
141
|
+
], AppComponent);
|
|
146
142
|
exports.AppComponent = AppComponent;
|
|
@@ -1,82 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
3
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
4
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
5
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
6
|
-
r[k] = a[j];
|
|
7
|
-
return r;
|
|
8
|
-
};
|
|
9
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
4
|
};
|
|
12
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
6
|
exports.renderNgApp = void 0;
|
|
14
7
|
// @ts-ignore
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}());
|
|
32
|
-
var componentClass = /** @class */ (function () {
|
|
33
|
-
function DynamicComponent() {
|
|
34
|
-
}
|
|
35
|
-
return DynamicComponent;
|
|
36
|
-
}());
|
|
8
|
+
const global_1 = __importDefault(require("global"));
|
|
9
|
+
const core_1 = require("@angular/core");
|
|
10
|
+
const forms_1 = require("@angular/forms");
|
|
11
|
+
const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
|
|
12
|
+
const platform_browser_1 = require("@angular/platform-browser");
|
|
13
|
+
const rxjs_1 = require("rxjs");
|
|
14
|
+
const app_component_1 = require("./components/app.component");
|
|
15
|
+
const app_token_1 = require("./app.token");
|
|
16
|
+
const { document } = global_1.default;
|
|
17
|
+
let platform = null;
|
|
18
|
+
let promises = [];
|
|
19
|
+
let storyData = new rxjs_1.ReplaySubject(1);
|
|
20
|
+
const moduleClass = class DynamicModule {
|
|
21
|
+
};
|
|
22
|
+
const componentClass = class DynamicComponent {
|
|
23
|
+
};
|
|
37
24
|
function storyDataFactory(data) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ngZone.run(function () { return subscriber.complete(); });
|
|
46
|
-
});
|
|
47
|
-
return function () {
|
|
48
|
-
sub.unsubscribe();
|
|
49
|
-
};
|
|
25
|
+
return (ngZone) => new rxjs_1.Observable((subscriber) => {
|
|
26
|
+
const sub = data.subscribe((v) => {
|
|
27
|
+
ngZone.run(() => subscriber.next(v));
|
|
28
|
+
}, (err) => {
|
|
29
|
+
ngZone.run(() => subscriber.error(err));
|
|
30
|
+
}, () => {
|
|
31
|
+
ngZone.run(() => subscriber.complete());
|
|
50
32
|
});
|
|
51
|
-
|
|
33
|
+
return () => {
|
|
34
|
+
sub.unsubscribe();
|
|
35
|
+
};
|
|
36
|
+
});
|
|
52
37
|
}
|
|
53
|
-
|
|
38
|
+
const getModule = (declarations, entryComponents, bootstrap, data, moduleMetadata) => {
|
|
54
39
|
// Complete last ReplaySubject and create a new one for the current module
|
|
55
40
|
storyData.complete();
|
|
56
41
|
storyData = new rxjs_1.ReplaySubject(1);
|
|
57
42
|
storyData.next(data);
|
|
58
|
-
|
|
59
|
-
declarations:
|
|
60
|
-
imports:
|
|
61
|
-
providers:
|
|
62
|
-
{ provide: app_token_1.STORY, useFactory: storyDataFactory(storyData.asObservable()), deps: [core_1.NgZone] }
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
const moduleMeta = {
|
|
44
|
+
declarations: [...declarations, ...(moduleMetadata.declarations || [])],
|
|
45
|
+
imports: [platform_browser_1.BrowserModule, forms_1.FormsModule, ...(moduleMetadata.imports || [])],
|
|
46
|
+
providers: [
|
|
47
|
+
{ provide: app_token_1.STORY, useFactory: storyDataFactory(storyData.asObservable()), deps: [core_1.NgZone] },
|
|
48
|
+
...(moduleMetadata.providers || []),
|
|
49
|
+
],
|
|
50
|
+
entryComponents: [...entryComponents, ...(moduleMetadata.entryComponents || [])],
|
|
51
|
+
schemas: [...(moduleMetadata.schemas || [])],
|
|
52
|
+
bootstrap: [...bootstrap],
|
|
67
53
|
};
|
|
68
54
|
return core_1.NgModule(moduleMeta)(moduleClass);
|
|
69
55
|
};
|
|
70
|
-
|
|
56
|
+
const createComponentFromTemplate = (template, styles) => {
|
|
71
57
|
return core_1.Component({
|
|
72
|
-
template
|
|
73
|
-
styles
|
|
58
|
+
template,
|
|
59
|
+
styles,
|
|
74
60
|
})(componentClass);
|
|
75
61
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
const extractNgModuleMetadata = (importItem) => {
|
|
63
|
+
const target = importItem && importItem.ngModule ? importItem.ngModule : importItem;
|
|
64
|
+
const decoratorKey = '__annotations__';
|
|
65
|
+
const decorators = Reflect &&
|
|
80
66
|
Reflect.getOwnPropertyDescriptor &&
|
|
81
67
|
Reflect.getOwnPropertyDescriptor(target, decoratorKey)
|
|
82
68
|
? Reflect.getOwnPropertyDescriptor(target, decoratorKey).value
|
|
@@ -84,22 +70,22 @@ var extractNgModuleMetadata = function (importItem) {
|
|
|
84
70
|
if (!decorators || decorators.length === 0) {
|
|
85
71
|
return null;
|
|
86
72
|
}
|
|
87
|
-
|
|
73
|
+
const ngModuleDecorator = decorators.find((decorator) => decorator instanceof core_1.NgModule);
|
|
88
74
|
if (!ngModuleDecorator) {
|
|
89
75
|
return null;
|
|
90
76
|
}
|
|
91
77
|
return ngModuleDecorator;
|
|
92
78
|
};
|
|
93
|
-
|
|
94
|
-
if (declarations && declarations.some(
|
|
79
|
+
const getExistenceOfComponentInModules = (component, declarations, imports) => {
|
|
80
|
+
if (declarations && declarations.some((declaration) => declaration === component)) {
|
|
95
81
|
// Found component in declarations array
|
|
96
82
|
return true;
|
|
97
83
|
}
|
|
98
84
|
if (!imports) {
|
|
99
85
|
return false;
|
|
100
86
|
}
|
|
101
|
-
return imports.some(
|
|
102
|
-
|
|
87
|
+
return imports.some((importItem) => {
|
|
88
|
+
const extractedNgModuleMetadata = extractNgModuleMetadata(importItem);
|
|
103
89
|
if (!extractedNgModuleMetadata) {
|
|
104
90
|
// Not an NgModule
|
|
105
91
|
return false;
|
|
@@ -107,31 +93,31 @@ var getExistenceOfComponentInModules = function (component, declarations, import
|
|
|
107
93
|
return getExistenceOfComponentInModules(component, extractedNgModuleMetadata.declarations, extractedNgModuleMetadata.imports);
|
|
108
94
|
});
|
|
109
95
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
const initModule = (storyFn) => {
|
|
97
|
+
const storyObj = storyFn();
|
|
98
|
+
const { component, template, props, styles, moduleMetadata = {} } = storyObj;
|
|
99
|
+
const isCreatingComponentFromTemplate = Boolean(template);
|
|
100
|
+
const AnnotatedComponent = isCreatingComponentFromTemplate
|
|
115
101
|
? createComponentFromTemplate(template, styles)
|
|
116
102
|
: component;
|
|
117
|
-
|
|
103
|
+
const componentRequiresDeclaration = isCreatingComponentFromTemplate ||
|
|
118
104
|
!getExistenceOfComponentInModules(component, moduleMetadata.declarations, moduleMetadata.imports);
|
|
119
|
-
|
|
105
|
+
const componentDeclarations = componentRequiresDeclaration
|
|
120
106
|
? [app_component_1.AppComponent, AnnotatedComponent]
|
|
121
107
|
: [app_component_1.AppComponent];
|
|
122
|
-
|
|
108
|
+
const story = {
|
|
123
109
|
component: AnnotatedComponent,
|
|
124
|
-
props
|
|
110
|
+
props,
|
|
125
111
|
};
|
|
126
112
|
return getModule(componentDeclarations, [AnnotatedComponent], [app_component_1.AppComponent], story, moduleMetadata);
|
|
127
113
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
const staticRoot = document.getElementById('root');
|
|
115
|
+
const insertDynamicRoot = () => {
|
|
116
|
+
const app = document.createElement('storybook-dynamic-app-root');
|
|
131
117
|
staticRoot.innerHTML = '';
|
|
132
118
|
staticRoot.appendChild(app);
|
|
133
119
|
};
|
|
134
|
-
|
|
120
|
+
const draw = (newModule) => {
|
|
135
121
|
if (!platform) {
|
|
136
122
|
insertDynamicRoot();
|
|
137
123
|
// eslint-disable-next-line no-undef
|
|
@@ -147,15 +133,15 @@ var draw = function (newModule) {
|
|
|
147
133
|
promises.push(platform.bootstrapModule(newModule));
|
|
148
134
|
}
|
|
149
135
|
else {
|
|
150
|
-
Promise.all(promises).then(
|
|
151
|
-
modules.forEach(
|
|
136
|
+
Promise.all(promises).then((modules) => {
|
|
137
|
+
modules.forEach((mod) => mod.destroy());
|
|
152
138
|
insertDynamicRoot();
|
|
153
139
|
promises = [];
|
|
154
140
|
promises.push(platform.bootstrapModule(newModule));
|
|
155
141
|
});
|
|
156
142
|
}
|
|
157
143
|
};
|
|
158
|
-
exports.renderNgApp =
|
|
144
|
+
exports.renderNgApp = (storyFn, forced) => {
|
|
159
145
|
if (!forced) {
|
|
160
146
|
draw(initModule(storyFn));
|
|
161
147
|
}
|