@storybook/angular 7.0.0-alpha.5 → 7.0.0-alpha.50
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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -2
- package/dist/{types/client/preview → client}/angular-beta/AbstractRenderer.js +0 -0
- 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 +4 -4
- package/dist/{types/client/preview → client}/angular-beta/ComputesTemplateFromComponent.js +0 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +389 -0
- package/dist/{types/client/preview → client}/angular-beta/DocsRenderer.d.ts +1 -2
- package/dist/{types/client/preview → client}/angular-beta/DocsRenderer.js +3 -6
- package/dist/{types/client/preview → client}/angular-beta/RendererFactory.d.ts +0 -0
- 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 +1 -1
- 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 +1 -1
- 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 +4 -4
- package/dist/{types/client → client}/docs/compodoc.js +2 -3
- 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 +0 -0
- package/dist/{types/client → client}/docs/types.d.ts +0 -0
- 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/client/types.d.ts +38 -0
- 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 → server}/angular-cli-webpack-13.x.x.d.ts +0 -0
- package/dist/{types/server → server}/angular-cli-webpack-13.x.x.js +0 -0
- 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 +3 -22
- package/dist/server/framework-preset-angular-cli.test.d.ts +1 -0
- package/dist/server/framework-preset-angular-cli.test.js +708 -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/{types/server → server}/preset-options.d.ts +1 -1
- 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 +44 -48
- 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 +54 -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/client/preview/types.d.ts +0 -29
- 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.d.ts +0 -1
- package/dist/types/server/angular-cli-webpack-12.2.x.js +0 -66
- 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,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: {
|
|
@@ -1,4 +1,4 @@
|
|
|
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
4
|
export declare type PresetOptions = CoreOptions & {
|
|
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
|
+
declare type FrameworkName = '@storybook/angular';
|
|
4
|
+
declare type BuilderName = '@storybook/builder-webpack5';
|
|
5
|
+
export declare type FrameworkOptions = AngularOptions & {
|
|
6
|
+
builder?: BuilderOptions;
|
|
7
|
+
};
|
|
8
|
+
declare 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 declare 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-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.50",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -20,52 +20,47 @@
|
|
|
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/addons": "7.0.0-alpha.
|
|
37
|
-
"@storybook/api": "7.0.0-alpha.
|
|
38
|
-
"@storybook/builder-webpack5": "7.0.0-alpha.
|
|
39
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
40
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
41
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
42
|
-
"@storybook/core-events": "7.0.0-alpha.
|
|
43
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
44
|
-
"@storybook/
|
|
45
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
46
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@storybook/
|
|
49
|
-
"@types/node": "^
|
|
37
|
+
"@storybook/addons": "7.0.0-alpha.50",
|
|
38
|
+
"@storybook/api": "7.0.0-alpha.50",
|
|
39
|
+
"@storybook/builder-webpack5": "7.0.0-alpha.50",
|
|
40
|
+
"@storybook/client-logger": "7.0.0-alpha.50",
|
|
41
|
+
"@storybook/core-client": "7.0.0-alpha.50",
|
|
42
|
+
"@storybook/core-common": "7.0.0-alpha.50",
|
|
43
|
+
"@storybook/core-events": "7.0.0-alpha.50",
|
|
44
|
+
"@storybook/core-server": "7.0.0-alpha.50",
|
|
45
|
+
"@storybook/core-webpack": "7.0.0-alpha.50",
|
|
46
|
+
"@storybook/docs-tools": "7.0.0-alpha.50",
|
|
47
|
+
"@storybook/node-logger": "7.0.0-alpha.50",
|
|
48
|
+
"@storybook/store": "7.0.0-alpha.50",
|
|
49
|
+
"@storybook/types": "7.0.0-alpha.50",
|
|
50
|
+
"@types/node": "^16.0.0",
|
|
50
51
|
"@types/react": "^16.14.23",
|
|
51
52
|
"@types/react-dom": "^16.9.14",
|
|
52
|
-
"
|
|
53
|
+
"@types/semver": "^7.3.4",
|
|
54
|
+
"@types/webpack-env": "^1.18.0",
|
|
53
55
|
"core-js": "^3.8.2",
|
|
54
56
|
"find-up": "^5.0.0",
|
|
55
|
-
"fork-ts-checker-webpack-plugin": "^7.2.6",
|
|
56
57
|
"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
58
|
"react": "^16.14.0",
|
|
63
59
|
"react-dom": "^16.14.0",
|
|
64
60
|
"read-pkg-up": "^7.0.1",
|
|
65
|
-
"
|
|
61
|
+
"semver": "^7.3.7",
|
|
66
62
|
"telejson": "^6.0.8",
|
|
67
63
|
"ts-dedent": "^2.0.0",
|
|
68
|
-
"ts-loader": "^9.2.8",
|
|
69
64
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
70
65
|
"util-deprecate": "^1.0.2",
|
|
71
66
|
"webpack": "5"
|
|
@@ -79,35 +74,36 @@
|
|
|
79
74
|
"@angular/compiler": "^13.3.6",
|
|
80
75
|
"@angular/compiler-cli": "^13.3.6",
|
|
81
76
|
"@angular/core": "^13.3.6",
|
|
82
|
-
"@angular/elements": "^13.3.6",
|
|
83
77
|
"@angular/forms": "^13.3.6",
|
|
84
78
|
"@angular/platform-browser": "^13.3.6",
|
|
85
79
|
"@angular/platform-browser-dynamic": "^13.3.6",
|
|
86
|
-
"@nrwl/workspace": "
|
|
87
|
-
"@types/
|
|
80
|
+
"@nrwl/workspace": "14.6.1",
|
|
81
|
+
"@types/rimraf": "^3.0.2",
|
|
88
82
|
"@types/tmp": "^0.2.3",
|
|
89
83
|
"cross-spawn": "^7.0.3",
|
|
90
|
-
"jest": "^
|
|
84
|
+
"jest": "^28.0.0",
|
|
91
85
|
"jest-preset-angular": "^12.0.0",
|
|
92
|
-
"jest-specific-snapshot": "^
|
|
86
|
+
"jest-specific-snapshot": "^6.0.0",
|
|
87
|
+
"rimraf": "^3.0.2",
|
|
93
88
|
"tmp": "^0.2.1",
|
|
94
89
|
"typescript": "~4.6.3",
|
|
95
|
-
"webpack": "5"
|
|
90
|
+
"webpack": "5",
|
|
91
|
+
"zone.js": "^0.11.0"
|
|
96
92
|
},
|
|
97
93
|
"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": ">=
|
|
94
|
+
"@angular-devkit/architect": ">=0.1300.0",
|
|
95
|
+
"@angular-devkit/build-angular": ">=13.0.0",
|
|
96
|
+
"@angular-devkit/core": ">=13.0.0",
|
|
97
|
+
"@angular/cli": ">=13.0.0",
|
|
98
|
+
"@angular/common": ">=13.0.0",
|
|
99
|
+
"@angular/compiler": ">=13.0.0",
|
|
100
|
+
"@angular/compiler-cli": ">=13.0.0",
|
|
101
|
+
"@angular/core": ">=13.0.0",
|
|
102
|
+
"@angular/forms": ">=13.0.0",
|
|
103
|
+
"@angular/platform-browser": ">=13.0.0",
|
|
104
|
+
"@angular/platform-browser-dynamic": ">=13.0.0",
|
|
109
105
|
"@babel/core": "*",
|
|
110
|
-
"@nrwl/workspace": "
|
|
106
|
+
"@nrwl/workspace": "14.6.1",
|
|
111
107
|
"rxjs": "^6.0.0 || ^7.4.0",
|
|
112
108
|
"typescript": "^4.0.0",
|
|
113
109
|
"zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0"
|
|
@@ -126,6 +122,6 @@
|
|
|
126
122
|
"publishConfig": {
|
|
127
123
|
"access": "public"
|
|
128
124
|
},
|
|
129
|
-
"builders": "dist/
|
|
130
|
-
"gitHead": "
|
|
125
|
+
"builders": "dist/builders/builders.json",
|
|
126
|
+
"gitHead": "77184d039091f4782dc4540df6d271a24fb3e242"
|
|
131
127
|
}
|
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,54 @@
|
|
|
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/angular/writing-stories/introduction#default-export
|
|
5
|
+
const meta: Meta<Button> = {
|
|
6
|
+
title: 'Example/Button',
|
|
7
|
+
component: Button,
|
|
8
|
+
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/angular/writing-docs/docs-page
|
|
9
|
+
tags: ['docsPage'],
|
|
10
|
+
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
11
|
+
render: (args: Button) => ({
|
|
12
|
+
props: {
|
|
13
|
+
backgroundColor: null,
|
|
14
|
+
...args,
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
// More on argTypes: https://storybook.js.org/docs/angular/api/argtypes
|
|
18
|
+
argTypes: {
|
|
19
|
+
backgroundColor: {
|
|
20
|
+
control: 'color',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<Button>;
|
|
27
|
+
|
|
28
|
+
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
29
|
+
export const Primary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
primary: true,
|
|
32
|
+
label: 'Button',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Secondary: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: 'Button',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Large: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
size: 'large',
|
|
45
|
+
label: 'Button',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Small: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
size: 'small',
|
|
52
|
+
label: 'Button',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -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/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 Story layout: https://storybook.js.org/docs/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 StoryFn layout: https://storybook.js.org/docs/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/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
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import type { User } from './User';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-page',
|
|
6
|
+
template: `<article>
|
|
7
|
+
<storybook-header
|
|
8
|
+
[user]="user"
|
|
9
|
+
(onLogout)="doLogout()"
|
|
10
|
+
(onLogin)="doLogin()"
|
|
11
|
+
(onCreateAccount)="doCreateAccount()"
|
|
12
|
+
></storybook-header>
|
|
13
|
+
<section>
|
|
14
|
+
<h2>Pages in Storybook</h2>
|
|
15
|
+
<p>
|
|
16
|
+
We recommend building UIs with a
|
|
17
|
+
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
18
|
+
<strong>component-driven</strong>
|
|
19
|
+
</a>
|
|
20
|
+
process starting with atomic components and ending with pages.
|
|
21
|
+
</p>
|
|
22
|
+
<p>
|
|
23
|
+
Render pages with mock data. This makes it easy to build and review page states without
|
|
24
|
+
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
25
|
+
in Storybook:
|
|
26
|
+
</p>
|
|
27
|
+
<ul>
|
|
28
|
+
<li>
|
|
29
|
+
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
30
|
+
"args" of child component stories
|
|
31
|
+
</li>
|
|
32
|
+
<li>
|
|
33
|
+
Assemble data in the page component from your services. You can mock these services out
|
|
34
|
+
using Storybook.
|
|
35
|
+
</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<p>
|
|
38
|
+
Get a guided tutorial on component-driven development at
|
|
39
|
+
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
40
|
+
Storybook tutorials
|
|
41
|
+
</a>
|
|
42
|
+
. Read more in the
|
|
43
|
+
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer"> docs </a>
|
|
44
|
+
.
|
|
45
|
+
</p>
|
|
46
|
+
<div class="tip-wrapper">
|
|
47
|
+
<span class="tip">Tip</span> Adjust the width of the canvas with the
|
|
48
|
+
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
49
|
+
<g fill="none" fillRule="evenodd">
|
|
50
|
+
<path
|
|
51
|
+
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
52
|
+
id="a"
|
|
53
|
+
fill="#999"
|
|
54
|
+
/>
|
|
55
|
+
</g>
|
|
56
|
+
</svg>
|
|
57
|
+
Viewports addon in the toolbar
|
|
58
|
+
</div>
|
|
59
|
+
</section>
|
|
60
|
+
</article>`,
|
|
61
|
+
styleUrls: ['./page.css'],
|
|
62
|
+
})
|
|
63
|
+
export default class PageComponent {
|
|
64
|
+
user: User | null = null;
|
|
65
|
+
|
|
66
|
+
doLogout() {
|
|
67
|
+
this.user = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
doLogin() {
|
|
71
|
+
this.user = { name: 'Jane Doe' };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
doCreateAccount() {
|
|
75
|
+
this.user = { name: 'Jane Doe' };
|
|
76
|
+
}
|
|
77
|
+
}
|