@storybook/angular 7.0.0-alpha.8 → 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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
// Needs to be a different name to the CLI template button
|
|
5
|
+
selector: 'storybook-framework-button',
|
|
6
|
+
template: ` <button
|
|
7
|
+
type="button"
|
|
8
|
+
(click)="onClick.emit($event)"
|
|
9
|
+
[ngClass]="classes"
|
|
10
|
+
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
11
|
+
>
|
|
12
|
+
{{ label }}
|
|
13
|
+
</button>`,
|
|
14
|
+
styleUrls: ['./button.css'],
|
|
15
|
+
})
|
|
16
|
+
export default class FrameworkButtonComponent {
|
|
17
|
+
/**
|
|
18
|
+
* Is this the principal call to action on the page?
|
|
19
|
+
*/
|
|
20
|
+
@Input()
|
|
21
|
+
primary = false;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* What background color to use
|
|
25
|
+
*/
|
|
26
|
+
@Input()
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* How large should the button be?
|
|
31
|
+
*/
|
|
32
|
+
@Input()
|
|
33
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Button contents
|
|
37
|
+
*
|
|
38
|
+
* @required
|
|
39
|
+
*/
|
|
40
|
+
@Input()
|
|
41
|
+
label = 'Button';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional click handler
|
|
45
|
+
*/
|
|
46
|
+
@Output()
|
|
47
|
+
onClick = new EventEmitter<Event>();
|
|
48
|
+
|
|
49
|
+
public get classes(): string[] {
|
|
50
|
+
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
51
|
+
|
|
52
|
+
return ['storybook-button', `storybook-button--${this.size}`, mode];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.storybook-button {
|
|
2
|
+
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
+
font-weight: 700;
|
|
4
|
+
border: 0;
|
|
5
|
+
border-radius: 3em;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
}
|
|
10
|
+
.storybook-button--primary {
|
|
11
|
+
color: white;
|
|
12
|
+
background-color: #1ea7fd;
|
|
13
|
+
}
|
|
14
|
+
.storybook-button--secondary {
|
|
15
|
+
color: #333;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
18
|
+
}
|
|
19
|
+
.storybook-button--small {
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
padding: 10px 16px;
|
|
22
|
+
}
|
|
23
|
+
.storybook-button--medium {
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
padding: 11px 20px;
|
|
26
|
+
}
|
|
27
|
+
.storybook-button--large {
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
padding: 12px 24px;
|
|
30
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'storybook-form',
|
|
5
|
+
template: `
|
|
6
|
+
<form id="interaction-test-form" (submit)="handleSubmit($event)">
|
|
7
|
+
<label>
|
|
8
|
+
Enter Value
|
|
9
|
+
<input type="text" data-testid="value" [value]="value" required />
|
|
10
|
+
</label>
|
|
11
|
+
<button type="submit">Submit</button>
|
|
12
|
+
<p *ngIf="complete">Completed!!</p>
|
|
13
|
+
</form>
|
|
14
|
+
`,
|
|
15
|
+
})
|
|
16
|
+
export default class FormComponent {
|
|
17
|
+
/**
|
|
18
|
+
* Optional success handler
|
|
19
|
+
*/
|
|
20
|
+
@Output()
|
|
21
|
+
onSuccess = new EventEmitter<string>();
|
|
22
|
+
|
|
23
|
+
value = '';
|
|
24
|
+
|
|
25
|
+
complete = false;
|
|
26
|
+
|
|
27
|
+
handleSubmit(event: SubmitEvent) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
this.onSuccess.emit(this.value);
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.complete = true;
|
|
32
|
+
}, 500);
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
this.complete = false;
|
|
35
|
+
}, 1500);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'storybook-html',
|
|
6
|
+
template: `<div [innerHTML]="safeContent"></div>`,
|
|
7
|
+
})
|
|
8
|
+
export default class HtmlComponent {
|
|
9
|
+
/**
|
|
10
|
+
* The HTML to render
|
|
11
|
+
*
|
|
12
|
+
* @required
|
|
13
|
+
*/
|
|
14
|
+
@Input()
|
|
15
|
+
content = '';
|
|
16
|
+
|
|
17
|
+
constructor(private sanitizer: DomSanitizer) {}
|
|
18
|
+
|
|
19
|
+
get safeContent() {
|
|
20
|
+
return this.sanitizer.bypassSecurityTrustHtml(this.content);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'storybook-pre',
|
|
5
|
+
template: `<pre data-testid="pre" [ngStyle]="style">{{ finalText }}</pre>`,
|
|
6
|
+
})
|
|
7
|
+
export default class PreComponent {
|
|
8
|
+
/**
|
|
9
|
+
* Styles to apply to the component
|
|
10
|
+
*/
|
|
11
|
+
@Input()
|
|
12
|
+
style?: Object;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An object to render
|
|
16
|
+
*/
|
|
17
|
+
@Input()
|
|
18
|
+
object?: Object;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The code to render
|
|
22
|
+
*/
|
|
23
|
+
@Input()
|
|
24
|
+
text?: string;
|
|
25
|
+
|
|
26
|
+
get finalText() {
|
|
27
|
+
return this.object ? JSON.stringify(this.object, null, 2) : this.text;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import globalThis from 'global';
|
|
2
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
3
|
+
import { Meta, Story, Canvas } from '@storybook/addon-docs';
|
|
4
|
+
|
|
5
|
+
export const Button = globalThis.Components.Button;
|
|
6
|
+
|
|
7
|
+
<Meta
|
|
8
|
+
title="angular/angular-mdx"
|
|
9
|
+
component={Button}
|
|
10
|
+
decorators={[moduleMetadata({ declarations: [Button] })]}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
# Angular-specific MDX Stories
|
|
14
|
+
|
|
15
|
+
<Canvas>
|
|
16
|
+
<Story name="Angular Story">
|
|
17
|
+
{{
|
|
18
|
+
template: `<storybook-framework-button [label]="text" (onClick)="onClick($event)"></storybook-framework-button>`,
|
|
19
|
+
props: {
|
|
20
|
+
text: 'hello button',
|
|
21
|
+
onClick: () => {},
|
|
22
|
+
},
|
|
23
|
+
}}
|
|
24
|
+
</Story>
|
|
25
|
+
</Canvas>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<button [disabled]="isDisabled" [ngClass]="classes" #buttonRef>
|
|
2
|
+
<img
|
|
3
|
+
width="100"
|
|
4
|
+
src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyNTAgMjUwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNTAgMjUwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDojREQwMDMxO30NCgkuc3Qxe2ZpbGw6I0MzMDAyRjt9DQoJLnN0MntmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnPg0KCTxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMTI1LDMwIDEyNSwzMCAxMjUsMzAgMzEuOSw2My4yIDQ2LjEsMTg2LjMgMTI1LDIzMCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAJIi8+DQoJPHBvbHlnb24gY2xhc3M9InN0MSIgcG9pbnRzPSIxMjUsMzAgMTI1LDUyLjIgMTI1LDUyLjEgMTI1LDE1My40IDEyNSwxNTMuNCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAxMjUsMzAgCSIvPg0KCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0xMjUsNTIuMUw2Ni44LDE4Mi42aDBoMjEuN2gwbDExLjctMjkuMmg0OS40bDExLjcsMjkuMmgwaDIxLjdoMEwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMQ0KCQlMMTI1LDUyLjF6IE0xNDIsMTM1LjRIMTA4bDE3LTQwLjlMMTQyLDEzNS40eiIvPg0KPC9nPg0KPC9zdmc+DQo="
|
|
5
|
+
/>
|
|
6
|
+
{{ label }}
|
|
7
|
+
</button>
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/* eslint-disable no-underscore-dangle */
|
|
3
|
+
import {
|
|
4
|
+
Component,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
HostBinding,
|
|
7
|
+
HostListener,
|
|
8
|
+
Input,
|
|
9
|
+
Output,
|
|
10
|
+
ViewChild,
|
|
11
|
+
ElementRef,
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
|
|
14
|
+
export const exportedConstant = 'An exported constant';
|
|
15
|
+
|
|
16
|
+
export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge';
|
|
17
|
+
|
|
18
|
+
export interface ISomeInterface {
|
|
19
|
+
one: string;
|
|
20
|
+
two: boolean;
|
|
21
|
+
three: any[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum ButtonAccent {
|
|
25
|
+
'Normal' = 'Normal',
|
|
26
|
+
'High' = 'High',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This is a simple button that demonstrates various JSDoc handling in Storybook Docs for Angular.
|
|
31
|
+
*
|
|
32
|
+
* It supports [markdown](https://en.wikipedia.org/wiki/Markdown), so you can embed formatted text,
|
|
33
|
+
* like **bold**, _italic_, and `inline code`.
|
|
34
|
+
*
|
|
35
|
+
* > How you like dem apples?! It's never been easier to document all your components.
|
|
36
|
+
*
|
|
37
|
+
* @string Hello world
|
|
38
|
+
* @link [Example](http://example.com)
|
|
39
|
+
* @code `ThingThing`
|
|
40
|
+
* @html <span class="badge">aaa</span>
|
|
41
|
+
*/
|
|
42
|
+
@Component({
|
|
43
|
+
selector: 'my-button',
|
|
44
|
+
templateUrl: './doc-button.component.html',
|
|
45
|
+
styleUrls: ['./doc-button.component.scss'],
|
|
46
|
+
})
|
|
47
|
+
export class DocButtonComponent<T> {
|
|
48
|
+
@ViewChild('buttonRef', { static: false }) buttonRef!: ElementRef;
|
|
49
|
+
|
|
50
|
+
/** Test default value. */
|
|
51
|
+
@Input()
|
|
52
|
+
public theDefaultValue = 'Default value in component';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Setting default value here because compodoc won't get the default value for accessors
|
|
56
|
+
* @default Another default value
|
|
57
|
+
* */
|
|
58
|
+
@Input()
|
|
59
|
+
get anotherDefaultValue() {
|
|
60
|
+
return this._anotherDefaultValue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
set anotherDefaultValue(v: string) {
|
|
64
|
+
this._anotherDefaultValue = v;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_anotherDefaultValue = 'Another default value';
|
|
68
|
+
|
|
69
|
+
/** Test null default value. */
|
|
70
|
+
@Input()
|
|
71
|
+
public aNullValue: string | null = null;
|
|
72
|
+
|
|
73
|
+
/** Test null default value. */
|
|
74
|
+
@Input()
|
|
75
|
+
// @ts-expect-error intentionally undefined
|
|
76
|
+
public anUndefinedValue;
|
|
77
|
+
|
|
78
|
+
/** Test numeric default value. */
|
|
79
|
+
@Input()
|
|
80
|
+
public aNumericValue = 123;
|
|
81
|
+
|
|
82
|
+
/** Appearance style of the button. */
|
|
83
|
+
@Input()
|
|
84
|
+
public appearance: 'primary' | 'secondary' = 'secondary';
|
|
85
|
+
|
|
86
|
+
/** Sets the button to a disabled state. */
|
|
87
|
+
@Input()
|
|
88
|
+
public isDisabled = false;
|
|
89
|
+
|
|
90
|
+
/** Specify the accent-type of the button */
|
|
91
|
+
@Input()
|
|
92
|
+
public accent: ButtonAccent = ButtonAccent.Normal;
|
|
93
|
+
|
|
94
|
+
/** Specifies some arbitrary object. This comment is to test certain chars like apostrophes - it's working */
|
|
95
|
+
@Input() public someDataObject!: ISomeInterface;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The inner text of the button.
|
|
99
|
+
*
|
|
100
|
+
* @required
|
|
101
|
+
*/
|
|
102
|
+
@Input()
|
|
103
|
+
public label!: string;
|
|
104
|
+
|
|
105
|
+
/** Size of the button. */
|
|
106
|
+
@Input()
|
|
107
|
+
public size?: ButtonSize = 'medium';
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Some input you shouldn't use.
|
|
111
|
+
*
|
|
112
|
+
* @deprecated
|
|
113
|
+
*/
|
|
114
|
+
@Input()
|
|
115
|
+
public somethingYouShouldNotUse = false;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Handler to be called when the button is clicked by a user.
|
|
119
|
+
*
|
|
120
|
+
* Will also block the emission of the event if `isDisabled` is true.
|
|
121
|
+
*/
|
|
122
|
+
@Output()
|
|
123
|
+
public onClick = new EventEmitter<Event>();
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* This is an internal method that we don't want to document and have added the `ignore` annotation to.
|
|
127
|
+
*
|
|
128
|
+
* @ignore
|
|
129
|
+
*/
|
|
130
|
+
public handleClick(event: Event) {
|
|
131
|
+
event.stopPropagation();
|
|
132
|
+
|
|
133
|
+
if (!this.isDisabled) {
|
|
134
|
+
this.onClick.emit(event);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private _inputValue = 'some value';
|
|
139
|
+
|
|
140
|
+
/** Setter for `inputValue` that is also an `@Input`. */
|
|
141
|
+
@Input()
|
|
142
|
+
public set inputValue(value: string) {
|
|
143
|
+
this._inputValue = value;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Getter for `inputValue`. */
|
|
147
|
+
public get inputValue() {
|
|
148
|
+
return this._inputValue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@HostListener('click', ['$event'])
|
|
152
|
+
onClickListener(event: Event) {
|
|
153
|
+
console.log('button', event.target);
|
|
154
|
+
this.handleClick(event);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@HostBinding('class.focused') focus = false;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Returns all the CSS classes for the button.
|
|
161
|
+
*
|
|
162
|
+
* @ignore
|
|
163
|
+
*/
|
|
164
|
+
public get classes(): string[] {
|
|
165
|
+
return [this.appearance, this.size]
|
|
166
|
+
.filter((_class) => !!_class)
|
|
167
|
+
.map((_class) => `btn-${_class}`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @ignore
|
|
172
|
+
*/
|
|
173
|
+
public ignoredProperty = 'Ignore me';
|
|
174
|
+
|
|
175
|
+
/** Public value. */
|
|
176
|
+
public internalProperty = 'Public hello';
|
|
177
|
+
|
|
178
|
+
/** Private value. */
|
|
179
|
+
private _value = 'Private hello';
|
|
180
|
+
|
|
181
|
+
/** Set the private value. */
|
|
182
|
+
public set value(value: string | number) {
|
|
183
|
+
this._value = `${value}`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Get the private value. */
|
|
187
|
+
public get value(): string | number {
|
|
188
|
+
return this._value;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* An internal calculation method which adds `x` and `y` together.
|
|
193
|
+
*
|
|
194
|
+
* @param x Some number you'd like to use.
|
|
195
|
+
* @param y Some other number or string you'd like to use, will have `parseInt()` applied before calculation.
|
|
196
|
+
*/
|
|
197
|
+
public calc(x: number, y: string | number): number {
|
|
198
|
+
return x + parseInt(`${y}`, 10);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** A public method using an interface. */
|
|
202
|
+
public publicMethod(things: ISomeInterface) {
|
|
203
|
+
console.log(things);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* A protected method.
|
|
208
|
+
*
|
|
209
|
+
* @param id Some `id`.
|
|
210
|
+
*/
|
|
211
|
+
protected protectedMethod(id?: number) {
|
|
212
|
+
console.log(id);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A private method.
|
|
217
|
+
*
|
|
218
|
+
* @param password Some `password`.
|
|
219
|
+
*/
|
|
220
|
+
private privateMethod(password: string) {
|
|
221
|
+
console.log(password);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@Input('showKeyAlias')
|
|
225
|
+
public showKey!: keyof T;
|
|
226
|
+
|
|
227
|
+
@Input()
|
|
228
|
+
public set item(item: T[]) {
|
|
229
|
+
this.processedItem = item;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
public processedItem!: T[];
|
|
233
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Args } from '@storybook/angular';
|
|
2
|
+
import { DocButtonComponent } from './doc-button.component';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
component: DocButtonComponent,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Basic = (args: Args) => ({
|
|
9
|
+
props: args,
|
|
10
|
+
});
|
|
11
|
+
Basic.args = { label: 'Args test', isDisabled: false };
|
|
12
|
+
Basic.ArgTypes = {
|
|
13
|
+
theDefaultValue: {
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: { summary: 'Basic default value' },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const WithTemplate = (args: Args) => ({
|
|
21
|
+
props: args,
|
|
22
|
+
template: '<my-button [label]="label" [appearance]="appearance"></my-button>',
|
|
23
|
+
});
|
|
24
|
+
WithTemplate.args = { label: 'Template test', appearance: 'primary' };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ElementRef, AfterViewInit, Directive, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is an Angular Directive
|
|
5
|
+
* example that has a Prop Table.
|
|
6
|
+
*/
|
|
7
|
+
@Directive({
|
|
8
|
+
selector: '[docDirective]',
|
|
9
|
+
})
|
|
10
|
+
export class DocDirective implements AfterViewInit {
|
|
11
|
+
constructor(private ref: ElementRef) {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Will apply gray background color
|
|
15
|
+
* if set to true.
|
|
16
|
+
*/
|
|
17
|
+
@Input() hasGrayBackground = false;
|
|
18
|
+
|
|
19
|
+
ngAfterViewInit(): void {
|
|
20
|
+
if (this.hasGrayBackground) {
|
|
21
|
+
this.ref.nativeElement.style = 'background-color: lightgray';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DocDirective } from './doc-directive.directive';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
component: DocDirective,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const modules = {
|
|
8
|
+
declarations: [DocDirective],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Basic = () => ({
|
|
12
|
+
moduleMetadata: modules,
|
|
13
|
+
template: '<div docDirective [hasGrayBackground]="true"><h1>DocDirective</h1></div>',
|
|
14
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpHeaders } from '@angular/common/http';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is an Angular Injectable
|
|
6
|
+
* example that has a Prop Table.
|
|
7
|
+
*/
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root',
|
|
10
|
+
})
|
|
11
|
+
export class DocInjectableService {
|
|
12
|
+
/**
|
|
13
|
+
* Auth headers to use.
|
|
14
|
+
*/
|
|
15
|
+
auth: any;
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
this.auth = new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get posts from Backend.
|
|
23
|
+
*/
|
|
24
|
+
getPosts(): unknown[] {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DocInjectableService } from './doc-injectable.service';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
component: DocInjectableService,
|
|
5
|
+
parameters: {
|
|
6
|
+
controls: { hideNoControlsWarning: true },
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const modules = {
|
|
11
|
+
provider: [DocInjectableService],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Basic = () => ({
|
|
15
|
+
moduleMetadata: modules,
|
|
16
|
+
template: '<div><h1>DocInjectable</h1></div>',
|
|
17
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PipeTransform, Pipe } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is an Angular Pipe
|
|
5
|
+
* example that has a Prop Table.
|
|
6
|
+
*/
|
|
7
|
+
@Pipe({
|
|
8
|
+
name: 'docPipe',
|
|
9
|
+
})
|
|
10
|
+
export class DocPipe implements PipeTransform {
|
|
11
|
+
/**
|
|
12
|
+
* Transforms a string into uppercase.
|
|
13
|
+
* @param value string
|
|
14
|
+
*/
|
|
15
|
+
transform(value: string): string {
|
|
16
|
+
return value?.toUpperCase();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DocPipe } from './doc-pipe.pipe';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
component: DocPipe,
|
|
5
|
+
parameters: {
|
|
6
|
+
controls: { hideNoControlsWarning: true },
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const modules = {
|
|
11
|
+
declarations: [DocPipe],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Basic = () => ({
|
|
15
|
+
moduleMetadata: modules,
|
|
16
|
+
template: `<div><h1>{{ 'DocPipe' | docPipe }}</h1></div>`,
|
|
17
|
+
});
|