@storybook/angular 7.6.4 → 7.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/template/cli/button.component.ts +2 -1
- package/template/cli/{Button.stories.ts → button.stories.ts} +6 -5
- package/template/cli/header.component.ts +8 -4
- package/template/cli/{Header.stories.ts → header.stories.ts} +4 -14
- package/template/cli/page.component.ts +7 -2
- package/template/cli/{Page.stories.ts → page.stories.ts} +5 -22
- package/template/cli/user.ts +3 -0
- package/template/cli/User.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.6",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@storybook/builder-webpack5": "7.6.
|
|
41
|
-
"@storybook/cli": "7.6.
|
|
42
|
-
"@storybook/client-logger": "7.6.
|
|
43
|
-
"@storybook/core-common": "7.6.
|
|
44
|
-
"@storybook/core-events": "7.6.
|
|
45
|
-
"@storybook/core-server": "7.6.
|
|
46
|
-
"@storybook/core-webpack": "7.6.
|
|
47
|
-
"@storybook/docs-tools": "7.6.
|
|
40
|
+
"@storybook/builder-webpack5": "7.6.6",
|
|
41
|
+
"@storybook/cli": "7.6.6",
|
|
42
|
+
"@storybook/client-logger": "7.6.6",
|
|
43
|
+
"@storybook/core-common": "7.6.6",
|
|
44
|
+
"@storybook/core-events": "7.6.6",
|
|
45
|
+
"@storybook/core-server": "7.6.6",
|
|
46
|
+
"@storybook/core-webpack": "7.6.6",
|
|
47
|
+
"@storybook/docs-tools": "7.6.6",
|
|
48
48
|
"@storybook/global": "^5.0.0",
|
|
49
|
-
"@storybook/node-logger": "7.6.
|
|
50
|
-
"@storybook/preview-api": "7.6.
|
|
51
|
-
"@storybook/telemetry": "7.6.
|
|
52
|
-
"@storybook/types": "7.6.
|
|
49
|
+
"@storybook/node-logger": "7.6.6",
|
|
50
|
+
"@storybook/preview-api": "7.6.6",
|
|
51
|
+
"@storybook/telemetry": "7.6.6",
|
|
52
|
+
"@storybook/types": "7.6.6",
|
|
53
53
|
"@types/node": "^18.0.0",
|
|
54
54
|
"@types/react": "^16.14.34",
|
|
55
55
|
"@types/react-dom": "^16.9.14",
|
|
@@ -3,6 +3,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
5
|
selector: 'storybook-button',
|
|
6
|
+
standalone: true,
|
|
6
7
|
imports: [CommonModule],
|
|
7
8
|
template: ` <button
|
|
8
9
|
type="button"
|
|
@@ -14,7 +15,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
|
14
15
|
</button>`,
|
|
15
16
|
styleUrls: ['./button.css'],
|
|
16
17
|
})
|
|
17
|
-
export
|
|
18
|
+
export class ButtonComponent {
|
|
18
19
|
/**
|
|
19
20
|
* Is this the principal call to action on the page?
|
|
20
21
|
*/
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { ButtonComponent } from './button.component';
|
|
3
4
|
|
|
4
5
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
-
const meta: Meta<
|
|
6
|
+
const meta: Meta<ButtonComponent> = {
|
|
6
7
|
title: 'Example/Button',
|
|
7
|
-
component:
|
|
8
|
+
component: ButtonComponent,
|
|
8
9
|
tags: ['autodocs'],
|
|
9
|
-
render: (args:
|
|
10
|
+
render: (args: ButtonComponent) => ({
|
|
10
11
|
props: {
|
|
11
12
|
backgroundColor: null,
|
|
12
13
|
...args,
|
|
@@ -20,7 +21,7 @@ const meta: Meta<Button> = {
|
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export default meta;
|
|
23
|
-
type Story = StoryObj<
|
|
24
|
+
type Story = StoryObj<ButtonComponent>;
|
|
24
25
|
|
|
25
26
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
26
27
|
export const Primary: Story = {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
-
import
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
import { ButtonComponent } from './button.component';
|
|
5
|
+
import type { User } from './user';
|
|
3
6
|
|
|
4
7
|
@Component({
|
|
5
8
|
selector: 'storybook-header',
|
|
9
|
+
standalone: true,
|
|
10
|
+
imports: [CommonModule, ButtonComponent],
|
|
6
11
|
template: `<header>
|
|
7
12
|
<div class="storybook-header">
|
|
8
13
|
<div>
|
|
@@ -47,9 +52,8 @@ import type { User } from './User';
|
|
|
47
52
|
></storybook-button>
|
|
48
53
|
<storybook-button
|
|
49
54
|
*ngIf="!user"
|
|
50
|
-
primary
|
|
51
55
|
size="small"
|
|
52
|
-
primary="true"
|
|
56
|
+
[primary]="true"
|
|
53
57
|
class="margin-left"
|
|
54
58
|
(onClick)="onCreateAccount.emit($event)"
|
|
55
59
|
label="Sign up"
|
|
@@ -60,7 +64,7 @@ import type { User } from './User';
|
|
|
60
64
|
</header>`,
|
|
61
65
|
styleUrls: ['./header.css'],
|
|
62
66
|
})
|
|
63
|
-
export
|
|
67
|
+
export class HeaderComponent {
|
|
64
68
|
@Input()
|
|
65
69
|
user: User | null = null;
|
|
66
70
|
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import { moduleMetadata } from '@storybook/angular';
|
|
2
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
2
|
|
|
5
|
-
import
|
|
6
|
-
import Header from './header.component';
|
|
3
|
+
import { HeaderComponent } from './header.component';
|
|
7
4
|
|
|
8
|
-
const meta: Meta<
|
|
5
|
+
const meta: Meta<HeaderComponent> = {
|
|
9
6
|
title: 'Example/Header',
|
|
10
|
-
component:
|
|
7
|
+
component: HeaderComponent,
|
|
11
8
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
12
9
|
tags: ['autodocs'],
|
|
13
|
-
render: (args) => ({ props: args }),
|
|
14
|
-
decorators: [
|
|
15
|
-
moduleMetadata({
|
|
16
|
-
declarations: [Button],
|
|
17
|
-
imports: [CommonModule],
|
|
18
|
-
}),
|
|
19
|
-
],
|
|
20
10
|
parameters: {
|
|
21
11
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
22
12
|
layout: 'fullscreen',
|
|
@@ -24,7 +14,7 @@ const meta: Meta<Header> = {
|
|
|
24
14
|
};
|
|
25
15
|
|
|
26
16
|
export default meta;
|
|
27
|
-
type Story = StoryObj<
|
|
17
|
+
type Story = StoryObj<HeaderComponent>;
|
|
28
18
|
|
|
29
19
|
export const LoggedIn: Story = {
|
|
30
20
|
args: {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
|
-
import
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
import { HeaderComponent } from './header.component';
|
|
5
|
+
import type { User } from './user';
|
|
3
6
|
|
|
4
7
|
@Component({
|
|
5
8
|
selector: 'storybook-page',
|
|
9
|
+
standalone: true,
|
|
10
|
+
imports: [CommonModule, HeaderComponent],
|
|
6
11
|
template: `<article>
|
|
7
12
|
<storybook-header
|
|
8
13
|
[user]="user"
|
|
@@ -60,7 +65,7 @@ import type { User } from './User';
|
|
|
60
65
|
</article>`,
|
|
61
66
|
styleUrls: ['./page.css'],
|
|
62
67
|
})
|
|
63
|
-
export
|
|
68
|
+
export class PageComponent {
|
|
64
69
|
user: User | null = null;
|
|
65
70
|
|
|
66
71
|
doLogout() {
|
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
import { moduleMetadata } from '@storybook/angular';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
2
|
import { within, userEvent, expect } from '@storybook/test';
|
|
5
3
|
|
|
6
|
-
import
|
|
7
|
-
import Header from './header.component';
|
|
8
|
-
import Page from './page.component';
|
|
4
|
+
import { PageComponent } from './page.component';
|
|
9
5
|
|
|
10
|
-
const meta: Meta<
|
|
6
|
+
const meta: Meta<PageComponent> = {
|
|
11
7
|
title: 'Example/Page',
|
|
12
|
-
component:
|
|
8
|
+
component: PageComponent,
|
|
13
9
|
parameters: {
|
|
14
10
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
15
11
|
layout: 'fullscreen',
|
|
16
12
|
},
|
|
17
|
-
decorators: [
|
|
18
|
-
moduleMetadata({
|
|
19
|
-
declarations: [Button, Header],
|
|
20
|
-
imports: [CommonModule],
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
13
|
};
|
|
24
14
|
|
|
25
15
|
export default meta;
|
|
26
|
-
type Story = StoryObj<
|
|
16
|
+
type Story = StoryObj<PageComponent>;
|
|
27
17
|
|
|
28
|
-
export const LoggedOut: Story = {
|
|
29
|
-
render: (args: Page) => ({
|
|
30
|
-
props: args,
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
18
|
+
export const LoggedOut: Story = {};
|
|
33
19
|
|
|
34
20
|
// More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
35
21
|
export const LoggedIn: Story = {
|
|
36
|
-
render: (args: Page) => ({
|
|
37
|
-
props: args,
|
|
38
|
-
}),
|
|
39
22
|
play: async ({ canvasElement }) => {
|
|
40
23
|
const canvas = within(canvasElement);
|
|
41
24
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
package/template/cli/User.ts
DELETED