@storybook/angular 7.0.0-alpha.0 → 7.0.0-alpha.11

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.
Files changed (70) hide show
  1. package/dist/types/builders/build-storybook/index.js +4 -6
  2. package/dist/types/builders/start-storybook/index.js +4 -6
  3. package/dist/types/builders/utils/build-standalone-errors-handler.js +3 -6
  4. package/dist/types/builders/utils/standalone-options.d.ts +12 -0
  5. package/dist/types/{client/preview/types-6-0.js → builders/utils/standalone-options.js} +0 -0
  6. package/dist/types/client/{preview/angular/components → angular}/app.component.d.ts +1 -1
  7. package/dist/types/client/{preview/angular/components → angular}/app.component.js +1 -1
  8. package/dist/types/client/{preview/angular → angular}/app.token.d.ts +0 -0
  9. package/dist/types/client/{preview/angular → angular}/app.token.js +0 -0
  10. package/dist/types/client/{preview/angular → angular}/helpers.d.ts +1 -1
  11. package/dist/types/client/{preview/angular → angular}/helpers.js +1 -1
  12. package/dist/types/client/{preview/angular-beta → angular-beta}/AbstractRenderer.d.ts +1 -2
  13. package/dist/types/client/{preview/angular-beta → angular-beta}/AbstractRenderer.js +0 -0
  14. package/dist/types/client/{preview/angular-beta → angular-beta}/CanvasRenderer.d.ts +1 -2
  15. package/dist/types/client/{preview/angular-beta → angular-beta}/CanvasRenderer.js +0 -0
  16. package/dist/types/client/{preview/angular-beta → angular-beta}/ComputesTemplateFromComponent.d.ts +0 -0
  17. package/dist/types/client/{preview/angular-beta → angular-beta}/ComputesTemplateFromComponent.js +0 -0
  18. package/dist/types/client/{preview/angular-beta → angular-beta}/DocsRenderer.d.ts +1 -2
  19. package/dist/types/client/{preview/angular-beta → angular-beta}/DocsRenderer.js +0 -0
  20. package/dist/types/client/{preview/angular-beta → angular-beta}/RendererFactory.d.ts +0 -0
  21. package/dist/types/client/{preview/angular-beta → angular-beta}/RendererFactory.js +0 -0
  22. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookModule.d.ts +0 -0
  23. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookModule.js +11 -5
  24. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookProvider.d.ts +0 -0
  25. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookProvider.js +0 -0
  26. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookWrapperComponent.d.ts +0 -0
  27. package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookWrapperComponent.js +0 -0
  28. package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgComponentAnalyzer.d.ts +1 -0
  29. package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgComponentAnalyzer.js +11 -1
  30. package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgModulesAnalyzer.d.ts +0 -0
  31. package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgModulesAnalyzer.js +0 -0
  32. package/dist/types/client/{preview/config.d.ts → config.d.ts} +1 -1
  33. package/dist/types/client/{preview/config.js → config.js} +0 -0
  34. package/dist/types/client/{preview/decorateStory.d.ts → decorateStory.d.ts} +1 -1
  35. package/dist/types/client/{preview/decorateStory.js → decorateStory.js} +0 -0
  36. package/dist/types/client/{preview/decorators.d.ts → decorators.d.ts} +1 -2
  37. package/dist/types/client/{preview/decorators.js → decorators.js} +0 -0
  38. package/dist/types/client/docs/config.d.ts +1 -2
  39. package/dist/types/client/docs/config.js +0 -2
  40. package/dist/types/client/docs/sourceDecorator.d.ts +2 -2
  41. package/dist/types/client/{preview/angular-polyfills.d.ts → globals.d.ts} +0 -10
  42. package/dist/types/client/{preview/angular-polyfills.js → globals.js} +7 -1
  43. package/dist/types/client/index.d.ts +5 -4
  44. package/dist/types/client/index.js +5 -12
  45. package/dist/types/client/{preview/index.d.ts → public-api.d.ts} +2 -4
  46. package/dist/types/client/{preview/index.js → public-api.js} +18 -4
  47. package/dist/types/client/{preview/types-6-0.d.ts → public-types.d.ts} +4 -19
  48. package/dist/types/client/{preview/types-7-0.js → public-types.js} +0 -0
  49. package/dist/types/client/{preview/render.d.ts → render.d.ts} +1 -1
  50. package/dist/types/client/{preview/render.js → render.js} +0 -0
  51. package/dist/types/client/{preview/types.d.ts → types.d.ts} +13 -0
  52. package/dist/types/client/{preview/types.js → types.js} +0 -0
  53. package/dist/types/index.d.ts +1 -1
  54. package/dist/types/index.js +1 -1
  55. package/dist/types/preset.d.ts +5 -11
  56. package/dist/types/preset.js +23 -8
  57. package/dist/types/renderer.d.ts +4 -4
  58. package/dist/types/renderer.js +4 -4
  59. package/dist/types/server/framework-preset-angular-cli.js +3 -3
  60. package/dist/types/types.d.ts +24 -9
  61. package/package.json +14 -14
  62. package/dist/types/client/docs/prepareForInline.d.ts +0 -7
  63. package/dist/types/client/docs/prepareForInline.js +0 -37
  64. package/dist/types/client/preview/globals.d.ts +0 -1
  65. package/dist/types/client/preview/globals.js +0 -9
  66. package/dist/types/client/preview/types-7-0.d.ts +0 -9
  67. package/standalone.d.ts +0 -21
  68. package/standalone.js +0 -7
  69. package/types-6-0.d.ts +0 -1
  70. package/types-7-0.d.ts +0 -1
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const architect_1 = require("@angular-devkit/architect");
7
4
  const rxjs_1 = require("rxjs");
8
5
  const operators_1 = require("rxjs/operators");
