@storybook/angular 8.3.0-alpha.0 → 8.3.0-alpha.10

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 (78) hide show
  1. package/dist/builders/build-storybook/index.d.ts +2 -2
  2. package/dist/builders/build-storybook/index.js +6 -6
  3. package/dist/builders/build-storybook/index.spec.js +2 -3
  4. package/dist/builders/start-storybook/index.d.ts +2 -2
  5. package/dist/builders/start-storybook/index.js +6 -6
  6. package/dist/builders/start-storybook/index.spec.js +3 -27
  7. package/dist/builders/utils/run-compodoc.js +4 -27
  8. package/dist/builders/utils/run-compodoc.spec.js +1 -2
  9. package/dist/builders/utils/standalone-options.d.ts +1 -1
  10. package/dist/client/angular-beta/AbstractRenderer.d.ts +16 -15
  11. package/dist/client/angular-beta/AbstractRenderer.js +17 -16
  12. package/dist/client/angular-beta/CanvasRenderer.d.ts +1 -1
  13. package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +8 -1
  14. package/dist/client/angular-beta/ComputesTemplateFromComponent.js +33 -5
  15. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +340 -12
  16. package/dist/client/angular-beta/DocsRenderer.d.ts +1 -1
  17. package/dist/client/angular-beta/DocsRenderer.js +8 -11
  18. package/dist/client/angular-beta/RendererFactory.js +1 -1
  19. package/dist/client/angular-beta/StorybookModule.js +2 -4
  20. package/dist/client/angular-beta/StorybookModule.test.js +6 -6
  21. package/dist/client/angular-beta/StorybookProvider.d.ts +1 -1
  22. package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +1 -3
  23. package/dist/client/angular-beta/StorybookWrapperComponent.js +1 -3
  24. package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +3 -0
  25. package/dist/client/angular-beta/__testfixtures__/input.component.js +9 -0
  26. package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +5 -7
  27. package/dist/client/angular-beta/utils/BootstrapQueue.js +8 -13
  28. package/dist/client/angular-beta/utils/BootstrapQueue.test.js +5 -4
  29. package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +4 -11
  30. package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +3 -10
  31. package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +1 -3
  32. package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -2
  33. package/dist/client/angular-beta/utils/PropertyExtractor.test.js +2 -2
  34. package/dist/client/angular-beta/utils/StoryUID.d.ts +8 -9
  35. package/dist/client/angular-beta/utils/StoryUID.js +9 -12
  36. package/dist/client/argsToTemplate.d.ts +13 -12
  37. package/dist/client/argsToTemplate.js +12 -7
  38. package/dist/client/argsToTemplate.test.js +7 -1
  39. package/dist/client/decorators.d.ts +5 -6
  40. package/dist/client/decorators.js +3 -4
  41. package/dist/client/decorators.test.js +2 -0
  42. package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +7 -8
  43. package/dist/client/docs/__testfixtures__/doc-button/input.js +7 -8
  44. package/dist/client/docs/angular-properties.test.js +9 -12
  45. package/dist/client/docs/compodoc.d.ts +1 -1
  46. package/dist/client/docs/compodoc.js +1 -1
  47. package/dist/client/docs/config.d.ts +1 -1
  48. package/dist/client/docs/sourceDecorator.d.ts +3 -2
  49. package/dist/client/docs/sourceDecorator.js +3 -2
  50. package/dist/client/globals.d.ts +9 -11
  51. package/dist/client/globals.js +16 -21
  52. package/dist/client/index.d.ts +1 -0
  53. package/dist/client/index.js +2 -1
  54. package/dist/client/portable-stories.d.ts +23 -0
  55. package/dist/client/portable-stories.js +53 -0
  56. package/dist/client/render.d.ts +2 -2
  57. package/dist/client/types.d.ts +7 -7
  58. package/dist/preset.js +2 -2
  59. package/dist/preset.mjs +1 -1
  60. package/dist/server/angular-cli-webpack.js +6 -10
  61. package/dist/server/framework-preset-angular-cli.js +7 -16
  62. package/dist/server/framework-preset-angular-ivy.d.ts +2 -2
  63. package/dist/server/framework-preset-angular-ivy.js +14 -40
  64. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +4 -3
  65. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +4 -3
  66. package/dist/test-setup.js +3 -4
  67. package/dist/test-setup.mjs +1 -2
  68. package/dist/types.d.ts +3 -5
  69. package/package.json +10 -6
  70. package/scripts/postbuild.js +5 -4
  71. package/template/cli/button.component.ts +11 -19
  72. package/template/cli/button.stories.ts +1 -0
  73. package/template/cli/header.component.ts +47 -50
  74. package/template/cli/header.stories.ts +1 -1
  75. package/template/cli/page.component.ts +54 -54
  76. package/template/cli/page.stories.ts +1 -1
  77. package/template/components/index.js +1 -1
  78. package/.eslintrc.js +0 -16
