@storybook/angular 6.4.0-beta.24 → 6.4.0-beta.25
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/builders/build-storybook/index.d.ts +12 -0
- package/dist/ts3.4/builders/start-storybook/index.d.ts +12 -0
- package/dist/ts3.4/builders/utils/build-standalone-errors-handler.d.ts +1 -0
- package/dist/ts3.4/builders/utils/run-compodoc.d.ts +6 -0
- package/dist/ts3.4/client/index.d.ts +4 -0
- package/dist/ts3.4/client/preview/angular/app.token.d.ts +3 -0
- package/dist/ts3.4/client/preview/angular/components/app.component.d.ts +38 -0
- package/dist/ts3.4/client/preview/angular/helpers.d.ts +8 -0
- package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +44 -0
- package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +14 -0
- package/dist/ts3.4/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +17 -0
- package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +14 -0
- package/dist/ts3.4/client/preview/angular-beta/RendererFactory.d.ts +11 -0
- package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +9 -0
- package/dist/ts3.4/client/preview/angular-beta/StorybookProvider.d.ts +5 -0
- package/dist/ts3.4/client/preview/angular-beta/StorybookWrapperComponent.d.ts +9 -0
- package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +26 -0
- package/dist/ts3.4/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +6 -0
- package/dist/ts3.4/client/preview/angular-polyfills.d.ts +41 -0
- package/dist/ts3.4/client/preview/config.d.ts +5 -0
- package/dist/ts3.4/client/preview/decorateStory.d.ts +4 -0
- package/dist/ts3.4/client/preview/decorators.d.ts +6 -0
- package/dist/ts3.4/client/preview/globals.d.ts +1 -0
- package/dist/ts3.4/client/preview/index.d.ts +25 -0
- package/dist/ts3.4/client/preview/render.d.ts +7 -0
- package/dist/ts3.4/client/preview/types-6-0.d.ts +42 -0
- package/dist/ts3.4/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.4/client/preview/types.d.ts +29 -0
- package/dist/ts3.4/demo/button.component.d.ts +5 -0
- package/dist/ts3.4/demo/welcome.component.d.ts +4 -0
- package/dist/ts3.4/public_api.d.ts +1 -0
- package/dist/ts3.4/renderer.d.ts +4 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/some-config/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +30 -0
- package/dist/ts3.4/server/angular-read-workspace.d.ts +13 -0
- package/dist/ts3.4/server/build.d.ts +1 -0
- package/dist/ts3.4/server/create-fork-ts-checker-plugin.d.ts +3 -0
- package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +73 -0
- package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +10 -0
- package/dist/ts3.4/server/framework-preset-angular.d.ts +4 -0
- package/dist/ts3.4/server/index.d.ts +1 -0
- package/dist/ts3.4/server/ngx-template-loader/index.d.ts +1 -0
- package/dist/ts3.4/server/options.d.ts +3 -0
- package/dist/ts3.4/server/preset.d.ts +3 -0
- package/dist/ts3.4/server/ts_config.d.ts +2 -0
- package/dist/ts3.4/server/utils/filter-out-styling-rules.d.ts +2 -0
- package/dist/ts3.4/server/utils/module-is-available.d.ts +1 -0
- package/dist/ts3.4/server/utils/normalize-asset-patterns.d.ts +6 -0
- package/dist/ts3.4/server/utils/normalize-optimization.d.ts +3 -0
- package/dist/ts3.4/types/index.d.ts +6 -0
- package/dist/ts3.9/builders/build-storybook/index.d.ts +12 -0
- package/dist/ts3.9/builders/build-storybook/index.js +114 -0
- package/dist/ts3.9/builders/build-storybook/schema.json +72 -0
- package/dist/ts3.9/builders/builders.json +14 -0
- package/dist/ts3.9/builders/start-storybook/index.d.ts +12 -0
- package/dist/ts3.9/builders/start-storybook/index.js +117 -0
- package/dist/ts3.9/builders/start-storybook/schema.json +99 -0
- package/dist/ts3.9/builders/utils/build-standalone-errors-handler.d.ts +1 -0
- package/dist/ts3.9/builders/utils/build-standalone-errors-handler.js +36 -0
- package/dist/ts3.9/builders/utils/run-compodoc.d.ts +6 -0
- package/dist/ts3.9/builders/utils/run-compodoc.js +45 -0
- package/dist/ts3.9/client/index.d.ts +4 -0
- package/dist/ts3.9/client/index.js +28 -0
- package/dist/ts3.9/client/preview/angular/app.token.d.ts +3 -0
- package/dist/ts3.9/client/preview/angular/app.token.js +5 -0
- package/dist/ts3.9/client/preview/angular/components/app.component.d.ts +38 -0
- package/dist/ts3.9/client/preview/angular/components/app.component.js +146 -0
- package/dist/ts3.9/client/preview/angular/helpers.d.ts +8 -0
- package/dist/ts3.9/client/preview/angular/helpers.js +165 -0
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.d.ts +44 -0
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +215 -0
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.d.ts +14 -0
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +97 -0
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +17 -0
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.js +112 -0
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.d.ts +14 -0
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +145 -0
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.d.ts +11 -0
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +101 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.d.ts +9 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +78 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.d.ts +5 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.js +27 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.d.ts +9 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.js +155 -0
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +26 -0
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +124 -0
- package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +6 -0
- package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.js +44 -0
- package/dist/ts3.9/client/preview/angular-polyfills.d.ts +41 -0
- package/dist/ts3.9/client/preview/angular-polyfills.js +61 -0
- package/dist/ts3.9/client/preview/config.d.ts +5 -0
- package/dist/ts3.9/client/preview/config.js +9 -0
- package/dist/ts3.9/client/preview/decorateStory.d.ts +4 -0
- package/dist/ts3.9/client/preview/decorateStory.js +64 -0
- package/dist/ts3.9/client/preview/decorators.d.ts +6 -0
- package/dist/ts3.9/client/preview/decorators.js +49 -0
- package/dist/ts3.9/client/preview/globals.d.ts +1 -0
- package/dist/ts3.9/client/preview/globals.js +9 -0
- package/dist/ts3.9/client/preview/index.d.ts +25 -0
- package/dist/ts3.9/client/preview/index.js +40 -0
- package/dist/ts3.9/client/preview/render.d.ts +7 -0
- package/dist/ts3.9/client/preview/render.js +73 -0
- package/dist/ts3.9/client/preview/types-6-0.d.ts +42 -0
- package/dist/ts3.9/client/preview/types-6-0.js +2 -0
- package/dist/ts3.9/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.9/client/preview/types-7-0.js +2 -0
- package/dist/ts3.9/client/preview/types.d.ts +29 -0
- package/dist/ts3.9/client/preview/types.js +2 -0
- package/dist/ts3.9/demo/button.component.d.ts +5 -0
- package/dist/ts3.9/demo/button.component.js +37 -0
- package/dist/ts3.9/demo/welcome.component.d.ts +4 -0
- package/dist/ts3.9/demo/welcome.component.js +32 -0
- package/dist/ts3.9/public_api.d.ts +1 -0
- package/dist/ts3.9/public_api.js +24 -0
- package/dist/ts3.9/renderer.d.ts +4 -0
- package/dist/ts3.9/renderer.js +10 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +4 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/angular.json +17 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/angular.json +18 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +60 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/angular.json +28 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +25 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/angular.json +17 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/nx.json +3 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +8 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +3 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +8 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +17 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/angular.json +17 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build/angular.json +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +11 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +7 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/angular.json +3 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +25 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/angular.json +16 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/ts3.9/server/angular-devkit-build-webpack.d.ts +30 -0
- package/dist/ts3.9/server/angular-devkit-build-webpack.js +213 -0
- package/dist/ts3.9/server/angular-read-workspace.d.ts +13 -0
- package/dist/ts3.9/server/angular-read-workspace.js +118 -0
- package/dist/ts3.9/server/build.d.ts +1 -0
- package/dist/ts3.9/server/build.js +65 -0
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.d.ts +3 -0
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +19 -0
- package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +73 -0
- package/dist/ts3.9/server/framework-preset-angular-cli.js +159 -0
- package/dist/ts3.9/server/framework-preset-angular-ivy.d.ts +10 -0
- package/dist/ts3.9/server/framework-preset-angular-ivy.js +111 -0
- package/dist/ts3.9/server/framework-preset-angular.d.ts +4 -0
- package/dist/ts3.9/server/framework-preset-angular.js +74 -0
- package/dist/ts3.9/server/index.d.ts +1 -0
- package/dist/ts3.9/server/index.js +8 -0
- package/dist/ts3.9/server/ngx-template-loader/index.d.ts +1 -0
- package/dist/ts3.9/server/ngx-template-loader/index.js +46 -0
- package/dist/ts3.9/server/options.d.ts +3 -0
- package/dist/ts3.9/server/options.js +8 -0
- package/dist/ts3.9/server/preset.d.ts +3 -0
- package/dist/ts3.9/server/preset.js +21 -0
- package/dist/ts3.9/server/ts_config.d.ts +2 -0
- package/dist/ts3.9/server/ts_config.js +28 -0
- package/dist/ts3.9/server/utils/filter-out-styling-rules.d.ts +2 -0
- package/dist/ts3.9/server/utils/filter-out-styling-rules.js +16 -0
- package/dist/ts3.9/server/utils/module-is-available.d.ts +1 -0
- package/dist/ts3.9/server/utils/module-is-available.js +12 -0
- package/dist/ts3.9/server/utils/normalize-asset-patterns.d.ts +6 -0
- package/dist/ts3.9/server/utils/normalize-asset-patterns.js +79 -0
- package/dist/ts3.9/server/utils/normalize-optimization.d.ts +3 -0
- package/dist/ts3.9/server/utils/normalize-optimization.js +20 -0
- package/dist/ts3.9/types/index.d.ts +6 -0
- package/dist/ts3.9/types/index.js +2 -0
- package/package.json +9 -9
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
};
|
|
19
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
+
};
|
|
22
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
23
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
24
|
+
};
|
|
25
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
26
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
27
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
28
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
29
|
+
r[k] = a[j];
|
|
30
|
+
return r;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.createStorybookWrapperComponent = void 0;
|
|
34
|
+
var core_1 = require("@angular/core");
|
|
35
|
+
var rxjs_1 = require("rxjs");
|
|
36
|
+
var operators_1 = require("rxjs/operators");
|
|
37
|
+
var StorybookProvider_1 = require("./StorybookProvider");
|
|
38
|
+
var NgComponentAnalyzer_1 = require("./utils/NgComponentAnalyzer");
|
|
39
|
+
var getNonInputsOutputsProps = function (ngComponentInputsOutputs, props) {
|
|
40
|
+
if (props === void 0) { props = {}; }
|
|
41
|
+
var inputs = ngComponentInputsOutputs.inputs
|
|
42
|
+
.filter(function (i) { return i.templateName in props; })
|
|
43
|
+
.map(function (i) { return i.templateName; });
|
|
44
|
+
var outputs = ngComponentInputsOutputs.outputs
|
|
45
|
+
.filter(function (o) { return o.templateName in props; })
|
|
46
|
+
.map(function (o) { return o.templateName; });
|
|
47
|
+
return Object.keys(props).filter(function (k) { return !__spreadArrays(inputs, outputs).includes(k); });
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Wraps the story template into a component
|
|
51
|
+
*
|
|
52
|
+
* @param storyComponent
|
|
53
|
+
* @param initialProps
|
|
54
|
+
*/
|
|
55
|
+
exports.createStorybookWrapperComponent = function (selector, template, storyComponent, styles, initialProps) {
|
|
56
|
+
// In ivy, a '' selector is not allowed, therefore we need to just set it to anything if
|
|
57
|
+
// storyComponent was not provided.
|
|
58
|
+
var viewChildSelector = storyComponent !== null && storyComponent !== void 0 ? storyComponent : '__storybook-noop';
|
|
59
|
+
var StorybookWrapperComponent = /** @class */ (function () {
|
|
60
|
+
// eslint-disable-next-line no-useless-constructor
|
|
61
|
+
function StorybookWrapperComponent(storyProps$, changeDetectorRef) {
|
|
62
|
+
this.storyProps$ = storyProps$;
|
|
63
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
64
|
+
// Used in case of a component without selector
|
|
65
|
+
this.storyComponent = storyComponent !== null && storyComponent !== void 0 ? storyComponent : '';
|
|
66
|
+
}
|
|
67
|
+
StorybookWrapperComponent.prototype.ngOnInit = function () {
|
|
68
|
+
var _this = this;
|
|
69
|
+
// Subscribes to the observable storyProps$ to keep these properties up to date
|
|
70
|
+
this.storyWrapperPropsSubscription = this.storyProps$.subscribe(function (storyProps) {
|
|
71
|
+
if (storyProps === void 0) { storyProps = {}; }
|
|
72
|
+
// All props are added as component properties
|
|
73
|
+
Object.assign(_this, storyProps);
|
|
74
|
+
_this.changeDetectorRef.detectChanges();
|
|
75
|
+
_this.changeDetectorRef.markForCheck();
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
StorybookWrapperComponent.prototype.ngAfterViewInit = function () {
|
|
79
|
+
var _this = this;
|
|
80
|
+
// Bind properties to component, if the story have component
|
|
81
|
+
if (this.storyComponentElementRef) {
|
|
82
|
+
var ngComponentInputsOutputs_1 = NgComponentAnalyzer_1.getComponentInputsOutputs(storyComponent);
|
|
83
|
+
var initialOtherProps = getNonInputsOutputsProps(ngComponentInputsOutputs_1, initialProps);
|
|
84
|
+
// Initializes properties that are not Inputs | Outputs
|
|
85
|
+
// Allows story props to override local component properties
|
|
86
|
+
initialOtherProps.forEach(function (p) {
|
|
87
|
+
_this.storyComponentElementRef[p] = initialProps[p];
|
|
88
|
+
});
|
|
89
|
+
// `markForCheck` the component in case this uses changeDetection: OnPush
|
|
90
|
+
// And then forces the `detectChanges`
|
|
91
|
+
this.storyComponentViewContainerRef.injector.get(core_1.ChangeDetectorRef).markForCheck();
|
|
92
|
+
this.changeDetectorRef.detectChanges();
|
|
93
|
+
// Once target component has been initialized, the storyProps$ observable keeps target component inputs up to date
|
|
94
|
+
this.storyComponentPropsSubscription = this.storyProps$
|
|
95
|
+
.pipe(operators_1.skip(1), operators_1.map(function (props) {
|
|
96
|
+
// removes component output in props
|
|
97
|
+
var outputsKeyToRemove = ngComponentInputsOutputs_1.outputs.map(function (o) { return o.templateName; });
|
|
98
|
+
return Object.entries(props).reduce(function (prev, _a) {
|
|
99
|
+
var _b;
|
|
100
|
+
var key = _a[0], value = _a[1];
|
|
101
|
+
return (__assign(__assign({}, prev), (!outputsKeyToRemove.includes(key) && (_b = {},
|
|
102
|
+
_b[key] = value,
|
|
103
|
+
_b))));
|
|
104
|
+
}, {});
|
|
105
|
+
}), operators_1.map(function (props) {
|
|
106
|
+
// In case a component uses an input with `bindingPropertyName` (ex: @Input('name'))
|
|
107
|
+
// find the value of the local propName in the component Inputs
|
|
108
|
+
// otherwise use the input key
|
|
109
|
+
return Object.entries(props).reduce(function (prev, _a) {
|
|
110
|
+
var _b, _c;
|
|
111
|
+
var propKey = _a[0], value = _a[1];
|
|
112
|
+
var input = ngComponentInputsOutputs_1.inputs.find(function (o) { return o.templateName === propKey; });
|
|
113
|
+
return __assign(__assign({}, prev), (input ? (_b = {}, _b[input.propName] = value, _b) : (_c = {}, _c[propKey] = value, _c)));
|
|
114
|
+
}, {});
|
|
115
|
+
}))
|
|
116
|
+
.subscribe(function (props) {
|
|
117
|
+
// Replace inputs with new ones from props
|
|
118
|
+
Object.assign(_this.storyComponentElementRef, props);
|
|
119
|
+
// `markForCheck` the component in case this uses changeDetection: OnPush
|
|
120
|
+
// And then forces the `detectChanges`
|
|
121
|
+
_this.storyComponentViewContainerRef.injector.get(core_1.ChangeDetectorRef).markForCheck();
|
|
122
|
+
_this.changeDetectorRef.detectChanges();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
StorybookWrapperComponent.prototype.ngOnDestroy = function () {
|
|
127
|
+
if (this.storyComponentPropsSubscription != null) {
|
|
128
|
+
this.storyComponentPropsSubscription.unsubscribe();
|
|
129
|
+
}
|
|
130
|
+
if (this.storyWrapperPropsSubscription != null) {
|
|
131
|
+
this.storyWrapperPropsSubscription.unsubscribe();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
__decorate([
|
|
135
|
+
core_1.ViewChild(viewChildSelector, { static: true }),
|
|
136
|
+
__metadata("design:type", core_1.ElementRef)
|
|
137
|
+
], StorybookWrapperComponent.prototype, "storyComponentElementRef", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
core_1.ViewChild(viewChildSelector, { read: core_1.ViewContainerRef, static: true }),
|
|
140
|
+
__metadata("design:type", core_1.ViewContainerRef)
|
|
141
|
+
], StorybookWrapperComponent.prototype, "storyComponentViewContainerRef", void 0);
|
|
142
|
+
StorybookWrapperComponent = __decorate([
|
|
143
|
+
core_1.Component({
|
|
144
|
+
selector: selector,
|
|
145
|
+
template: template,
|
|
146
|
+
styles: styles,
|
|
147
|
+
}),
|
|
148
|
+
__param(0, core_1.Inject(StorybookProvider_1.STORY_PROPS)),
|
|
149
|
+
__metadata("design:paramtypes", [rxjs_1.Subject,
|
|
150
|
+
core_1.ChangeDetectorRef])
|
|
151
|
+
], StorybookWrapperComponent);
|
|
152
|
+
return StorybookWrapperComponent;
|
|
153
|
+
}());
|
|
154
|
+
return StorybookWrapperComponent;
|
|
155
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Component, Input, Output, Type } from '@angular/core';
|
|
2
|
+
export declare type ComponentInputsOutputs = {
|
|
3
|
+
inputs: {
|
|
4
|
+
propName: string;
|
|
5
|
+
templateName: string;
|
|
6
|
+
}[];
|
|
7
|
+
outputs: {
|
|
8
|
+
propName: string;
|
|
9
|
+
templateName: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Returns component Inputs / Outputs by browsing these properties and decorator
|
|
14
|
+
*/
|
|
15
|
+
export declare const getComponentInputsOutputs: (component: any) => ComponentInputsOutputs;
|
|
16
|
+
export declare const isDeclarable: (component: any) => boolean;
|
|
17
|
+
export declare const isComponent: (component: any) => component is Type<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns all component decorator properties
|
|
20
|
+
* is used to get all `@Input` and `@Output` Decorator
|
|
21
|
+
*/
|
|
22
|
+
export declare const getComponentPropsDecoratorMetadata: (component: any) => Record<string, (Input | Output)[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns component decorator `@Component`
|
|
25
|
+
*/
|
|
26
|
+
export declare const getComponentDecoratorMetadata: (component: any) => Component | undefined;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
14
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
15
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
16
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
17
|
+
r[k] = a[j];
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
|
|
22
|
+
var core_1 = require("@angular/core");
|
|
23
|
+
/**
|
|
24
|
+
* Returns component Inputs / Outputs by browsing these properties and decorator
|
|
25
|
+
*/
|
|
26
|
+
exports.getComponentInputsOutputs = function (component) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
var componentMetadata = exports.getComponentDecoratorMetadata(component);
|
|
29
|
+
var componentPropsMetadata = exports.getComponentPropsDecoratorMetadata(component);
|
|
30
|
+
var initialValue = {
|
|
31
|
+
inputs: [],
|
|
32
|
+
outputs: [],
|
|
33
|
+
};
|
|
34
|
+
// Adds the I/O present in @Component metadata
|
|
35
|
+
if (componentMetadata && componentMetadata.inputs) {
|
|
36
|
+
(_a = initialValue.inputs).push.apply(_a, componentMetadata.inputs.map(function (i) { return ({ propName: i, templateName: i }); }));
|
|
37
|
+
}
|
|
38
|
+
if (componentMetadata && componentMetadata.outputs) {
|
|
39
|
+
(_b = initialValue.outputs).push.apply(_b, componentMetadata.outputs.map(function (i) { return ({ propName: i, templateName: i }); }));
|
|
40
|
+
}
|
|
41
|
+
if (!componentPropsMetadata) {
|
|
42
|
+
return initialValue;
|
|
43
|
+
}
|
|
44
|
+
// Browses component properties to extract I/O
|
|
45
|
+
// Filters properties that have the same name as the one present in the @Component property
|
|
46
|
+
return Object.entries(componentPropsMetadata).reduce(function (previousValue, _a) {
|
|
47
|
+
var _b, _c;
|
|
48
|
+
var propertyName = _a[0], values = _a[1];
|
|
49
|
+
var value = values.find(function (v) { return v instanceof core_1.Input || v instanceof core_1.Output; });
|
|
50
|
+
if (value instanceof core_1.Input) {
|
|
51
|
+
var inputToAdd = {
|
|
52
|
+
propName: propertyName,
|
|
53
|
+
templateName: (_b = value.bindingPropertyName) !== null && _b !== void 0 ? _b : propertyName,
|
|
54
|
+
};
|
|
55
|
+
var previousInputsFiltered = previousValue.inputs.filter(function (i) { return i.templateName !== propertyName; });
|
|
56
|
+
return __assign(__assign({}, previousValue), { inputs: __spreadArrays(previousInputsFiltered, [inputToAdd]) });
|
|
57
|
+
}
|
|
58
|
+
if (value instanceof core_1.Output) {
|
|
59
|
+
var outputToAdd = {
|
|
60
|
+
propName: propertyName,
|
|
61
|
+
templateName: (_c = value.bindingPropertyName) !== null && _c !== void 0 ? _c : propertyName,
|
|
62
|
+
};
|
|
63
|
+
var previousOutputsFiltered = previousValue.outputs.filter(function (i) { return i.templateName !== propertyName; });
|
|
64
|
+
return __assign(__assign({}, previousValue), { outputs: __spreadArrays(previousOutputsFiltered, [outputToAdd]) });
|
|
65
|
+
}
|
|
66
|
+
return previousValue;
|
|
67
|
+
}, initialValue);
|
|
68
|
+
};
|
|
69
|
+
exports.isDeclarable = function (component) {
|
|
70
|
+
if (!component) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
var decoratorKey = '__annotations__';
|
|
74
|
+
var decorators = Reflect.getOwnPropertyDescriptor(component, decoratorKey)
|
|
75
|
+
? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
|
|
76
|
+
: component[decoratorKey];
|
|
77
|
+
return !!(decorators || []).find(function (d) { return d instanceof core_1.Directive || d instanceof core_1.Pipe || d instanceof core_1.Component; });
|
|
78
|
+
};
|
|
79
|
+
exports.isComponent = function (component) {
|
|
80
|
+
if (!component) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
var decoratorKey = '__annotations__';
|
|
84
|
+
var decorators = Reflect.getOwnPropertyDescriptor(component, decoratorKey)
|
|
85
|
+
? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
|
|
86
|
+
: component[decoratorKey];
|
|
87
|
+
return (decorators || []).some(function (d) { return d instanceof core_1.Component; });
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Returns all component decorator properties
|
|
91
|
+
* is used to get all `@Input` and `@Output` Decorator
|
|
92
|
+
*/
|
|
93
|
+
exports.getComponentPropsDecoratorMetadata = function (component) {
|
|
94
|
+
var decoratorKey = '__prop__metadata__';
|
|
95
|
+
var propsDecorators = Reflect &&
|
|
96
|
+
Reflect.getOwnPropertyDescriptor &&
|
|
97
|
+
Reflect.getOwnPropertyDescriptor(component, decoratorKey)
|
|
98
|
+
? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
|
|
99
|
+
: component[decoratorKey];
|
|
100
|
+
var parent = Reflect && Reflect.getPrototypeOf && Reflect.getPrototypeOf(component);
|
|
101
|
+
if (parent) {
|
|
102
|
+
var parentPropsDecorators = exports.getComponentPropsDecoratorMetadata(parent);
|
|
103
|
+
propsDecorators = __assign(__assign({}, parentPropsDecorators), propsDecorators);
|
|
104
|
+
}
|
|
105
|
+
return propsDecorators;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Returns component decorator `@Component`
|
|
109
|
+
*/
|
|
110
|
+
exports.getComponentDecoratorMetadata = function (component) {
|
|
111
|
+
var decoratorKey = '__annotations__';
|
|
112
|
+
var decorators = Reflect &&
|
|
113
|
+
Reflect.getOwnPropertyDescriptor &&
|
|
114
|
+
Reflect.getOwnPropertyDescriptor(component, decoratorKey)
|
|
115
|
+
? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
|
|
116
|
+
: component[decoratorKey];
|
|
117
|
+
if (!decorators) {
|
|
118
|
+
return (component.decorators &&
|
|
119
|
+
component.decorators[0] &&
|
|
120
|
+
component.decorators[0].args &&
|
|
121
|
+
component.decorators[0].args[0]);
|
|
122
|
+
}
|
|
123
|
+
return decorators.find(function (d) { return d instanceof core_1.Component; });
|
|
124
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avoid component redeclaration
|
|
3
|
+
*
|
|
4
|
+
* Checks recursively if the component has already been declared in all import Module
|
|
5
|
+
*/
|
|
6
|
+
export declare const isComponentAlreadyDeclaredInModules: (componentToFind: any, moduleDeclarations: any[], moduleImports: any[]) => boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isComponentAlreadyDeclaredInModules = void 0;
|
|
4
|
+
var core_1 = require("@angular/core");
|
|
5
|
+
/**
|
|
6
|
+
* Avoid component redeclaration
|
|
7
|
+
*
|
|
8
|
+
* Checks recursively if the component has already been declared in all import Module
|
|
9
|
+
*/
|
|
10
|
+
exports.isComponentAlreadyDeclaredInModules = function (componentToFind, moduleDeclarations, moduleImports) {
|
|
11
|
+
if (moduleDeclarations &&
|
|
12
|
+
moduleDeclarations.some(function (declaration) { return declaration === componentToFind; })) {
|
|
13
|
+
// Found component in declarations array
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (!moduleImports) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return moduleImports.some(function (importItem) {
|
|
20
|
+
var extractedNgModuleMetadata = extractNgModuleMetadata(importItem);
|
|
21
|
+
if (!extractedNgModuleMetadata) {
|
|
22
|
+
// Not an NgModule
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return exports.isComponentAlreadyDeclaredInModules(componentToFind, extractedNgModuleMetadata.declarations, extractedNgModuleMetadata.imports);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var extractNgModuleMetadata = function (importItem) {
|
|
29
|
+
var target = importItem && importItem.ngModule ? importItem.ngModule : importItem;
|
|
30
|
+
var decoratorKey = '__annotations__';
|
|
31
|
+
var decorators = Reflect &&
|
|
32
|
+
Reflect.getOwnPropertyDescriptor &&
|
|
33
|
+
Reflect.getOwnPropertyDescriptor(target, decoratorKey)
|
|
34
|
+
? Reflect.getOwnPropertyDescriptor(target, decoratorKey).value
|
|
35
|
+
: target[decoratorKey];
|
|
36
|
+
if (!decorators || decorators.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
var ngModuleDecorator = decorators.find(function (decorator) { return decorator instanceof core_1.NgModule; });
|
|
40
|
+
if (!ngModuleDecorator) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return ngModuleDecorator;
|
|
44
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
+
* You can add your own extra polyfills to this file.
|
|
4
|
+
*
|
|
5
|
+
* This file is divided into 2 sections:
|
|
6
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
+
* file.
|
|
9
|
+
*
|
|
10
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
12
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
13
|
+
*
|
|
14
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
15
|
+
*/
|
|
16
|
+
/** *************************************************************************************************
|
|
17
|
+
* BROWSER POLYFILLS
|
|
18
|
+
*/
|
|
19
|
+
/** IE9, IE10 and IE11 requires all of the following polyfills. * */
|
|
20
|
+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
21
|
+
/** Evergreen browsers require these. * */
|
|
22
|
+
import 'core-js/es/reflect';
|
|
23
|
+
import 'core-js/proposals/reflect-metadata';
|
|
24
|
+
/**
|
|
25
|
+
* Required to support Web Animations `@angular/animation`.
|
|
26
|
+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
|
27
|
+
* */
|
|
28
|
+
/** *************************************************************************************************
|
|
29
|
+
* Zone JS is required by Angular itself.
|
|
30
|
+
*/
|
|
31
|
+
import 'zone.js/dist/zone';
|
|
32
|
+
/** *************************************************************************************************
|
|
33
|
+
* APPLICATION IMPORTS
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Date, currency, decimal and percent pipes.
|
|
37
|
+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Need to import at least one locale-data with intl.
|
|
41
|
+
*/
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
4
|
+
* You can add your own extra polyfills to this file.
|
|
5
|
+
*
|
|
6
|
+
* This file is divided into 2 sections:
|
|
7
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
8
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
9
|
+
* file.
|
|
10
|
+
*
|
|
11
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
12
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
13
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
14
|
+
*
|
|
15
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
/** *************************************************************************************************
|
|
19
|
+
* BROWSER POLYFILLS
|
|
20
|
+
*/
|
|
21
|
+
/** IE9, IE10 and IE11 requires all of the following polyfills. * */
|
|
22
|
+
// import 'core-js/es6/symbol';
|
|
23
|
+
// import 'core-js/es6/object';
|
|
24
|
+
// import 'core-js/es6/function';
|
|
25
|
+
// import 'core-js/es6/parse-int';
|
|
26
|
+
// import 'core-js/es6/parse-float';
|
|
27
|
+
// import 'core-js/es6/number';
|
|
28
|
+
// import 'core-js/es6/math';
|
|
29
|
+
// import 'core-js/es6/string';
|
|
30
|
+
// import 'core-js/es6/date';
|
|
31
|
+
// import 'core-js/es6/array';
|
|
32
|
+
// import 'core-js/es6/regexp';
|
|
33
|
+
// import 'core-js/es6/map';
|
|
34
|
+
// import 'core-js/es6/weak-map';
|
|
35
|
+
// import 'core-js/es6/set';
|
|
36
|
+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
37
|
+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
38
|
+
/** Evergreen browsers require these. * */
|
|
39
|
+
require("core-js/es/reflect");
|
|
40
|
+
require("core-js/proposals/reflect-metadata");
|
|
41
|
+
/**
|
|
42
|
+
* Required to support Web Animations `@angular/animation`.
|
|
43
|
+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
|
44
|
+
* */
|
|
45
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
46
|
+
/** *************************************************************************************************
|
|
47
|
+
* Zone JS is required by Angular itself.
|
|
48
|
+
*/
|
|
49
|
+
require("zone.js/dist/zone"); // Included with Angular CLI.
|
|
50
|
+
/** *************************************************************************************************
|
|
51
|
+
* APPLICATION IMPORTS
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* Date, currency, decimal and percent pipes.
|
|
55
|
+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
56
|
+
*/
|
|
57
|
+
// import 'intl'; // Run `npm install --save intl`.
|
|
58
|
+
/**
|
|
59
|
+
* Need to import at least one locale-data with intl.
|
|
60
|
+
*/
|
|
61
|
+
// import 'intl/locale-data/jsonp/en';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parameters = void 0;
|
|
4
|
+
var render_1 = require("./render");
|
|
5
|
+
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return render_1.render; } });
|
|
6
|
+
Object.defineProperty(exports, "renderToDOM", { enumerable: true, get: function () { return render_1.renderToDOM; } });
|
|
7
|
+
var decorateStory_1 = require("./decorateStory");
|
|
8
|
+
Object.defineProperty(exports, "decorateStory", { enumerable: true, get: function () { return decorateStory_1.decorateStory; } });
|
|
9
|
+
exports.parameters = { framework: 'angular' };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
|
|
2
|
+
import { AngularFramework } from './types-6-0';
|
|
3
|
+
export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
|
|
4
|
+
export { decorateStory };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
14
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
15
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
16
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
17
|
+
r[k] = a[j];
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.decorateStory = void 0;
|
|
22
|
+
var store_1 = require("@storybook/store");
|
|
23
|
+
var ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFromComponent");
|
|
24
|
+
function decorateStory(mainStoryFn, decorators) {
|
|
25
|
+
var returnDecorators = __spreadArrays([cleanArgsDecorator], decorators).reduce(function (previousStoryFn, decorator) { return function (context) {
|
|
26
|
+
var decoratedStory = decorator(function (update) {
|
|
27
|
+
return previousStoryFn(__assign(__assign({}, context), store_1.sanitizeStoryContextUpdate(update)));
|
|
28
|
+
}, context);
|
|
29
|
+
return decoratedStory;
|
|
30
|
+
}; }, function (context) { return prepareMain(mainStoryFn(context), context); });
|
|
31
|
+
return returnDecorators;
|
|
32
|
+
}
|
|
33
|
+
exports.default = decorateStory;
|
|
34
|
+
exports.decorateStory = decorateStory;
|
|
35
|
+
var prepareMain = function (story, context) {
|
|
36
|
+
var _a;
|
|
37
|
+
var template = story.template;
|
|
38
|
+
var component = (_a = story.component) !== null && _a !== void 0 ? _a : context.component;
|
|
39
|
+
var userDefinedTemplate = !hasNoTemplate(template);
|
|
40
|
+
if (!userDefinedTemplate && component) {
|
|
41
|
+
template = ComputesTemplateFromComponent_1.computesTemplateFromComponent(component, story.props, '');
|
|
42
|
+
}
|
|
43
|
+
return __assign(__assign({}, story), (template ? { template: template, userDefinedTemplate: userDefinedTemplate } : {}));
|
|
44
|
+
};
|
|
45
|
+
function hasNoTemplate(template) {
|
|
46
|
+
return template === null || template === undefined;
|
|
47
|
+
}
|
|
48
|
+
var cleanArgsDecorator = function (storyFn, context) {
|
|
49
|
+
if (!context.argTypes || !context.args) {
|
|
50
|
+
return storyFn();
|
|
51
|
+
}
|
|
52
|
+
var argsToClean = context.args;
|
|
53
|
+
context.args = Object.entries(argsToClean).reduce(function (obj, _a) {
|
|
54
|
+
var _b;
|
|
55
|
+
var key = _a[0], arg = _a[1];
|
|
56
|
+
var argType = context.argTypes[key];
|
|
57
|
+
// Only keeps args with a control or an action in argTypes
|
|
58
|
+
if (argType.action || argType.control) {
|
|
59
|
+
return __assign(__assign({}, obj), (_b = {}, _b[key] = arg, _b));
|
|
60
|
+
}
|
|
61
|
+
return obj;
|
|
62
|
+
}, {});
|
|
63
|
+
return storyFn();
|
|
64
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { DecoratorFunction, StoryContext } from '@storybook/csf';
|
|
3
|
+
import { ICollection, NgModuleMetadata } from './types';
|
|
4
|
+
import { AngularFramework } from './types-6-0';
|
|
5
|
+
export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularFramework, TArgs>;
|
|
6
|
+
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularFramework, TArgs>) => ICollection)) => DecoratorFunction<AngularFramework, TArgs>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
14
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
15
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
16
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
17
|
+
r[k] = a[j];
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.componentWrapperDecorator = exports.moduleMetadata = void 0;
|
|
22
|
+
var ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFromComponent");
|
|
23
|
+
var NgComponentAnalyzer_1 = require("./angular-beta/utils/NgComponentAnalyzer");
|
|
24
|
+
// We use `any` here as the default type rather than `Args` because we need something that is
|
|
25
|
+
// castable to any component-specific args type when the user is being careful.
|
|
26
|
+
exports.moduleMetadata = function (metadata) { return function (storyFn) {
|
|
27
|
+
var story = storyFn();
|
|
28
|
+
var storyMetadata = story.moduleMetadata || {};
|
|
29
|
+
metadata = metadata || {};
|
|
30
|
+
return __assign(__assign({}, story), { moduleMetadata: {
|
|
31
|
+
declarations: __spreadArrays((metadata.declarations || []), (storyMetadata.declarations || [])),
|
|
32
|
+
entryComponents: __spreadArrays((metadata.entryComponents || []), (storyMetadata.entryComponents || [])),
|
|
33
|
+
imports: __spreadArrays((metadata.imports || []), (storyMetadata.imports || [])),
|
|
34
|
+
schemas: __spreadArrays((metadata.schemas || []), (storyMetadata.schemas || [])),
|
|
35
|
+
providers: __spreadArrays((metadata.providers || []), (storyMetadata.providers || [])),
|
|
36
|
+
} });
|
|
37
|
+
}; };
|
|
38
|
+
exports.componentWrapperDecorator = function (element, props) { return function (storyFn, storyContext) {
|
|
39
|
+
var story = storyFn();
|
|
40
|
+
var currentProps = typeof props === 'function' ? props(storyContext) : props;
|
|
41
|
+
var template = NgComponentAnalyzer_1.isComponent(element)
|
|
42
|
+
? ComputesTemplateFromComponent_1.computesTemplateFromComponent(element, currentProps !== null && currentProps !== void 0 ? currentProps : {}, story.template)
|
|
43
|
+
: element(story.template);
|
|
44
|
+
return __assign(__assign(__assign({}, story), { template: template }), (currentProps || story.props
|
|
45
|
+
? {
|
|
46
|
+
props: __assign(__assign({}, currentProps), story.props),
|
|
47
|
+
}
|
|
48
|
+
: {}));
|
|
49
|
+
}; };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './angular-polyfills';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var global_1 = __importDefault(require("global"));
|
|
7
|
+
require("./angular-polyfills");
|
|
8
|
+
var globalWindow = global_1.default.window;
|
|
9
|
+
globalWindow.STORYBOOK_ENV = 'angular';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="webpack-env" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
|
4
|
+
import './globals';
|
|
5
|
+
import { IStorybookSection } from './types';
|
|
6
|
+
import { AngularFramework } from './types-6-0';
|
|
7
|
+
interface ClientApi extends ClientStoryApi<AngularFramework['storyResult']> {
|
|
8
|
+
setAddon(addon: any): void;
|
|
9
|
+
configure(loader: Loadable, module: NodeModule): void;
|
|
10
|
+
getStorybook(): IStorybookSection[];
|
|
11
|
+
clearDecorators(): void;
|
|
12
|
+
forceReRender(): void;
|
|
13
|
+
raw: () => any;
|
|
14
|
+
load: (...args: any[]) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const storiesOf: ClientApi['storiesOf'];
|
|
17
|
+
export declare const configure: ClientApi['configure'];
|
|
18
|
+
export declare const addDecorator: ClientApi['addDecorator'];
|
|
19
|
+
export declare const addParameters: ClientApi['addParameters'];
|
|
20
|
+
export declare const clearDecorators: ClientApi['clearDecorators'];
|
|
21
|
+
export declare const setAddon: ClientApi['setAddon'];
|
|
22
|
+
export declare const forceReRender: ClientApi['forceReRender'];
|
|
23
|
+
export declare const getStorybook: ClientApi['getStorybook'];
|
|
24
|
+
export declare const raw: ClientApi['raw'];
|
|
25
|
+
export {};
|