@storybook/angular 7.0.0-alpha.6 → 7.0.0-alpha.61
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 +1 -1
- package/dist/{types/builders → builders}/build-storybook/index.d.ts +3 -3
- package/dist/{types/builders → builders}/build-storybook/index.js +0 -0
- package/dist/builders/build-storybook/index.spec.d.ts +1 -0
- package/dist/builders/build-storybook/index.spec.js +218 -0
- package/dist/{types/builders → builders}/build-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/builders.json +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.d.ts +3 -3
- package/dist/{types/builders → builders}/start-storybook/index.js +0 -0
- package/dist/builders/start-storybook/index.spec.d.ts +1 -0
- package/dist/builders/start-storybook/index.spec.js +214 -0
- package/dist/{types/builders → builders}/start-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.js +3 -6
- package/dist/{types/builders → builders}/utils/run-compodoc.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.js +0 -1
- package/dist/builders/utils/run-compodoc.spec.d.ts +1 -0
- package/dist/builders/utils/run-compodoc.spec.js +59 -0
- package/dist/{types/builders → builders}/utils/standalone-options.d.ts +3 -3
- package/dist/{types/builders → builders}/utils/standalone-options.js +0 -0
- package/dist/{types/client/preview/angular/components → client/angular}/app.component.d.ts +2 -2
- package/dist/{types/client/preview/angular/components → client/angular}/app.component.js +1 -2
- package/dist/{types/client/preview → client}/angular/app.token.d.ts +0 -0
- package/dist/{types/client/preview → client}/angular/app.token.js +0 -0
- package/dist/{types/client/preview → client}/angular/helpers.d.ts +3 -3
- package/dist/{types/client/preview → client}/angular/helpers.js +2 -3
- package/dist/{types/client/preview → client}/angular-beta/AbstractRenderer.d.ts +2 -3
- package/dist/{types/client/preview → client}/angular-beta/AbstractRenderer.js +13 -13
- package/dist/{types/client/preview → client}/angular-beta/CanvasRenderer.d.ts +1 -2
- package/dist/{types/client/preview → client}/angular-beta/CanvasRenderer.js +0 -0
- package/dist/{types/client/preview → client}/angular-beta/ComputesTemplateFromComponent.d.ts +3 -3
- package/dist/{types/client/preview → client}/angular-beta/ComputesTemplateFromComponent.js +3 -3
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +390 -0
- package/dist/{types/client/preview → client}/angular-beta/DocsRenderer.d.ts +1 -2
- package/dist/{types/client/preview → client}/angular-beta/DocsRenderer.js +5 -8
- package/dist/{types/client/preview → client}/angular-beta/RendererFactory.d.ts +1 -1
- package/dist/{types/client/preview → client}/angular-beta/RendererFactory.js +3 -3
- package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
- package/dist/client/angular-beta/RendererFactory.test.js +297 -0
- package/dist/{types/client/preview → client}/angular-beta/StorybookModule.d.ts +2 -2
- package/dist/{types/client/preview → client}/angular-beta/StorybookModule.js +4 -23
- package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
- package/dist/client/angular-beta/StorybookModule.test.js +279 -0
- package/dist/{types/client/preview → client}/angular-beta/StorybookProvider.d.ts +1 -1
- package/dist/{types/client/preview → client}/angular-beta/StorybookProvider.js +0 -0
- package/dist/{types/client/preview → client}/angular-beta/StorybookWrapperComponent.d.ts +0 -0
- package/dist/{types/client/preview → client}/angular-beta/StorybookWrapperComponent.js +0 -1
- 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/{types/client/preview → client}/angular-beta/utils/NgComponentAnalyzer.d.ts +2 -2
- package/dist/{types/client/preview → client}/angular-beta/utils/NgComponentAnalyzer.js +0 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +340 -0
- package/dist/{types/client/preview → client}/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/{types/client/preview → client}/angular-beta/utils/NgModulesAnalyzer.js +0 -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/config.d.ts +6 -0
- package/dist/client/config.js +10 -0
- package/dist/client/decorateStory.d.ts +4 -0
- package/dist/{types/client/preview → client}/decorateStory.js +3 -3
- package/dist/client/decorateStory.test.d.ts +1 -0
- package/dist/client/decorateStory.test.js +335 -0
- package/dist/client/decorators.d.ts +5 -0
- package/dist/{types/client/preview → client}/decorators.js +0 -0
- package/dist/client/decorators.test.d.ts +1 -0
- package/dist/client/decorators.test.js +106 -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 +56 -0
- package/dist/{types/client → client}/docs/compodoc.d.ts +5 -11
- package/dist/{types/client → client}/docs/compodoc.js +7 -7
- 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/{types/client → client}/docs/config.js +0 -0
- package/dist/{types/client → client}/docs/index.d.ts +0 -0
- package/dist/{types/client → client}/docs/index.js +0 -0
- package/dist/{types/client → client}/docs/sourceDecorator.d.ts +3 -3
- package/dist/{types/client → client}/docs/sourceDecorator.js +3 -3
- package/dist/{types/client → client}/docs/types.d.ts +1 -1
- package/dist/{types/client → client}/docs/types.js +0 -0
- package/dist/{types/client/preview/angular-polyfills.d.ts → client/globals.d.ts} +0 -10
- package/dist/{types/client/preview/angular-polyfills.js → client/globals.js} +7 -1
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +28 -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 +36 -0
- package/dist/{types/client/preview/types-6-0.js → client/public-types.js} +0 -0
- package/dist/client/render.d.ts +6 -0
- package/dist/{types/client/preview → client}/render.js +3 -3
- package/dist/{types/client/preview → client}/types.d.ts +17 -8
- package/dist/{types/client/preview → client}/types.js +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/{types/index.js → index.js} +1 -1
- package/dist/preset.d.ts +6 -0
- package/dist/{types/preset.js → preset.js} +12 -9
- package/dist/renderer.d.ts +4 -0
- package/dist/{types/renderer.js → renderer.js} +4 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/some-config → server/__mocks-ng-workspace__/minimal-config}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/with-angularBrowserTarget → server/__mocks-ng-workspace__/some-config}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/minimal-config → server/__mocks-ng-workspace__/with-angularBrowserTarget}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/without-projects-entry → server/__mocks-ng-workspace__/with-lib}/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/with-lib → server/__mocks-ng-workspace__/without-projects-entry}/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/server/__tests__/angular.json +96 -0
- package/dist/{types/server/angular-cli-webpack-12.2.x.d.ts → server/angular-cli-webpack.d.ts} +0 -0
- package/dist/{types/server/angular-cli-webpack-13.x.x.js → server/angular-cli-webpack.js} +6 -1
- package/dist/{types/server → server}/angular-read-workspace.d.ts +0 -0
- package/dist/{types/server → server}/angular-read-workspace.js +1 -1
- package/dist/{types/server → server}/framework-preset-angular-cli.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-cli.js +5 -24
- package/dist/server/framework-preset-angular-cli.test.d.ts +1 -0
- package/dist/server/framework-preset-angular-cli.test.js +698 -0
- package/dist/{types/server → server}/framework-preset-angular-docs.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-docs.js +1 -1
- package/dist/{types/server → server}/framework-preset-angular-ivy.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-ivy.js +4 -2
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +25 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +46 -0
- package/dist/{types/server → server}/preset-options.d.ts +2 -2
- package/dist/{types/server → server}/preset-options.js +0 -0
- package/dist/{types/server → server}/utils/filter-out-styling-rules.d.ts +1 -1
- package/dist/{types/server → server}/utils/filter-out-styling-rules.js +0 -0
- package/dist/{types/server → server}/utils/module-is-available.d.ts +0 -0
- package/dist/{types/server → server}/utils/module-is-available.js +0 -0
- package/dist/{types/server → server}/utils/normalize-asset-patterns.d.ts +1 -1
- package/dist/{types/server → server}/utils/normalize-asset-patterns.js +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.d.ts +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.js +0 -0
- package/dist/types.d.ts +29 -0
- package/dist/{types/types.js → types.js} +0 -0
- package/jest.config.js +8 -1
- package/package.json +48 -53
- package/preset.js +1 -1
- package/renderer.d.ts +1 -1
- package/renderer.js +1 -1
- 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 +53 -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 +233 -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 +42 -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-for-root.stories.ts +50 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +46 -0
- package/template/stories/button.component.ts +26 -0
- package/template/stories/core/README.stories.mdx +7 -0
- package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +117 -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/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 +22 -0
- package/template/stories/core/styles/story-styles.stories.ts +50 -0
- package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
- package/template/stories/others/ngx-translate/README.stories.mdx +58 -0
- package/LICENSE +0 -21
- package/dist/types/client/docs/config.d.ts +0 -14
- package/dist/types/client/index.d.ts +0 -4
- package/dist/types/client/index.js +0 -32
- package/dist/types/client/preview/config.d.ts +0 -6
- package/dist/types/client/preview/config.js +0 -10
- package/dist/types/client/preview/decorateStory.d.ts +0 -4
- package/dist/types/client/preview/decorators.d.ts +0 -6
- package/dist/types/client/preview/globals.d.ts +0 -1
- package/dist/types/client/preview/globals.js +0 -9
- package/dist/types/client/preview/index.d.ts +0 -25
- package/dist/types/client/preview/index.js +0 -29
- package/dist/types/client/preview/render.d.ts +0 -7
- package/dist/types/client/preview/types-6-0.d.ts +0 -42
- package/dist/types/client/preview/types-7-0.d.ts +0 -9
- package/dist/types/client/preview/types-7-0.js +0 -2
- package/dist/types/index.d.ts +0 -2
- package/dist/types/preset.d.ts +0 -13
- package/dist/types/renderer.d.ts +0 -4
- package/dist/types/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -19
- package/dist/types/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -19
- package/dist/types/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -16
- package/dist/types/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -16
- package/dist/types/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -16
- package/dist/types/server/angular-cli-webpack-12.2.x.js +0 -66
- package/dist/types/server/angular-cli-webpack-13.x.x.d.ts +0 -1
- package/dist/types/server/angular-cli-webpack-older.d.ts +0 -6
- package/dist/types/server/angular-cli-webpack-older.js +0 -111
- package/dist/types/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/types/server/angular-devkit-build-webpack.js +0 -164
- package/dist/types/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/types/server/create-fork-ts-checker-plugin.js +0 -19
- package/dist/types/server/framework-preset-angular.d.ts +0 -5
- package/dist/types/server/framework-preset-angular.js +0 -103
- package/dist/types/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/types/server/ngx-template-loader/index.js +0 -46
- package/dist/types/server/ts_config.d.ts +0 -2
- package/dist/types/server/ts_config.js +0 -28
- package/dist/types/types.d.ts +0 -13
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
+
import { AngularRenderer } from '../types';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
NODE_ENV: 'string' | 'development' | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare const renderNgApp: (storyFn: PartialStoryFn<
|
|
8
|
+
export declare const renderNgApp: (storyFn: PartialStoryFn<AngularRenderer>, forced: boolean) => void;
|
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderNgApp = void 0;
|
|
7
|
-
// @ts-ignore
|
|
8
7
|
const global_1 = __importDefault(require("global"));
|
|
9
8
|
const core_1 = require("@angular/core");
|
|
10
9
|
const forms_1 = require("@angular/forms");
|
|
11
10
|
const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
|
|
12
11
|
const platform_browser_1 = require("@angular/platform-browser");
|
|
13
12
|
const rxjs_1 = require("rxjs");
|
|
14
|
-
const app_component_1 = require("./
|
|
13
|
+
const app_component_1 = require("./app.component");
|
|
15
14
|
const app_token_1 = require("./app.token");
|
|
16
15
|
const { document } = global_1.default;
|
|
17
16
|
let platform = null;
|
|
@@ -111,7 +110,7 @@ const initModule = (storyFn) => {
|
|
|
111
110
|
};
|
|
112
111
|
return getModule(componentDeclarations, [AnnotatedComponent], [app_component_1.AppComponent], story, moduleMetadata);
|
|
113
112
|
};
|
|
114
|
-
const staticRoot = document.getElementById('root');
|
|
113
|
+
const staticRoot = document.getElementById('storybook-root');
|
|
115
114
|
const insertDynamicRoot = () => {
|
|
116
115
|
const app = document.createElement('storybook-dynamic-app-root');
|
|
117
116
|
staticRoot.innerHTML = '';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
|
-
import { ICollection, StoryFnAngularReturnType } from '../types';
|
|
3
|
-
|
|
4
|
-
declare type StoryRenderInfo = {
|
|
2
|
+
import { ICollection, StoryFnAngularReturnType, Parameters } from '../types';
|
|
3
|
+
type StoryRenderInfo = {
|
|
5
4
|
storyFnAngular: StoryFnAngularReturnType;
|
|
6
5
|
moduleMetadataSnapshot: string;
|
|
7
6
|
};
|
|
@@ -39,19 +39,6 @@ function getPlatform(newPlatform) {
|
|
|
39
39
|
return platformRef;
|
|
40
40
|
}
|
|
41
41
|
class AbstractRenderer {
|
|
42
|
-
constructor(storyId) {
|
|
43
|
-
this.storyId = storyId;
|
|
44
|
-
if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
|
|
45
|
-
try {
|
|
46
|
-
// platform should be set after enableProdMode()
|
|
47
|
-
(0, core_1.enableProdMode)();
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
// eslint-disable-next-line no-console
|
|
51
|
-
console.debug(e);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
42
|
/**
|
|
56
43
|
* Wait and destroy the platform
|
|
57
44
|
*/
|
|
@@ -71,6 +58,19 @@ class AbstractRenderer {
|
|
|
71
58
|
getPlatform(true);
|
|
72
59
|
});
|
|
73
60
|
}
|
|
61
|
+
constructor(storyId) {
|
|
62
|
+
this.storyId = storyId;
|
|
63
|
+
if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
|
|
64
|
+
try {
|
|
65
|
+
// platform should be set after enableProdMode()
|
|
66
|
+
(0, core_1.enableProdMode)();
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.debug(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
74
|
/**
|
|
75
75
|
* Bootstrap main angular module with main component or send only new `props` with storyProps$
|
|
76
76
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AbstractRenderer } from './AbstractRenderer';
|
|
2
|
-
import { StoryFnAngularReturnType } from '../types';
|
|
3
|
-
import { Parameters } from '../types-6-0';
|
|
2
|
+
import { StoryFnAngularReturnType, Parameters } from '../types';
|
|
4
3
|
export declare class CanvasRenderer extends AbstractRenderer {
|
|
5
4
|
render(options: {
|
|
6
5
|
storyFnAngular: StoryFnAngularReturnType;
|
|
File without changes
|
package/dist/{types/client/preview → client}/angular-beta/ComputesTemplateFromComponent.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { ArgTypes } from '@storybook/types';
|
|
3
|
+
import { ICollection } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Converts a component into a template with inputs/outputs present in initial props
|
|
6
6
|
* @param component
|
|
@@ -37,9 +37,9 @@ const computesTemplateFromComponent = (component, initialProps, innerTemplate =
|
|
|
37
37
|
};
|
|
38
38
|
exports.computesTemplateFromComponent = computesTemplateFromComponent;
|
|
39
39
|
const createAngularInputProperty = ({ propertyName, value, argType, }) => {
|
|
40
|
-
const { name: type = null
|
|
41
|
-
let templateValue = type === 'enum' &&
|
|
42
|
-
const actualType = type === 'enum' &&
|
|
40
|
+
const { name: type = null } = (typeof argType?.type === 'object' && argType?.type) || {};
|
|
41
|
+
let templateValue = type === 'enum' && value;
|
|
42
|
+
const actualType = type === 'enum' && typeof value;
|
|
43
43
|
const requiresBrackets = ['object', 'any', 'boolean', 'enum', 'number'].includes(actualType);
|
|
44
44
|
if (typeof value === 'object') {
|
|
45
45
|
templateValue = propertyName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const core_1 = require("@angular/core");
|
|
10
|
+
const ComputesTemplateFromComponent_1 = require("./ComputesTemplateFromComponent");
|
|
11
|
+
const input_component_1 = require("./__testfixtures__/input.component");
|
|
12
|
+
describe('angular source decorator', () => {
|
|
13
|
+
it('With no props should generate simple tag', () => {
|
|
14
|
+
const component = input_component_1.InputComponent;
|
|
15
|
+
const props = {};
|
|
16
|
+
const argTypes = {};
|
|
17
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
18
|
+
expect(source).toEqual('<doc-button></doc-button>');
|
|
19
|
+
});
|
|
20
|
+
describe('with component without selector', () => {
|
|
21
|
+
let WithoutSelectorComponent = class WithoutSelectorComponent {
|
|
22
|
+
};
|
|
23
|
+
WithoutSelectorComponent = __decorate([
|
|
24
|
+
(0, core_1.Component)({
|
|
25
|
+
template: `The content`,
|
|
26
|
+
})
|
|
27
|
+
], WithoutSelectorComponent);
|
|
28
|
+
it('should add component ng-container', async () => {
|
|
29
|
+
const component = WithoutSelectorComponent;
|
|
30
|
+
const props = {};
|
|
31
|
+
const argTypes = {};
|
|
32
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
33
|
+
expect(source).toEqual(`<ng-container *ngComponentOutlet="WithoutSelectorComponent"></ng-container>`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe('with component with attribute selector', () => {
|
|
37
|
+
let WithAttributeComponent = class WithAttributeComponent {
|
|
38
|
+
};
|
|
39
|
+
WithAttributeComponent = __decorate([
|
|
40
|
+
(0, core_1.Component)({
|
|
41
|
+
selector: 'doc-button[foo]',
|
|
42
|
+
template: '<button></button>',
|
|
43
|
+
})
|
|
44
|
+
], WithAttributeComponent);
|
|
45
|
+
it('should add attribute to template', async () => {
|
|
46
|
+
const component = WithAttributeComponent;
|
|
47
|
+
const props = {};
|
|
48
|
+
const argTypes = {};
|
|
49
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
50
|
+
expect(source).toEqual(`<doc-button foo></doc-button>`);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('with component with attribute and value selector', () => {
|
|
54
|
+
let WithAttributeValueComponent = class WithAttributeValueComponent {
|
|
55
|
+
};
|
|
56
|
+
WithAttributeValueComponent = __decorate([
|
|
57
|
+
(0, core_1.Component)({
|
|
58
|
+
selector: 'doc-button[foo="bar"]',
|
|
59
|
+
template: '<button></button>',
|
|
60
|
+
})
|
|
61
|
+
], WithAttributeValueComponent);
|
|
62
|
+
it('should add attribute to template', async () => {
|
|
63
|
+
const component = WithAttributeValueComponent;
|
|
64
|
+
const props = {};
|
|
65
|
+
const argTypes = {};
|
|
66
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
67
|
+
expect(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('with component with attribute only selector', () => {
|
|
71
|
+
let WithAttributeOnlyComponent = class WithAttributeOnlyComponent {
|
|
72
|
+
};
|
|
73
|
+
WithAttributeOnlyComponent = __decorate([
|
|
74
|
+
(0, core_1.Component)({
|
|
75
|
+
selector: '[foo]',
|
|
76
|
+
template: '<button></button>',
|
|
77
|
+
})
|
|
78
|
+
], WithAttributeOnlyComponent);
|
|
79
|
+
it('should create a div and add attribute to template', async () => {
|
|
80
|
+
const component = WithAttributeOnlyComponent;
|
|
81
|
+
const props = {};
|
|
82
|
+
const argTypes = {};
|
|
83
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
84
|
+
expect(source).toEqual(`<div foo></div>`);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe('with component with void element and attribute selector', () => {
|
|
88
|
+
let VoidElementWithAttributeComponent = class VoidElementWithAttributeComponent {
|
|
89
|
+
};
|
|
90
|
+
VoidElementWithAttributeComponent = __decorate([
|
|
91
|
+
(0, core_1.Component)({
|
|
92
|
+
selector: 'input[foo]',
|
|
93
|
+
template: '<button></button>',
|
|
94
|
+
})
|
|
95
|
+
], VoidElementWithAttributeComponent);
|
|
96
|
+
it('should create without separate closing tag', async () => {
|
|
97
|
+
const component = VoidElementWithAttributeComponent;
|
|
98
|
+
const props = {};
|
|
99
|
+
const argTypes = {};
|
|
100
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
101
|
+
expect(source).toEqual(`<input foo />`);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('with component with attribute and value only selector', () => {
|
|
105
|
+
let WithAttributeOnlyComponent = class WithAttributeOnlyComponent {
|
|
106
|
+
};
|
|
107
|
+
WithAttributeOnlyComponent = __decorate([
|
|
108
|
+
(0, core_1.Component)({
|
|
109
|
+
selector: '[foo="bar"]',
|
|
110
|
+
template: '<button></button>',
|
|
111
|
+
})
|
|
112
|
+
], WithAttributeOnlyComponent);
|
|
113
|
+
it('should create a div and add attribute to template', async () => {
|
|
114
|
+
const component = WithAttributeOnlyComponent;
|
|
115
|
+
const props = {};
|
|
116
|
+
const argTypes = {};
|
|
117
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
118
|
+
expect(source).toEqual(`<div foo="bar"></div>`);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
describe('with component with void element, attribute and value only selector', () => {
|
|
122
|
+
let VoidElementWithAttributeComponent = class VoidElementWithAttributeComponent {
|
|
123
|
+
};
|
|
124
|
+
VoidElementWithAttributeComponent = __decorate([
|
|
125
|
+
(0, core_1.Component)({
|
|
126
|
+
selector: 'input[foo="bar"]',
|
|
127
|
+
template: '<button></button>',
|
|
128
|
+
})
|
|
129
|
+
], VoidElementWithAttributeComponent);
|
|
130
|
+
it('should create and add attribute to template without separate closing tag', async () => {
|
|
131
|
+
const component = VoidElementWithAttributeComponent;
|
|
132
|
+
const props = {};
|
|
133
|
+
const argTypes = {};
|
|
134
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
135
|
+
expect(source).toEqual(`<input foo="bar" />`);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
describe('with component with class selector', () => {
|
|
139
|
+
let WithClassComponent = class WithClassComponent {
|
|
140
|
+
};
|
|
141
|
+
WithClassComponent = __decorate([
|
|
142
|
+
(0, core_1.Component)({
|
|
143
|
+
selector: 'doc-button.foo',
|
|
144
|
+
template: '<button></button>',
|
|
145
|
+
})
|
|
146
|
+
], WithClassComponent);
|
|
147
|
+
it('should add class to template', async () => {
|
|
148
|
+
const component = WithClassComponent;
|
|
149
|
+
const props = {};
|
|
150
|
+
const argTypes = {};
|
|
151
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
152
|
+
expect(source).toEqual(`<doc-button class="foo"></doc-button>`);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('with component with class only selector', () => {
|
|
156
|
+
let WithClassComponent = class WithClassComponent {
|
|
157
|
+
};
|
|
158
|
+
WithClassComponent = __decorate([
|
|
159
|
+
(0, core_1.Component)({
|
|
160
|
+
selector: '.foo',
|
|
161
|
+
template: '<button></button>',
|
|
162
|
+
})
|
|
163
|
+
], WithClassComponent);
|
|
164
|
+
it('should create a div and add attribute to template', async () => {
|
|
165
|
+
const component = WithClassComponent;
|
|
166
|
+
const props = {};
|
|
167
|
+
const argTypes = {};
|
|
168
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
169
|
+
expect(source).toEqual(`<div class="foo"></div>`);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
describe('with component with multiple selectors', () => {
|
|
173
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
174
|
+
};
|
|
175
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
176
|
+
(0, core_1.Component)({
|
|
177
|
+
selector: 'doc-button, doc-button2',
|
|
178
|
+
template: '<button></button>',
|
|
179
|
+
})
|
|
180
|
+
], WithMultipleSelectorsComponent);
|
|
181
|
+
it('should use the first selector', async () => {
|
|
182
|
+
const component = WithMultipleSelectorsComponent;
|
|
183
|
+
const props = {};
|
|
184
|
+
const argTypes = {};
|
|
185
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
186
|
+
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
describe('with component with multiple selectors starting with attribute', () => {
|
|
190
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
191
|
+
};
|
|
192
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
193
|
+
(0, core_1.Component)({
|
|
194
|
+
selector: 'doc-button[foo], doc-button2',
|
|
195
|
+
template: '<button></button>',
|
|
196
|
+
})
|
|
197
|
+
], WithMultipleSelectorsComponent);
|
|
198
|
+
it('should use the first selector', async () => {
|
|
199
|
+
const component = WithMultipleSelectorsComponent;
|
|
200
|
+
const props = {};
|
|
201
|
+
const argTypes = {};
|
|
202
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
203
|
+
expect(source).toEqual(`<doc-button foo></doc-button>`);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe('with component with multiple selectors starting with attribute and value', () => {
|
|
207
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
208
|
+
};
|
|
209
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
210
|
+
(0, core_1.Component)({
|
|
211
|
+
selector: 'doc-button[foo="bar"], doc-button2',
|
|
212
|
+
template: '<button></button>',
|
|
213
|
+
})
|
|
214
|
+
], WithMultipleSelectorsComponent);
|
|
215
|
+
it('should use the first selector', async () => {
|
|
216
|
+
const component = WithMultipleSelectorsComponent;
|
|
217
|
+
const props = {};
|
|
218
|
+
const argTypes = {};
|
|
219
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
220
|
+
expect(source).toEqual(`<doc-button foo="bar"></doc-button>`);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
describe('with component with multiple selectors including 2 attributes and a class', () => {
|
|
224
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
225
|
+
};
|
|
226
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
227
|
+
(0, core_1.Component)({
|
|
228
|
+
selector: 'doc-button, button[foo], .button[foo], button[baz]',
|
|
229
|
+
template: '<button></button>',
|
|
230
|
+
})
|
|
231
|
+
], WithMultipleSelectorsComponent);
|
|
232
|
+
it('should use the first selector', async () => {
|
|
233
|
+
const component = WithMultipleSelectorsComponent;
|
|
234
|
+
const props = {};
|
|
235
|
+
const argTypes = {};
|
|
236
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
237
|
+
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
describe('with component with multiple selectors with line breaks', () => {
|
|
241
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
242
|
+
};
|
|
243
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
244
|
+
(0, core_1.Component)({
|
|
245
|
+
selector: `doc-button,
|
|
246
|
+
doc-button2`,
|
|
247
|
+
template: '<button></button>',
|
|
248
|
+
})
|
|
249
|
+
], WithMultipleSelectorsComponent);
|
|
250
|
+
it('should use the first selector', async () => {
|
|
251
|
+
const component = WithMultipleSelectorsComponent;
|
|
252
|
+
const props = {};
|
|
253
|
+
const argTypes = {};
|
|
254
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
255
|
+
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
describe('with component with multiple selectors starting with attribute only with line breaks', () => {
|
|
259
|
+
let WithMultipleSelectorsComponent = class WithMultipleSelectorsComponent {
|
|
260
|
+
};
|
|
261
|
+
WithMultipleSelectorsComponent = __decorate([
|
|
262
|
+
(0, core_1.Component)({
|
|
263
|
+
selector: `[foo],
|
|
264
|
+
doc-button2`,
|
|
265
|
+
template: '<button></button>',
|
|
266
|
+
})
|
|
267
|
+
], WithMultipleSelectorsComponent);
|
|
268
|
+
it('should use the first selector', async () => {
|
|
269
|
+
const component = WithMultipleSelectorsComponent;
|
|
270
|
+
const props = {};
|
|
271
|
+
const argTypes = {};
|
|
272
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
273
|
+
expect(source).toEqual(`<div foo></div>`);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
describe('no argTypes', () => {
|
|
277
|
+
it('should generate tag-only template with no props', () => {
|
|
278
|
+
const component = input_component_1.InputComponent;
|
|
279
|
+
const props = {};
|
|
280
|
+
const argTypes = {};
|
|
281
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
282
|
+
expect(source).toEqual(`<doc-button></doc-button>`);
|
|
283
|
+
});
|
|
284
|
+
it('With props should generate tag with properties', () => {
|
|
285
|
+
const component = input_component_1.InputComponent;
|
|
286
|
+
const props = {
|
|
287
|
+
isDisabled: true,
|
|
288
|
+
label: 'Hello world',
|
|
289
|
+
accent: input_component_1.ButtonAccent.High,
|
|
290
|
+
counter: 4,
|
|
291
|
+
};
|
|
292
|
+
const argTypes = {};
|
|
293
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
294
|
+
expect(source).toEqual(`<doc-button [counter]="4" accent="High" [isDisabled]="true" label="Hello world"></doc-button>`);
|
|
295
|
+
});
|
|
296
|
+
it('With props should generate tag with outputs', () => {
|
|
297
|
+
const component = input_component_1.InputComponent;
|
|
298
|
+
const props = {
|
|
299
|
+
isDisabled: true,
|
|
300
|
+
label: 'Hello world',
|
|
301
|
+
onClick: ($event) => { },
|
|
302
|
+
};
|
|
303
|
+
const argTypes = {};
|
|
304
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
305
|
+
expect(source).toEqual(`<doc-button [isDisabled]="true" label="Hello world" (onClick)="onClick($event)"></doc-button>`);
|
|
306
|
+
});
|
|
307
|
+
it('should generate correct property for overridden name for Input', () => {
|
|
308
|
+
const component = input_component_1.InputComponent;
|
|
309
|
+
const props = {
|
|
310
|
+
color: '#ffffff',
|
|
311
|
+
};
|
|
312
|
+
const argTypes = {};
|
|
313
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
314
|
+
expect(source).toEqual(`<doc-button color="#ffffff"></doc-button>`);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
describe('with argTypes (from compodoc)', () => {
|
|
318
|
+
it('Should handle enum as strongly typed enum', () => {
|
|
319
|
+
const component = input_component_1.InputComponent;
|
|
320
|
+
const props = {
|
|
321
|
+
isDisabled: false,
|
|
322
|
+
label: 'Hello world',
|
|
323
|
+
accent: input_component_1.ButtonAccent.High,
|
|
324
|
+
};
|
|
325
|
+
const argTypes = {
|
|
326
|
+
accent: {
|
|
327
|
+
control: {
|
|
328
|
+
options: ['Normal', 'High'],
|
|
329
|
+
type: 'radio',
|
|
330
|
+
},
|
|
331
|
+
defaultValue: undefined,
|
|
332
|
+
table: {
|
|
333
|
+
category: 'inputs',
|
|
334
|
+
},
|
|
335
|
+
type: {
|
|
336
|
+
name: 'enum',
|
|
337
|
+
required: true,
|
|
338
|
+
value: [],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
343
|
+
expect(source).toEqual(`<doc-button [accent]="ButtonAccent.High" [isDisabled]="false" label="Hello world"></doc-button>`);
|
|
344
|
+
});
|
|
345
|
+
it('Should handle enum without values as string', () => {
|
|
346
|
+
const component = input_component_1.InputComponent;
|
|
347
|
+
const props = {
|
|
348
|
+
isDisabled: false,
|
|
349
|
+
label: 'Hello world',
|
|
350
|
+
accent: input_component_1.ButtonAccent.High,
|
|
351
|
+
};
|
|
352
|
+
const argTypes = {
|
|
353
|
+
accent: {
|
|
354
|
+
control: {
|
|
355
|
+
options: ['Normal', 'High'],
|
|
356
|
+
type: 'radio',
|
|
357
|
+
},
|
|
358
|
+
defaultValue: undefined,
|
|
359
|
+
table: {
|
|
360
|
+
category: 'inputs',
|
|
361
|
+
},
|
|
362
|
+
type: {
|
|
363
|
+
name: 'object',
|
|
364
|
+
required: true,
|
|
365
|
+
value: {},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
370
|
+
expect(source).toEqual(`<doc-button accent="High" [isDisabled]="false" label="Hello world"></doc-button>`);
|
|
371
|
+
});
|
|
372
|
+
it('Should handle objects correctly', () => {
|
|
373
|
+
const component = input_component_1.InputComponent;
|
|
374
|
+
const someDataObject = {
|
|
375
|
+
one: 'Hello world',
|
|
376
|
+
two: true,
|
|
377
|
+
three: ['One', 'Two', 'Three'],
|
|
378
|
+
};
|
|
379
|
+
const props = {
|
|
380
|
+
isDisabled: false,
|
|
381
|
+
label: 'Hello world',
|
|
382
|
+
someDataObject,
|
|
383
|
+
};
|
|
384
|
+
const source = (0, ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent)(component, props, null);
|
|
385
|
+
// Ideally we should stringify the object, but that could cause the story to break because of unescaped values in the JSON object.
|
|
386
|
+
// This will have to do for now
|
|
387
|
+
expect(source).toEqual(`<doc-button [isDisabled]="false" label="Hello world" [someDataObject]="someDataObject"></doc-button>`);
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AbstractRenderer } from './AbstractRenderer';
|
|
2
|
-
import { StoryFnAngularReturnType } from '../types';
|
|
3
|
-
import { Parameters } from '../types-6-0';
|
|
2
|
+
import { StoryFnAngularReturnType, Parameters } from '../types';
|
|
4
3
|
export declare class DocsRenderer extends AbstractRenderer {
|
|
5
4
|
render(options: {
|
|
6
5
|
storyFnAngular: StoryFnAngularReturnType;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DocsRenderer = void 0;
|
|
7
|
-
const
|
|
8
|
-
const core_events_1 =
|
|
4
|
+
const preview_api_1 = require("@storybook/preview-api");
|
|
5
|
+
const core_events_1 = require("@storybook/core-events");
|
|
9
6
|
const AbstractRenderer_1 = require("./AbstractRenderer");
|
|
10
7
|
class DocsRenderer extends AbstractRenderer_1.AbstractRenderer {
|
|
11
8
|
async render(options) {
|
|
12
|
-
const channel =
|
|
9
|
+
const channel = preview_api_1.addons.getChannel();
|
|
13
10
|
/**
|
|
14
11
|
* Destroy and recreate the PlatformBrowserDynamic of angular
|
|
15
12
|
* For several stories to be rendered in the same docs we should
|
|
@@ -20,7 +17,7 @@ class DocsRenderer extends AbstractRenderer_1.AbstractRenderer {
|
|
|
20
17
|
* rendered in the doc. But one event could be enough for the whole docs
|
|
21
18
|
*
|
|
22
19
|
*/
|
|
23
|
-
channel.once(core_events_1.
|
|
20
|
+
channel.once(core_events_1.STORY_CHANGED, async () => {
|
|
24
21
|
await DocsRenderer.resetPlatformBrowserDynamic();
|
|
25
22
|
});
|
|
26
23
|
/**
|
|
@@ -28,7 +25,7 @@ class DocsRenderer extends AbstractRenderer_1.AbstractRenderer {
|
|
|
28
25
|
* when doc re render. Allows to call ngOnDestroy of angular
|
|
29
26
|
* for previous component
|
|
30
27
|
*/
|
|
31
|
-
channel.once(core_events_1.
|
|
28
|
+
channel.once(core_events_1.DOCS_RENDERED, async () => {
|
|
32
29
|
await DocsRenderer.resetPlatformBrowserDynamic();
|
|
33
30
|
});
|
|
34
31
|
await super.render({ ...options, forced: false });
|
|
@@ -37,16 +37,16 @@ class RendererFactory {
|
|
|
37
37
|
}
|
|
38
38
|
exports.RendererFactory = RendererFactory;
|
|
39
39
|
const getRenderType = (targetDOMNode) => {
|
|
40
|
-
return targetDOMNode.id === 'root' ? 'canvas' : 'docs';
|
|
40
|
+
return targetDOMNode.id === 'storybook-root' ? 'canvas' : 'docs';
|
|
41
41
|
};
|
|
42
42
|
exports.getRenderType = getRenderType;
|
|
43
43
|
function clearRootHTMLElement(renderType) {
|
|
44
44
|
switch (renderType) {
|
|
45
45
|
case 'canvas':
|
|
46
|
-
global.document.getElementById('docs
|
|
46
|
+
global.document.getElementById('storybook-docs').innerHTML = '';
|
|
47
47
|
break;
|
|
48
48
|
case 'docs':
|
|
49
|
-
global.document.getElementById('root').innerHTML = '';
|
|
49
|
+
global.document.getElementById('storybook-root').innerHTML = '';
|
|
50
50
|
break;
|
|
51
51
|
default:
|
|
52
52
|
break;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|