@storybook/angular 0.0.0-pr-23609-sha-f47ef339
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/.eslintrc.js +8 -0
- package/README.md +322 -0
- package/dist/builders/build-storybook/index.js +72 -0
- package/dist/builders/build-storybook/index.spec.d.ts +1 -0
- package/dist/builders/build-storybook/index.spec.js +216 -0
- package/dist/builders/build-storybook/schema.json +167 -0
- package/dist/builders/builders.json +14 -0
- package/dist/builders/start-storybook/index.js +93 -0
- package/dist/builders/start-storybook/index.spec.d.ts +1 -0
- package/dist/builders/start-storybook/index.spec.js +215 -0
- package/dist/builders/start-storybook/schema.json +198 -0
- package/dist/builders/utils/error-handler.d.ts +2 -0
- package/dist/builders/utils/error-handler.js +38 -0
- package/dist/builders/utils/run-compodoc.d.ts +6 -0
- package/dist/builders/utils/run-compodoc.js +58 -0
- package/dist/builders/utils/run-compodoc.spec.d.ts +1 -0
- package/dist/builders/utils/run-compodoc.spec.js +86 -0
- package/dist/builders/utils/standalone-options.d.ts +15 -0
- package/dist/builders/utils/standalone-options.js +2 -0
- package/dist/client/angular-beta/AbstractRenderer.d.ts +53 -0
- package/dist/client/angular-beta/AbstractRenderer.js +180 -0
- package/dist/client/angular-beta/CanvasRenderer.d.ts +13 -0
- package/dist/client/angular-beta/CanvasRenderer.js +16 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +17 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.js +132 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +403 -0
- package/dist/client/angular-beta/DocsRenderer.d.ts +13 -0
- package/dist/client/angular-beta/DocsRenderer.js +40 -0
- package/dist/client/angular-beta/RendererFactory.d.ts +11 -0
- package/dist/client/angular-beta/RendererFactory.js +56 -0
- package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
- package/dist/client/angular-beta/RendererFactory.test.js +164 -0
- package/dist/client/angular-beta/StorybookModule.d.ts +8 -0
- package/dist/client/angular-beta/StorybookModule.js +29 -0
- package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
- package/dist/client/angular-beta/StorybookModule.test.js +311 -0
- package/dist/client/angular-beta/StorybookProvider.d.ts +5 -0
- package/dist/client/angular-beta/StorybookProvider.js +26 -0
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +16 -0
- package/dist/client/angular-beta/StorybookWrapperComponent.js +140 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +26 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.js +67 -0
- package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +2 -0
- package/dist/client/angular-beta/__testfixtures__/test.module.js +20 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +29 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +100 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +374 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +6 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +41 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +23 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +32 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.js +162 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +142 -0
- package/dist/client/config.d.ts +6 -0
- package/dist/client/config.js +10 -0
- package/dist/client/decorateStory.d.ts +4 -0
- package/dist/client/decorateStory.js +49 -0
- package/dist/client/decorateStory.test.d.ts +1 -0
- package/dist/client/decorateStory.test.js +304 -0
- package/dist/client/decorators.d.ts +14 -0
- package/dist/client/decorators.js +70 -0
- package/dist/client/decorators.test.d.ts +1 -0
- package/dist/client/decorators.test.js +146 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +111 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.js +207 -0
- package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +7 -0
- package/dist/client/docs/angular-properties.test.d.ts +1 -0
- package/dist/client/docs/angular-properties.test.js +62 -0
- package/dist/client/docs/compodoc.d.ts +12 -0
- package/dist/client/docs/compodoc.js +258 -0
- package/dist/client/docs/compodoc.test.d.ts +1 -0
- package/dist/client/docs/compodoc.test.js +131 -0
- package/dist/client/docs/config.d.ts +4 -0
- package/dist/client/docs/config.js +19 -0
- package/dist/client/docs/index.d.ts +1 -0
- package/dist/client/docs/index.js +17 -0
- package/dist/client/docs/sourceDecorator.d.ts +9 -0
- package/dist/client/docs/sourceDecorator.js +51 -0
- package/dist/client/docs/types.d.ts +102 -0
- package/dist/client/docs/types.js +2 -0
- package/dist/client/globals.d.ts +23 -0
- package/dist/client/globals.js +40 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +30 -0
- package/dist/client/preview-prod.d.ts +1 -0
- package/dist/client/preview-prod.js +4 -0
- package/dist/client/public-api.d.ts +15 -0
- package/dist/client/public-api.js +36 -0
- package/dist/client/public-types.d.ts +37 -0
- package/dist/client/public-types.js +2 -0
- package/dist/client/render.d.ts +7 -0
- package/dist/client/render.js +19 -0
- package/dist/client/types.d.ts +46 -0
- package/dist/client/types.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/dist/index.mjs +13 -0
- package/dist/preset.d.ts +6 -0
- package/dist/preset.js +36 -0
- package/dist/preset.mjs +30 -0
- package/dist/renderer.d.ts +6 -0
- package/dist/renderer.js +15 -0
- package/dist/renderer.mjs +6 -0
- package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +4 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/some-config/angular.json +19 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +64 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +28 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +20 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +3 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +8 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +3 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +8 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +5 -0
- package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +11 -0
- package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +7 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +3 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +20 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +16 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/server/__tests__/angular.json +96 -0
- package/dist/server/angular-cli-webpack.d.ts +1 -0
- package/dist/server/angular-cli-webpack.js +99 -0
- package/dist/server/framework-preset-angular-cli.d.ts +4 -0
- package/dist/server/framework-preset-angular-cli.js +85 -0
- package/dist/server/framework-preset-angular-docs.d.ts +2 -0
- package/dist/server/framework-preset-angular-docs.js +10 -0
- package/dist/server/framework-preset-angular-ivy.d.ts +10 -0
- package/dist/server/framework-preset-angular-ivy.js +103 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +25 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +48 -0
- package/dist/server/preset-options.d.ts +13 -0
- package/dist/server/preset-options.js +2 -0
- package/dist/server/utils/filter-out-styling-rules.d.ts +2 -0
- package/dist/server/utils/filter-out-styling-rules.js +17 -0
- package/dist/server/utils/module-is-available.d.ts +1 -0
- package/dist/server/utils/module-is-available.js +13 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.js +2 -0
- package/dist/types.mjs +1 -0
- package/jest.config.js +31 -0
- package/package.json +126 -0
- package/preset.js +1 -0
- package/renderer.d.ts +1 -0
- package/renderer.js +1 -0
- package/src/server/angular-cli-webpack.d.ts +7 -0
- package/src/server/angular-cli-webpack.js +127 -0
- package/src/server/plugins/storybook-normalize-angular-entry-plugin.js +54 -0
- package/src/typings.d.ts +21 -0
- package/template/cli/.eslintrc.json +5 -0
- package/template/cli/Button.stories.ts +51 -0
- package/template/cli/Header.stories.ts +37 -0
- package/template/cli/Page.stories.ts +46 -0
- package/template/cli/User.ts +2 -0
- package/template/cli/button.component.ts +55 -0
- package/template/cli/header.component.ts +75 -0
- package/template/cli/page.component.ts +77 -0
- package/template/components/button.component.ts +54 -0
- package/template/components/button.css +30 -0
- package/template/components/form.component.ts +37 -0
- package/template/components/html.component.ts +22 -0
- package/template/components/index.js +8 -0
- package/template/components/pre.component.ts +29 -0
- package/template/stories/angular-mdx.stories.mdx +25 -0
- package/template/stories/argTypes/doc-button/doc-button.component.html +7 -0
- package/template/stories/argTypes/doc-button/doc-button.component.scss +3 -0
- package/template/stories/argTypes/doc-button/doc-button.component.ts +232 -0
- package/template/stories/argTypes/doc-button/doc-button.stories.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.directive.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.stories.ts +14 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.service.ts +27 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.stories.ts +17 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.pipe.ts +18 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.stories.ts +17 -0
- package/template/stories/basics/README.stories.mdx +7 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva-component.stories.ts +27 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva.component.ts +57 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selectors.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.ts +37 -0
- package/template/stories/basics/component-with-enums/enums.component.html +8 -0
- package/template/stories/basics/component-with-enums/enums.component.stories.ts +24 -0
- package/template/stories/basics/component-with-enums/enums.component.ts +53 -0
- package/template/stories/basics/component-with-inheritance/base-button.component.ts +10 -0
- package/template/stories/basics/component-with-inheritance/base-button.stories.ts +12 -0
- package/template/stories/basics/component-with-inheritance/icon-button.component.ts +11 -0
- package/template/stories/basics/component-with-inheritance/icon-button.stories.ts +13 -0
- package/template/stories/basics/component-with-ng-content/ng-content-about-parent.stories.ts +58 -0
- package/template/stories/basics/component-with-ng-content/ng-content-simple.stories.ts +29 -0
- package/template/stories/basics/component-with-ng-on-destroy/component-with-on-destroy.stories.ts +40 -0
- package/template/stories/basics/component-with-on-push/on-push-box.component.ts +21 -0
- package/template/stories/basics/component-with-on-push/on-push.stories.ts +21 -0
- package/template/stories/basics/component-with-pipe/custom-pipes.stories.ts +31 -0
- package/template/stories/basics/component-with-pipe/custom.pipe.ts +10 -0
- package/template/stories/basics/component-with-pipe/with-pipe.component.ts +10 -0
- package/template/stories/basics/component-with-provider/di.component.html +7 -0
- package/template/stories/basics/component-with-provider/di.component.stories.ts +26 -0
- package/template/stories/basics/component-with-provider/di.component.ts +28 -0
- package/template/stories/basics/component-with-style/styled.component.css +3 -0
- package/template/stories/basics/component-with-style/styled.component.html +5 -0
- package/template/stories/basics/component-with-style/styled.component.scss +5 -0
- package/template/stories/basics/component-with-style/styled.component.stories.ts +10 -0
- package/template/stories/basics/component-with-style/styled.component.ts +8 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-component-outlet.stories.ts +73 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-factory-resolver.stories.ts +71 -0
- package/template/stories/basics/component-without-selector/without-selector.component.ts +30 -0
- package/template/stories/basics/component-without-selector/without-selector.stories.ts +30 -0
- package/template/stories/basics/ng-module/angular-src/chip-color.token.ts +3 -0
- package/template/stories/basics/ng-module/angular-src/chip-text.pipe.ts +29 -0
- package/template/stories/basics/ng-module/angular-src/chip.component.ts +60 -0
- package/template/stories/basics/ng-module/angular-src/chips-group.component.ts +49 -0
- package/template/stories/basics/ng-module/angular-src/chips.module.ts +31 -0
- package/template/stories/basics/ng-module/import-module-chip.stories.ts +23 -0
- package/template/stories/basics/ng-module/import-module-for-root.stories.ts +50 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +35 -0
- package/template/stories/button.component.ts +26 -0
- package/template/stories/core/README.stories.mdx +7 -0
- package/template/stories/core/applicationConfig/with-browser-animations.stories.ts +40 -0
- package/template/stories/core/applicationConfig/with-noop-browser-animations.stories.ts +35 -0
- package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +99 -0
- package/template/stories/core/decorators/componentWrapperDecorator/parent.component.ts +18 -0
- package/template/stories/core/decorators/theme-decorator/decorators.stories.ts +20 -0
- package/template/stories/core/moduleMetadata/angular-src/custom.pipe.ts +10 -0
- package/template/stories/core/moduleMetadata/angular-src/dummy.service.ts +14 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.css +13 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.html +7 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.ts +39 -0
- package/template/stories/core/moduleMetadata/angular-src/service.component.ts +24 -0
- package/template/stories/core/moduleMetadata/angular-src/token.component.ts +31 -0
- package/template/stories/core/moduleMetadata/in-export-default.stories.ts +38 -0
- package/template/stories/core/moduleMetadata/in-stories.stories.ts +46 -0
- package/template/stories/core/moduleMetadata/merge-default-and-story.stories.ts +35 -0
- package/template/stories/core/parameters/bootstrap-options.stories.ts +18 -0
- package/template/stories/core/styles/story-styles.stories.ts +50 -0
- package/template/stories/others/app-initializer-use-factory/app-initializer-use-factory.stories.ts +34 -0
- package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
- package/template/stories/others/ngx-translate/README.stories.mdx +65 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractComponentDescription = exports.extractArgTypes = exports.extractArgTypesFromData = exports.extractType = exports.findComponentByName = exports.checkValidCompodocJson = exports.checkValidComponentOrDirective = exports.getCompodocJson = exports.setCompodocJson = exports.isMethod = void 0;
|
|
4
|
+
/* eslint-disable no-underscore-dangle */
|
|
5
|
+
const global_1 = require("@storybook/global");
|
|
6
|
+
const client_logger_1 = require("@storybook/client-logger");
|
|
7
|
+
const isMethod = (methodOrProp) => {
|
|
8
|
+
return methodOrProp.args !== undefined;
|
|
9
|
+
};
|
|
10
|
+
exports.isMethod = isMethod;
|
|
11
|
+
const setCompodocJson = (compodocJson) => {
|
|
12
|
+
global_1.global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
13
|
+
};
|
|
14
|
+
exports.setCompodocJson = setCompodocJson;
|
|
15
|
+
const getCompodocJson = () => global_1.global.__STORYBOOK_COMPODOC_JSON__;
|
|
16
|
+
exports.getCompodocJson = getCompodocJson;
|
|
17
|
+
const checkValidComponentOrDirective = (component) => {
|
|
18
|
+
if (!component.name) {
|
|
19
|
+
throw new Error(`Invalid component ${JSON.stringify(component)}`);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.checkValidComponentOrDirective = checkValidComponentOrDirective;
|
|
23
|
+
const checkValidCompodocJson = (compodocJson) => {
|
|
24
|
+
if (!compodocJson || !compodocJson.components) {
|
|
25
|
+
throw new Error('Invalid compodoc JSON');
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.checkValidCompodocJson = checkValidCompodocJson;
|
|
29
|
+
const hasDecorator = (item, decoratorName) => item.decorators && item.decorators.find((x) => x.name === decoratorName);
|
|
30
|
+
const mapPropertyToSection = (item) => {
|
|
31
|
+
if (hasDecorator(item, 'ViewChild')) {
|
|
32
|
+
return 'view child';
|
|
33
|
+
}
|
|
34
|
+
if (hasDecorator(item, 'ViewChildren')) {
|
|
35
|
+
return 'view children';
|
|
36
|
+
}
|
|
37
|
+
if (hasDecorator(item, 'ContentChild')) {
|
|
38
|
+
return 'content child';
|
|
39
|
+
}
|
|
40
|
+
if (hasDecorator(item, 'ContentChildren')) {
|
|
41
|
+
return 'content children';
|
|
42
|
+
}
|
|
43
|
+
return 'properties';
|
|
44
|
+
};
|
|
45
|
+
const mapItemToSection = (key, item) => {
|
|
46
|
+
switch (key) {
|
|
47
|
+
case 'methods':
|
|
48
|
+
case 'methodsClass':
|
|
49
|
+
return 'methods';
|
|
50
|
+
case 'inputsClass':
|
|
51
|
+
return 'inputs';
|
|
52
|
+
case 'outputsClass':
|
|
53
|
+
return 'outputs';
|
|
54
|
+
case 'properties':
|
|
55
|
+
case 'propertiesClass':
|
|
56
|
+
if ((0, exports.isMethod)(item)) {
|
|
57
|
+
throw new Error("Cannot be of type Method if key === 'propertiesClass'");
|
|
58
|
+
}
|
|
59
|
+
return mapPropertyToSection(item);
|
|
60
|
+
default:
|
|
61
|
+
throw new Error(`Unknown key: ${key}`);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const findComponentByName = (name, compodocJson) => compodocJson.components.find((c) => c.name === name) ||
|
|
65
|
+
compodocJson.directives.find((c) => c.name === name) ||
|
|
66
|
+
compodocJson.pipes.find((c) => c.name === name) ||
|
|
67
|
+
compodocJson.injectables.find((c) => c.name === name) ||
|
|
68
|
+
compodocJson.classes.find((c) => c.name === name);
|
|
69
|
+
exports.findComponentByName = findComponentByName;
|
|
70
|
+
const getComponentData = (component) => {
|
|
71
|
+
if (!component) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
(0, exports.checkValidComponentOrDirective)(component);
|
|
75
|
+
const compodocJson = (0, exports.getCompodocJson)();
|
|
76
|
+
if (!compodocJson) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
(0, exports.checkValidCompodocJson)(compodocJson);
|
|
80
|
+
const { name } = component;
|
|
81
|
+
const metadata = (0, exports.findComponentByName)(name, compodocJson);
|
|
82
|
+
if (!metadata) {
|
|
83
|
+
client_logger_1.logger.warn(`Component not found in compodoc JSON: '${name}'`);
|
|
84
|
+
}
|
|
85
|
+
return metadata;
|
|
86
|
+
};
|
|
87
|
+
const displaySignature = (item) => {
|
|
88
|
+
const args = item.args.map((arg) => `${arg.name}${arg.optional ? '?' : ''}: ${arg.type}`);
|
|
89
|
+
return `(${args.join(', ')}) => ${item.returnType}`;
|
|
90
|
+
};
|
|
91
|
+
const extractTypeFromValue = (defaultValue) => {
|
|
92
|
+
const valueType = typeof defaultValue;
|
|
93
|
+
return defaultValue || valueType === 'number' || valueType === 'boolean' || valueType === 'string'
|
|
94
|
+
? valueType
|
|
95
|
+
: null;
|
|
96
|
+
};
|
|
97
|
+
const extractEnumValues = (compodocType) => {
|
|
98
|
+
const compodocJson = (0, exports.getCompodocJson)();
|
|
99
|
+
const enumType = compodocJson?.miscellaneous?.enumerations?.find((x) => x.name === compodocType);
|
|
100
|
+
if (enumType?.childs.every((x) => x.value)) {
|
|
101
|
+
return enumType.childs.map((x) => x.value);
|
|
102
|
+
}
|
|
103
|
+
if (typeof compodocType !== 'string' || compodocType.indexOf('|') === -1) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return compodocType.split('|').map((value) => JSON.parse(value));
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const extractType = (property, defaultValue) => {
|
|
114
|
+
const compodocType = property.type || extractTypeFromValue(defaultValue);
|
|
115
|
+
switch (compodocType) {
|
|
116
|
+
case 'string':
|
|
117
|
+
case 'boolean':
|
|
118
|
+
case 'number':
|
|
119
|
+
return { name: compodocType };
|
|
120
|
+
case undefined:
|
|
121
|
+
case null:
|
|
122
|
+
return { name: 'other', value: 'void' };
|
|
123
|
+
default: {
|
|
124
|
+
const resolvedType = resolveTypealias(compodocType);
|
|
125
|
+
const enumValues = extractEnumValues(resolvedType);
|
|
126
|
+
return enumValues
|
|
127
|
+
? { name: 'enum', value: enumValues }
|
|
128
|
+
: { name: 'other', value: 'empty-enum' };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.extractType = extractType;
|
|
133
|
+
const castDefaultValue = (property, defaultValue) => {
|
|
134
|
+
const compodocType = property.type;
|
|
135
|
+
// All these checks are necessary as compodoc does not always set the type ie. @HostBinding have empty types.
|
|
136
|
+
// null and undefined also have 'any' type
|
|
137
|
+
if (['boolean', 'number', 'string', 'EventEmitter'].includes(compodocType)) {
|
|
138
|
+
switch (compodocType) {
|
|
139
|
+
case 'boolean':
|
|
140
|
+
return defaultValue === 'true';
|
|
141
|
+
case 'number':
|
|
142
|
+
return Number(defaultValue);
|
|
143
|
+
case 'EventEmitter':
|
|
144
|
+
return undefined;
|
|
145
|
+
default:
|
|
146
|
+
return defaultValue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
switch (defaultValue) {
|
|
151
|
+
case 'true':
|
|
152
|
+
return true;
|
|
153
|
+
case 'false':
|
|
154
|
+
return false;
|
|
155
|
+
case 'null':
|
|
156
|
+
return null;
|
|
157
|
+
case 'undefined':
|
|
158
|
+
return undefined;
|
|
159
|
+
default:
|
|
160
|
+
return defaultValue;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const extractDefaultValueFromComments = (property, value) => {
|
|
165
|
+
let commentValue = value;
|
|
166
|
+
property.jsdoctags.forEach((tag) => {
|
|
167
|
+
if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
|
|
168
|
+
const dom = new global_1.global.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
169
|
+
commentValue = dom.body.textContent;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return commentValue;
|
|
173
|
+
};
|
|
174
|
+
const extractDefaultValue = (property) => {
|
|
175
|
+
try {
|
|
176
|
+
let value = property.defaultValue?.replace(/^'(.*)'$/, '$1');
|
|
177
|
+
value = castDefaultValue(property, value);
|
|
178
|
+
if (value == null && property.jsdoctags?.length > 0) {
|
|
179
|
+
value = extractDefaultValueFromComments(property, value);
|
|
180
|
+
}
|
|
181
|
+
return value;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
client_logger_1.logger.debug(`Error extracting ${property.name}: ${property.defaultValue}`);
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const resolveTypealias = (compodocType) => {
|
|
189
|
+
const compodocJson = (0, exports.getCompodocJson)();
|
|
190
|
+
const typeAlias = compodocJson?.miscellaneous?.typealiases?.find((x) => x.name === compodocType);
|
|
191
|
+
return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
|
|
192
|
+
};
|
|
193
|
+
const extractArgTypesFromData = (componentData) => {
|
|
194
|
+
const sectionToItems = {};
|
|
195
|
+
const compodocClasses = ['component', 'directive'].includes(componentData.type)
|
|
196
|
+
? ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass']
|
|
197
|
+
: ['properties', 'methods'];
|
|
198
|
+
compodocClasses.forEach((key) => {
|
|
199
|
+
const data = componentData[key] || [];
|
|
200
|
+
data.forEach((item) => {
|
|
201
|
+
const section = mapItemToSection(key, item);
|
|
202
|
+
const defaultValue = (0, exports.isMethod)(item) ? undefined : extractDefaultValue(item);
|
|
203
|
+
const type = (0, exports.isMethod)(item) || (section !== 'inputs' && section !== 'properties')
|
|
204
|
+
? { name: 'other', value: 'void' }
|
|
205
|
+
: (0, exports.extractType)(item, defaultValue);
|
|
206
|
+
const action = section === 'outputs' ? { action: item.name } : {};
|
|
207
|
+
const argType = {
|
|
208
|
+
name: item.name,
|
|
209
|
+
description: item.rawdescription || item.description,
|
|
210
|
+
type,
|
|
211
|
+
...action,
|
|
212
|
+
table: {
|
|
213
|
+
category: section,
|
|
214
|
+
type: {
|
|
215
|
+
summary: (0, exports.isMethod)(item) ? displaySignature(item) : item.type,
|
|
216
|
+
required: (0, exports.isMethod)(item) ? false : !item.optional,
|
|
217
|
+
},
|
|
218
|
+
defaultValue: { summary: defaultValue },
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
if (!sectionToItems[section]) {
|
|
222
|
+
sectionToItems[section] = [];
|
|
223
|
+
}
|
|
224
|
+
sectionToItems[section].push(argType);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
const SECTIONS = [
|
|
228
|
+
'properties',
|
|
229
|
+
'inputs',
|
|
230
|
+
'outputs',
|
|
231
|
+
'methods',
|
|
232
|
+
'view child',
|
|
233
|
+
'view children',
|
|
234
|
+
'content child',
|
|
235
|
+
'content children',
|
|
236
|
+
];
|
|
237
|
+
const argTypes = {};
|
|
238
|
+
SECTIONS.forEach((section) => {
|
|
239
|
+
const items = sectionToItems[section];
|
|
240
|
+
if (items) {
|
|
241
|
+
items.forEach((argType) => {
|
|
242
|
+
argTypes[argType.name] = argType;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return argTypes;
|
|
247
|
+
};
|
|
248
|
+
exports.extractArgTypesFromData = extractArgTypesFromData;
|
|
249
|
+
const extractArgTypes = (component) => {
|
|
250
|
+
const componentData = getComponentData(component);
|
|
251
|
+
return componentData && (0, exports.extractArgTypesFromData)(componentData);
|
|
252
|
+
};
|
|
253
|
+
exports.extractArgTypes = extractArgTypes;
|
|
254
|
+
const extractComponentDescription = (component) => {
|
|
255
|
+
const componentData = getComponentData(component);
|
|
256
|
+
return componentData && (componentData.rawdescription || componentData.description);
|
|
257
|
+
};
|
|
258
|
+
exports.extractComponentDescription = extractComponentDescription;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const compodoc_1 = require("./compodoc");
|
|
4
|
+
const makeProperty = (compodocType) => ({
|
|
5
|
+
type: compodocType,
|
|
6
|
+
name: 'dummy',
|
|
7
|
+
decorators: [],
|
|
8
|
+
optional: true,
|
|
9
|
+
});
|
|
10
|
+
const getDummyCompodocJson = () => {
|
|
11
|
+
return {
|
|
12
|
+
miscellaneous: {
|
|
13
|
+
typealiases: [
|
|
14
|
+
{
|
|
15
|
+
name: 'EnumAlias',
|
|
16
|
+
ctype: 'miscellaneous',
|
|
17
|
+
subtype: 'typealias',
|
|
18
|
+
rawtype: 'EnumNumeric',
|
|
19
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
20
|
+
description: '',
|
|
21
|
+
kind: 161,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'TypeAlias',
|
|
25
|
+
ctype: 'miscellaneous',
|
|
26
|
+
subtype: 'typealias',
|
|
27
|
+
rawtype: '"Type Alias 1" | "Type Alias 2" | "Type Alias 3"',
|
|
28
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
29
|
+
description: '',
|
|
30
|
+
kind: 168,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
enumerations: [
|
|
34
|
+
{
|
|
35
|
+
name: 'EnumNumeric',
|
|
36
|
+
childs: [
|
|
37
|
+
{
|
|
38
|
+
name: 'FIRST',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'SECOND',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'THIRD',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
ctype: 'miscellaneous',
|
|
48
|
+
subtype: 'enum',
|
|
49
|
+
description: '<p>Button Priority</p>\n',
|
|
50
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'EnumNumericInitial',
|
|
54
|
+
childs: [
|
|
55
|
+
{
|
|
56
|
+
name: 'UNO',
|
|
57
|
+
value: '1',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'DOS',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'TRES',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
ctype: 'miscellaneous',
|
|
67
|
+
subtype: 'enum',
|
|
68
|
+
description: '',
|
|
69
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'EnumStringValues',
|
|
73
|
+
childs: [
|
|
74
|
+
{
|
|
75
|
+
name: 'PRIMARY',
|
|
76
|
+
value: 'PRIMARY',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'SECONDARY',
|
|
80
|
+
value: 'SECONDARY',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'TERTIARY',
|
|
84
|
+
value: 'TERTIARY',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
ctype: 'miscellaneous',
|
|
88
|
+
subtype: 'enum',
|
|
89
|
+
description: '',
|
|
90
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
describe('extractType', () => {
|
|
97
|
+
describe('with compodoc type', () => {
|
|
98
|
+
(0, compodoc_1.setCompodocJson)(getDummyCompodocJson());
|
|
99
|
+
it.each([
|
|
100
|
+
['string', { name: 'string' }],
|
|
101
|
+
['boolean', { name: 'boolean' }],
|
|
102
|
+
['number', { name: 'number' }],
|
|
103
|
+
// ['object', { name: 'object' }], // seems to be wrong | TODO: REVISIT
|
|
104
|
+
// ['foo', { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
|
|
105
|
+
[null, { name: 'other', value: 'void' }],
|
|
106
|
+
[undefined, { name: 'other', value: 'void' }],
|
|
107
|
+
// ['T[]', { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
|
|
108
|
+
['[]', { name: 'other', value: 'empty-enum' }],
|
|
109
|
+
['"primary" | "secondary"', { name: 'enum', value: ['primary', 'secondary'] }],
|
|
110
|
+
['TypeAlias', { name: 'enum', value: ['Type Alias 1', 'Type Alias 2', 'Type Alias 3'] }],
|
|
111
|
+
// ['EnumNumeric', { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
|
|
112
|
+
// ['EnumNumericInitial', { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
|
|
113
|
+
['EnumStringValues', { name: 'enum', value: ['PRIMARY', 'SECONDARY', 'TERTIARY'] }],
|
|
114
|
+
])('%s', (compodocType, expected) => {
|
|
115
|
+
expect((0, compodoc_1.extractType)(makeProperty(compodocType), null)).toEqual(expected);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe('without compodoc type', () => {
|
|
119
|
+
it.each([
|
|
120
|
+
['string', { name: 'string' }],
|
|
121
|
+
['', { name: 'string' }],
|
|
122
|
+
[false, { name: 'boolean' }],
|
|
123
|
+
[10, { name: 'number' }],
|
|
124
|
+
// [['abc'], { name: 'object' }], // seems to be wrong | TODO: REVISIT
|
|
125
|
+
// [{ foo: 1 }, { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
|
|
126
|
+
[undefined, { name: 'other', value: 'void' }],
|
|
127
|
+
])('%s', (defaultValue, expected) => {
|
|
128
|
+
expect((0, compodoc_1.extractType)(makeProperty(null), defaultValue)).toEqual(expected);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.argTypesEnhancers = exports.decorators = exports.parameters = void 0;
|
|
4
|
+
const docs_tools_1 = require("@storybook/docs-tools");
|
|
5
|
+
const compodoc_1 = require("./compodoc");
|
|
6
|
+
const sourceDecorator_1 = require("./sourceDecorator");
|
|
7
|
+
exports.parameters = {
|
|
8
|
+
docs: {
|
|
9
|
+
story: { inline: true },
|
|
10
|
+
extractArgTypes: compodoc_1.extractArgTypes,
|
|
11
|
+
extractComponentDescription: compodoc_1.extractComponentDescription,
|
|
12
|
+
source: {
|
|
13
|
+
type: docs_tools_1.SourceType.DYNAMIC,
|
|
14
|
+
language: 'html',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
exports.decorators = [sourceDecorator_1.sourceDecorator];
|
|
19
|
+
exports.argTypesEnhancers = [docs_tools_1.enhanceArgTypes];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './compodoc';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./compodoc"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
+
import { StoryContext, AngularRenderer } from '../types';
|
|
3
|
+
export declare const skipSourceRender: (context: StoryContext) => any;
|
|
4
|
+
/**
|
|
5
|
+
* Angular source decorator.
|
|
6
|
+
* @param storyFn Fn
|
|
7
|
+
* @param context StoryContext
|
|
8
|
+
*/
|
|
9
|
+
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularRenderer>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceDecorator = exports.skipSourceRender = void 0;
|
|
4
|
+
const preview_api_1 = require("@storybook/preview-api");
|
|
5
|
+
const docs_tools_1 = require("@storybook/docs-tools");
|
|
6
|
+
const renderer_1 = require("../../renderer");
|
|
7
|
+
const skipSourceRender = (context) => {
|
|
8
|
+
const sourceParams = context?.parameters.docs?.source;
|
|
9
|
+
// always render if the user forces it
|
|
10
|
+
if (sourceParams?.type === docs_tools_1.SourceType.DYNAMIC) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
// never render if the user is forcing the block to render code, or
|
|
14
|
+
// if the user provides code
|
|
15
|
+
return sourceParams?.code || sourceParams?.type === docs_tools_1.SourceType.CODE;
|
|
16
|
+
};
|
|
17
|
+
exports.skipSourceRender = skipSourceRender;
|
|
18
|
+
/**
|
|
19
|
+
* Angular source decorator.
|
|
20
|
+
* @param storyFn Fn
|
|
21
|
+
* @param context StoryContext
|
|
22
|
+
*/
|
|
23
|
+
const sourceDecorator = (storyFn, context) => {
|
|
24
|
+
const story = storyFn();
|
|
25
|
+
if ((0, exports.skipSourceRender)(context)) {
|
|
26
|
+
return story;
|
|
27
|
+
}
|
|
28
|
+
const channel = preview_api_1.addons.getChannel();
|
|
29
|
+
const { props, template, userDefinedTemplate } = story;
|
|
30
|
+
const { component, argTypes } = context;
|
|
31
|
+
let toEmit;
|
|
32
|
+
(0, preview_api_1.useEffect)(() => {
|
|
33
|
+
if (toEmit) {
|
|
34
|
+
const { id, unmappedArgs } = context;
|
|
35
|
+
channel.emit(docs_tools_1.SNIPPET_RENDERED, { id, args: unmappedArgs, source: toEmit, format: 'angular' });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (component && !userDefinedTemplate) {
|
|
39
|
+
const source = (0, renderer_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
40
|
+
// We might have a story with a Directive or Service defined as the component
|
|
41
|
+
// In these cases there might exist a template, even if we aren't able to create source from component
|
|
42
|
+
if (source || template) {
|
|
43
|
+
toEmit = source || template;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (template) {
|
|
47
|
+
toEmit = template;
|
|
48
|
+
}
|
|
49
|
+
return story;
|
|
50
|
+
};
|
|
51
|
+
exports.sourceDecorator = sourceDecorator;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface Method {
|
|
2
|
+
name: string;
|
|
3
|
+
args: Argument[];
|
|
4
|
+
returnType: string;
|
|
5
|
+
decorators?: Decorator[];
|
|
6
|
+
description?: string;
|
|
7
|
+
rawdescription?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface JsDocTag {
|
|
10
|
+
comment?: string;
|
|
11
|
+
tagName?: {
|
|
12
|
+
escapedText?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface Property {
|
|
16
|
+
name: string;
|
|
17
|
+
decorators?: Decorator[];
|
|
18
|
+
type: string;
|
|
19
|
+
optional: boolean;
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
rawdescription?: string;
|
|
23
|
+
jsdoctags?: JsDocTag[];
|
|
24
|
+
}
|
|
25
|
+
export interface Class {
|
|
26
|
+
name: string;
|
|
27
|
+
ngname: string;
|
|
28
|
+
type: 'pipe';
|
|
29
|
+
properties: Property[];
|
|
30
|
+
methods: Method[];
|
|
31
|
+
description?: string;
|
|
32
|
+
rawdescription?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface Injectable {
|
|
35
|
+
name: string;
|
|
36
|
+
type: 'injectable';
|
|
37
|
+
properties: Property[];
|
|
38
|
+
methods: Method[];
|
|
39
|
+
description?: string;
|
|
40
|
+
rawdescription?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface Pipe {
|
|
43
|
+
name: string;
|
|
44
|
+
type: 'class';
|
|
45
|
+
properties: Property[];
|
|
46
|
+
methods: Method[];
|
|
47
|
+
description?: string;
|
|
48
|
+
rawdescription?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface Directive {
|
|
51
|
+
name: string;
|
|
52
|
+
type: 'directive' | 'component';
|
|
53
|
+
propertiesClass: Property[];
|
|
54
|
+
inputsClass: Property[];
|
|
55
|
+
outputsClass: Property[];
|
|
56
|
+
methodsClass: Method[];
|
|
57
|
+
description?: string;
|
|
58
|
+
rawdescription?: string;
|
|
59
|
+
}
|
|
60
|
+
export type Component = Directive;
|
|
61
|
+
export interface Argument {
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
optional?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface Decorator {
|
|
67
|
+
name: string;
|
|
68
|
+
}
|
|
69
|
+
export interface TypeAlias {
|
|
70
|
+
name: string;
|
|
71
|
+
ctype: string;
|
|
72
|
+
subtype: string;
|
|
73
|
+
rawtype: string;
|
|
74
|
+
file: string;
|
|
75
|
+
kind: number;
|
|
76
|
+
description?: string;
|
|
77
|
+
rawdescription?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface EnumType {
|
|
80
|
+
name: string;
|
|
81
|
+
childs: EnumTypeChild[];
|
|
82
|
+
ctype: string;
|
|
83
|
+
subtype: string;
|
|
84
|
+
file: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
rawdescription?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface EnumTypeChild {
|
|
89
|
+
name: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface CompodocJson {
|
|
93
|
+
directives: Directive[];
|
|
94
|
+
components: Component[];
|
|
95
|
+
pipes: Pipe[];
|
|
96
|
+
injectables: Injectable[];
|
|
97
|
+
classes: Class[];
|
|
98
|
+
miscellaneous?: {
|
|
99
|
+
typealiases?: TypeAlias[];
|
|
100
|
+
enumerations?: EnumType[];
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
* Required to support Web Animations `@angular/animation`.
|
|
18
|
+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
|
19
|
+
* */
|
|
20
|
+
/** *************************************************************************************************
|
|
21
|
+
* Zone JS is required by Angular itself.
|
|
22
|
+
*/
|
|
23
|
+
import 'zone.js/dist/zone';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const global_1 = require("@storybook/global");
|
|
4
|
+
/**
|
|
5
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
6
|
+
* You can add your own extra polyfills to this file.
|
|
7
|
+
*
|
|
8
|
+
* This file is divided into 2 sections:
|
|
9
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
10
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
11
|
+
* file.
|
|
12
|
+
*
|
|
13
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
14
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
15
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
16
|
+
*
|
|
17
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Required to support Web Animations `@angular/animation`.
|
|
21
|
+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
|
22
|
+
* */
|
|
23
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
24
|
+
/** *************************************************************************************************
|
|
25
|
+
* Zone JS is required by Angular itself.
|
|
26
|
+
*/
|
|
27
|
+
require("zone.js/dist/zone"); // Included with Angular CLI.
|
|
28
|
+
/** *************************************************************************************************
|
|
29
|
+
* APPLICATION IMPORTS
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Date, currency, decimal and percent pipes.
|
|
33
|
+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
34
|
+
*/
|
|
35
|
+
// import 'intl'; // Run `npm install --save intl`.
|
|
36
|
+
/**
|
|
37
|
+
* Need to import at least one locale-data with intl.
|
|
38
|
+
*/
|
|
39
|
+
// import 'intl/locale-data/jsonp/en';
|
|
40
|
+
global_1.global.STORYBOOK_ENV = 'angular';
|