Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: Re-structure types for frameworks and presets #18504

Merged
merged 49 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
37e814a
let's structure out framework types and presets. They cascade into ea…
ndelangen Jun 17, 2022
c942de4
remove react specific webpack plugin from builder-webpack5, should be…
ndelangen Jun 17, 2022
7f65c7b
migrate examples to use main.ts (typescript),they import the correct …
ndelangen Jun 20, 2022
93433a9
improve
ndelangen Jun 20, 2022
a76abc9
cleanup
ndelangen Jun 20, 2022
e69a829
cleanup
ndelangen Jun 20, 2022
e666221
cleanup
ndelangen Jun 20, 2022
2f10e33
cleanup
ndelangen Jun 20, 2022
b239db2
fix
ndelangen Jun 20, 2022
4b018d2
wip
ndelangen Jun 20, 2022
7e5db15
fix
ndelangen Jun 20, 2022
3423883
make TS in generated main based on language in generator
ndelangen Jun 21, 2022
fb0400f
Merge branch 'future/SB-444-examples' into future/SB-444-cleanup
ndelangen Jun 21, 2022
a312571
cleanup
ndelangen Jun 21, 2022
05e0643
experiment with setting latest version of yarn instead, not berry
ndelangen Jun 21, 2022
fd6db36
bump
ndelangen Jun 21, 2022
b0d32a9
Merge branch 'future/base' into future/SB-444
ndelangen Jun 21, 2022
e6bf81d
Merge branch 'future/SB-444' into future/SB-444-examples
ndelangen Jun 21, 2022
235317e
Merge branch 'future/SB-444-examples' into future/SB-444-cleanup
ndelangen Jun 21, 2022
4dbfd8e
fix merge conflict
ndelangen Jun 21, 2022
5b11159
Merge branch 'future/SB-444' into future/SB-444-examples
ndelangen Jun 21, 2022
d0d07ea
Merge branch 'future/SB-444-examples' into future/SB-444-cleanup
ndelangen Jun 21, 2022
3d7d312
cleanup
ndelangen Jun 21, 2022
93cdd77
cleanup
ndelangen Jun 21, 2022
9ef9e67
clear
ndelangen Jun 21, 2022
1c2aac0
Merge branch 'future/SB-444-examples' into future/SB-444-cleanup
ndelangen Jun 21, 2022
bb6859c
fix deepscan issue
ndelangen Jun 21, 2022
d4c22e2
Merge pull request #18519 from storybookjs/future/SB-444-examples
ndelangen Jun 21, 2022
d3e6c48
fix types in example stories
ndelangen Jun 21, 2022
c0240f8
changes
ndelangen Jun 21, 2022
4863ee1
fix deepscan issue
ndelangen Jun 21, 2022
0498b96
Merge branch 'future/SB-444' into future/SB-444-cleanup
ndelangen Jun 21, 2022
0982008
Merge pull request #18527 from storybookjs/future/SB-444-cleanup
ndelangen Jun 21, 2022
493b15f
wip
ndelangen Jun 21, 2022
c29b2cb
make it all imported by type, and convert to use to StoryFn
ndelangen Jun 21, 2022
d26fb61
cleanup comments about pre-7.0
ndelangen Jun 21, 2022
de91f89
refactor angular to look more like the other frameworks
ndelangen Jun 21, 2022
0b7aa13
fix
ndelangen Jun 21, 2022
69a61b6
Story should StoryFn
ndelangen Jun 21, 2022
e262d8c
more Story to StoryFn convertion
ndelangen Jun 21, 2022
2cbe15b
even more, why do we have so many stories
ndelangen Jun 21, 2022
4f42f71
fix bad migration
ndelangen Jun 21, 2022
b94b844
and even more
ndelangen Jun 21, 2022
27e9cd5
Merge pull request #18532 from storybookjs/future/SB-444-angular
ndelangen Jun 21, 2022
685f64f
Merge branch 'future/base' into future/SB-444
ndelangen Jun 23, 2022
c568b3a
Merge branch 'future/base' into future/SB-444
ndelangen Jun 23, 2022
63460cf
Merge branch 'future/base' into future/SB-444
shilman Jun 29, 2022
88486fb
apply review comments (thanks)
ndelangen Jun 29, 2022
83759ea
Merge branch 'future/base' into future/SB-444
ndelangen Jun 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion addons/interactions/src/Panel.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { ComponentStoryObj, ComponentMeta } from '@storybook/react';
import type { ComponentStoryObj, ComponentMeta } from '@storybook/react';
import { CallStates } from '@storybook/instrumenter';
import { styled } from '@storybook/theming';

Expand Down
4 changes: 2 additions & 2 deletions addons/jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const decorators = [
Finally, in your story, you'll need to include the following:

```ts
import { Meta, Story } from '@storybook/angular/types-6-0';
import type { Meta, StoryFn } from '@storybook/angular';

import MyComponent from './MyComponent.component';

Expand All @@ -230,7 +230,7 @@ export default {
title: 'MyComponent',
} as Meta;

const Template: Story<MyComponent> = (args: MyComponent) => ({
const Template: StoryFn<MyComponent> = (args: MyComponent) => ({
props: args,
});

Expand Down
23 changes: 16 additions & 7 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ module.exports = {
addons: [
/* ... */
],
angularOptions: {
enableIvy: false,
framework: {
name: '@storybook/angular',
options: {
enableIvy: false,
}
},
};
```
Expand Down Expand Up @@ -73,8 +76,11 @@ FAST_REFRESH=true

```js
module.exports = {
reactOptions: {
fastRefresh: true,
framework: {
name: '@storybook/react-webpack5',
options: {
fastRefresh: true,
},
},
};
```
Expand All @@ -91,8 +97,11 @@ You can opt-out from the new React Root API by setting the following property in

```js
module.exports = {
reactOptions: {
legacyRootApi: true,
framework: {
name: '@storybook/react-webpack5',
options: {
legacyRootApi: true,
},
},
};
```
Expand Down Expand Up @@ -410,7 +419,7 @@ We're aware that the default Typescript story construct might seem outdated and
// Button.stories.ts | tsx

import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStory, ComponentMeta } from '@storybook/react';

