@storybook/angular 6.4.0-beta.20 → 6.4.0-beta.24
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 +9 -9
- package/types-7-0.d.ts +1 -0
- package/dist/ts3.4/builders/build-storybook/index.d.ts +0 -12
- package/dist/ts3.4/builders/start-storybook/index.d.ts +0 -12
- package/dist/ts3.4/builders/utils/build-standalone-errors-handler.d.ts +0 -1
- package/dist/ts3.4/builders/utils/run-compodoc.d.ts +0 -6
- package/dist/ts3.4/client/index.d.ts +0 -4
- package/dist/ts3.4/client/preview/angular/app.token.d.ts +0 -3
- package/dist/ts3.4/client/preview/angular/components/app.component.d.ts +0 -38
- package/dist/ts3.4/client/preview/angular/helpers.d.ts +0 -8
- package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +0 -44
- package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
- package/dist/ts3.4/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
- package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
- package/dist/ts3.4/client/preview/angular-beta/RendererFactory.d.ts +0 -11
- package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +0 -9
- package/dist/ts3.4/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
- package/dist/ts3.4/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
- package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -26
- package/dist/ts3.4/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
- package/dist/ts3.4/client/preview/angular-polyfills.d.ts +0 -41
- package/dist/ts3.4/client/preview/config.d.ts +0 -4
- package/dist/ts3.4/client/preview/decorateStory.d.ts +0 -3
- package/dist/ts3.4/client/preview/decorators.d.ts +0 -6
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -25
- package/dist/ts3.4/client/preview/render.d.ts +0 -7
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -42
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -9
- package/dist/ts3.4/client/preview/types.d.ts +0 -29
- package/dist/ts3.4/demo/button.component.d.ts +0 -5
- package/dist/ts3.4/demo/welcome.component.d.ts +0 -4
- package/dist/ts3.4/public_api.d.ts +0 -1
- package/dist/ts3.4/renderer.d.ts +0 -4
- package/dist/ts3.4/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
- package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/ts3.4/server/angular-read-workspace.d.ts +0 -13
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +0 -73
- package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +0 -10
- package/dist/ts3.4/server/framework-preset-angular.d.ts +0 -4
- package/dist/ts3.4/server/index.d.ts +0 -1
- package/dist/ts3.4/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/ts3.4/server/options.d.ts +0 -3
- package/dist/ts3.4/server/preset.d.ts +0 -3
- package/dist/ts3.4/server/ts_config.d.ts +0 -2
- package/dist/ts3.4/server/utils/filter-out-styling-rules.d.ts +0 -2
- package/dist/ts3.4/server/utils/module-is-available.d.ts +0 -1
- package/dist/ts3.4/server/utils/normalize-asset-patterns.d.ts +0 -6
- package/dist/ts3.4/server/utils/normalize-optimization.d.ts +0 -3
- package/dist/ts3.4/types/index.d.ts +0 -6
- package/dist/ts3.9/builders/build-storybook/index.d.ts +0 -12
- package/dist/ts3.9/builders/build-storybook/index.js +0 -114
- package/dist/ts3.9/builders/build-storybook/schema.json +0 -72
- package/dist/ts3.9/builders/builders.json +0 -14
- package/dist/ts3.9/builders/start-storybook/index.d.ts +0 -12
- package/dist/ts3.9/builders/start-storybook/index.js +0 -117
- package/dist/ts3.9/builders/start-storybook/schema.json +0 -99
- package/dist/ts3.9/builders/utils/build-standalone-errors-handler.d.ts +0 -1
- package/dist/ts3.9/builders/utils/build-standalone-errors-handler.js +0 -36
- package/dist/ts3.9/builders/utils/run-compodoc.d.ts +0 -6
- package/dist/ts3.9/builders/utils/run-compodoc.js +0 -45
- package/dist/ts3.9/client/index.d.ts +0 -4
- package/dist/ts3.9/client/index.js +0 -28
- package/dist/ts3.9/client/preview/angular/app.token.d.ts +0 -3
- package/dist/ts3.9/client/preview/angular/app.token.js +0 -5
- package/dist/ts3.9/client/preview/angular/components/app.component.d.ts +0 -38
- package/dist/ts3.9/client/preview/angular/components/app.component.js +0 -146
- package/dist/ts3.9/client/preview/angular/helpers.d.ts +0 -8
- package/dist/ts3.9/client/preview/angular/helpers.js +0 -165
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.d.ts +0 -44
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +0 -215
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +0 -97
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.js +0 -112
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +0 -145
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.d.ts +0 -11
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +0 -101
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.d.ts +0 -9
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +0 -78
- package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
- package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.js +0 -27
- package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
- package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.js +0 -155
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -26
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +0 -124
- package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
- package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.js +0 -44
- package/dist/ts3.9/client/preview/angular-polyfills.d.ts +0 -41
- package/dist/ts3.9/client/preview/angular-polyfills.js +0 -61
- package/dist/ts3.9/client/preview/config.d.ts +0 -4
- package/dist/ts3.9/client/preview/config.js +0 -7
- package/dist/ts3.9/client/preview/decorateStory.d.ts +0 -3
- package/dist/ts3.9/client/preview/decorateStory.js +0 -62
- package/dist/ts3.9/client/preview/decorators.d.ts +0 -6
- package/dist/ts3.9/client/preview/decorators.js +0 -49
- package/dist/ts3.9/client/preview/globals.d.ts +0 -1
- package/dist/ts3.9/client/preview/globals.js +0 -9
- package/dist/ts3.9/client/preview/index.d.ts +0 -25
- package/dist/ts3.9/client/preview/index.js +0 -40
- package/dist/ts3.9/client/preview/render.d.ts +0 -7
- package/dist/ts3.9/client/preview/render.js +0 -73
- package/dist/ts3.9/client/preview/types-6-0.d.ts +0 -42
- package/dist/ts3.9/client/preview/types-6-0.js +0 -2
- package/dist/ts3.9/client/preview/types-7-0.d.ts +0 -9
- package/dist/ts3.9/client/preview/types-7-0.js +0 -2
- package/dist/ts3.9/client/preview/types.d.ts +0 -29
- package/dist/ts3.9/client/preview/types.js +0 -2
- package/dist/ts3.9/demo/button.component.d.ts +0 -5
- package/dist/ts3.9/demo/button.component.js +0 -37
- package/dist/ts3.9/demo/welcome.component.d.ts +0 -4
- package/dist/ts3.9/demo/welcome.component.js +0 -32
- package/dist/ts3.9/public_api.d.ts +0 -1
- package/dist/ts3.9/public_api.js +0 -24
- package/dist/ts3.9/renderer.d.ts +0 -4
- package/dist/ts3.9/renderer.js +0 -10
- package/dist/ts3.9/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -4
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -17
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -9
- package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/angular.json +0 -18
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -9
- package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -60
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -9
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/angular.json +0 -28
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -25
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/angular.json +0 -17
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/nx.json +0 -3
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -8
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -14
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -3
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -8
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -14
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -17
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -17
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -9
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -11
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -7
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -3
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -25
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -13
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -16
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -5
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -9
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -13
- package/dist/ts3.9/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/ts3.9/server/angular-devkit-build-webpack.js +0 -213
- package/dist/ts3.9/server/angular-read-workspace.d.ts +0 -13
- package/dist/ts3.9/server/angular-read-workspace.js +0 -118
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/build.js +0 -65
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +0 -19
- package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +0 -73
- package/dist/ts3.9/server/framework-preset-angular-cli.js +0 -159
- package/dist/ts3.9/server/framework-preset-angular-ivy.d.ts +0 -10
- package/dist/ts3.9/server/framework-preset-angular-ivy.js +0 -111
- package/dist/ts3.9/server/framework-preset-angular.d.ts +0 -4
- package/dist/ts3.9/server/framework-preset-angular.js +0 -74
- package/dist/ts3.9/server/index.d.ts +0 -1
- package/dist/ts3.9/server/index.js +0 -8
- package/dist/ts3.9/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/ts3.9/server/ngx-template-loader/index.js +0 -46
- package/dist/ts3.9/server/options.d.ts +0 -3
- package/dist/ts3.9/server/options.js +0 -8
- package/dist/ts3.9/server/preset.d.ts +0 -3
- package/dist/ts3.9/server/preset.js +0 -21
- package/dist/ts3.9/server/ts_config.d.ts +0 -2
- package/dist/ts3.9/server/ts_config.js +0 -28
- package/dist/ts3.9/server/utils/filter-out-styling-rules.d.ts +0 -2
- package/dist/ts3.9/server/utils/filter-out-styling-rules.js +0 -16
- package/dist/ts3.9/server/utils/module-is-available.d.ts +0 -1
- package/dist/ts3.9/server/utils/module-is-available.js +0 -12
- package/dist/ts3.9/server/utils/normalize-asset-patterns.d.ts +0 -6
- package/dist/ts3.9/server/utils/normalize-asset-patterns.js +0 -79
- package/dist/ts3.9/server/utils/normalize-optimization.d.ts +0 -3
- package/dist/ts3.9/server/utils/normalize-optimization.js +0 -20
- package/dist/ts3.9/types/index.d.ts +0 -6
- package/dist/ts3.9/types/index.js +0 -2
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.clearRootHTMLElement = exports.getRenderType = exports.RendererFactory = void 0;
|
|
40
|
-
var AbstractRenderer_1 = require("./AbstractRenderer");
|
|
41
|
-
var DocsRenderer_1 = require("./DocsRenderer");
|
|
42
|
-
var CanvasRenderer_1 = require("./CanvasRenderer");
|
|
43
|
-
var RendererFactory = /** @class */ (function () {
|
|
44
|
-
function RendererFactory() {
|
|
45
|
-
this.rendererMap = new Map();
|
|
46
|
-
}
|
|
47
|
-
RendererFactory.prototype.getRendererInstance = function (storyId, targetDOMNode) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
var renderType;
|
|
50
|
-
return __generator(this, function (_a) {
|
|
51
|
-
switch (_a.label) {
|
|
52
|
-
case 0:
|
|
53
|
-
// do nothing if the target node is null
|
|
54
|
-
// fix a problem when the docs asks 2 times the same component at the same time
|
|
55
|
-
// the 1st targetDOMNode of the 1st requested rendering becomes null 🤷♂️
|
|
56
|
-
if (targetDOMNode === null) {
|
|
57
|
-
return [2 /*return*/, null];
|
|
58
|
-
}
|
|
59
|
-
renderType = exports.getRenderType(targetDOMNode);
|
|
60
|
-
if (!(this.lastRenderType && this.lastRenderType !== renderType)) return [3 /*break*/, 2];
|
|
61
|
-
return [4 /*yield*/, AbstractRenderer_1.AbstractRenderer.resetPlatformBrowserDynamic()];
|
|
62
|
-
case 1:
|
|
63
|
-
_a.sent();
|
|
64
|
-
clearRootHTMLElement(renderType);
|
|
65
|
-
this.rendererMap.clear();
|
|
66
|
-
_a.label = 2;
|
|
67
|
-
case 2:
|
|
68
|
-
if (!this.rendererMap.has(storyId)) {
|
|
69
|
-
this.rendererMap.set(storyId, this.buildRenderer(storyId, renderType));
|
|
70
|
-
}
|
|
71
|
-
this.lastRenderType = renderType;
|
|
72
|
-
return [2 /*return*/, this.rendererMap.get(storyId)];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
RendererFactory.prototype.buildRenderer = function (storyId, renderType) {
|
|
78
|
-
if (renderType === 'docs') {
|
|
79
|
-
return new DocsRenderer_1.DocsRenderer(storyId);
|
|
80
|
-
}
|
|
81
|
-
return new CanvasRenderer_1.CanvasRenderer(storyId);
|
|
82
|
-
};
|
|
83
|
-
return RendererFactory;
|
|
84
|
-
}());
|
|
85
|
-
exports.RendererFactory = RendererFactory;
|
|
86
|
-
exports.getRenderType = function (targetDOMNode) {
|
|
87
|
-
return targetDOMNode.id === 'root' ? 'canvas' : 'docs';
|
|
88
|
-
};
|
|
89
|
-
function clearRootHTMLElement(renderType) {
|
|
90
|
-
switch (renderType) {
|
|
91
|
-
case 'canvas':
|
|
92
|
-
global.document.getElementById('docs-root').innerHTML = '';
|
|
93
|
-
break;
|
|
94
|
-
case 'docs':
|
|
95
|
-
global.document.getElementById('root').innerHTML = '';
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.clearRootHTMLElement = clearRootHTMLElement;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NgModule, Type } from '@angular/core';
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
|
-
import { ICollection, StoryFnAngularReturnType } from '../types';
|
|
4
|
-
export declare const getStorybookModuleMetadata: ({ storyFnAngular, component: annotatedComponent, targetSelector, }: {
|
|
5
|
-
storyFnAngular: StoryFnAngularReturnType;
|
|
6
|
-
component?: any;
|
|
7
|
-
targetSelector: string;
|
|
8
|
-
}, storyProps$: Subject<ICollection>) => NgModule;
|
|
9
|
-
export declare const createStorybookModule: (ngModule: NgModule) => Type<unknown>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
-
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;
|
|
10
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
-
};
|
|
12
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
13
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
14
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
15
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
16
|
-
r[k] = a[j];
|
|
17
|
-
return r;
|
|
18
|
-
};
|
|
19
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.createStorybookModule = exports.getStorybookModuleMetadata = void 0;
|
|
24
|
-
var core_1 = require("@angular/core");
|
|
25
|
-
var platform_browser_1 = require("@angular/platform-browser");
|
|
26
|
-
var ts_dedent_1 = __importDefault(require("ts-dedent"));
|
|
27
|
-
var util_deprecate_1 = __importDefault(require("util-deprecate"));
|
|
28
|
-
var StorybookProvider_1 = require("./StorybookProvider");
|
|
29
|
-
var NgModulesAnalyzer_1 = require("./utils/NgModulesAnalyzer");
|
|
30
|
-
var NgComponentAnalyzer_1 = require("./utils/NgComponentAnalyzer");
|
|
31
|
-
var StorybookWrapperComponent_1 = require("./StorybookWrapperComponent");
|
|
32
|
-
var ComputesTemplateFromComponent_1 = require("./ComputesTemplateFromComponent");
|
|
33
|
-
var deprecatedStoryComponentWarning = util_deprecate_1.default(function () { }, ts_dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["`component` story return value is deprecated, and will be removed in Storybook 7.0.\n Instead, use `export const default = () => ({ component: AppComponent });`\n or\n ```\n export const Primary: Story = () => ({});\n Primary.parameters = { component: AppComponent };\n ```\n Read more at \n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-angular-story-component).\n - https://storybook.js.org/docs/angular/writing-stories/parameters\n "], ["\\`component\\` story return value is deprecated, and will be removed in Storybook 7.0.\n Instead, use \\`export const default = () => ({ component: AppComponent });\\`\n or\n \\`\\`\\`\n export const Primary: Story = () => ({});\n Primary.parameters = { component: AppComponent };\n \\`\\`\\`\n Read more at \n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-angular-story-component).\n - https://storybook.js.org/docs/angular/writing-stories/parameters\n "]))));
|
|
34
|
-
exports.getStorybookModuleMetadata = function (_a, storyProps$) {
|
|
35
|
-
var _b, _c, _d, _e, _f;
|
|
36
|
-
var storyFnAngular = _a.storyFnAngular, annotatedComponent = _a.component, targetSelector = _a.targetSelector;
|
|
37
|
-
var storyComponent = storyFnAngular.component, props = storyFnAngular.props, styles = storyFnAngular.styles, _g = storyFnAngular.moduleMetadata, moduleMetadata = _g === void 0 ? {} : _g;
|
|
38
|
-
var template = storyFnAngular.template;
|
|
39
|
-
if (storyComponent) {
|
|
40
|
-
deprecatedStoryComponentWarning();
|
|
41
|
-
}
|
|
42
|
-
var component = storyComponent !== null && storyComponent !== void 0 ? storyComponent : annotatedComponent;
|
|
43
|
-
if (hasNoTemplate(template) && component) {
|
|
44
|
-
template = ComputesTemplateFromComponent_1.computesTemplateFromComponent(component, props, '');
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Create a component that wraps generated template and gives it props
|
|
48
|
-
*/
|
|
49
|
-
var ComponentToInject = StorybookWrapperComponent_1.createStorybookWrapperComponent(targetSelector, template, component, styles, props);
|
|
50
|
-
// Look recursively (deep) if the component is not already declared by an import module
|
|
51
|
-
var requiresComponentDeclaration = NgComponentAnalyzer_1.isDeclarable(component) &&
|
|
52
|
-
!NgModulesAnalyzer_1.isComponentAlreadyDeclaredInModules(component, moduleMetadata.declarations, moduleMetadata.imports);
|
|
53
|
-
return {
|
|
54
|
-
declarations: __spreadArrays((requiresComponentDeclaration ? [component] : []), [
|
|
55
|
-
ComponentToInject
|
|
56
|
-
], ((_b = moduleMetadata.declarations) !== null && _b !== void 0 ? _b : [])),
|
|
57
|
-
imports: __spreadArrays([platform_browser_1.BrowserModule], ((_c = moduleMetadata.imports) !== null && _c !== void 0 ? _c : [])),
|
|
58
|
-
providers: __spreadArrays([StorybookProvider_1.storyPropsProvider(storyProps$)], ((_d = moduleMetadata.providers) !== null && _d !== void 0 ? _d : [])),
|
|
59
|
-
entryComponents: __spreadArrays(((_e = moduleMetadata.entryComponents) !== null && _e !== void 0 ? _e : [])),
|
|
60
|
-
schemas: __spreadArrays(((_f = moduleMetadata.schemas) !== null && _f !== void 0 ? _f : [])),
|
|
61
|
-
bootstrap: [ComponentToInject],
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
exports.createStorybookModule = function (ngModule) {
|
|
65
|
-
var StorybookModule = /** @class */ (function () {
|
|
66
|
-
function StorybookModule() {
|
|
67
|
-
}
|
|
68
|
-
StorybookModule = __decorate([
|
|
69
|
-
core_1.NgModule(ngModule)
|
|
70
|
-
], StorybookModule);
|
|
71
|
-
return StorybookModule;
|
|
72
|
-
}());
|
|
73
|
-
return StorybookModule;
|
|
74
|
-
};
|
|
75
|
-
function hasNoTemplate(template) {
|
|
76
|
-
return template === null || template === undefined;
|
|
77
|
-
}
|
|
78
|
-
var templateObject_1;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
|
-
import { ICollection } from '../types';
|
|
4
|
-
export declare const STORY_PROPS: InjectionToken<Subject<ICollection>>;
|
|
5
|
-
export declare const storyPropsProvider: (storyProps$: Subject<ICollection | undefined>) => Provider;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storyPropsProvider = exports.STORY_PROPS = void 0;
|
|
4
|
-
var core_1 = require("@angular/core");
|
|
5
|
-
var rxjs_1 = require("rxjs");
|
|
6
|
-
exports.STORY_PROPS = new core_1.InjectionToken('STORY_PROPS');
|
|
7
|
-
exports.storyPropsProvider = function (storyProps$) { return ({
|
|
8
|
-
provide: exports.STORY_PROPS,
|
|
9
|
-
useFactory: storyDataFactory(storyProps$.asObservable()),
|
|
10
|
-
deps: [core_1.NgZone],
|
|
11
|
-
}); };
|
|
12
|
-
function storyDataFactory(data) {
|
|
13
|
-
return function (ngZone) {
|
|
14
|
-
return new rxjs_1.Observable(function (subscriber) {
|
|
15
|
-
var sub = data.subscribe(function (v) {
|
|
16
|
-
ngZone.run(function () { return subscriber.next(v); });
|
|
17
|
-
}, function (err) {
|
|
18
|
-
ngZone.run(function () { return subscriber.error(err); });
|
|
19
|
-
}, function () {
|
|
20
|
-
ngZone.run(function () { return subscriber.complete(); });
|
|
21
|
-
});
|
|
22
|
-
return function () {
|
|
23
|
-
sub.unsubscribe();
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Type } from '@angular/core';
|
|
2
|
-
import { ICollection } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps the story template into a component
|
|
5
|
-
*
|
|
6
|
-
* @param storyComponent
|
|
7
|
-
* @param initialProps
|
|
8
|
-
*/
|
|
9
|
-
export declare const createStorybookWrapperComponent: (selector: string, template: string, storyComponent: Type<unknown> | undefined, styles: string[], initialProps?: ICollection) => Type<any>;
|
|
@@ -1,155 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
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;
|
|
@@ -1,124 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
*/
|