9
6
  const find_up_1 = require("find-up");
10
- // eslint-disable-next-line import/no-extraneous-dependencies
11
- const standalone_1 = __importDefault(require("@storybook/angular/standalone"));
7
+ const read_pkg_up_1 = require("read-pkg-up");
8
+ const core_server_1 = require("@storybook/core-server");
12
9
  const run_compodoc_1 = require("../utils/run-compodoc");
13
10
  const build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
14
11
  exports.default = (0, architect_1.createBuilder)(commandBuilder);
@@ -21,6 +18,7 @@ function commandBuilder(options, context) {
21
18
  }), (0, operators_1.map)(({ tsConfig }) => {
22
19
  const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, outputDir, quiet, webpackStatsJson, } = options;
23
20
  const standaloneOptions = {
21
+ packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
24
22
  configDir,
25
23
  docs,
26
24
  loglevel,
@@ -54,5 +52,5 @@ async function setup(options, context) {
54
52
  };
55
53
  }
56
54
  function runInstance(options) {
57
- return (0, rxjs_1.from)((0, standalone_1.default)(options)).pipe((0, operators_1.catchError)((error) => (0, rxjs_1.throwError)((0, build_standalone_errors_handler_1.buildStandaloneErrorHandler)(error))));
55
+ return (0, rxjs_1.from)((0, core_server_1.buildStaticStandalone)(options)).pipe((0, operators_1.catchError)((error) => (0, rxjs_1.throwError)((0, build_standalone_errors_handler_1.buildStandaloneErrorHandler)(error))));
58
56
  }
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const architect_1 = require("@angular-devkit/architect");
7
4
  const rxjs_1 = require("rxjs");
8
5
  const operators_1 = require("rxjs/operators");
9
6
  const find_up_1 = require("find-up");
10
- // eslint-disable-next-line import/no-extraneous-dependencies
11
- const standalone_1 = __importDefault(require("@storybook/angular/standalone"));
7
+ const read_pkg_up_1 = require("read-pkg-up");
8
+ const core_server_1 = require("@storybook/core-server");
12
9
  const run_compodoc_1 = require("../utils/run-compodoc");
13
10
  const build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
14
11
  exports.default = (0, architect_1.createBuilder)(commandBuilder);
@@ -21,6 +18,7 @@ function commandBuilder(options, context) {
21
18
  }), (0, operators_1.map)(({ tsConfig }) => {
22
19
  const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, smokeTest, sslCa, sslCert, sslKey, } = options;
23
20
  const standaloneOptions = {
21
+ packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
24
22
  ci,
25
23
  configDir,
26
24
  docs,
@@ -61,6 +59,6 @@ async function setup(options, context) {
61
59
  function runInstance(options) {
62
60
  return new rxjs_1.Observable((observer) => {
63
61
  // This Observable intentionally never complete, leaving the process running ;)
64
- (0, standalone_1.default)(options).then(() => observer.next(), (error) => observer.error((0, build_standalone_errors_handler_1.buildStandaloneErrorHandler)(error)));
62
+ (0, core_server_1.buildDevStandalone)(options).then(() => observer.next(), (error) => observer.error((0, build_standalone_errors_handler_1.buildStandaloneErrorHandler)(error)));
65
63
  });
66
64
  }
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.buildStandaloneErrorHandler = void 0;
7
4
  const node_logger_1 = require("@storybook/node-logger");
8
- const ts_dedent_1 = __importDefault(require("ts-dedent"));
5
+ const ts_dedent_1 = require("ts-dedent");
9
6
  const buildStandaloneErrorHandler = (error) => {
10
7
  // Duplicate code for Standalone error handling
11
8
  // Source: https://github.com/storybookjs/storybook/blob/39c7ba09ad84fbd466f9c25d5b92791a5450b9f6/lib/core-server/src/build-dev.ts#L136
@@ -26,11 +23,11 @@ const buildStandaloneErrorHandler = (error) => {
26
23
  }
27
24
  node_logger_1.logger.line();
28
25
  return error.close
29
- ? (0, ts_dedent_1.default) `
26
+ ? (0, ts_dedent_1.dedent) `
30
27
  FATAL broken build!, will close the process,
31
28
  Fix the error below and restart storybook.
32
29
  `
33
- : (0, ts_dedent_1.default) `
30
+ : (0, ts_dedent_1.dedent) `
34
31
  Broken build, fix the error above.
35
32
  You may need to refresh the browser.
36
33
  `;
@@ -0,0 +1,12 @@
1
+ import type { BuilderContext } from '@angular-devkit/architect';
2
+ import type { LoadOptions, CLIOptions, BuilderOptions } from '@storybook/core-common';
3
+ export declare type StandaloneOptions = Partial<CLIOptions & LoadOptions & BuilderOptions & {
4
+ mode?: 'static' | 'dev';
5
+ angularBrowserTarget?: string | null;
6
+ angularBuilderOptions?: Record<string, any> & {
7
+ styles?: any[];
8
+ stylePreprocessorOptions?: any;
9
+ };
10
+ angularBuilderContext?: BuilderContext | null;
11
+ tsConfig?: string;
12
+ }>;
@@ -1,6 +1,6 @@
1
1
  import { OnInit, ViewContainerRef, ComponentFactoryResolver, OnDestroy, ChangeDetectorRef } from '@angular/core';
2
2
  import { Observable, Subscription } from 'rxjs';
3
- import { StoryFnAngularReturnType } from '../../types';
3
+ import { StoryFnAngularReturnType } from '../types';
4
4
  export declare class AppComponent implements OnInit, OnDestroy {
5
5
  private cfr;
6
6
  private changeDetectorRef;
@@ -21,7 +21,7 @@ exports.AppComponent = void 0;
21
21
  const core_1 = require("@angular/core");
22
22
  const rxjs_1 = require("rxjs");
23
23
  const operators_1 = require("rxjs/operators");
24
- const app_token_1 = require("../app.token");
24
+ const app_token_1 = require("./app.token");
25
25
  let AppComponent = class AppComponent {
26
26
  constructor(cfr, changeDetectorRef, data) {
27
27
  this.cfr = cfr;
@@ -1,5 +1,5 @@
1
1
  import type { PartialStoryFn } from '@storybook/csf';
2
- import type { AngularFramework } from '../types-6-0';
2
+ import type { AngularFramework } from '../types';
3
3
  declare global {
4
4
  interface Window {
5
5
  NODE_ENV: 'string' | 'development' | undefined;
@@ -11,7 +11,7 @@ const forms_1 = require("@angular/forms");
11
11
  const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
12
12
  const platform_browser_1 = require("@angular/platform-browser");
13
13
  const rxjs_1 = require("rxjs");
14
- const app_component_1 = require("./components/app.component");
14
+ const app_component_1 = require("./app.component");
15
15
  const app_token_1 = require("./app.token");
16
16
  const { document } = global_1.default;
17
17
  let platform = null;
@@ -1,6 +1,5 @@
1
1
  import { Subject } from 'rxjs';
2
- import { ICollection, StoryFnAngularReturnType } from '../types';
3
- import { Parameters } from '../types-6-0';
2
+ import { ICollection, StoryFnAngularReturnType, Parameters } from '../types';
4
3
  declare type StoryRenderInfo = {
5
4
  storyFnAngular: StoryFnAngularReturnType;
6
5
  moduleMetadataSnapshot: string;
@@ -1,6 +1,5 @@
1
1
  import { AbstractRenderer } from './AbstractRenderer';
2
- import { StoryFnAngularReturnType } from '../types';
3
- import { Parameters } from '../types-6-0';
2
+ import { StoryFnAngularReturnType, Parameters } from '../types';
4
3
  export declare class CanvasRenderer extends AbstractRenderer {
5
4
  render(options: {
6
5
  storyFnAngular: StoryFnAngularReturnType;
@@ -1,6 +1,5 @@
1
1
  import { AbstractRenderer } from './AbstractRenderer';
2
- import { StoryFnAngularReturnType } from '../types';
3
- import { Parameters } from '../types-6-0';
2
+ import { StoryFnAngularReturnType, Parameters } from '../types';
4
3
  export declare class DocsRenderer extends AbstractRenderer {
5
4
  render(options: {
6
5
  storyFnAngular: StoryFnAngularReturnType;
@@ -12,18 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createStorybookModule = exports.getStorybookModuleMetadata = void 0;
13
13
  const core_1 = require("@angular/core");
14
14
  const platform_browser_1 = require("@angular/platform-browser");
15
- const ts_dedent_1 = __importDefault(require("ts-dedent"));
15
+ const ts_dedent_1 = require("ts-dedent");
16
16
  const util_deprecate_1 = __importDefault(require("util-deprecate"));
17
17
  const StorybookProvider_1 = require("./StorybookProvider");
18
18
  const NgModulesAnalyzer_1 = require("./utils/NgModulesAnalyzer");
19
19
  const NgComponentAnalyzer_1 = require("./utils/NgComponentAnalyzer");
20
20
  const StorybookWrapperComponent_1 = require("./StorybookWrapperComponent");
21
21
  const ComputesTemplateFromComponent_1 = require("./ComputesTemplateFromComponent");
22
- const deprecatedStoryComponentWarning = (0, util_deprecate_1.default)(() => { }, (0, ts_dedent_1.default) `\`component\` story return value is deprecated, and will be removed in Storybook 7.0.
22
+ const deprecatedStoryComponentWarning = (0, util_deprecate_1.default)(() => { }, (0, ts_dedent_1.dedent) `\`component\` story return value is deprecated, and will be removed in Storybook 7.0.
23
23
  Instead, use \`export const default = () => ({ component: AppComponent });\`
24
24
  or
25
25
  \`\`\`
26
- export const Primary: Story = () => ({});
26
+ export const Primary: StoryFn = () => ({});
27
27
  Primary.parameters = { component: AppComponent };
28
28
  \`\`\`
29
29
  Read more at
@@ -44,16 +44,22 @@ const getStorybookModuleMetadata = ({ storyFnAngular, component: annotatedCompon
44
44
  * Create a component that wraps generated template and gives it props
45
45
  */
46
46
  const ComponentToInject = (0, StorybookWrapperComponent_1.createStorybookWrapperComponent)(targetSelector, template, component, styles, props);
47
+ const isStandalone = (0, NgComponentAnalyzer_1.isStandaloneComponent)(component);
47
48
  // Look recursively (deep) if the component is not already declared by an import module
48
49
  const requiresComponentDeclaration = (0, NgComponentAnalyzer_1.isDeclarable)(component) &&
49
- !(0, NgModulesAnalyzer_1.isComponentAlreadyDeclaredInModules)(component, moduleMetadata.declarations, moduleMetadata.imports);
50
+ !(0, NgModulesAnalyzer_1.isComponentAlreadyDeclaredInModules)(component, moduleMetadata.declarations, moduleMetadata.imports) &&
51
+ !isStandalone;
50
52
  return {
51
53
  declarations: [
52
54
  ...(requiresComponentDeclaration ? [component] : []),
53
55
  ComponentToInject,
54
56
  ...(moduleMetadata.declarations ?? []),
55
57
  ],
56
- imports: [platform_browser_1.BrowserModule, ...(moduleMetadata.imports ?? [])],
58
+ imports: [
59
+ platform_browser_1.BrowserModule,
60
+ ...(isStandalone ? [component] : []),
61
+ ...(moduleMetadata.imports ?? []),
62
+ ],
57
63
  providers: [(0, StorybookProvider_1.storyPropsProvider)(storyProps$), ...(moduleMetadata.providers ?? [])],
58
64
  entryComponents: [...(moduleMetadata.entryComponents ?? [])],
59
65
  schemas: [...(moduleMetadata.schemas ?? [])],
@@ -15,6 +15,7 @@ export declare type ComponentInputsOutputs = {
15
15
  export declare const getComponentInputsOutputs: (component: any) => ComponentInputsOutputs;
16
16
  export declare const isDeclarable: (component: any) => boolean;
17
17
  export declare const isComponent: (component: any) => component is Type<unknown>;
18
+ export declare const isStandaloneComponent: (component: any) => component is Type<unknown>;
18
19
  /**
19
20
  * Returns all component decorator properties
20
21
  * is used to get all `@Input` and `@Output` Decorator
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
3
+ exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isStandaloneComponent = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
4
4
  const core_1 = require("@angular/core");
5
5
  const reflectionCapabilities = new core_1.ɵReflectionCapabilities();
6
6
  /**
@@ -69,6 +69,16 @@ const isComponent = (component) => {
69
69
  return (decorators || []).some((d) => d instanceof core_1.Component);
70
70
  };
71
71
  exports.isComponent = isComponent;
72
+ const isStandaloneComponent = (component) => {
73
+ if (!component) {
74
+ return false;
75
+ }
76
+ const decorators = reflectionCapabilities.annotations(component);
77
+ // TODO: `standalone` is only available in Angular v14. Remove cast to `any` once
78
+ // Angular deps are updated to v14.x.x.
79
+ return (decorators || []).some((d) => d instanceof core_1.Component && d.standalone);
80
+ };
81
+ exports.isStandaloneComponent = isStandaloneComponent;
72
82
  /**
73
83
  * Returns all component decorator properties
74
84
  * is used to get all `@Input` and `@Output` Decorator
@@ -2,5 +2,5 @@ import './globals';
2
2
  export { render, renderToDOM } from './render';
3
3
  export { decorateStory } from './decorateStory';
4
4
  export declare const parameters: {
5
- framework: string;
5
+ framework: "angular";
6
6
  };
@@ -1,4 +1,4 @@
1
1
  import type { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
2
- import type { AngularFramework } from './types-6-0';
2
+ import type { AngularFramework } from './types';
3
3
  export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
4
4
  export { decorateStory };
@@ -1,6 +1,5 @@
1
1
  import type { Type } from '@angular/core';
2
2
  import type { DecoratorFunction, StoryContext } from '@storybook/csf';
3
- import type { ICollection, NgModuleMetadata } from './types';
4
- import type { AngularFramework } from './types-6-0';
3
+ import type { ICollection, NgModuleMetadata, AngularFramework } from './types';
5
4
  export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularFramework, TArgs>;
6
5
  export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularFramework, TArgs>) => ICollection)) => DecoratorFunction<AngularFramework, TArgs>;
@@ -2,7 +2,6 @@ import { SourceType } from '@storybook/docs-tools';
2
2
  export declare const parameters: {
3
3
  docs: {
4
4
  inlineStories: boolean;
5
- prepareForInline: (storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, { id, parameters, component }: import("..").StoryContext) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<undefined>, undefined>;
6
5
  extractArgTypes: (component: import("./types").Directive) => import("lib/api/dist/types").ArgTypes;
7
6
  extractComponentDescription: (component: import("./types").Directive) => string;
8
7
  source: {
@@ -11,5 +10,5 @@ export declare const parameters: {
11
10
  };
12
11
  };
13
12
  };
14
- export declare const decorators: ((storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, context: import("..").StoryContext) => import("..").IStory)[];
13
+ export declare const decorators: ((storyFn: import("@storybook/csf").PartialStoryFn<import("../types").AngularFramework, import("@storybook/csf").Args>, context: import("../types").StoryContext) => import("..").IStory)[];
15
14
  export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("lib/addons/dist/types").Parameters)[];
@@ -4,12 +4,10 @@ exports.argTypesEnhancers = exports.decorators = exports.parameters = void 0;
4
4
  const docs_tools_1 = require("@storybook/docs-tools");
5
5
  const compodoc_1 = require("./compodoc");
6
6
  const sourceDecorator_1 = require("./sourceDecorator");
7
- const prepareForInline_1 = require("./prepareForInline");
8
7
  exports.parameters = {
9
8
  docs: {
10
9
  // probably set this to true by default once it's battle-tested
11
10
  inlineStories: false,
12
- prepareForInline: prepareForInline_1.prepareForInline,
13
11
  extractArgTypes: compodoc_1.extractArgTypes,
14
12
  extractComponentDescription: compodoc_1.extractComponentDescription,
15
13
  source: {
@@ -1,9 +1,9 @@
1
1
  import type { PartialStoryFn } from '@storybook/csf';
2
- import { StoryContext, AngularFramework } from '..';
2
+ import { StoryContext, AngularFramework } 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<AngularFramework>, context: StoryContext) => import("..").IStory;
9
+ export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularFramework>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
@@ -29,13 +29,3 @@ import 'core-js/proposals/reflect-metadata';
29
29
  * Zone JS is required by Angular itself.
30
30
  */
31
31
  import 'zone.js/dist/zone';
32
- /** *************************************************************************************************
33
- * APPLICATION IMPORTS
34
- */
35
- /**
36
- * Date, currency, decimal and percent pipes.
37
- * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
38
- */
39
- /**
40
- * Need to import at least one locale-data with intl.
41
- */
@@ -1,4 +1,9 @@
1
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
+ const global_1 = __importDefault(require("global"));
2
7
  /**
3
8
  * This file includes polyfills needed by Angular and is loaded before the app.
4
9
  * You can add your own extra polyfills to this file.
@@ -14,7 +19,6 @@
14
19
  *
15
20
  * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
16
21
  */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
22
  /** *************************************************************************************************
19
23
  * BROWSER POLYFILLS
20
24
  */
@@ -59,3 +63,5 @@ require("zone.js/dist/zone"); // Included with Angular CLI.
59
63
  * Need to import at least one locale-data with intl.
60
64
  */
61
65
  // import 'intl/locale-data/jsonp/en';
66
+ const { window: globalWindow } = global_1.default;
67
+ globalWindow.STORYBOOK_ENV = 'angular';
@@ -1,4 +1,5 @@
1
- export { storiesOf, setAddon, addDecorator, addParameters, configure, getStorybook, forceReRender, raw, } from './preview';
2
- export * from './preview/types-6-0';
3
- export type { StoryFnAngularReturnType as IStory } from './preview/types';
4
- export { moduleMetadata, componentWrapperDecorator } from './preview/decorators';
1
+ import './globals';
2
+ export * from './public-api';
3
+ export * from './public-types';
4
+ export type { StoryFnAngularReturnType as IStory } from './types';
5
+ export { moduleMetadata, componentWrapperDecorator } from './decorators';
@@ -14,18 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.componentWrapperDecorator = exports.moduleMetadata = exports.raw = exports.forceReRender = exports.getStorybook = exports.configure = exports.addParameters = exports.addDecorator = exports.setAddon = exports.storiesOf = void 0;
18
- var preview_1 = require("./preview");
19
- Object.defineProperty(exports, "storiesOf", { enumerable: true, get: function () { return preview_1.storiesOf; } });
20
- Object.defineProperty(exports, "setAddon", { enumerable: true, get: function () { return preview_1.setAddon; } });
21
- Object.defineProperty(exports, "addDecorator", { enumerable: true, get: function () { return preview_1.addDecorator; } });
22
- Object.defineProperty(exports, "addParameters", { enumerable: true, get: function () { return preview_1.addParameters; } });
23
- Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return preview_1.configure; } });
24
- Object.defineProperty(exports, "getStorybook", { enumerable: true, get: function () { return preview_1.getStorybook; } });
25
- Object.defineProperty(exports, "forceReRender", { enumerable: true, get: function () { return preview_1.forceReRender; } });
26
- Object.defineProperty(exports, "raw", { enumerable: true, get: function () { return preview_1.raw; } });
27
- __exportStar(require("./preview/types-6-0"), exports);
28
- var decorators_1 = require("./preview/decorators");
17
+ exports.componentWrapperDecorator = exports.moduleMetadata = void 0;
18
+ require("./globals");
19
+ __exportStar(require("./public-api"), exports);
20
+ __exportStar(require("./public-types"), exports);
21
+ var decorators_1 = require("./decorators");
29
22
  Object.defineProperty(exports, "moduleMetadata", { enumerable: true, get: function () { return decorators_1.moduleMetadata; } });
30
23
  Object.defineProperty(exports, "componentWrapperDecorator", { enumerable: true, get: function () { return decorators_1.componentWrapperDecorator; } });
31
24
  // optimization: stop HMR propagation in webpack
@@ -1,9 +1,8 @@
1
1
  /// <reference types="webpack-env" />
2
2
  /// <reference types="node" />
3
3
  import type { ClientStoryApi, Loadable } from '@storybook/addons';
4
- import './globals';
5
- import type { IStorybookSection } from './types';
6
- import type { AngularFramework } from './types-6-0';
4
+ import type { IStorybookSection, AngularFramework } from './types';
5
+ export * from './public-types';
7
6
  interface ClientApi extends ClientStoryApi<AngularFramework['storyResult']> {
8
7
  setAddon(addon: any): void;
9
8
  configure(loader: Loadable, module: NodeModule): void;
@@ -22,4 +21,3 @@ export declare const setAddon: ClientApi['setAddon'];
22
21
  export declare const forceReRender: ClientApi['forceReRender'];
23
22
  export declare const getStorybook: ClientApi['getStorybook'];
24
23
  export declare const raw: ClientApi['raw'];
25
- export {};
@@ -1,22 +1,36 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
6
20
  exports.raw = exports.getStorybook = exports.forceReRender = exports.setAddon = exports.clearDecorators = exports.addParameters = exports.addDecorator = exports.configure = exports.storiesOf = void 0;
7
21
  const core_client_1 = require("@storybook/core-client");
8
- require("./globals");
9
22
  const render_1 = require("./render");
10
23
  const decorateStory_1 = __importDefault(require("./decorateStory"));
11
- const framework = 'angular';
24
+ __exportStar(require("./public-types"), exports);
25
+ const FRAMEWORK = 'angular';
12
26
  const api = (0, core_client_1.start)(render_1.renderToDOM, { decorateStory: decorateStory_1.default, render: render_1.render });
13
27
  const storiesOf = (kind, m) => {
14
28
  return api.clientApi.storiesOf(kind, m).addParameters({
15
- framework,
29
+ framework: FRAMEWORK,
16
30
  });
17
31
  };
18
32
  exports.storiesOf = storiesOf;
19
- const configure = (...args) => api.configure(framework, ...args);
33
+ const configure = (...args) => api.configure(FRAMEWORK, ...args);
20
34
  exports.configure = configure;
21
35
  exports.addDecorator = api.clientApi
22
36
  .addDecorator;
@@ -1,10 +1,6 @@
1
- import type { Args, Parameters as DefaultParameters, StoryContext as DefaultStoryContext, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
2
- import type { StoryFnAngularReturnType } from './types';
1
+ import type { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
2
+ import { AngularFramework } from './types';
3
3
  export type { Args, ArgTypes } from '@storybook/csf';
4
- export declare type AngularFramework = {
5
- component: any;
6
- storyResult: StoryFnAngularReturnType;
7
- };
8
4
  /**
9
5
  * Metadata to configure the stories for a component.
10
6
  *
@@ -24,19 +20,8 @@ export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularFramework, T
24
20
  */
25
21
  export declare type StoryObj<TArgs = Args> = StoryAnnotations<AngularFramework, TArgs>;
26
22
  /**
27
- * Story function that represents a CSFv2 component example.
23
+ * Story function that represents a CSFv3 component example.
28
24
  *
29
25
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
30
- *
31
- * NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
32
- *
33
26
  */
34
- export declare type Story<TArgs = Args> = StoryFn<TArgs>;
35
- export declare type Parameters = DefaultParameters & {
36
- /** Uses legacy angular rendering engine that use dynamic component */
37
- angularLegacyRendering?: boolean;
38
- bootstrapModuleOptions?: unknown;
39
- };
40
- export declare type StoryContext = DefaultStoryContext<AngularFramework> & {
41
- parameters: Parameters;
42
- };
27
+ export declare type Story<TArgs = Args> = StoryObj<TArgs>;
@@ -1,6 +1,6 @@
1
1
  import type { RenderContext } from '@storybook/store';
2
2
  import type { ArgsStoryFn } from '@storybook/csf';
3
- import type { AngularFramework } from './types-6-0';
3
+ import type { AngularFramework } from './types';
4
4
  import { RendererFactory } from './angular-beta/RendererFactory';
5
5
  export declare const rendererFactory: RendererFactory;
6
6
  export declare const render: ArgsStoryFn<AngularFramework>;
@@ -1,3 +1,4 @@
1
+ import type { Parameters as DefaultParameters, StoryContext as DefaultStoryContext } from '@storybook/csf';
1
2
  export interface NgModuleMetadata {
2
3
  declarations?: any[];
3
4
  entryComponents?: any[];
@@ -27,3 +28,15 @@ export interface StoryFnAngularReturnType {
27
28
  styles?: string[];
28
29
  userDefinedTemplate?: boolean;
29
30
  }
31
+ export declare type AngularFramework = {
32
+ component: any;
33
+ storyResult: StoryFnAngularReturnType;
34
+ };
35
+ export declare type Parameters = DefaultParameters & {
36
+ /** Uses legacy angular rendering engine that use dynamic component */
37
+ angularLegacyRendering?: boolean;
38
+ bootstrapModuleOptions?: unknown;
39
+ };
40
+ export declare type StoryContext = DefaultStoryContext<AngularFramework> & {
41
+ parameters: Parameters;
42
+ };
File without changes
@@ -1,2 +1,2 @@
1
- export * from './client';
1
+ export * from './client/index';
2
2
  export * from './types';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client"), exports);
17
+ __exportStar(require("./client/index"), exports);
18
18
  __exportStar(require("./types"), exports);
19
19
  /*
20
20
  * ATTENTION:
@@ -1,12 +1,6 @@
1
- import type { StorybookConfig } from '@storybook/core-common';
1
+ import type { PresetProperty } from '@storybook/core-common';
2
+ import { StorybookConfig } from './types';
3
+ export declare const addons: PresetProperty<'addons', StorybookConfig>;
2
4
  export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
3
- export declare const addons: StorybookConfig['addons'];
4
- export declare const core: (config: StorybookConfig['core']) => Promise<{
5
- builder: string;
6
- disableWebpackDefaults?: boolean;
7
- channelOptions?: Partial<import("telejson").Options>;
8
- disableProjectJson?: boolean;
9
- disableTelemetry?: boolean;
10
- enableCrashReports?: boolean;
11
- crossOriginIsolated?: boolean;
12
- }>;
5
+ export declare const core: PresetProperty<'core', StorybookConfig>;
6
+ export declare const typescript: PresetProperty<'typescript', StorybookConfig>;
@@ -1,21 +1,36 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.core = exports.addons = exports.previewAnnotations = void 0;
4
- const previewAnnotations = (entries = []) => [
5
- ...entries,
6
- require.resolve('./client/preview/config'),
7
- ];
8
- exports.previewAnnotations = previewAnnotations;
6
+ exports.typescript = exports.core = exports.previewAnnotations = exports.addons = void 0;
7
+ const path_1 = __importDefault(require("path"));
9
8
  exports.addons = [
10
9
  require.resolve('./server/framework-preset-angular'),
11
10
  require.resolve('./server/framework-preset-angular-cli'),
12
11
  require.resolve('./server/framework-preset-angular-ivy'),
13
12
  require.resolve('./server/framework-preset-angular-docs'),
14
13
  ];
15
- const core = async (config) => {
14
+ const previewAnnotations = (entries = []) => [
15
+ ...entries,
16
+ require.resolve('./client/config'),
17
+ ];
18
+ exports.previewAnnotations = previewAnnotations;
19
+ const core = async (config, options) => {
20
+ const framework = await options.presets.apply('framework');
16
21
  return {
17
22
  ...config,
18
- builder: require.resolve('@storybook/builder-webpack5'),
23
+ builder: {
24
+ name: path_1.default.dirname(require.resolve(path_1.default.join('@storybook/builder-webpack5', 'package.json'))),
25
+ options: typeof framework === 'string' ? {} : framework.options.builder || {},
26
+ },
19
27
  };
20
28
  };
21
29
  exports.core = core;
30
+ const typescript = async (config) => {
31
+ return {
32
+ ...config,
33
+ skipBabel: true,
34
+ };
35
+ };
36
+ exports.typescript = typescript;
@@ -1,4 +1,4 @@
1
- export { computesTemplateSourceFromComponent } from './client/preview/angular-beta/ComputesTemplateFromComponent';
2
- export { rendererFactory } from './client/preview/render';
3
- export { AbstractRenderer } from './client/preview/angular-beta/AbstractRenderer';
4
- export { getStorybookModuleMetadata } from './client/preview/angular-beta/StorybookModule';
1
+ export { computesTemplateSourceFromComponent } from './client/angular-beta/ComputesTemplateFromComponent';
2
+ export { rendererFactory } from './client/render';
3
+ export { AbstractRenderer } from './client/angular-beta/AbstractRenderer';
4
+ export { getStorybookModuleMetadata } from './client/angular-beta/StorybookModule';
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStorybookModuleMetadata = exports.AbstractRenderer = exports.rendererFactory = exports.computesTemplateSourceFromComponent = void 0;
4
- var ComputesTemplateFromComponent_1 = require("./client/preview/angular-beta/ComputesTemplateFromComponent");
4
+ var ComputesTemplateFromComponent_1 = require("./client/angular-beta/ComputesTemplateFromComponent");
5
5
  Object.defineProperty(exports, "computesTemplateSourceFromComponent", { enumerable: true, get: function () { return ComputesTemplateFromComponent_1.computesTemplateSourceFromComponent; } });
6
- var render_1 = require("./client/preview/render");
6
+ var render_1 = require("./client/render");
7
7
  Object.defineProperty(exports, "rendererFactory", { enumerable: true, get: function () { return render_1.rendererFactory; } });
8
- var AbstractRenderer_1 = require("./client/preview/angular-beta/AbstractRenderer");
8
+ var AbstractRenderer_1 = require("./client/angular-beta/AbstractRenderer");
9
9
  Object.defineProperty(exports, "AbstractRenderer", { enumerable: true, get: function () { return AbstractRenderer_1.AbstractRenderer; } });
10
- var StorybookModule_1 = require("./client/preview/angular-beta/StorybookModule");
10
+ var StorybookModule_1 = require("./client/angular-beta/StorybookModule");
11
11
  Object.defineProperty(exports, "getStorybookModuleMetadata", { enumerable: true, get: function () { return StorybookModule_1.getStorybookModuleMetadata; } });
@@ -31,7 +31,7 @@ const node_logger_1 = require("@storybook/node-logger");
31
31
  const architect_1 = require("@angular-devkit/architect");
32
32
  const find_up_1 = require("find-up");
33
33
  const semver_1 = __importDefault(require("@storybook/semver"));
34
- const ts_dedent_1 = __importDefault(require("ts-dedent"));
34
+ const ts_dedent_1 = require("ts-dedent");
35
35
  const core_1 = require("@angular-devkit/core");
36
36
  const module_is_available_1 = require("./utils/module-is-available");
37
37
  const angular_cli_webpack_12_2_x_1 = require("./angular-cli-webpack-12.2.x");
@@ -139,7 +139,7 @@ async function getLegacyDefaultBuildOptions(options) {
139
139
  // Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
140
140
  return {};
141
141
  }
142
- node_logger_1.logger.warn((0, ts_dedent_1.default) `Your Storybook startup uses a solution that will not be supported in version 7.0.
142
+ node_logger_1.logger.warn((0, ts_dedent_1.dedent) `Your Storybook startup uses a solution that will not be supported in version 7.0.
143
143
  You must use angular builder to have an explicit configuration on the project used in angular.json
144
144
  Read more at:
145
145
  - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)
@@ -163,7 +163,7 @@ async function getLegacyDefaultBuildOptions(options) {
163
163
  project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
164
164
  target: 'build',
165
165
  };
166
- const { target, project } = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
166
+ const { target } = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
167
167
  node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}" for configuring Storybook`);
168
168
  return { ...target.options };
169
169
  }
@@ -1,13 +1,28 @@
1
- import type { StorybookConfig as BaseConfig } from '@storybook/core-common';
2
- export interface AngularOptions {
3
- enableIvy: boolean;
4
- }
1
+ import type { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact } from '@storybook/core-webpack';
2
+ import type { StorybookConfigWebpack, BuilderOptions, TypescriptOptions as TypescriptOptionsBuilder } from '@storybook/builder-webpack5';
3
+ declare type FrameworkName = '@storybook/angular';
4
+ declare type BuilderName = '@storybook/builder-webpack5';
5
+ export declare type FrameworkOptions = AngularOptions & {
6
+ builder?: BuilderOptions;
7
+ };
8
+ declare type StorybookConfigFramework = {
9
+ framework: FrameworkName | {
10
+ name: FrameworkName;
11
+ options: FrameworkOptions;
12
+ };
13
+ core?: StorybookConfigBase['core'] & {
14
+ builder?: BuilderName | {
15
+ name: BuilderName;
16
+ options: BuilderOptions;
17
+ };
18
+ };
19
+ typescript?: Partial<TypescriptOptionsBuilder & TypescriptOptionsReact> & StorybookConfigBase['typescript'];
20
+ };
5
21
  /**
6
22
  * The interface for Storybook configuration in `main.ts` files.
7
23
  */
8
- export interface StorybookConfig extends BaseConfig {
9
- framework: string | {
10
- name: '@storybook/angular';
11
- options: AngularOptions;
12
- };
24
+ export declare type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
25
+ export interface AngularOptions {
26
+ enableIvy: boolean;
13
27
  }
28
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "7.0.0-alpha.0",
3
+ "version": "7.0.0-alpha.11",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -30,22 +30,23 @@
30
30
  "*.d.ts"
31
31
  ],
32
32
  "scripts": {
33
+ "check": "tsc --noEmit",
33
34
  "prepare": "node ../../scripts/prepare.js"
34
35
  },
35
36
  "dependencies": {
36
- "@storybook/addons": "7.0.0-alpha.0",
37
- "@storybook/api": "7.0.0-alpha.0",
38
- "@storybook/builder-webpack5": "7.0.0-alpha.0",
39
- "@storybook/client-logger": "7.0.0-alpha.0",
40
- "@storybook/core-client": "7.0.0-alpha.0",
41
- "@storybook/core-common": "7.0.0-alpha.0",
42
- "@storybook/core-events": "7.0.0-alpha.0",
43
- "@storybook/core-server": "7.0.0-alpha.0",
37
+ "@storybook/addons": "7.0.0-alpha.11",
38
+ "@storybook/api": "7.0.0-alpha.11",
39
+ "@storybook/builder-webpack5": "7.0.0-alpha.11",
40
+ "@storybook/client-logger": "7.0.0-alpha.11",
41
+ "@storybook/core-client": "7.0.0-alpha.11",
42
+ "@storybook/core-common": "7.0.0-alpha.11",
43
+ "@storybook/core-events": "7.0.0-alpha.11",
44
+ "@storybook/core-server": "7.0.0-alpha.11",
44
45
  "@storybook/csf": "0.0.2--canary.4566f4d.1",
45
- "@storybook/docs-tools": "7.0.0-alpha.0",
46
- "@storybook/node-logger": "7.0.0-alpha.0",
46
+ "@storybook/docs-tools": "7.0.0-alpha.11",
47
+ "@storybook/node-logger": "7.0.0-alpha.11",
47
48
  "@storybook/semver": "^7.3.2",
48
- "@storybook/store": "7.0.0-alpha.0",
49
+ "@storybook/store": "7.0.0-alpha.11",
49
50
  "@types/node": "^14.14.20 || ^16.0.0",
50
51
  "@types/react": "^16.14.23",
51
52
  "@types/react-dom": "^16.9.14",
@@ -62,7 +63,6 @@
62
63
  "react": "^16.14.0",
63
64
  "react-dom": "^16.14.0",
64
65
  "read-pkg-up": "^7.0.1",
65
- "regenerator-runtime": "^0.13.7",
66
66
  "sass-loader": "^12.6.0",
67
67
  "telejson": "^6.0.8",
68
68
  "ts-dedent": "^2.0.0",
@@ -128,5 +128,5 @@
128
128
  "access": "public"
129
129
  },
130
130
  "builders": "dist/types/builders/builders.json",
131
- "gitHead": "c82d897ea765da8cf4fbbcc2af1f28c808a93e23"
131
+ "gitHead": "688d338903e84a7e83cb104472e868e734399f65"
132
132
  }
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { PartialStoryFn } from '@storybook/csf';
3
- import { AngularFramework, StoryContext } from '..';
4
- /**
5
- * Uses the angular renderer to generate a story. Uses p-limit to run synchronously
6
- */
7
- export declare const prepareForInline: (storyFn: PartialStoryFn<AngularFramework>, { id, parameters, component }: StoryContext) => React.DetailedReactHTMLElement<React.HTMLAttributes<undefined>, undefined>;
@@ -1,37 +0,0 @@
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
- exports.prepareForInline = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const p_limit_1 = __importDefault(require("p-limit"));
9
- const nanoid_1 = require("nanoid");
10
- const renderer_1 = require("../../renderer");
11
- const limit = (0, p_limit_1.default)(1);
12
- /**
13
- * Uses the angular renderer to generate a story. Uses p-limit to run synchronously
14
- */
15
- const prepareForInline = (storyFn, { id, parameters, component }) => {
16
- const el = react_1.default.useRef();
17
- react_1.default.useEffect(() => {
18
- (async () => {
19
- limit(async () => {
20
- const renderer = await renderer_1.rendererFactory.getRendererInstance(`${id}-${(0, nanoid_1.nanoid)(10)}`.toLowerCase(), el.current);
21
- if (renderer) {
22
- await renderer.render({
23
- forced: false,
24
- component,
25
- parameters,
26
- storyFnAngular: storyFn(),
27
- targetDOMNode: el.current,
28
- });
29
- }
30
- });
31
- })();
32
- });
33
- return react_1.default.createElement('div', {
34
- ref: el,
35
- });
36
- };
37
- exports.prepareForInline = prepareForInline;
@@ -1 +0,0 @@
1
- import './angular-polyfills';
@@ -1,9 +0,0 @@
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
- const global_1 = __importDefault(require("global"));
7
- require("./angular-polyfills");
8
- const { window: globalWindow } = global_1.default;
9
- globalWindow.STORYBOOK_ENV = 'angular';
@@ -1,9 +0,0 @@
1
- import type { Args } from '@storybook/csf';
2
- import type { StoryObj } from './types-6-0';
3
- export type { StoryFn, StoryObj, Meta } from './types-6-0';
4
- /**
5
- * Story function that represents a CSFv3 component example.
6
- *
7
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
8
- */
9
- export declare type Story<TArgs = Args> = StoryObj<TArgs>;
package/standalone.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core-common';
2
- import type { BuilderContext } from '@angular-devkit/architect';
3
-
4
- export type StandaloneOptions = Partial<
5
- CLIOptions &
6
- LoadOptions &
7
- BuilderOptions & {
8
- mode?: 'static' | 'dev';
9
- angularBrowserTarget?: string | null;
10
- angularBuilderOptions?: Record<string, any> & {
11
- styles?: any[];
12
- stylePreprocessorOptions?: any;
13
- };
14
- angularBuilderContext?: BuilderContext | null;
15
- tsConfig?: string;
16
- }
17
- >;
18
-
19
- declare module '@storybook/angular/standalone' {
20
- export default function buildStandalone(options: StandaloneOptions): Promise<unknown>;
21
- }
package/standalone.js DELETED
@@ -1,7 +0,0 @@
1
- const build = require('@storybook/core-server/standalone');
2
-
3
- async function buildStandalone(options) {
4
- return build(options);
5
- }
6
-
7
- module.exports = buildStandalone;
package/types-6-0.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/client/preview/types-6-0.d';
package/types-7-0.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/client/preview/types-7-0.d';