@storybook/angular 7.0.0-alpha.50 → 7.0.0-alpha.52

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.
@@ -2,7 +2,7 @@ import { BuilderOutput } from '@angular-devkit/architect';
2
2
  import { JsonObject } from '@angular-devkit/core';
3
3
  import { CLIOptions } from '@storybook/types';
4
4
  import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
5
- export declare type StorybookBuilderOptions = JsonObject & {
5
+ export type StorybookBuilderOptions = JsonObject & {
6
6
  browserTarget?: string | null;
7
7
  tsConfig?: string;
8
8
  compodoc: boolean;
@@ -10,6 +10,6 @@ export declare type StorybookBuilderOptions = JsonObject & {
10
10
  styles?: ExtraEntryPoint[];
11
11
  stylePreprocessorOptions?: StylePreprocessorOptions;
12
12
  } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs' | 'webpackStatsJson'>;
13
- export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
13
+ export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
14
14
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
15
15
  export default _default;
@@ -2,7 +2,7 @@ import { BuilderOutput } from '@angular-devkit/architect';
2
2
  import { JsonObject } from '@angular-devkit/core';
3
3
  import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
4
4
  import { CLIOptions } from '@storybook/types';
5
- export declare type StorybookBuilderOptions = JsonObject & {
5
+ export type StorybookBuilderOptions = JsonObject & {
6
6
  browserTarget?: string | null;
7
7
  tsConfig?: string;
8
8
  compodoc: boolean;
@@ -10,6 +10,6 @@ export declare type StorybookBuilderOptions = JsonObject & {
10
10
  styles?: ExtraEntryPoint[];
11
11
  stylePreprocessorOptions?: StylePreprocessorOptions;
12
12
  } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
13
- export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
13
+ export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
14
14
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
15
15
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { BuilderContext } from '@angular-devkit/architect';
2
2
  import { LoadOptions, CLIOptions, BuilderOptions } from '@storybook/types';
3
- export declare type StandaloneOptions = Partial<CLIOptions & LoadOptions & BuilderOptions & {
3
+ export type StandaloneOptions = Partial<CLIOptions & LoadOptions & BuilderOptions & {
4
4
  mode?: 'static' | 'dev';
5
5
  angularBrowserTarget?: string | null;
6
6
  angularBuilderOptions?: Record<string, any> & {
@@ -1,6 +1,6 @@
1
1
  import { Subject } from 'rxjs';
2
2
  import { ICollection, StoryFnAngularReturnType, Parameters } from '../types';
3
- declare type StoryRenderInfo = {
3
+ type StoryRenderInfo = {
4
4
  storyFnAngular: StoryFnAngularReturnType;
5
5
  moduleMetadataSnapshot: string;
6
6
  };
@@ -39,19 +39,6 @@ function getPlatform(newPlatform) {
39
39
  return platformRef;
40
40
  }
41
41
  class AbstractRenderer {
42
- constructor(storyId) {
43
- this.storyId = storyId;
44
- if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
45
- try {
46
- // platform should be set after enableProdMode()
47
- (0, core_1.enableProdMode)();
48
- }
49
- catch (e) {
50
- // eslint-disable-next-line no-console
51
- console.debug(e);
52
- }
53
- }
54
- }
55
42
  /**
56
43
  * Wait and destroy the platform
57
44
  */
@@ -71,6 +58,19 @@ class AbstractRenderer {
71
58
  getPlatform(true);
72
59
  });
73
60
  }
61
+ constructor(storyId) {
62
+ this.storyId = storyId;
63
+ if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
64
+ try {
65
+ // platform should be set after enableProdMode()
66
+ (0, core_1.enableProdMode)();
67
+ }
68
+ catch (e) {
69
+ // eslint-disable-next-line no-console
70
+ console.debug(e);
71
+ }
72
+ }
73
+ }
74
74
  /**
75
75
  * Bootstrap main angular module with main component or send only new `props` with storyProps$
76
76
  *
@@ -1,5 +1,5 @@
1
1
  import { AbstractRenderer } from './AbstractRenderer';
2
- declare type RenderType = 'canvas' | 'docs';
2
+ type RenderType = 'canvas' | 'docs';
3
3
  export declare class RendererFactory {
4
4
  private lastRenderType;
5
5
  private rendererMap;
@@ -1,5 +1,5 @@
1
1
  import { Type, Component } from '@angular/core';
2
- export declare type ComponentInputsOutputs = {
2
+ export type ComponentInputsOutputs = {
3
3
  inputs: {
4
4
  propName: string;
5
5
  templateName: string;
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter, ElementRef } from '@angular/core';
2
2
  export declare const exportedConstant = "An exported constant";
3
- export declare type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge';
3
+ export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge';
4
4
  export declare enum ButtonAccent {
5
5
  'Normal' = "Normal",
6
6
  'High' = "High"
@@ -57,7 +57,7 @@ export interface Directive {
57
57
  description?: string;
58
58
  rawdescription?: string;
59
59
  }
60
- export declare type Component = Directive;
60
+ export type Component = Directive;
61
61
  export interface Argument {
62
62
  name: string;
63
63
  type: string;
@@ -8,19 +8,19 @@ export type { AngularRenderer };
8
8
  *
9
9
  * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
10
10
  */
11
- export declare type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TArgs>;
11
+ export type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TArgs>;
12
12
  /**
13
13
  * Story function that represents a CSFv2 component example.
14
14
  *
15
15
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
16
16
  */
17
- export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TArgs>;
17
+ export type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TArgs>;
18
18
  /**
19
19
  * Story function that represents a CSFv3 component example.
20
20
  *
21
21
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
22
22
  */
23
- export declare type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TArgs>;
23
+ export type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TArgs>;
24
24
  /**
25
25
  * @deprecated Use `StoryFn` instead.
26
26
  * Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
@@ -30,7 +30,7 @@ export declare type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, T
30
30
  *
31
31
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
32
32
  */
33
- export declare type Story<TArgs = Args> = StoryFn<TArgs>;
34
- export declare type Decorator<TArgs = StrictArgs> = DecoratorFunction<AngularRenderer, TArgs>;
35
- export declare type Loader<TArgs = StrictArgs> = LoaderFunction<AngularRenderer, TArgs>;
36
- export declare type StoryContext<TArgs = StrictArgs> = GenericStoryContext<AngularRenderer, TArgs>;
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>;
@@ -23,16 +23,16 @@ export interface StoryFnAngularReturnType {
23
23
  /**
24
24
  * @deprecated Use `AngularRenderer` instead.
25
25
  */
26
- export declare type AngularFramework = AngularRenderer;
26
+ export type AngularFramework = AngularRenderer;
27
27
  export interface AngularRenderer extends WebRenderer {
28
28
  component: any;
29
29
  storyResult: StoryFnAngularReturnType;
30
30
  }
31
- export declare type Parameters = DefaultParameters & {
31
+ export type Parameters = DefaultParameters & {
32
32
  /** Uses legacy angular rendering engine that use dynamic component */
33
33
  angularLegacyRendering?: boolean;
34
34
  bootstrapModuleOptions?: unknown;
35
35
  };
36
- export declare type StoryContext = DefaultStoryContext<AngularRenderer> & {
36
+ export type StoryContext = DefaultStoryContext<AngularRenderer> & {
37
37
  parameters: Parameters;
38
38
  };
@@ -1,7 +1,7 @@
1
1
  import { Options as CoreOptions } from '@storybook/types';
2
2
  import { BuilderContext } from '@angular-devkit/architect';
3
3
  import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
4
- export declare type PresetOptions = CoreOptions & {
4
+ export type PresetOptions = CoreOptions & {
5
5
  angularBrowserTarget?: string | null;
6
6
  angularBuilderOptions?: {
7
7
  styles?: ExtraEntryPoint[];
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact } from '@storybook/core-webpack';
2
2
  import { StorybookConfigWebpack, BuilderOptions, TypescriptOptions as TypescriptOptionsBuilder } from '@storybook/builder-webpack5';
3
- declare type FrameworkName = '@storybook/angular';
4
- declare type BuilderName = '@storybook/builder-webpack5';
5
- export declare type FrameworkOptions = AngularOptions & {
3
+ type FrameworkName = '@storybook/angular';
4
+ type BuilderName = '@storybook/builder-webpack5';
5
+ export type FrameworkOptions = AngularOptions & {
6
6
  builder?: BuilderOptions;
7
7
  };
8
- declare type StorybookConfigFramework = {
8
+ type StorybookConfigFramework = {
9
9
  framework: FrameworkName | {
10
10
  name: FrameworkName;
11
11
  options: FrameworkOptions;
@@ -21,7 +21,7 @@ declare type StorybookConfigFramework = {
21
21
  /**
22
22
  * The interface for Storybook configuration in `main.ts` files.
23
23
  */
24
- export declare type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
24
+ export type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
25
25
  export interface AngularOptions {
26
26
  enableIvy?: boolean;
27
27
  enableNgcc?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "7.0.0-alpha.50",
3
+ "version": "7.0.0-alpha.52",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -34,21 +34,21 @@
34
34
  "prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
35
35
  },
36
36
  "dependencies": {
37
- "@storybook/addons": "7.0.0-alpha.50",
38
- "@storybook/api": "7.0.0-alpha.50",
39
- "@storybook/builder-webpack5": "7.0.0-alpha.50",
40
- "@storybook/client-logger": "7.0.0-alpha.50",
41
- "@storybook/core-client": "7.0.0-alpha.50",
42
- "@storybook/core-common": "7.0.0-alpha.50",
43
- "@storybook/core-events": "7.0.0-alpha.50",
44
- "@storybook/core-server": "7.0.0-alpha.50",
45
- "@storybook/core-webpack": "7.0.0-alpha.50",
46
- "@storybook/docs-tools": "7.0.0-alpha.50",
47
- "@storybook/node-logger": "7.0.0-alpha.50",
48
- "@storybook/store": "7.0.0-alpha.50",
49
- "@storybook/types": "7.0.0-alpha.50",
50
- "@types/node": "^16.0.0",
51
- "@types/react": "^16.14.23",
37
+ "@storybook/addons": "7.0.0-alpha.52",
38
+ "@storybook/api": "7.0.0-alpha.52",
39
+ "@storybook/builder-webpack5": "7.0.0-alpha.52",
40
+ "@storybook/client-logger": "7.0.0-alpha.52",
41
+ "@storybook/core-client": "7.0.0-alpha.52",
42
+ "@storybook/core-common": "7.0.0-alpha.52",
43
+ "@storybook/core-events": "7.0.0-alpha.52",
44
+ "@storybook/core-server": "7.0.0-alpha.52",
45
+ "@storybook/core-webpack": "7.0.0-alpha.52",
46
+ "@storybook/docs-tools": "7.0.0-alpha.52",
47
+ "@storybook/node-logger": "7.0.0-alpha.52",
48
+ "@storybook/store": "7.0.0-alpha.52",
49
+ "@storybook/types": "7.0.0-alpha.52",
50
+ "@types/node": "^16.0.0 || ^18.0.0",
51
+ "@types/react": "^16.14.34",
52
52
  "@types/react-dom": "^16.9.14",
53
53
  "@types/semver": "^7.3.4",
54
54
  "@types/webpack-env": "^1.18.0",
@@ -81,12 +81,12 @@
81
81
  "@types/rimraf": "^3.0.2",
82
82
  "@types/tmp": "^0.2.3",
83
83
  "cross-spawn": "^7.0.3",
84
- "jest": "^28.0.0",
84
+ "jest": "^29.3.1",
85
85
  "jest-preset-angular": "^12.0.0",
86
86
  "jest-specific-snapshot": "^6.0.0",
87
87
  "rimraf": "^3.0.2",
88
88
  "tmp": "^0.2.1",
89
- "typescript": "~4.6.3",
89
+ "typescript": "^4.9.3",
90
90
  "webpack": "5",
91
91
  "zone.js": "^0.11.0"
92
92
  },
@@ -123,5 +123,5 @@
123
123
  "access": "public"
124
124
  },
125
125
  "builders": "dist/builders/builders.json",
126
- "gitHead": "77184d039091f4782dc4540df6d271a24fb3e242"
126
+ "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666"
127
127
  }
@@ -1,20 +1,17 @@
1
1
  import type { Meta, StoryObj } from '@storybook/angular';
2
2
  import Button from './button.component';
3
3
 
4
- // More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
4
+ // More on how to set up stories at: https://storybook.js.org/docs/7.0/angular/writing-stories/introduction
5
5
  const meta: Meta<Button> = {
6
6
  title: 'Example/Button',
7
7
  component: Button,
8
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/angular/writing-docs/docs-page
9
8
  tags: ['docsPage'],
10
- // More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
11
9
  render: (args: Button) => ({
12
10
  props: {
13
11
  backgroundColor: null,
14
12
  ...args,
15
13
  },
16
14
  }),
17
- // More on argTypes: https://storybook.js.org/docs/angular/api/argtypes
18
15
  argTypes: {
19
16
  backgroundColor: {
20
17
  control: 'color',
@@ -25,7 +22,7 @@ const meta: Meta<Button> = {
25
22
  export default meta;
26
23
  type Story = StoryObj<Button>;
27
24
 
28
- // More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
25
+ // More on writing stories with args: https://storybook.js.org/docs/7.0/angular/writing-stories/args
29
26
  export const Primary: Story = {
30
27
  args: {
31
28
  primary: true,
@@ -8,7 +8,7 @@ import Header from './header.component';
8
8
  const meta: Meta<Header> = {
9
9
  title: 'Example/Header',
10
10
  component: Header,
11
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/angular/writing-docs/docs-page
11
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/angular/writing-docs/docs-page
12
12
  tags: ['docsPage'],
13
13
  render: (args) => ({ props: args }),
14
14
  decorators: [
@@ -18,7 +18,7 @@ const meta: Meta<Header> = {
18
18
  }),
19
19
  ],
20
20
  parameters: {
21
- // More on Story layout: https://storybook.js.org/docs/angular/configure/story-layout
21
+ // More on how to position stories at: https://storybook.js.org/docs/7.0/angular/configure/story-layout
22
22
  layout: 'fullscreen',
23
23
  },
24
24
  };
@@ -11,7 +11,7 @@ const meta: Meta<Page> = {
11
11
  title: 'Example/Page',
12
12
  component: Page,
13
13
  parameters: {
14
- // More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout
14
+ // More on how to position stories at: https://storybook.js.org/docs/7.0/angular/configure/story-layout
15
15
  layout: 'fullscreen',
16
16
  },
17
17
  decorators: [
@@ -31,7 +31,7 @@ export const LoggedOut: Story = {
31
31
  }),
32
32
  };
33
33
 
34
- // More on interaction testing: https://storybook.js.org/docs/angular/writing-tests/interaction-testing
34
+ // More on interaction testing: https://storybook.js.org/docs/7.0/angular/writing-tests/interaction-testing
35
35
  export const LoggedIn: Story = {
36
36
  render: (args: Page) => ({
37
37
  props: args,