@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,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InputComponent = exports.ButtonAccent = exports.exportedConstant = void 0;
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-nocheck
|
|
15
|
+
/* eslint-disable no-console */
|
|
16
|
+
/* eslint-disable no-underscore-dangle */
|
|
17
|
+
const core_1 = require("@angular/core");
|
|
18
|
+
exports.exportedConstant = 'An exported constant';
|
|
19
|
+
var ButtonAccent;
|
|
20
|
+
(function (ButtonAccent) {
|
|
21
|
+
ButtonAccent["Normal"] = "Normal";
|
|
22
|
+
ButtonAccent["High"] = "High";
|
|
23
|
+
})(ButtonAccent = exports.ButtonAccent || (exports.ButtonAccent = {}));
|
|
24
|
+
/**
|
|
25
|
+
* This is a simple button that demonstrates various JSDoc handling in Storybook Docs for Angular.
|
|
26
|
+
*
|
|
27
|
+
* It supports [markdown](https://en.wikipedia.org/wiki/Markdown), so you can embed formatted text,
|
|
28
|
+
* like **bold**, _italic_, and `inline code`.
|
|
29
|
+
*
|
|
30
|
+
* > How you like dem apples?! It's never been easier to document all your components.
|
|
31
|
+
*
|
|
32
|
+
* @string Hello world
|
|
33
|
+
* @link [Example](http://example.com)
|
|
34
|
+
* @code `ThingThing`
|
|
35
|
+
* @html <span class="badge">aaa</span>
|
|
36
|
+
*/
|
|
37
|
+
let InputComponent = class InputComponent {
|
|
38
|
+
constructor() {
|
|
39
|
+
/** Appearance style of the button. */
|
|
40
|
+
this.appearance = 'secondary';
|
|
41
|
+
/** Sets the button to a disabled state. */
|
|
42
|
+
this.isDisabled = false;
|
|
43
|
+
/** Size of the button. */
|
|
44
|
+
this.size = 'medium';
|
|
45
|
+
/**
|
|
46
|
+
* Some input you shouldn't use.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
50
|
+
this.somethingYouShouldNotUse = false;
|
|
51
|
+
/**
|
|
52
|
+
* Handler to be called when the button is clicked by a user.
|
|
53
|
+
*
|
|
54
|
+
* Will also block the emission of the event if `isDisabled` is true.
|
|
55
|
+
*/
|
|
56
|
+
this.onClick = new core_1.EventEmitter();
|
|
57
|
+
this._inputValue = 'some value';
|
|
58
|
+
this.focus = false;
|
|
59
|
+
/**
|
|
60
|
+
* @ignore
|
|
61
|
+
*/
|
|
62
|
+
this.ignoredProperty = 'Ignore me';
|
|
63
|
+
/** Public value. */
|
|
64
|
+
this.internalProperty = 'Public hello';
|
|
65
|
+
/** Private value. */
|
|
66
|
+
this._value = 'Private hello';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* This is an internal method that we don't want to document and have added the `ignore` annotation to.
|
|
70
|
+
*
|
|
71
|
+
* @ignore
|
|
72
|
+
*/
|
|
73
|
+
handleClick(event) {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
if (!this.isDisabled) {
|
|
76
|
+
this.onClick.emit(event);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Setter for `inputValue` that is also an `@Input`. */
|
|
80
|
+
set inputValue(value) {
|
|
81
|
+
this._inputValue = value;
|
|
82
|
+
}
|
|
83
|
+
/** Getter for `inputValue`. */
|
|
84
|
+
get inputValue() {
|
|
85
|
+
return this._inputValue;
|
|
86
|
+
}
|
|
87
|
+
onClickListener(btn) {
|
|
88
|
+
console.log('button', btn);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns all the CSS classes for the button.
|
|
92
|
+
*
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
get classes() {
|
|
96
|
+
return [this.appearance, this.size]
|
|
97
|
+
.filter((_class) => !!_class)
|
|
98
|
+
.map((_class) => `btn-${_class}`);
|
|
99
|
+
}
|
|
100
|
+
/** Set the private value. */
|
|
101
|
+
set value(value) {
|
|
102
|
+
this._value = `${value}`;
|
|
103
|
+
}
|
|
104
|
+
/** Get the private value. */
|
|
105
|
+
get value() {
|
|
106
|
+
return this._value;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* An internal calculation method which adds `x` and `y` together.
|
|
110
|
+
*
|
|
111
|
+
* @param x Some number you'd like to use.
|
|
112
|
+
* @param y Some other number or string you'd like to use, will have `parseInt()` applied before calculation.
|
|
113
|
+
*/
|
|
114
|
+
calc(x, y) {
|
|
115
|
+
return x + parseInt(`${y}`, 10);
|
|
116
|
+
}
|
|
117
|
+
/** A public method using an interface. */
|
|
118
|
+
publicMethod(things) {
|
|
119
|
+
console.log(things);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A protected method.
|
|
123
|
+
*
|
|
124
|
+
* @param id Some `id`.
|
|
125
|
+
*/
|
|
126
|
+
protectedMethod(id) {
|
|
127
|
+
console.log(id);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A private method.
|
|
131
|
+
*
|
|
132
|
+
* @param password Some `password`.
|
|
133
|
+
*/
|
|
134
|
+
privateMethod(password) {
|
|
135
|
+
console.log(password);
|
|
136
|
+
}
|
|
137
|
+
set item(item) {
|
|
138
|
+
this.processedItem = item;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
__decorate([
|
|
142
|
+
(0, core_1.ViewChild)('buttonRef', { static: false }),
|
|
143
|
+
__metadata("design:type", core_1.ElementRef)
|
|
144
|
+
], InputComponent.prototype, "buttonRef", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, core_1.Input)(),
|
|
147
|
+
__metadata("design:type", String)
|
|
148
|
+
], InputComponent.prototype, "appearance", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, core_1.Input)(),
|
|
151
|
+
__metadata("design:type", String)
|
|
152
|
+
], InputComponent.prototype, "accent", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, core_1.Input)(),
|
|
155
|
+
__metadata("design:type", Object)
|
|
156
|
+
], InputComponent.prototype, "isDisabled", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, core_1.Input)(),
|
|
159
|
+
__metadata("design:type", String)
|
|
160
|
+
], InputComponent.prototype, "label", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, core_1.Input)(),
|
|
163
|
+
__metadata("design:type", String)
|
|
164
|
+
], InputComponent.prototype, "size", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, core_1.Input)(),
|
|
167
|
+
__metadata("design:type", Object)
|
|
168
|
+
], InputComponent.prototype, "someDataObject", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, core_1.Input)(),
|
|
171
|
+
__metadata("design:type", Object)
|
|
172
|
+
], InputComponent.prototype, "somethingYouShouldNotUse", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, core_1.Output)(),
|
|
175
|
+
__metadata("design:type", Object)
|
|
176
|
+
], InputComponent.prototype, "onClick", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, core_1.Input)(),
|
|
179
|
+
__metadata("design:type", String),
|
|
180
|
+
__metadata("design:paramtypes", [String])
|
|
181
|
+
], InputComponent.prototype, "inputValue", null);
|
|
182
|
+
__decorate([
|
|
183
|
+
(0, core_1.HostListener)('click', ['$event.target']),
|
|
184
|
+
__metadata("design:type", Function),
|
|
185
|
+
__metadata("design:paramtypes", [Object]),
|
|
186
|
+
__metadata("design:returntype", void 0)
|
|
187
|
+
], InputComponent.prototype, "onClickListener", null);
|
|
188
|
+
__decorate([
|
|
189
|
+
(0, core_1.HostBinding)('class.focused'),
|
|
190
|
+
__metadata("design:type", Object)
|
|
191
|
+
], InputComponent.prototype, "focus", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, core_1.Input)('showKeyAlias'),
|
|
194
|
+
__metadata("design:type", Object)
|
|
195
|
+
], InputComponent.prototype, "showKey", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
(0, core_1.Input)(),
|
|
198
|
+
__metadata("design:type", Array),
|
|
199
|
+
__metadata("design:paramtypes", [Array])
|
|
200
|
+
], InputComponent.prototype, "item", null);
|
|
201
|
+
InputComponent = __decorate([
|
|
202
|
+
(0, core_1.Component)({
|
|
203
|
+
selector: 'doc-button',
|
|
204
|
+
template: '<button>{{ label }}</button>',
|
|
205
|
+
})
|
|
206
|
+
], InputComponent);
|
|
207
|
+
exports.InputComponent = InputComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'jest-specific-snapshot';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
require("jest-specific-snapshot");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const tmp_1 = __importDefault(require("tmp"));
|
|
10
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
11
|
+
const compodoc_1 = require("./compodoc");
|
|
12
|
+
// @ts-expect-error (Converted from ts-ignore)
|
|
13
|
+
const { SNAPSHOT_OS } = global;
|
|
14
|
+
// File hierarchy: __testfixtures__ / some-test-case / input.*
|
|
15
|
+
const inputRegExp = /^input\..*$/;
|
|
16
|
+
const runCompodoc = (inputPath) => {
|
|
17
|
+
const testDir = path_1.default.dirname(inputPath);
|
|
18
|
+
const { name: tmpDir, removeCallback } = tmp_1.default.dirSync();
|
|
19
|
+
// FIXME: for now, this requires a tsconfig.json for each test case. Tried generating
|
|
20
|
+
// one dynamically in tmpDir, but compodoc doesn't handle absolute paths properly
|
|
21
|
+
// (and screwed around with relative paths as well, but couldn't get it working)
|
|
22
|
+
(0, cross_spawn_1.sync)('yarn', ['compodoc', '-p', `${testDir}/tsconfig.json`, '-e', 'json', '-d', tmpDir], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
shell: true,
|
|
25
|
+
});
|
|
26
|
+
const output = fs_1.default.readFileSync(`${tmpDir}/documentation.json`, 'utf8');
|
|
27
|
+
try {
|
|
28
|
+
removeCallback();
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
//
|
|
32
|
+
}
|
|
33
|
+
return output;
|
|
34
|
+
};
|
|
35
|
+
describe('angular component properties', () => {
|
|
36
|
+
const fixturesDir = path_1.default.join(__dirname, '__testfixtures__');
|
|
37
|
+
fs_1.default.readdirSync(fixturesDir, { withFileTypes: true }).forEach((testEntry) => {
|
|
38
|
+
if (testEntry.isDirectory()) {
|
|
39
|
+
const testDir = path_1.default.join(fixturesDir, testEntry.name);
|
|
40
|
+
const testFile = fs_1.default.readdirSync(testDir).find((fileName) => inputRegExp.test(fileName));
|
|
41
|
+
if (testFile) {
|
|
42
|
+
it(`${testEntry.name}`, () => {
|
|
43
|
+
const inputPath = path_1.default.join(testDir, testFile);
|
|
44
|
+
// snapshot the output of compodoc
|
|
45
|
+
const compodocOutput = runCompodoc(inputPath);
|
|
46
|
+
const compodocJson = JSON.parse(compodocOutput);
|
|
47
|
+
expect(compodocJson).toMatchSpecificSnapshot(path_1.default.join(testDir, `compodoc-${SNAPSHOT_OS}.snapshot`));
|
|
48
|
+
// snapshot the output of addon-docs angular-properties
|
|
49
|
+
const componentData = (0, compodoc_1.findComponentByName)('InputComponent', compodocJson);
|
|
50
|
+
const argTypes = (0, compodoc_1.extractArgTypesFromData)(componentData);
|
|
51
|
+
expect(argTypes).toMatchSpecificSnapshot(path_1.default.join(testDir, 'argtypes.snapshot'));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ArgTypes, SBType } from '@storybook/types';
|
|
2
|
+
import { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './types';
|
|
3
3
|
export declare const isMethod: (methodOrProp: Method | Property) => methodOrProp is Method;
|
|
4
4
|
export declare const setCompodocJson: (compodocJson: CompodocJson) => void;
|
|
5
5
|
export declare const getCompodocJson: () => CompodocJson;
|
|
6
6
|
export declare const checkValidComponentOrDirective: (component: Component | Directive) => void;
|
|
7
7
|
export declare const checkValidCompodocJson: (compodocJson: CompodocJson) => void;
|
|
8
8
|
export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive;
|
|
9
|
-
export declare const extractType: (property: Property, defaultValue: any) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} | {
|
|
13
|
-
name: string;
|
|
14
|
-
value: any[];
|
|
15
|
-
};
|
|
16
|
-
export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => ArgTypes;
|
|
17
|
-
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes;
|
|
9
|
+
export declare const extractType: (property: Property, defaultValue: any) => SBType;
|
|
10
|
+
export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => ArgTypes<import("@storybook/types").Args>;
|
|
11
|
+
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes<import("@storybook/types").Args>;
|
|
18
12
|
export declare const extractComponentDescription: (component: Component | Directive) => string;
|
|
@@ -9,11 +9,11 @@ const isMethod = (methodOrProp) => {
|
|
|
9
9
|
};
|
|
10
10
|
exports.isMethod = isMethod;
|
|
11
11
|
const setCompodocJson = (compodocJson) => {
|
|
12
|
-
// @ts-ignore
|
|
12
|
+
// @ts-expect-error (Converted from ts-ignore)
|
|
13
13
|
window.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
14
14
|
};
|
|
15
15
|
exports.setCompodocJson = setCompodocJson;
|
|
16
|
-
// @ts-ignore
|
|
16
|
+
// @ts-expect-error (Converted from ts-ignore)
|
|
17
17
|
const getCompodocJson = () => window.__STORYBOOK_COMPODOC_JSON__;
|
|
18
18
|
exports.getCompodocJson = getCompodocJson;
|
|
19
19
|
const checkValidComponentOrDirective = (component) => {
|
|
@@ -121,11 +121,13 @@ const extractType = (property, defaultValue) => {
|
|
|
121
121
|
return { name: compodocType };
|
|
122
122
|
case undefined:
|
|
123
123
|
case null:
|
|
124
|
-
return { name: 'void' };
|
|
124
|
+
return { name: 'other', value: 'void' };
|
|
125
125
|
default: {
|
|
126
126
|
const resolvedType = resolveTypealias(compodocType);
|
|
127
127
|
const enumValues = extractEnumValues(resolvedType);
|
|
128
|
-
return enumValues
|
|
128
|
+
return enumValues
|
|
129
|
+
? { name: 'enum', value: enumValues }
|
|
130
|
+
: { name: 'other', value: 'empty-enum' };
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
};
|
|
@@ -165,7 +167,6 @@ const extractDefaultValueFromComments = (property, value) => {
|
|
|
165
167
|
let commentValue = value;
|
|
166
168
|
property.jsdoctags.forEach((tag) => {
|
|
167
169
|
if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
|
|
168
|
-
// @ts-ignore
|
|
169
170
|
const dom = new window.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
170
171
|
commentValue = dom.body.textContent;
|
|
171
172
|
}
|
|
@@ -202,13 +203,12 @@ const extractArgTypesFromData = (componentData) => {
|
|
|
202
203
|
const section = mapItemToSection(key, item);
|
|
203
204
|
const defaultValue = (0, exports.isMethod)(item) ? undefined : extractDefaultValue(item);
|
|
204
205
|
const type = (0, exports.isMethod)(item) || (section !== 'inputs' && section !== 'properties')
|
|
205
|
-
? { name: 'void' }
|
|
206
|
+
? { name: 'other', value: 'void' }
|
|
206
207
|
: (0, exports.extractType)(item, defaultValue);
|
|
207
208
|
const action = section === 'outputs' ? { action: item.name } : {};
|
|
208
209
|
const argType = {
|
|
209
210
|
name: item.name,
|
|
210
211
|
description: item.rawdescription || item.description,
|
|
211
|
-
defaultValue,
|
|
212
212
|
type,
|
|
213
213
|
...action,
|
|
214
214
|
table: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const compodoc_1 = require("./compodoc");
|
|
4
|
+
const makeProperty = (compodocType) => ({
|
|
5
|
+
type: compodocType,
|
|
6
|
+
name: 'dummy',
|
|
7
|
+
decorators: [],
|
|
8
|
+
optional: true,
|
|
9
|
+
});
|
|
10
|
+
const getDummyCompodocJson = () => {
|
|
11
|
+
return {
|
|
12
|
+
miscellaneous: {
|
|
13
|
+
typealiases: [
|
|
14
|
+
{
|
|
15
|
+
name: 'EnumAlias',
|
|
16
|
+
ctype: 'miscellaneous',
|
|
17
|
+
subtype: 'typealias',
|
|
18
|
+
rawtype: 'EnumNumeric',
|
|
19
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
20
|
+
description: '',
|
|
21
|
+
kind: 161,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'TypeAlias',
|
|
25
|
+
ctype: 'miscellaneous',
|
|
26
|
+
subtype: 'typealias',
|
|
27
|
+
rawtype: '"Type Alias 1" | "Type Alias 2" | "Type Alias 3"',
|
|
28
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
29
|
+
description: '',
|
|
30
|
+
kind: 168,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
enumerations: [
|
|
34
|
+
{
|
|
35
|
+
name: 'EnumNumeric',
|
|
36
|
+
childs: [
|
|
37
|
+
{
|
|
38
|
+
name: 'FIRST',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'SECOND',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'THIRD',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
ctype: 'miscellaneous',
|
|
48
|
+
subtype: 'enum',
|
|
49
|
+
description: '<p>Button Priority</p>\n',
|
|
50
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'EnumNumericInitial',
|
|
54
|
+
childs: [
|
|
55
|
+
{
|
|
56
|
+
name: 'UNO',
|
|
57
|
+
value: '1',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'DOS',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'TRES',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
ctype: 'miscellaneous',
|
|
67
|
+
subtype: 'enum',
|
|
68
|
+
description: '',
|
|
69
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'EnumStringValues',
|
|
73
|
+
childs: [
|
|
74
|
+
{
|
|
75
|
+
name: 'PRIMARY',
|
|
76
|
+
value: 'PRIMARY',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'SECONDARY',
|
|
80
|
+
value: 'SECONDARY',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'TERTIARY',
|
|
84
|
+
value: 'TERTIARY',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
ctype: 'miscellaneous',
|
|
88
|
+
subtype: 'enum',
|
|
89
|
+
description: '',
|
|
90
|
+
file: 'src/stories/component-with-enums/enums.component.ts',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
describe('extractType', () => {
|
|
97
|
+
describe('with compodoc type', () => {
|
|
98
|
+
(0, compodoc_1.setCompodocJson)(getDummyCompodocJson());
|
|
99
|
+
it.each([
|
|
100
|
+
['string', { name: 'string' }],
|
|
101
|
+
['boolean', { name: 'boolean' }],
|
|
102
|
+
['number', { name: 'number' }],
|
|
103
|
+
['object', { name: 'object' }],
|
|
104
|
+
['foo', { name: 'object' }],
|
|
105
|
+
[null, { name: 'void' }],
|
|
106
|
+
[undefined, { name: 'void' }],
|
|
107
|
+
['T[]', { name: 'object' }],
|
|
108
|
+
['[]', { name: 'object' }],
|
|
109
|
+
['"primary" | "secondary"', { name: 'enum', value: ['primary', 'secondary'] }],
|
|
110
|
+
['TypeAlias', { name: 'enum', value: ['Type Alias 1', 'Type Alias 2', 'Type Alias 3'] }],
|
|
111
|
+
['EnumNumeric', { name: 'object' }],
|
|
112
|
+
['EnumNumericInitial', { name: 'object' }],
|
|
113
|
+
['EnumStringValues', { name: 'enum', value: ['PRIMARY', 'SECONDARY', 'TERTIARY'] }],
|
|
114
|
+
])('%s', (compodocType, expected) => {
|
|
115
|
+
expect((0, compodoc_1.extractType)(makeProperty(compodocType), null)).toEqual(expected);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe('without compodoc type', () => {
|
|
119
|
+
it.each([
|
|
120
|
+
['string', { name: 'string' }],
|
|
121
|
+
['', { name: 'string' }],
|
|
122
|
+
[false, { name: 'boolean' }],
|
|
123
|
+
[10, { name: 'number' }],
|
|
124
|
+
[['abc'], { name: 'object' }],
|
|
125
|
+
[{ foo: 1 }, { name: 'object' }],
|
|
126
|
+
[undefined, { name: 'void' }],
|
|
127
|
+
])('%s', (defaultValue, expected) => {
|
|
128
|
+
expect((0, compodoc_1.extractType)(makeProperty(null), defaultValue)).toEqual(expected);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { StoryContext,
|
|
1
|
+
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
+
import { StoryContext, AngularRenderer } from '../types';
|
|
3
3
|
export declare const skipSourceRender: (context: StoryContext) => any;
|
|
4
4
|
/**
|
|
5
5
|
* Angular source decorator.
|
|
6
6
|
* @param storyFn Fn
|
|
7
7
|
* @param context StoryContext
|
|
8
8
|
*/
|
|
9
|
-
export declare const sourceDecorator: (storyFn: PartialStoryFn<
|
|
9
|
+
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularRenderer>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sourceDecorator = exports.skipSourceRender = void 0;
|
|
4
|
-
const
|
|
4
|
+
const preview_api_1 = require("@storybook/preview-api");
|
|
5
5
|
const docs_tools_1 = require("@storybook/docs-tools");
|
|
6
6
|
const renderer_1 = require("../../renderer");
|
|
7
7
|
const skipSourceRender = (context) => {
|
|
@@ -25,11 +25,11 @@ const sourceDecorator = (storyFn, context) => {
|
|
|
25
25
|
if ((0, exports.skipSourceRender)(context)) {
|
|
26
26
|
return story;
|
|
27
27
|
}
|
|
28
|
-
const channel =
|
|
28
|
+
const channel = preview_api_1.addons.getChannel();
|
|
29
29
|
const { props, template, userDefinedTemplate } = story;
|
|
30
30
|
const { component, argTypes } = context;
|
|
31
31
|
let toEmit;
|
|
32
|
-
(0,
|
|
32
|
+
(0, preview_api_1.useEffect)(() => {
|
|
33
33
|
if (toEmit) {
|
|
34
34
|
channel.emit(docs_tools_1.SNIPPET_RENDERED, context.id, toEmit, 'angular');
|
|
35
35
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/// <reference types="webpack-env" />
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -16,7 +17,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
18
|
exports.componentWrapperDecorator = exports.moduleMetadata = void 0;
|
|
18
19
|
require("./globals");
|
|
20
|
+
// eslint-disable-next-line import/export
|
|
19
21
|
__exportStar(require("./public-api"), exports);
|
|
22
|
+
// eslint-disable-next-line import/export
|
|
20
23
|
__exportStar(require("./public-types"), exports);
|
|
21
24
|
var decorators_1 = require("./decorators");
|
|
22
25
|
Object.defineProperty(exports, "moduleMetadata", { enumerable: true, get: function () { return decorators_1.moduleMetadata; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="webpack-env" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types';
|
|
4
|
+
import { AngularRenderer } from './types';
|
|
5
|
+
export * from './public-types';
|
|
6
|
+
interface ClientApi extends Addon_ClientStoryApi<AngularRenderer['storyResult']> {
|
|
7
|
+
configure(loader: Addon_Loadable, module: NodeModule): void;
|
|
8
|
+
forceReRender(): void;
|
|
9
|
+
raw: () => any;
|
|
10
|
+
load: (...args: any[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const storiesOf: ClientApi['storiesOf'];
|
|
13
|
+
export declare const configure: ClientApi['configure'];
|
|
14
|
+
export declare const forceReRender: ClientApi['forceReRender'];
|
|
15
|
+
export declare const raw: ClientApi['raw'];
|
|
@@ -17,13 +17,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.raw = exports.
|
|
20
|
+
exports.raw = exports.forceReRender = exports.configure = exports.storiesOf = void 0;
|
|
21
21
|
const core_client_1 = require("@storybook/core-client");
|
|
22
22
|
const render_1 = require("./render");
|
|
23
23
|
const decorateStory_1 = __importDefault(require("./decorateStory"));
|
|
24
24
|
__exportStar(require("./public-types"), exports);
|
|
25
25
|
const FRAMEWORK = 'angular';
|
|
26
|
-
const api = (0, core_client_1.start)(render_1.
|
|
26
|
+
const api = (0, core_client_1.start)(render_1.renderToCanvas, { decorateStory: decorateStory_1.default, render: render_1.render });
|
|
27
27
|
const storiesOf = (kind, m) => {
|
|
28
28
|
return api.clientApi.storiesOf(kind, m).addParameters({
|
|
29
29
|
framework: FRAMEWORK,
|
|
@@ -32,12 +32,5 @@ const storiesOf = (kind, m) => {
|
|
|
32
32
|
exports.storiesOf = storiesOf;
|
|
33
33
|
const configure = (...args) => api.configure(FRAMEWORK, ...args);
|
|
34
34
|
exports.configure = configure;
|
|
35
|
-
exports.addDecorator = api.clientApi
|
|
36
|
-
.addDecorator;
|
|
37
|
-
exports.addParameters = api.clientApi
|
|
38
|
-
.addParameters;
|
|
39
|
-
exports.clearDecorators = api.clientApi.clearDecorators;
|
|
40
|
-
exports.setAddon = api.clientApi.setAddon;
|
|
41
35
|
exports.forceReRender = api.forceReRender;
|
|
42
|
-
exports.getStorybook = api.clientApi.getStorybook;
|
|
43
36
|
exports.raw = api.clientApi.raw;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AnnotatedStoryFn, Args, ComponentAnnotations, DecoratorFunction, LoaderFunction, StoryAnnotations, StoryContext as GenericStoryContext, StrictArgs } from '@storybook/types';
|
|
2
|
+
import { AngularRenderer } from './types';
|
|
3
|
+
export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
|
|
4
|
+
export type { Parameters as AngularParameters } from './types';
|
|
5
|
+
export type { AngularRenderer };
|
|
6
|
+
/**
|
|
7
|
+
* Metadata to configure the stories for a component.
|
|
8
|
+
*
|
|
9
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
10
|
+
*/
|
|
11
|
+
export type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TArgs>;
|
|
12
|
+
/**
|
|
13
|
+
* Story function that represents a CSFv2 component example.
|
|
14
|
+
*
|
|
15
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
16
|
+
*/
|
|
17
|
+
export type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TArgs>;
|
|
18
|
+
/**
|
|
19
|
+
* Story function that represents a CSFv3 component example.
|
|
20
|
+
*
|
|
21
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
22
|
+
*/
|
|
23
|
+
export type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TArgs>;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use `StoryFn` instead.
|
|
26
|
+
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
|
|
27
|
+
* You can read more about the CSF3 format here: https://storybook.js.org/blog/component-story-format-3-0/
|
|
28
|
+
*
|
|
29
|
+
* Story function that represents a CSFv2 component example.
|
|
30
|
+
*
|
|
31
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
32
|
+
*/
|
|
33
|
+
export type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
34
|
+
export type Decorator<TArgs = StrictArgs> = DecoratorFunction<AngularRenderer, TArgs>;
|
|
35
|
+
export type Loader<TArgs = StrictArgs> = LoaderFunction<AngularRenderer, TArgs>;
|
|
36
|
+
export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<AngularRenderer, TArgs>;
|
|
File without changes
|