@@ -27,8 +27,8 @@ exports.queueBootstrapping = void 0;
27
27
  const queue = [];
28
28
  let isProcessing = false;
29
29
  /**
30
- * Reset compiled components because we often want to compile the same component with
31
- * more than one NgModule.
30
+ * Reset compiled components because we often want to compile the same component with more than one
31
+ * NgModule.
32
32
  */
33
33
  const resetCompiledComponents = async () => {
34
34
  try {
@@ -41,22 +41,17 @@ const resetCompiledComponents = async () => {
41
41
  ɵresetCompiledComponents();
42
42
  }
43
43
  catch (e) {
44
- /**
45
- * noop catch
46
- * This means angular removed or modified ɵresetCompiledComponents
47
- */
44
+ /** Noop catch This means angular removed or modified ɵresetCompiledComponents */
48
45
  }
49
46
  };
50
47
  /**
51
- * Queue bootstrapping, so that only one application can be bootstrapped at a
52
- * time.
48
+ * Queue bootstrapping, so that only one application can be bootstrapped at a time.
53
49
  *
54
- * Bootstrapping multiple applications at once can cause Angular to throw an
55
- * error that a component is declared in multiple modules. This avoids two
56
- * stories confusing the Angular compiler, by bootstrapping more that one
57
- * application at a time.
50
+ * Bootstrapping multiple applications at once can cause Angular to throw an error that a component
51
+ * is declared in multiple modules. This avoids two stories confusing the Angular compiler, by
52
+ * bootstrapping more that one application at a time.
58
53
  *
59
- * @param fn callback that should complete the bootstrap process
54
+ * @param fn Callback that should complete the bootstrap process
60
55
  * @returns ApplicationRef from the completed bootstrap process
61
56
  */
62
57
  const queueBootstrapping = (fn) => {
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
- // @vitest-environment happy-dom
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const rxjs_1 = require("rxjs");
3
+ // @vitest-environment happy-dom
5
4
  const vitest_1 = require("vitest");
5
+ const rxjs_1 = require("rxjs");
6
6
  const BootstrapQueue_1 = require("./BootstrapQueue");
7
7
  const instantWaitFor = (fn) => {
8
8
  return vitest_1.vi.waitFor(fn, {
9
9
  interval: 0,
10
+ timeout: 10000,
10
11
  });
11
12
  };
12
13
  (0, vitest_1.describe)('BootstrapQueue', () => {
@@ -16,7 +17,7 @@ const instantWaitFor = (fn) => {
16
17
  (0, vitest_1.afterEach)(() => {
17
18
  vitest_1.vi.clearAllMocks();
18
19
  });
19
- (0, vitest_1.it)('should wait until complete', async () => {
20
+ (0, vitest_1.it)('@flaky should wait until complete', async () => {
20
21
  const pendingSubject = new rxjs_1.Subject();
21
22
  const bootstrapApp = vitest_1.vi.fn().mockImplementation(async () => {
22
23
  return (0, rxjs_1.lastValueFrom)(pendingSubject);
@@ -160,4 +161,4 @@ const instantWaitFor = (fn) => {
160
161
  (0, vitest_1.expect)(bootstrapAppFinished2).toHaveBeenCalledTimes(1);
161
162
  (0, vitest_1.expect)(bootstrapAppError2).not.toHaveBeenCalled();
162
163
  });
163
- });
164
+ }, { retry: 3 });
@@ -1,4 +1,4 @@
1
- import { Type, Component } from '@angular/core';
1
+ import { Component, Type } from '@angular/core';
2
2
  export type ComponentInputsOutputs = {
3
3
  inputs: {
4
4
  propName: string;
@@ -9,21 +9,14 @@ export type ComponentInputsOutputs = {
9
9
  templateName: string;
10
10
  }[];
11
11
  };
12
- /**
13
- * Returns component Inputs / Outputs by browsing these properties and decorator
14
- */
12
+ /** Returns component Inputs / Outputs by browsing these properties and decorator */
15
13
  export declare const getComponentInputsOutputs: (component: any) => ComponentInputsOutputs;
16
14
  export declare const isDeclarable: (component: any) => boolean;
17
15
  export declare const isComponent: (component: any) => component is Type<unknown>;
18
16
  export declare const isStandaloneComponent: (component: any) => component is Type<unknown>;
19
- /**
20
- * Returns all component decorator properties
21
- * is used to get all `@Input` and `@Output` Decorator
22
- */
17
+ /** Returns all component decorator properties is used to get all `@Input` and `@Output` Decorator */
23
18
  export declare const getComponentPropsDecoratorMetadata: (component: any) => {
24
19
  [key: string]: any[];
25
20
  };
26
- /**
27
- * Returns component decorator `@Component`
28
- */
21
+ /** Returns component decorator `@Component` */
29
22
  export declare const getComponentDecoratorMetadata: (component: any) => Component | undefined;
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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
- /**
7
- * Returns component Inputs / Outputs by browsing these properties and decorator
8
- */
6
+ /** Returns component Inputs / Outputs by browsing these properties and decorator */
9
7
  const getComponentInputsOutputs = (component) => {
10
8
  const componentMetadata = (0, exports.getComponentDecoratorMetadata)(component);
11
9
  const componentPropsMetadata = (0, exports.getComponentPropsDecoratorMetadata)(component);
@@ -82,17 +80,12 @@ const isStandaloneComponent = (component) => {
82
80
  return (decorators || []).some((d) => (d instanceof core_1.Component || d instanceof core_1.Directive || d instanceof core_1.Pipe) && d.standalone);
83
81
  };
84
82
  exports.isStandaloneComponent = isStandaloneComponent;
85
- /**
86
- * Returns all component decorator properties
87
- * is used to get all `@Input` and `@Output` Decorator
88
- */
83
+ /** Returns all component decorator properties is used to get all `@Input` and `@Output` Decorator */
89
84
  const getComponentPropsDecoratorMetadata = (component) => {
90
85
  return reflectionCapabilities.propMetadata(component);
91
86
  };
92
87
  exports.getComponentPropsDecoratorMetadata = getComponentPropsDecoratorMetadata;
93
- /**
94
- * Returns component decorator `@Component`
95
- */
88
+ /** Returns component decorator `@Component` */
96
89
  const getComponentDecoratorMetadata = (component) => {
97
90
  const decorators = reflectionCapabilities.annotations(component);
98
91
  return decorators.reverse().find((d) => d instanceof core_1.Component);
@@ -1,4 +1,4 @@
1
- import { importProvidersFrom, InjectionToken, NgModule, Provider, ɵReflectionCapabilities as ReflectionCapabilities } from '@angular/core';
1
+ import { InjectionToken, NgModule, Provider, ɵReflectionCapabilities as ReflectionCapabilities, importProvidersFrom } from '@angular/core';
2
2
  import { NgModuleMetadata } from '../../types';
3
3
  export declare const reflectionCapabilities: ReflectionCapabilities;
4
4
  export declare const REMOVED_MODULES: InjectionToken<unknown>;
@@ -19,8 +19,6 @@ export declare class PropertyExtractor implements NgModuleMetadata {
19
19
  * - Removes Restricted Imports
20
20
  * - Extracts providers from ModuleWithProviders
21
21
  * - Returns a new NgModuleMetadata object
22
- *
23
- *
24
22
  */
25
23
  private analyzeMetadata;
26
24
  static analyzeRestricted: (ngModule: NgModule) => [boolean] | [boolean, Provider];
@@ -30,8 +30,6 @@ class PropertyExtractor {
30
30
  * - Removes Restricted Imports
31
31
  * - Extracts providers from ModuleWithProviders
32
32
  * - Returns a new NgModuleMetadata object
33
- *
34
- *
35
33
  */
36
34
  this.analyzeMetadata = (metadata) => {
37
35
  const declarations = [...(metadata?.declarations || [])];
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
3
  const common_1 = require("@angular/common");
5
4
  const core_1 = require("@angular/core");
6
5
  const platform_browser_1 = require("@angular/platform-browser");
7
6
  const animations_1 = require("@angular/platform-browser/animations");
8
- const PropertyExtractor_1 = require("./PropertyExtractor");
7
+ const vitest_1 = require("vitest");
9
8
  const test_module_1 = require("../__testfixtures__/test.module");
9
+ const PropertyExtractor_1 = require("./PropertyExtractor");
10
10
  const TEST_TOKEN = new core_1.InjectionToken('testToken');
11
11
  const TestTokenProvider = { provide: TEST_TOKEN, useValue: 123 };
12
12
  const TestService = (0, core_1.Injectable)()(class {
@@ -1,23 +1,22 @@
1
1
  /**
2
2
  * Increments the count for a storyId and returns the next UID.
3
3
  *
4
- * When a story is bootstrapped, the storyId is used as the element tag. That
5
- * becomes an issue when a story is rendered multiple times in the same docs
6
- * page. This function returns a UID that is appended to the storyId to make
7
- * it unique.
4
+ * When a story is bootstrapped, the storyId is used as the element tag. That becomes an issue when
5
+ * a story is rendered multiple times in the same docs page. This function returns a UID that is
6
+ * appended to the storyId to make it unique.
8
7
  *
9
- * @param storyId id of a story
10
- * @returns uid of a story
8
+ * @param storyId Id of a story
9
+ * @returns Uid of a story
11
10
  */
12
11
  export declare const getNextStoryUID: (storyId: string) => string;
13
12
  /**
14
13
  * Clears the storyId counts.
15
14
  *
16
- * Can be useful for testing, where you need predictable increments, without
17
- * reloading the global state.
15
+ * Can be useful for testing, where you need predictable increments, without reloading the global
16
+ * state.
18
17
  *
19
18
  * If onlyStoryId is provided, only that storyId is cleared.
20
19
  *
21
- * @param onlyStoryId id of a story
20
+ * @param onlyStoryId Id of a story
22
21
  */
23
22
  export declare const clearStoryUIDs: (onlyStoryId?: string) => void;
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clearStoryUIDs = exports.getNextStoryUID = void 0;
4
- /**
5
- * Count of stories for each storyId.
6
- */
4
+ /** Count of stories for each storyId. */
7
5
  const storyCounts = new Map();
8
6
  /**
9
7
  * Increments the count for a storyId and returns the next UID.
10
8
  *
11
- * When a story is bootstrapped, the storyId is used as the element tag. That
12
- * becomes an issue when a story is rendered multiple times in the same docs
13
- * page. This function returns a UID that is appended to the storyId to make
14
- * it unique.
9
+ * When a story is bootstrapped, the storyId is used as the element tag. That becomes an issue when
10
+ * a story is rendered multiple times in the same docs page. This function returns a UID that is
11
+ * appended to the storyId to make it unique.
15
12
  *
16
- * @param storyId id of a story
17
- * @returns uid of a story
13
+ * @param storyId Id of a story
14
+ * @returns Uid of a story
18
15
  */
19
16
  const getNextStoryUID = (storyId) => {
20
17
  if (!storyCounts.has(storyId)) {
@@ -28,12 +25,12 @@ exports.getNextStoryUID = getNextStoryUID;
28
25
  /**
29
26
  * Clears the storyId counts.
30
27
  *
31
- * Can be useful for testing, where you need predictable increments, without
32
- * reloading the global state.
28
+ * Can be useful for testing, where you need predictable increments, without reloading the global
29
+ * state.
33
30
  *
34
31
  * If onlyStoryId is provided, only that storyId is cleared.
35
32
  *
36
- * @param onlyStoryId id of a story
33
+ * @param onlyStoryId Id of a story
37
34
  */
38
35
  const clearStoryUIDs = (onlyStoryId) => {
39
36
  if (onlyStoryId !== undefined && onlyStoryId !== null) {
@@ -5,27 +5,28 @@
5
5
  */
6
6
  export interface ArgsToTemplateOptions<T> {
7
7
  /**
8
- * An array of keys to specifically include in the output.
9
- * If provided, only the keys from this array will be included in the output,
10
- * irrespective of the `exclude` option. Undefined values will still be excluded from the output.
8
+ * An array of keys to specifically include in the output. If provided, only the keys from this
9
+ * array will be included in the output, irrespective of the `exclude` option. Undefined values
10
+ * will still be excluded from the output.
11
11
  */
12
12
  include?: Array<T>;
13
13
  /**
14
- * An array of keys to specifically exclude from the output.
15
- * If provided, these keys will be omitted from the output. This option is
16
- * ignored if the `include` option is also provided
14
+ * An array of keys to specifically exclude from the output. If provided, these keys will be
15
+ * omitted from the output. This option is ignored if the `include` option is also provided
17
16
  */
18
17
  exclude?: Array<T>;
19
18
  }
20
19
  /**
21
- * Converts an object of arguments to a string of property and event bindings and excludes undefined values.
22
- * Why? Because Angular treats undefined values in property bindings as an actual value
23
- * and does not apply the default value of the property as soon as the binding is set.
24
- * This feels counter-intuitive and is a common source of bugs in stories.
20
+ * Converts an object of arguments to a string of property and event bindings and excludes undefined
21
+ * values. Why? Because Angular treats undefined values in property bindings as an actual value and
22
+ * does not apply the default value of the property as soon as the binding is set. This feels
23
+ * counter-intuitive and is a common source of bugs in stories.
24
+ *
25
25
  * @example
26
+ *
26
27
  * ```ts
27
28
  * // component.ts
28
- *ㅤ@Component({ selector: 'example' })
29
+ * ㅤ@Component({ selector: 'example' })
29
30
  * export class ExampleComponent {
30
31
  * ㅤ@Input() input1: string = 'Default Input1';
31
32
  * ㅤ@Input() input2: string = 'Default Input2';
@@ -49,7 +50,7 @@ export interface ArgsToTemplateOptions<T> {
49
50
  * input1: 'Input 1',
50
51
  * click: { action: 'clicked' },
51
52
  * },
52
- *};
53
+ * };
53
54
  * ```
54
55
  */
55
56
  export declare function argsToTemplate<A extends Record<string, any>>(args: A, options?: ArgsToTemplateOptions<keyof A>): string;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.argsToTemplate = void 0;
4
+ const ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFromComponent");
4
5
  /**
5
- * Converts an object of arguments to a string of property and event bindings and excludes undefined values.
6
- * Why? Because Angular treats undefined values in property bindings as an actual value
7
- * and does not apply the default value of the property as soon as the binding is set.
8
- * This feels counter-intuitive and is a common source of bugs in stories.
6
+ * Converts an object of arguments to a string of property and event bindings and excludes undefined
7
+ * values. Why? Because Angular treats undefined values in property bindings as an actual value and
8
+ * does not apply the default value of the property as soon as the binding is set. This feels
9
+ * counter-intuitive and is a common source of bugs in stories.
10
+ *
9
11
  * @example
12
+ *
10
13
  * ```ts
11
14
  * // component.ts
12
- *ㅤ@Component({ selector: 'example' })
15
+ * ㅤ@Component({ selector: 'example' })
13
16
  * export class ExampleComponent {
14
17
  * ㅤ@Input() input1: string = 'Default Input1';
15
18
  * ㅤ@Input() input2: string = 'Default Input2';
@@ -33,7 +36,7 @@ exports.argsToTemplate = void 0;
33
36
  * input1: 'Input 1',
34
37
  * click: { action: 'clicked' },
35
38
  * },
36
- *};
39
+ * };
37
40
  * ```
38
41
  */
39
42
  function argsToTemplate(args, options = {}) {
@@ -48,7 +51,9 @@ function argsToTemplate(args, options = {}) {
48
51
  return !excludeSet.has(key);
49
52
  return true;
50
53
  })
51
- .map(([key, value]) => typeof value === 'function' ? `(${key})="${key}($event)"` : `[${key}]="${key}"`)
54
+ .map(([key, value]) => typeof value === 'function'
55
+ ? `(${key})="${(0, ComputesTemplateFromComponent_1.formatPropInTemplate)(key)}($event)"`
56
+ : `[${key}]="${(0, ComputesTemplateFromComponent_1.formatPropInTemplate)(key)}"`)
52
57
  .join(' ');
53
58
  }
54
59
  exports.argsToTemplate = argsToTemplate;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
- const argsToTemplate_1 = require("./argsToTemplate"); // adjust path
4
+ const argsToTemplate_1 = require("./argsToTemplate");
5
+ // adjust path
5
6
  (0, vitest_1.describe)('argsToTemplate', () => {
6
7
  (0, vitest_1.it)('should correctly convert args to template string and exclude undefined values', () => {
7
8
  const args = {
@@ -93,4 +94,9 @@ const argsToTemplate_1 = require("./argsToTemplate"); // adjust path
93
94
  const result = (0, argsToTemplate_1.argsToTemplate)(args, {});
94
95
  (0, vitest_1.expect)(result).toEqual('[input]="input" (event1)="event1($event)"');
95
96
  });
97
+ (0, vitest_1.it)('should format for non dot notation', () => {
98
+ const args = { 'non-dot': 'Value1', 'dash-out': () => { } };
99
+ const result = (0, argsToTemplate_1.argsToTemplate)(args, {});
100
+ (0, vitest_1.expect)(result).toEqual('[non-dot]="this[\'non-dot\']" (dash-out)="this[\'dash-out\']($event)"');
101
+ });
96
102
  });
@@ -1,14 +1,13 @@
1
+ import { DecoratorFunction, StoryContext } from 'storybook/internal/types';
1
2
  import { Type } from '@angular/core';
2
3
  import { ApplicationConfig } from '@angular/platform-browser';
3
- import { DecoratorFunction, StoryContext } from 'storybook/internal/types';
4
- import { ICollection, NgModuleMetadata, AngularRenderer } from './types';
4
+ import { AngularRenderer, ICollection, NgModuleMetadata } from './types';
5
5
  export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularRenderer, TArgs>;
6
6
  /**
7
- * Decorator to set the config options which are available during the application bootstrap operation
7
+ * Decorator to set the config options which are available during the application bootstrap
8
+ * operation
8
9
  */
9
10
  export declare function applicationConfig<TArgs = any>(
10
- /**
11
- * Set of config options available during the application bootstrap operation.
12
- */
11
+ /** Set of config options available during the application bootstrap operation. */
13
12
  config: ApplicationConfig): DecoratorFunction<AngularRenderer, TArgs>;
14
13
  export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection)) => DecoratorFunction<AngularRenderer, TArgs>;
@@ -25,12 +25,11 @@ const moduleMetadata = (metadata) => (storyFn) => {
25
25
  };
26
26
  exports.moduleMetadata = moduleMetadata;
27
27
  /**
28
- * Decorator to set the config options which are available during the application bootstrap operation
28
+ * Decorator to set the config options which are available during the application bootstrap
29
+ * operation
29
30
  */
30
31
  function applicationConfig(
31
- /**
32
- * Set of config options available during the application bootstrap operation.
33
- */
32
+ /** Set of config options available during the application bootstrap operation. */
34
33
  config) {
35
34
  return (storyFn) => {
36
35
  const story = storyFn();
@@ -22,6 +22,8 @@ const defaultContext = {
22
22
  args: {},
23
23
  argTypes: {},
24
24
  globals: {},
25
+ globalTypes: {},
26
+ storyGlobals: {},
25
27
  hooks: {},
26
28
  loaded: {},
27
29
  originalStoryFn: vitest_1.vi.fn(),
@@ -14,9 +14,8 @@ export interface ISomeInterface {
14
14
  * This is a simple button that demonstrates various JSDoc handling in Storybook Docs for Angular.
15
15
  *
16
16
  * It supports [markdown](https://en.wikipedia.org/wiki/Markdown), so you can embed formatted text,
17
- * like **bold**, _italic_, and `inline code`.
18
- *
19
- * > How you like dem apples?! It's never been easier to document all your components.
17
+ * like **bold**, _italic_, and `inline code`.> How you like dem apples?! It's never been easier to
18
+ * document all your components.
20
19
  *
21
20
  * @string Hello world
22
21
  * @link [Example](http://example.com)
@@ -54,7 +53,8 @@ export declare class InputComponent<T> {
54
53
  */
55
54
  onClick: EventEmitter<Event>;
56
55
  /**
57
- * This is an internal method that we don't want to document and have added the `ignore` annotation to.
56
+ * This is an internal method that we don't want to document and have added the `ignore`
57
+ * annotation to.
58
58
  *
59
59
  * @ignore
60
60
  */
@@ -72,9 +72,7 @@ export declare class InputComponent<T> {
72
72
  * @ignore
73
73
  */
74
74
  get classes(): string[];
75
- /**
76
- * @ignore
77
- */
75
+ /** @ignore */
78
76
  ignoredProperty: string;
79
77
  /** Public value. */
80
78
  internalProperty: string;
@@ -88,7 +86,8 @@ export declare class InputComponent<T> {
88
86
  * An internal calculation method which adds `x` and `y` together.
89
87
  *
90
88
  * @param x Some number you'd like to use.
91
- * @param y Some other number or string you'd like to use, will have `parseInt()` applied before calculation.
89
+ * @param y Some other number or string you'd like to use, will have `parseInt()` applied before
90
+ * calculation.
92
91
  */
93
92
  calc(x: number, y: string | number): number;
94
93
  /** A public method using an interface. */
@@ -24,9 +24,8 @@ var ButtonAccent;
24
24
  * This is a simple button that demonstrates various JSDoc handling in Storybook Docs for Angular.
25
25
  *
26
26
  * It supports [markdown](https://en.wikipedia.org/wiki/Markdown), so you can embed formatted text,
27
- * like **bold**, _italic_, and `inline code`.
28
- *
29
- * > How you like dem apples?! It's never been easier to document all your components.
27
+ * like **bold**, _italic_, and `inline code`.> How you like dem apples?! It's never been easier to
28
+ * document all your components.
30
29
  *
31
30
  * @string Hello world
32
31
  * @link [Example](http://example.com)
@@ -55,9 +54,7 @@ let InputComponent = class InputComponent {
55
54
  this.onClick = new core_1.EventEmitter();
56
55
  this._inputValue = 'some value';
57
56
  this.focus = false;
58
- /**
59
- * @ignore
60
- */
57
+ /** @ignore */
61
58
  this.ignoredProperty = 'Ignore me';
62
59
  /** Public value. */
63
60
  this.internalProperty = 'Public hello';
@@ -65,7 +62,8 @@ let InputComponent = class InputComponent {
65
62
  this._value = 'Private hello';
66
63
  }
67
64
  /**
68
- * This is an internal method that we don't want to document and have added the `ignore` annotation to.
65
+ * This is an internal method that we don't want to document and have added the `ignore`
66
+ * annotation to.
69
67
  *
70
68
  * @ignore
71
69
  */
@@ -108,7 +106,8 @@ let InputComponent = class InputComponent {
108
106
  * An internal calculation method which adds `x` and `y` together.
109
107
  *
110
108
  * @param x Some number you'd like to use.
111
- * @param y Some other number or string you'd like to use, will have `parseInt()` applied before calculation.
109
+ * @param y Some other number or string you'd like to use, will have `parseInt()` applied before
110
+ * calculation.
112
111
  */
113
112
  calc(x, y) {
114
113
  return x + parseInt(`${y}`, 10);
@@ -1,19 +1,16 @@
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
- const path_1 = __importDefault(require("path"));
7
- const fs_1 = __importDefault(require("fs"));
3
+ const node_fs_1 = require("node:fs");
4
+ const node_path_1 = require("node:path");
8
5
  const vitest_1 = require("vitest");
9
6
  // File hierarchy: __testfixtures__ / some-test-case / input.*
10
7
  const inputRegExp = /^input\..*$/;
11
8
  (0, vitest_1.describe)('angular component properties', () => {
12
- const fixturesDir = path_1.default.join(__dirname, '__testfixtures__');
13
- fs_1.default.readdirSync(fixturesDir, { withFileTypes: true }).forEach((testEntry) => {
9
+ const fixturesDir = (0, node_path_1.join)(__dirname, '__testfixtures__');
10
+ (0, node_fs_1.readdirSync)(fixturesDir, { withFileTypes: true }).forEach((testEntry) => {
14
11
  if (testEntry.isDirectory()) {
15
- const testDir = path_1.default.join(fixturesDir, testEntry.name);
16
- const testFile = fs_1.default.readdirSync(testDir).find((fileName) => inputRegExp.test(fileName));
12
+ const testDir = (0, node_path_1.join)(fixturesDir, testEntry.name);
13
+ const testFile = (0, node_fs_1.readdirSync)(testDir).find((fileName) => inputRegExp.test(fileName));
17
14
  if (testFile) {
18
15
  // TODO: Remove this as soon as the real test is fixed
19
16
  (0, vitest_1.it)('true', () => {
@@ -21,17 +18,17 @@ const inputRegExp = /^input\..*$/;
21
18
  });
22
19
  // TODO: Fix this test
23
20
  // it(`${testEntry.name}`, () => {
24
- // const inputPath = path.join(testDir, testFile);
21
+ // const inputPath = join(testDir, testFile);
25
22
  // // snapshot the output of compodoc
26
23
  // const compodocOutput = runCompodoc(inputPath);
27
24
  // const compodocJson = JSON.parse(compodocOutput);
28
25
  // expect(compodocJson).toMatchFileSnapshot(
29
- // path.join(testDir, `compodoc-${SNAPSHOT_OS}.snapshot`)
26
+ // join(testDir, `compodoc-${SNAPSHOT_OS}.snapshot`)
30
27
  // );
31
28
  // // snapshot the output of addon-docs angular-properties
32
29
  // const componentData = findComponentByName('InputComponent', compodocJson);
33
30
  // const argTypes = extractArgTypesFromData(componentData);
34
- // expect(argTypes).toMatchFileSnapshot(path.join(testDir, 'argtypes.snapshot'));
31
+ // expect(argTypes).toMatchFileSnapshot(join(testDir, 'argtypes.snapshot'));
35
32
  // });
36
33
  }
37
34
  }
@@ -1,5 +1,5 @@
1
1
  import { ArgTypes, SBType } from 'storybook/internal/types';
2
- import { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './types';
2
+ import { Class, CompodocJson, Component, Directive, Injectable, Method, Pipe, Property } 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;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractComponentDescription = exports.extractArgTypes = exports.extractArgTypesFromData = exports.extractType = exports.findComponentByName = exports.checkValidCompodocJson = exports.checkValidComponentOrDirective = exports.getCompodocJson = exports.setCompodocJson = exports.isMethod = void 0;
4
4
  /* eslint-disable no-underscore-dangle */
5
- const global_1 = require("@storybook/global");
6
5
  const client_logger_1 = require("storybook/internal/client-logger");
6
+ const global_1 = require("@storybook/global");
7
7
  const isMethod = (methodOrProp) => {
8
8
  return methodOrProp.args !== undefined;
9
9
  };
@@ -1,4 +1,4 @@
1
- import { Parameters, DecoratorFunction, ArgTypesEnhancer } from 'storybook/internal/types';
1
+ import { ArgTypesEnhancer, DecoratorFunction, Parameters } from 'storybook/internal/types';
2
2
  export declare const parameters: Parameters;
3
3
  export declare const decorators: DecoratorFunction[];
4
4
  export declare const argTypesEnhancers: ArgTypesEnhancer[];
@@ -1,9 +1,10 @@
1
1
  import { PartialStoryFn } from 'storybook/internal/types';
2
- import { StoryContext, AngularRenderer } from '../types';
2
+ import { AngularRenderer, StoryContext } from '../types';
3
3
  export declare const skipSourceRender: (context: StoryContext) => any;
4
4
  /**
5
5
  * Angular source decorator.
6
+ *
6
7
  * @param storyFn Fn
7
- * @param context StoryContext
8
+ * @param context StoryContext
8
9
  */
9
10
  export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularRenderer>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sourceDecorator = exports.skipSourceRender = void 0;
4
- const preview_api_1 = require("storybook/internal/preview-api");
5
4
  const docs_tools_1 = require("storybook/internal/docs-tools");
5
+ const preview_api_1 = require("storybook/internal/preview-api");
6
6
  const renderer_1 = require("../../renderer");
7
7
  const skipSourceRender = (context) => {
8
8
  const sourceParams = context?.parameters.docs?.source;
@@ -17,8 +17,9 @@ const skipSourceRender = (context) => {
17
17
  exports.skipSourceRender = skipSourceRender;
18
18
  /**
19
19
  * Angular source decorator.
20
+ *
20
21
  * @param storyFn Fn
21
- * @param context StoryContext
22
+ * @param context StoryContext
22
23
  */
23
24
  const sourceDecorator = (storyFn, context) => {
24
25
  const story = storyFn();
@@ -1,23 +1,21 @@
1
1
  /**
2
- * This file includes polyfills needed by Angular and is loaded before the app.
3
- * You can add your own extra polyfills to this file.
2
+ * This file includes polyfills needed by Angular and is loaded before the app. You can add your own
3
+ * extra polyfills to this file.
4
4
  *
5
5
  * This file is divided into 2 sections:
6
- * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
- * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
- * file.
6
+ *
7
+ * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
8
+ * 2. Application imports. Files imported after ZoneJS that should be loaded before your main file.
9
9
  *
10
10
  * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
11
  * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
- * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
12
+ * Edge> = 13 on the desktop, and iOS 10 and Chrome on mobile.
13
13
  *
14
14
  * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15
15
  */
16
16
  /**
17
- * Required to support Web Animations `@angular/animation`.
18
- * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
19
- * */
20
- /** *************************************************************************************************
21
- * Zone JS is required by Angular itself.
17
+ * Required to support Web Animations `@angular/animation`. Needed for: All but Chrome, Firefox and
18
+ * Opera. http://caniuse.com/#feat=web-animation
22
19
  */
20
+ /** Zone JS is required by Angular itself. */
23
21
  import 'zone.js';