@storybook/angular 7.0.0-alpha.7 → 7.0.0-beta.0
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 → client}/angular/app.component.d.ts +1 -1
- package/dist/{types/client → client}/angular/app.component.js +0 -1
- package/dist/{types/client → client}/angular/app.token.d.ts +0 -0
- package/dist/{types/client → client}/angular/app.token.js +0 -0
- package/dist/{types/client → client}/angular/helpers.d.ts +3 -3
- package/dist/{types/client → client}/angular/helpers.js +1 -2
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.d.ts +1 -1
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.js +13 -13
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.js +0 -0
- package/dist/{types/client → client}/angular-beta/ComputesTemplateFromComponent.d.ts +3 -3
- package/dist/{types/client → 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 → client}/angular-beta/DocsRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/DocsRenderer.js +5 -8
- package/dist/{types/client → client}/angular-beta/RendererFactory.d.ts +1 -1
- package/dist/{types/client → 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 → client}/angular-beta/StorybookModule.d.ts +2 -2
- package/dist/{types/client → 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 → client}/angular-beta/StorybookProvider.d.ts +1 -1
- package/dist/{types/client → client}/angular-beta/StorybookProvider.js +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookWrapperComponent.d.ts +0 -0
- package/dist/{types/client → 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 → client}/angular-beta/utils/NgComponentAnalyzer.d.ts +2 -2
- package/dist/{types/client → 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 → client}/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/{types/client → 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 → 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 → 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 → client}/globals.d.ts +0 -0
- package/dist/{types/client → client}/globals.js +0 -0
- package/dist/{types/client → client}/index.d.ts +0 -0
- package/dist/{types/client → client}/index.js +3 -0
- package/dist/client/public-api.d.ts +15 -0
- package/dist/{types/client → client}/public-api.js +2 -9
- package/dist/client/public-types.d.ts +36 -0
- package/dist/{types/client → client}/public-types.js +0 -0
- package/dist/client/render.d.ts +6 -0
- package/dist/{types/client → client}/render.js +3 -3
- package/dist/{types/client → client}/types.d.ts +9 -13
- package/dist/{types/client → client}/types.js +0 -0
- package/dist/{types/index.d.ts → index.d.ts} +0 -0
- package/dist/{types/index.js → index.js} +0 -0
- package/dist/{types/preset.d.ts → preset.d.ts} +1 -1
- package/dist/{types/preset.js → preset.js} +0 -1
- package/dist/{types/renderer.d.ts → renderer.d.ts} +0 -0
- package/dist/{types/renderer.js → renderer.js} +0 -0
- 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 +49 -54
- 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/config.d.ts +0 -6
- package/dist/types/client/config.js +0 -10
- package/dist/types/client/decorateStory.d.ts +0 -4
- package/dist/types/client/decorators.d.ts +0 -5
- package/dist/types/client/docs/config.d.ts +0 -14
- package/dist/types/client/public-api.d.ts +0 -23
- package/dist/types/client/public-types.d.ts +0 -27
- package/dist/types/client/render.d.ts +0 -7
- 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 -28
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StorybookConfig } from '@storybook/
|
|
1
|
+
import { StorybookConfig } from '@storybook/types';
|
|
2
2
|
export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
|
|
@@ -9,6 +9,6 @@ const docs_tools_1 = require("@storybook/docs-tools");
|
|
|
9
9
|
const previewAnnotations = (entry = [], options) => {
|
|
10
10
|
if (!(0, docs_tools_1.hasDocsOrControls)(options))
|
|
11
11
|
return entry;
|
|
12
|
-
return [...entry, path_1.default.join(__dirname, '
|
|
12
|
+
return [...entry, path_1.default.join(__dirname, '../../dist/client/docs/config')];
|
|
13
13
|
};
|
|
14
14
|
exports.previewAnnotations = previewAnnotations;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import
|
|
2
|
+
import { PresetOptions } from './preset-options';
|
|
3
3
|
/**
|
|
4
4
|
* Run ngcc for converting modules to ivy format before starting storybook
|
|
5
5
|
* This step is needed in order to support Ivy in storybook
|
|
@@ -39,7 +39,7 @@ const path = __importStar(require("path"));
|
|
|
39
39
|
* @returns A Promise that resolves to the dynamically imported module.
|
|
40
40
|
*/
|
|
41
41
|
function loadEsmModule(modulePath) {
|
|
42
|
-
// eslint-disable-next-line no-
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
43
43
|
return new Function('modulePath', `return import(modulePath);`)(modulePath);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -73,7 +73,9 @@ const webpack = async (webpackConfig, options) => {
|
|
|
73
73
|
if (angularOptions.enableIvy === false) {
|
|
74
74
|
return webpackConfig;
|
|
75
75
|
}
|
|
76
|
-
(
|
|
76
|
+
if (angularOptions.enableNgcc !== false) {
|
|
77
|
+
(0, exports.runNgcc)();
|
|
78
|
+
}
|
|
77
79
|
return {
|
|
78
80
|
...webpackConfig,
|
|
79
81
|
resolve: {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular's webpack plugin @angular-devkit/build-angular/src/webpack/plugins/styles-webpack-plugin.js
|
|
3
|
+
* transforms the original webpackOptions.entry point array into a structure like this:
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* {
|
|
7
|
+
* main: {
|
|
8
|
+
* import: [...]
|
|
9
|
+
* },
|
|
10
|
+
*
|
|
11
|
+
* styles: {
|
|
12
|
+
* import: [...]
|
|
13
|
+
* },
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Storybook throws an __webpack_require__.nmd is not a function error, when another runtime bundle (styles~runtime.iframe.bundle.js) is loaded.
|
|
18
|
+
* To prevent this error, we have to normalize the entry point to only generate one runtime bundle (main~runtime.iframe.bundle.js).
|
|
19
|
+
*/
|
|
20
|
+
export default class StorybookNormalizeAngularEntryPlugin {
|
|
21
|
+
constructor(options: any);
|
|
22
|
+
options: any;
|
|
23
|
+
apply(compiler: any): void;
|
|
24
|
+
compilation: any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PLUGIN_NAME = 'storybook-normalize-angular-entry-plugin';
|
|
4
|
+
/**
|
|
5
|
+
* Angular's webpack plugin @angular-devkit/build-angular/src/webpack/plugins/styles-webpack-plugin.js
|
|
6
|
+
* transforms the original webpackOptions.entry point array into a structure like this:
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* {
|
|
10
|
+
* main: {
|
|
11
|
+
* import: [...]
|
|
12
|
+
* },
|
|
13
|
+
*
|
|
14
|
+
* styles: {
|
|
15
|
+
* import: [...]
|
|
16
|
+
* },
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Storybook throws an __webpack_require__.nmd is not a function error, when another runtime bundle (styles~runtime.iframe.bundle.js) is loaded.
|
|
21
|
+
* To prevent this error, we have to normalize the entry point to only generate one runtime bundle (main~runtime.iframe.bundle.js).
|
|
22
|
+
*/
|
|
23
|
+
class StorybookNormalizeAngularEntryPlugin {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this.options = options;
|
|
26
|
+
}
|
|
27
|
+
apply(compiler) {
|
|
28
|
+
const webpackOptions = compiler.options;
|
|
29
|
+
const entry = typeof webpackOptions.entry === 'function' ? webpackOptions.entry() : webpackOptions.entry;
|
|
30
|
+
webpackOptions.entry = async () => {
|
|
31
|
+
const entryResult = await entry;
|
|
32
|
+
if (entryResult.main && entryResult.styles) {
|
|
33
|
+
return {
|
|
34
|
+
main: {
|
|
35
|
+
import: Array.from(new Set([...entryResult.main.import, ...entryResult.styles.import])),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return entry;
|
|
40
|
+
};
|
|
41
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
42
|
+
this.compilation = compilation;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = StorybookNormalizeAngularEntryPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Options as CoreOptions } from '@storybook/types';
|
|
2
2
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
3
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
4
|
-
export
|
|
4
|
+
export type PresetOptions = CoreOptions & {
|
|
5
5
|
angularBrowserTarget?: string | null;
|
|
6
6
|
angularBuilderOptions?: {
|
|
7
7
|
styles?: ExtraEntryPoint[];
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Configuration, RuleSetRule } from 'webpack';
|
|
2
2
|
export declare const filterOutStylingRules: (config: Configuration) => RuleSetRule[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Path, BaseException } from '@angular-devkit/core';
|
|
2
2
|
import { AssetPattern } from '@angular-devkit/build-angular';
|
|
3
3
|
import { AssetPatternClass } from '@angular-devkit/build-angular/src/builders/browser/schema';
|
|
4
4
|
export declare class MissingAssetSourceRootException extends BaseException {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact } from '@storybook/core-webpack';
|
|
2
|
+
import { StorybookConfigWebpack, BuilderOptions, TypescriptOptions as TypescriptOptionsBuilder } from '@storybook/builder-webpack5';
|
|
3
|
+
type FrameworkName = '@storybook/angular';
|
|
4
|
+
type BuilderName = '@storybook/builder-webpack5';
|
|
5
|
+
export type FrameworkOptions = AngularOptions & {
|
|
6
|
+
builder?: BuilderOptions;
|
|
7
|
+
};
|
|
8
|
+
type StorybookConfigFramework = {
|
|
9
|
+
framework: FrameworkName | {
|
|
10
|
+
name: FrameworkName;
|
|
11
|
+
options: FrameworkOptions;
|
|
12
|
+
};
|
|
13
|
+
core?: StorybookConfigBase['core'] & {
|
|
14
|
+
builder?: BuilderName | {
|
|
15
|
+
name: BuilderName;
|
|
16
|
+
options: BuilderOptions;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
typescript?: Partial<TypescriptOptionsBuilder & TypescriptOptionsReact> & StorybookConfigBase['typescript'];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
23
|
+
*/
|
|
24
|
+
export type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
|
|
25
|
+
export interface AngularOptions {
|
|
26
|
+
enableIvy?: boolean;
|
|
27
|
+
enableNgcc?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
File without changes
|
package/jest.config.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
4
|
+
displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
|
|
2
5
|
preset: 'jest-preset-angular',
|
|
3
6
|
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
|
|
4
|
-
transformIgnorePatterns: ['
|
|
7
|
+
transformIgnorePatterns: ['/node_modules/(?!@angular|rxjs|nanoid|uuid)'],
|
|
8
|
+
snapshotFormat: {
|
|
9
|
+
escapeString: true,
|
|
10
|
+
printBasicPrototype: true,
|
|
11
|
+
},
|
|
5
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -20,52 +20,44 @@
|
|
|
20
20
|
"url": "https://opencollective.com/storybook"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"main": "dist/
|
|
24
|
-
"
|
|
25
|
-
"types": "dist/types/index.d.ts",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
26
25
|
"files": [
|
|
27
26
|
"dist/**/*",
|
|
27
|
+
"template/**/*",
|
|
28
28
|
"README.md",
|
|
29
29
|
"*.js",
|
|
30
30
|
"*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
|
-
"
|
|
33
|
+
"check": "../../../scripts/node_modules/.bin/tsc",
|
|
34
|
+
"prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@storybook/
|
|
37
|
-
"@storybook/
|
|
38
|
-
"@storybook/
|
|
39
|
-
"@storybook/
|
|
40
|
-
"@storybook/core-
|
|
41
|
-
"@storybook/core-
|
|
42
|
-
"@storybook/core-
|
|
43
|
-
"@storybook/
|
|
44
|
-
"@storybook/
|
|
45
|
-
"@storybook/
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/react": "^16.14.23",
|
|
37
|
+
"@storybook/builder-webpack5": "7.0.0-beta.0",
|
|
38
|
+
"@storybook/client-logger": "7.0.0-beta.0",
|
|
39
|
+
"@storybook/core-client": "7.0.0-beta.0",
|
|
40
|
+
"@storybook/core-common": "7.0.0-beta.0",
|
|
41
|
+
"@storybook/core-events": "7.0.0-beta.0",
|
|
42
|
+
"@storybook/core-server": "7.0.0-beta.0",
|
|
43
|
+
"@storybook/core-webpack": "7.0.0-beta.0",
|
|
44
|
+
"@storybook/docs-tools": "7.0.0-beta.0",
|
|
45
|
+
"@storybook/manager-api": "7.0.0-beta.0",
|
|
46
|
+
"@storybook/node-logger": "7.0.0-beta.0",
|
|
47
|
+
"@storybook/preview-api": "7.0.0-beta.0",
|
|
48
|
+
"@storybook/types": "7.0.0-beta.0",
|
|
49
|
+
"@types/node": "^16.0.0",
|
|
50
|
+
"@types/react": "^16.14.34",
|
|
51
51
|
"@types/react-dom": "^16.9.14",
|
|
52
|
-
"
|
|
52
|
+
"@types/semver": "^7.3.4",
|
|
53
|
+
"@types/webpack-env": "^1.18.0",
|
|
53
54
|
"core-js": "^3.8.2",
|
|
54
55
|
"find-up": "^5.0.0",
|
|
55
|
-
"fork-ts-checker-webpack-plugin": "^7.2.6",
|
|
56
56
|
"global": "^4.4.0",
|
|
57
|
-
"nanoid": "^3.1.23",
|
|
58
|
-
"p-limit": "^3.1.0",
|
|
59
|
-
"postcss": "^7.0.36",
|
|
60
|
-
"postcss-loader": "^6.2.1",
|
|
61
|
-
"raw-loader": "^4.0.2",
|
|
62
|
-
"react": "^16.14.0",
|
|
63
|
-
"react-dom": "^16.14.0",
|
|
64
57
|
"read-pkg-up": "^7.0.1",
|
|
65
|
-
"
|
|
66
|
-
"telejson": "^
|
|
58
|
+
"semver": "^7.3.7",
|
|
59
|
+
"telejson": "^7.0.3",
|
|
67
60
|
"ts-dedent": "^2.0.0",
|
|
68
|
-
"ts-loader": "^9.2.8",
|
|
69
61
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
70
62
|
"util-deprecate": "^1.0.2",
|
|
71
63
|
"webpack": "5"
|
|
@@ -79,38 +71,41 @@
|
|
|
79
71
|
"@angular/compiler": "^13.3.6",
|
|
80
72
|
"@angular/compiler-cli": "^13.3.6",
|
|
81
73
|
"@angular/core": "^13.3.6",
|
|
82
|
-
"@angular/elements": "^13.3.6",
|
|
83
74
|
"@angular/forms": "^13.3.6",
|
|
84
75
|
"@angular/platform-browser": "^13.3.6",
|
|
85
76
|
"@angular/platform-browser-dynamic": "^13.3.6",
|
|
86
|
-
"@nrwl/workspace": "
|
|
87
|
-
"@types/
|
|
77
|
+
"@nrwl/workspace": "14.6.1",
|
|
78
|
+
"@types/rimraf": "^3.0.2",
|
|
88
79
|
"@types/tmp": "^0.2.3",
|
|
89
80
|
"cross-spawn": "^7.0.3",
|
|
90
|
-
"jest": "^
|
|
81
|
+
"jest": "^29.3.1",
|
|
91
82
|
"jest-preset-angular": "^12.0.0",
|
|
92
|
-
"jest-specific-snapshot": "^
|
|
83
|
+
"jest-specific-snapshot": "^7.0.0",
|
|
84
|
+
"rimraf": "^3.0.2",
|
|
93
85
|
"tmp": "^0.2.1",
|
|
94
|
-
"typescript": "~4.
|
|
95
|
-
"webpack": "5"
|
|
86
|
+
"typescript": "~4.9.3",
|
|
87
|
+
"webpack": "5",
|
|
88
|
+
"zone.js": "^0.12.0"
|
|
96
89
|
},
|
|
97
90
|
"peerDependencies": {
|
|
98
|
-
"@angular-devkit/architect": ">=0.
|
|
99
|
-
"@angular-devkit/build-angular": ">=
|
|
100
|
-
"@angular-devkit/core": "
|
|
101
|
-
"@angular/cli": ">=
|
|
102
|
-
"@angular/common": ">=
|
|
103
|
-
"@angular/compiler": ">=
|
|
104
|
-
"@angular/compiler-cli": ">=
|
|
105
|
-
"@angular/core": ">=
|
|
106
|
-
"@angular/forms": ">=
|
|
107
|
-
"@angular/platform-browser": ">=
|
|
108
|
-
"@angular/platform-browser-dynamic": ">=
|
|
91
|
+
"@angular-devkit/architect": ">=0.1300.0",
|
|
92
|
+
"@angular-devkit/build-angular": ">=13.0.0",
|
|
93
|
+
"@angular-devkit/core": ">=13.0.0",
|
|
94
|
+
"@angular/cli": ">=13.0.0",
|
|
95
|
+
"@angular/common": ">=13.0.0",
|
|
96
|
+
"@angular/compiler": ">=13.0.0",
|
|
97
|
+
"@angular/compiler-cli": ">=13.0.0",
|
|
98
|
+
"@angular/core": ">=13.0.0",
|
|
99
|
+
"@angular/forms": ">=13.0.0",
|
|
100
|
+
"@angular/platform-browser": ">=13.0.0",
|
|
101
|
+
"@angular/platform-browser-dynamic": ">=13.0.0",
|
|
109
102
|
"@babel/core": "*",
|
|
110
|
-
"@nrwl/workspace": "
|
|
103
|
+
"@nrwl/workspace": "14.6.1",
|
|
104
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
105
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
111
106
|
"rxjs": "^6.0.0 || ^7.4.0",
|
|
112
107
|
"typescript": "^4.0.0",
|
|
113
|
-
"zone.js": "^0.8.29 ||
|
|
108
|
+
"zone.js": "^0.8.29 || >= 0.9.0 < 1.0.0"
|
|
114
109
|
},
|
|
115
110
|
"peerDependenciesMeta": {
|
|
116
111
|
"@angular/cli": {
|
|
@@ -126,6 +121,6 @@
|
|
|
126
121
|
"publishConfig": {
|
|
127
122
|
"access": "public"
|
|
128
123
|
},
|
|
129
|
-
"builders": "dist/
|
|
130
|
-
"gitHead": "
|
|
124
|
+
"builders": "dist/builders/builders.json",
|
|
125
|
+
"gitHead": "2e4ddde6a0a291266d91fe6a5ecda767bf119e70"
|
|
131
126
|
}
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/
|
|
1
|
+
module.exports = require('./dist/preset');
|
package/renderer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/
|
|
1
|
+
export * from './dist/renderer.d';
|
package/renderer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/
|
|
1
|
+
module.exports = require('./dist/renderer');
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import Button from './button.component';
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/angular/writing-stories/introduction
|
|
5
|
+
const meta: Meta<Button> = {
|
|
6
|
+
title: 'Example/Button',
|
|
7
|
+
component: Button,
|
|
8
|
+
tags: ['docsPage'],
|
|
9
|
+
render: (args: Button) => ({
|
|
10
|
+
props: {
|
|
11
|
+
backgroundColor: null,
|
|
12
|
+
...args,
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
argTypes: {
|
|
16
|
+
backgroundColor: {
|
|
17
|
+
control: 'color',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<Button>;
|
|
24
|
+
|
|
25
|
+
// More on writing stories with args: https://storybook.js.org/docs/7.0/angular/writing-stories/args
|
|
26
|
+
export const Primary: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
primary: true,
|
|
29
|
+
label: 'Button',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Secondary: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
label: 'Button',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Large: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
size: 'large',
|
|
42
|
+
label: 'Button',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Small: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
size: 'small',
|
|
49
|
+
label: 'Button',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
import Button from './button.component';
|
|
6
|
+
import Header from './header.component';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<Header> = {
|
|
9
|
+
title: 'Example/Header',
|
|
10
|
+
component: Header,
|
|
11
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/angular/writing-docs/docs-page
|
|
12
|
+
tags: ['docsPage'],
|
|
13
|
+
render: (args) => ({ props: args }),
|
|
14
|
+
decorators: [
|
|
15
|
+
moduleMetadata({
|
|
16
|
+
declarations: [Button],
|
|
17
|
+
imports: [CommonModule],
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
parameters: {
|
|
21
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/angular/configure/story-layout
|
|
22
|
+
layout: 'fullscreen',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<Header>;
|
|
28
|
+
|
|
29
|
+
export const LoggedIn: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
user: {
|
|
32
|
+
name: 'Jane Doe',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const LoggedOut: Story = {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
3
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
import Button from './button.component';
|
|
7
|
+
import Header from './header.component';
|
|
8
|
+
import Page from './page.component';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<Page> = {
|
|
11
|
+
title: 'Example/Page',
|
|
12
|
+
component: Page,
|
|
13
|
+
parameters: {
|
|
14
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/angular/configure/story-layout
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
moduleMetadata({
|
|
19
|
+
declarations: [Button, Header],
|
|
20
|
+
imports: [CommonModule],
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<Page>;
|
|
27
|
+
|
|
28
|
+
export const LoggedOut: Story = {
|
|
29
|
+
render: (args: Page) => ({
|
|
30
|
+
props: args,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// More on interaction testing: https://storybook.js.org/docs/7.0/angular/writing-tests/interaction-testing
|
|
35
|
+
export const LoggedIn: Story = {
|
|
36
|
+
render: (args: Page) => ({
|
|
37
|
+
props: args,
|
|
38
|
+
}),
|
|
39
|
+
play: async ({ canvasElement }) => {
|
|
40
|
+
const canvas = within(canvasElement);
|
|
41
|
+
const loginButton = await canvas.getByRole('button', {
|
|
42
|
+
name: /Log in/i,
|
|
43
|
+
});
|
|
44
|
+
await userEvent.click(loginButton);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'storybook-button',
|
|
5
|
+
template: ` <button
|
|
6
|
+
type="button"
|
|
7
|
+
(click)="onClick.emit($event)"
|
|
8
|
+
[ngClass]="classes"
|
|
9
|
+
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
10
|
+
>
|
|
11
|
+
{{ label }}
|
|
12
|
+
</button>`,
|
|
13
|
+
styleUrls: ['./button.css'],
|
|
14
|
+
})
|
|
15
|
+
export default class ButtonComponent {
|
|
16
|
+
/**
|
|
17
|
+
* Is this the principal call to action on the page?
|
|
18
|
+
*/
|
|
19
|
+
@Input()
|
|
20
|
+
primary = false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What background color to use
|
|
24
|
+
*/
|
|
25
|
+
@Input()
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How large should the button be?
|
|
30
|
+
*/
|
|
31
|
+
@Input()
|
|
32
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Button contents
|
|
36
|
+
*
|
|
37
|
+
* @required
|
|
38
|
+
*/
|
|
39
|
+
@Input()
|
|
40
|
+
label = 'Button';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Optional click handler
|
|
44
|
+
*/
|
|
45
|
+
@Output()
|
|
46
|
+
onClick = new EventEmitter<Event>();
|
|
47
|
+
|
|
48
|
+
public get classes(): string[] {
|
|
49
|
+
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
50
|
+
|
|
51
|
+
return ['storybook-button', `storybook-button--${this.size}`, mode];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import type { User } from './User';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-header',
|
|
6
|
+
template: `<header>
|
|
7
|
+
<div class="wrapper">
|
|
8
|
+
<div>
|
|
9
|
+
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<g fill="none" fillRule="evenodd">
|
|
11
|
+
<path
|
|
12
|
+
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
13
|
+
fill="#FFF"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
17
|
+
fill="#555AB9"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
21
|
+
fill="#91BAF8"
|
|
22
|
+
/>
|
|
23
|
+
</g>
|
|
24
|
+
</svg>
|
|
25
|
+
<h1>Acme</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<div *ngIf="user">
|
|
29
|
+
<span class="welcome">
|
|
30
|
+
Welcome, <b>{{ user.name }}</b
|
|
31
|
+
>!
|
|
32
|
+
</span>
|
|
33
|
+
<storybook-button
|
|
34
|
+
*ngIf="user"
|
|
35
|
+
size="small"
|
|
36
|
+
(onClick)="onLogout.emit($event)"
|
|
37
|
+
label="Log out"
|
|
38
|
+
></storybook-button>
|
|
39
|
+
</div>
|
|
40
|
+
<div *ngIf="!user">
|
|
41
|
+
<storybook-button
|
|
42
|
+
*ngIf="!user"
|
|
43
|
+
size="small"
|
|
44
|
+
class="margin-left"
|
|
45
|
+
(onClick)="onLogin.emit($event)"
|
|
46
|
+
label="Log in"
|
|
47
|
+
></storybook-button>
|
|
48
|
+
<storybook-button
|
|
49
|
+
*ngIf="!user"
|
|
50
|
+
primary
|
|
51
|
+
size="small"
|
|
52
|
+
primary="true"
|
|
53
|
+
class="margin-left"
|
|
54
|
+
(onClick)="onCreateAccount.emit($event)"
|
|
55
|
+
label="Sign up"
|
|
56
|
+
></storybook-button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</header>`,
|
|
61
|
+
styleUrls: ['./header.css'],
|
|
62
|
+
})
|
|
63
|
+
export default class HeaderComponent {
|
|
64
|
+
@Input()
|
|
65
|
+
user: User | null = null;
|
|
66
|
+
|
|
67
|
+
@Output()
|
|
68
|
+
onLogin = new EventEmitter<Event>();
|
|
69
|
+
|
|
70
|
+
@Output()
|
|
71
|
+
onLogout = new EventEmitter<Event>();
|
|
72
|
+
|
|
73
|
+
@Output()
|
|
74
|
+
onCreateAccount = new EventEmitter<Event>();
|
|
75
|
+
}
|