const StoryMeta: ComponentMeta<typeof Button> = {
/* 👇 The title prop is optional.
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/app-story-with-mock.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// App.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { AppComponent } from './app.component';

Expand All @@ -14,7 +14,7 @@ export default {
component: AppComponent,
} as Meta;

const Template: Story = () => ({
const Template: StoryFn = () => ({
props: {},
});

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-group-story.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// ButtonGroup.stories.ts

import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { Meta, moduleMetadata, StoryFn } from '@storybook/angular';

import { CommonModule } from '@angular/common';

Expand All @@ -26,7 +26,7 @@ export default {
],
} as Meta;

const Template: Story = (args) => ({
const Template: StoryFn = (args) => ({
props: args,
});

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-click-handler-args.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { action } from '@storybook/addon-actions';

Expand All @@ -16,7 +16,7 @@ export default {
component: Button,
} as Meta;

export const Text: Story = ({ label, onClick }) => ({
export const Text: StoryFn = ({ label, onClick }) => ({
props: {
label,
onClick,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -14,7 +14,7 @@ export default {
component: Button,
} as Meta;

export const Text: Story = (args) => ({
export const Text: StoryFn = (args) => ({
props: args,
});
```
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-click-handler.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -16,7 +16,7 @@ export default {
component: Button,
} as Meta;

export const Text: Story = () => ({
export const Text: StoryFn = () => ({
props: {
text: 'Hello Button',
onClick: action('clicked'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta } from '@storybook/angular';
import type { Meta } from '@storybook/angular';

import { Button } from './button.component';

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-default-docs-code.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -24,7 +24,7 @@ const someFunction = (someValue: string) => {
};


export const ExampleStory: Story = (args) => {
export const ExampleStory: StoryFn = (args) => {
//👇 Destructure the label from the args object
const { label } = args;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta } from '@storybook/angular';
import type { Meta } from '@storybook/angular';

import { Button } from './button.component';

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-rename-story.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -15,7 +15,7 @@ export default {
} as Meta;


export const Primary: Story = () => ({
export const Primary: StoryFn = () => ({
props: {
label: 'Button',
primary: true,
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-using-args.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -16,7 +16,7 @@ export default {


//👇 We create a “template” of how args map to rendering
const Template: Story = (args) => ({
const Template: StoryFn = (args) => ({
props: args,
});

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-with-addon-example.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -20,7 +20,7 @@ export default {
},
} as Meta;

export const Basic: Story = () => ({
export const Basic: StoryFn = () => ({
template: `<app-button>hello</<app-button>`,
});
```
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story-with-args.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular/';
import type { Meta, StoryFn } from '@storybook/angular/';

import { Button } from './button.component';

Expand All @@ -15,7 +15,7 @@ export default {
} as Meta;

//👇 We create a “template” of how args map to rendering
const Template: Story = (args) => ({
const Template: StoryFn = (args) => ({
props: args,
});

Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/angular/button-story-with-blue-args.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta } from '@storybook/angular';
import type { Meta } from '@storybook/angular';

import { Button } from './button.component';

Expand Down
8 changes: 4 additions & 4 deletions docs/snippets/angular/button-story-with-emojis.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -14,22 +14,22 @@ export default {
component: Button,
};

export const Primary: Story = () => ({
export const Primary: StoryFn = () => ({
props: {
label: 'Button',
backgroundColor: '#ff0',
},
});


export const Secondary: Story = () => ({
export const Secondary: StoryFn = () => ({
props: {
label: '😄👍😍💯',
backgroundColor: '#ff0',
},
});

export const Tertiary: Story = () => ({
export const Tertiary: StoryFn = () => ({
props: {
label: '📚📕📈🤓',
backgroundColor: '#ff0',
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/button-story.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Button.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Button } from './button.component';

Expand All @@ -14,7 +14,7 @@ export default {
component: Button,
} as Meta;

export const Primary: Story = () => ({
export const Primary: StoryFn = () => ({
props: {
label: 'Button',
primary: true,
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/checkbox-story-csf.ts.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Checkbox.stories.ts

import { Meta, Story } from '@storybook/angular';
import type { Meta, StoryFn } from '@storybook/angular';

import { Checkbox } from './Checkbox.component';

Expand All @@ -14,7 +14,7 @@ export default {
component: Checkbox,
} as Meta;

export const allCheckboxes: Story = () => ({
export const allCheckboxes: StoryFn = () => ({
template: `
<form>
<Checkbox id="Unchecked" label="Unchecked" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// Icon.stories.ts

import { Story, Meta } from '@storybook/angular/types-6-0';
import type { Meta, StoryFn } from '@storybook/angular';

import Icon from './icon.component';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```ts
// MyComponent.stories.ts

import { Story, Meta } from '@storybook/angular/';
import type { Meta, StoryFn } from '@storybook/angular';

import { withDesign } from 'storybook-addon-designs';

Expand All @@ -15,7 +15,7 @@ export default {
} as Meta;

// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
const Template: Story = () => ({
const Template: StoryFn = () => ({
props: {},
});

Expand Down
Loading