@storybook/angular 7.0.0-alpha.49 → 7.0.0-alpha.50
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/dist/builders/build-storybook/index.spec.js +25 -9
- package/dist/builders/start-storybook/index.spec.js +22 -8
- package/dist/builders/utils/run-compodoc.spec.js +2 -0
- package/dist/client/angular/helpers.d.ts +2 -2
- package/dist/client/angular-beta/RendererFactory.test.js +7 -5
- package/dist/client/decorateStory.d.ts +2 -2
- package/dist/client/decorators.d.ts +3 -3
- package/dist/client/docs/sourceDecorator.d.ts +2 -2
- package/dist/client/public-api.d.ts +2 -2
- package/dist/client/public-types.d.ts +11 -6
- package/dist/client/render.d.ts +3 -3
- package/dist/client/types.d.ts +7 -3
- package/jest.config.js +8 -1
- package/package.json +18 -17
|
@@ -27,8 +27,13 @@ const architect_1 = require("@angular-devkit/architect");
|
|
|
27
27
|
const testing_1 = require("@angular-devkit/architect/testing");
|
|
28
28
|
const core_1 = require("@angular-devkit/core");
|
|
29
29
|
const path = __importStar(require("path"));
|
|
30
|
-
const
|
|
31
|
-
jest.
|
|
30
|
+
const buildDevStandaloneMock = jest.fn();
|
|
31
|
+
const buildStaticStandaloneMock = jest.fn();
|
|
32
|
+
const buildMock = {
|
|
33
|
+
buildDevStandalone: buildDevStandaloneMock,
|
|
34
|
+
buildStaticStandalone: buildStaticStandaloneMock,
|
|
35
|
+
};
|
|
36
|
+
jest.doMock('@storybook/core-server', () => buildMock);
|
|
32
37
|
jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
|
33
38
|
const cpSpawnMock = {
|
|
34
39
|
spawn: jest.fn(),
|
|
@@ -60,7 +65,7 @@ describe('Build Storybook Builder', () => {
|
|
|
60
65
|
await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
|
|
61
66
|
});
|
|
62
67
|
beforeEach(() => {
|
|
63
|
-
|
|
68
|
+
buildStaticStandaloneMock.mockImplementation((_options) => Promise.resolve());
|
|
64
69
|
cpSpawnMock.spawn.mockImplementation(() => ({
|
|
65
70
|
stdout: { on: () => { } },
|
|
66
71
|
stderr: { on: () => { } },
|
|
@@ -79,14 +84,16 @@ describe('Build Storybook Builder', () => {
|
|
|
79
84
|
await run.stop();
|
|
80
85
|
expect(output.success).toBeTruthy();
|
|
81
86
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
82
|
-
expect(
|
|
87
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
83
88
|
angularBrowserTarget: 'angular-cli:build-2',
|
|
84
89
|
angularBuilderContext: expect.any(Object),
|
|
85
90
|
angularBuilderOptions: {},
|
|
86
91
|
configDir: '.storybook',
|
|
92
|
+
docs: undefined,
|
|
87
93
|
loglevel: undefined,
|
|
88
94
|
quiet: false,
|
|
89
95
|
outputDir: 'storybook-static',
|
|
96
|
+
packageJson: expect.any(Object),
|
|
90
97
|
mode: 'static',
|
|
91
98
|
tsConfig: './storybook/tsconfig.ts',
|
|
92
99
|
webpackStatsJson: false,
|
|
@@ -101,14 +108,16 @@ describe('Build Storybook Builder', () => {
|
|
|
101
108
|
await run.stop();
|
|
102
109
|
expect(output.success).toBeTruthy();
|
|
103
110
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
104
|
-
expect(
|
|
111
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
105
112
|
angularBrowserTarget: null,
|
|
106
113
|
angularBuilderContext: expect.any(Object),
|
|
107
114
|
angularBuilderOptions: {},
|
|
108
115
|
configDir: '.storybook',
|
|
116
|
+
docs: undefined,
|
|
109
117
|
loglevel: undefined,
|
|
110
118
|
quiet: false,
|
|
111
119
|
outputDir: 'storybook-static',
|
|
120
|
+
packageJson: expect.any(Object),
|
|
112
121
|
mode: 'static',
|
|
113
122
|
tsConfig: 'path/to/tsConfig.json',
|
|
114
123
|
webpackStatsJson: false,
|
|
@@ -124,21 +133,23 @@ describe('Build Storybook Builder', () => {
|
|
|
124
133
|
await run.stop();
|
|
125
134
|
expect(output.success).toBeTruthy();
|
|
126
135
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
127
|
-
expect(
|
|
136
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
128
137
|
angularBrowserTarget: null,
|
|
129
138
|
angularBuilderContext: expect.any(Object),
|
|
130
139
|
angularBuilderOptions: {},
|
|
131
140
|
configDir: '.storybook',
|
|
141
|
+
docs: undefined,
|
|
132
142
|
loglevel: undefined,
|
|
133
143
|
quiet: false,
|
|
134
144
|
outputDir: 'storybook-static',
|
|
145
|
+
packageJson: expect.any(Object),
|
|
135
146
|
mode: 'static',
|
|
136
147
|
tsConfig: 'path/to/tsConfig.json',
|
|
137
148
|
webpackStatsJson: true,
|
|
138
149
|
});
|
|
139
150
|
});
|
|
140
151
|
it('should throw error', async () => {
|
|
141
|
-
|
|
152
|
+
buildStaticStandaloneMock.mockRejectedValue(true);
|
|
142
153
|
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
143
154
|
browserTarget: 'angular-cli:build-2',
|
|
144
155
|
port: 4400,
|
|
@@ -162,15 +173,18 @@ describe('Build Storybook Builder', () => {
|
|
|
162
173
|
expect(output.success).toBeTruthy();
|
|
163
174
|
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', './storybook/tsconfig.ts', '-d', '', '-e', 'json'], {
|
|
164
175
|
cwd: '',
|
|
176
|
+
shell: true,
|
|
165
177
|
});
|
|
166
|
-
expect(
|
|
178
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
167
179
|
angularBrowserTarget: 'angular-cli:build-2',
|
|
168
180
|
angularBuilderContext: expect.any(Object),
|
|
169
181
|
angularBuilderOptions: {},
|
|
170
182
|
configDir: '.storybook',
|
|
183
|
+
docs: undefined,
|
|
171
184
|
loglevel: undefined,
|
|
172
185
|
quiet: false,
|
|
173
186
|
outputDir: 'storybook-static',
|
|
187
|
+
packageJson: expect.any(Object),
|
|
174
188
|
mode: 'static',
|
|
175
189
|
tsConfig: './storybook/tsconfig.ts',
|
|
176
190
|
webpackStatsJson: false,
|
|
@@ -186,14 +200,16 @@ describe('Build Storybook Builder', () => {
|
|
|
186
200
|
await run.stop();
|
|
187
201
|
expect(output.success).toBeTruthy();
|
|
188
202
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
189
|
-
expect(
|
|
203
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
190
204
|
angularBrowserTarget: null,
|
|
191
205
|
angularBuilderContext: expect.any(Object),
|
|
192
206
|
angularBuilderOptions: { styles: ['style.scss'] },
|
|
193
207
|
configDir: '.storybook',
|
|
208
|
+
docs: undefined,
|
|
194
209
|
loglevel: undefined,
|
|
195
210
|
quiet: false,
|
|
196
211
|
outputDir: 'storybook-static',
|
|
212
|
+
packageJson: expect.any(Object),
|
|
197
213
|
mode: 'static',
|
|
198
214
|
tsConfig: 'path/to/tsConfig.json',
|
|
199
215
|
webpackStatsJson: false,
|
|
@@ -27,8 +27,13 @@ const architect_1 = require("@angular-devkit/architect");
|
|
|
27
27
|
const testing_1 = require("@angular-devkit/architect/testing");
|
|
28
28
|
const core_1 = require("@angular-devkit/core");
|
|
29
29
|
const path = __importStar(require("path"));
|
|
30
|
-
const
|
|
31
|
-
jest.
|
|
30
|
+
const buildDevStandaloneMock = jest.fn();
|
|
31
|
+
const buildStaticStandaloneMock = jest.fn();
|
|
32
|
+
const buildMock = {
|
|
33
|
+
buildDevStandalone: buildDevStandaloneMock,
|
|
34
|
+
buildStaticStandalone: buildStaticStandaloneMock,
|
|
35
|
+
};
|
|
36
|
+
jest.doMock('@storybook/core-server', () => buildMock);
|
|
32
37
|
jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
|
33
38
|
const cpSpawnMock = {
|
|
34
39
|
spawn: jest.fn(),
|
|
@@ -60,7 +65,7 @@ describe('Start Storybook Builder', () => {
|
|
|
60
65
|
await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
|
|
61
66
|
});
|
|
62
67
|
beforeEach(() => {
|
|
63
|
-
|
|
68
|
+
buildDevStandaloneMock.mockImplementation((_options) => Promise.resolve());
|
|
64
69
|
cpSpawnMock.spawn.mockImplementation(() => ({
|
|
65
70
|
stdout: { on: () => { } },
|
|
66
71
|
stderr: { on: () => { } },
|
|
@@ -80,14 +85,16 @@ describe('Start Storybook Builder', () => {
|
|
|
80
85
|
await run.stop();
|
|
81
86
|
expect(output.success).toBeTruthy();
|
|
82
87
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
83
|
-
expect(
|
|
88
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
84
89
|
angularBrowserTarget: 'angular-cli:build-2',
|
|
85
90
|
angularBuilderContext: expect.any(Object),
|
|
86
91
|
angularBuilderOptions: {},
|
|
87
92
|
ci: false,
|
|
88
93
|
configDir: '.storybook',
|
|
94
|
+
docs: undefined,
|
|
89
95
|
host: 'localhost',
|
|
90
96
|
https: false,
|
|
97
|
+
packageJson: expect.any(Object),
|
|
91
98
|
port: 4400,
|
|
92
99
|
quiet: false,
|
|
93
100
|
smokeTest: false,
|
|
@@ -107,14 +114,16 @@ describe('Start Storybook Builder', () => {
|
|
|
107
114
|
await run.stop();
|
|
108
115
|
expect(output.success).toBeTruthy();
|
|
109
116
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
110
|
-
expect(
|
|
117
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
111
118
|
angularBrowserTarget: null,
|
|
112
119
|
angularBuilderContext: expect.any(Object),
|
|
113
120
|
angularBuilderOptions: {},
|
|
114
121
|
ci: false,
|
|
115
122
|
configDir: '.storybook',
|
|
123
|
+
docs: undefined,
|
|
116
124
|
host: 'localhost',
|
|
117
125
|
https: false,
|
|
126
|
+
packageJson: expect.any(Object),
|
|
118
127
|
port: 4400,
|
|
119
128
|
quiet: false,
|
|
120
129
|
smokeTest: false,
|
|
@@ -125,7 +134,7 @@ describe('Start Storybook Builder', () => {
|
|
|
125
134
|
});
|
|
126
135
|
});
|
|
127
136
|
it('should throw error', async () => {
|
|
128
|
-
|
|
137
|
+
buildDevStandaloneMock.mockRejectedValue(true);
|
|
129
138
|
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
130
139
|
browserTarget: 'angular-cli:build-2',
|
|
131
140
|
port: 4400,
|
|
@@ -149,15 +158,18 @@ describe('Start Storybook Builder', () => {
|
|
|
149
158
|
expect(output.success).toBeTruthy();
|
|
150
159
|
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', './storybook/tsconfig.ts', '-d', '', '-e', 'json'], {
|
|
151
160
|
cwd: '',
|
|
161
|
+
shell: true,
|
|
152
162
|
});
|
|
153
|
-
expect(
|
|
163
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
154
164
|
angularBrowserTarget: 'angular-cli:build-2',
|
|
155
165
|
angularBuilderContext: expect.any(Object),
|
|
156
166
|
angularBuilderOptions: {},
|
|
157
167
|
ci: false,
|
|
158
168
|
configDir: '.storybook',
|
|
169
|
+
docs: undefined,
|
|
159
170
|
host: 'localhost',
|
|
160
171
|
https: false,
|
|
172
|
+
packageJson: expect.any(Object),
|
|
161
173
|
port: 9009,
|
|
162
174
|
quiet: false,
|
|
163
175
|
smokeTest: false,
|
|
@@ -178,7 +190,7 @@ describe('Start Storybook Builder', () => {
|
|
|
178
190
|
await run.stop();
|
|
179
191
|
expect(output.success).toBeTruthy();
|
|
180
192
|
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
181
|
-
expect(
|
|
193
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
182
194
|
angularBrowserTarget: null,
|
|
183
195
|
angularBuilderContext: expect.any(Object),
|
|
184
196
|
angularBuilderOptions: {
|
|
@@ -186,9 +198,11 @@ describe('Start Storybook Builder', () => {
|
|
|
186
198
|
},
|
|
187
199
|
ci: false,
|
|
188
200
|
configDir: '.storybook',
|
|
201
|
+
docs: undefined,
|
|
189
202
|
host: 'localhost',
|
|
190
203
|
https: false,
|
|
191
204
|
port: 4400,
|
|
205
|
+
packageJson: expect.any(Object),
|
|
192
206
|
quiet: false,
|
|
193
207
|
smokeTest: false,
|
|
194
208
|
sslCa: undefined,
|
|
@@ -38,6 +38,7 @@ describe('runCompodoc', () => {
|
|
|
38
38
|
.subscribe();
|
|
39
39
|
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], {
|
|
40
40
|
cwd: 'path/to/project',
|
|
41
|
+
shell: true,
|
|
41
42
|
});
|
|
42
43
|
});
|
|
43
44
|
it('should run compodoc with tsconfig from compodocArgs', async () => {
|
|
@@ -52,6 +53,7 @@ describe('runCompodoc', () => {
|
|
|
52
53
|
.subscribe();
|
|
53
54
|
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-d', 'path/to/project', '-p', 'path/to/tsconfig.stories.json'], {
|
|
54
55
|
cwd: 'path/to/project',
|
|
56
|
+
shell: true,
|
|
55
57
|
});
|
|
56
58
|
});
|
|
57
59
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
-
import {
|
|
2
|
+
import { AngularRenderer } from '../types';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
NODE_ENV: 'string' | 'development' | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare const renderNgApp: (storyFn: PartialStoryFn<
|
|
8
|
+
export declare const renderNgApp: (storyFn: PartialStoryFn<AngularRenderer>, forced: boolean) => void;
|
|
@@ -20,8 +20,8 @@ describe('RendererFactory', () => {
|
|
|
20
20
|
beforeEach(async () => {
|
|
21
21
|
rendererFactory = new RendererFactory_1.RendererFactory();
|
|
22
22
|
document.body.innerHTML =
|
|
23
|
-
'<div id="root"></div><div id="root-docs"><div id="story-in-docs"></div></div>';
|
|
24
|
-
rootTargetDOMNode = global.document.getElementById('root');
|
|
23
|
+
'<div id="storybook-root"></div><div id="root-docs"><div id="story-in-docs"></div></div>';
|
|
24
|
+
rootTargetDOMNode = global.document.getElementById('storybook-root');
|
|
25
25
|
rootDocstargetDOMNode = global.document.getElementById('root-docs');
|
|
26
26
|
platform_browser_dynamic_1.platformBrowserDynamic.mockImplementation(testing_1.platformBrowserDynamicTesting);
|
|
27
27
|
jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
@@ -257,10 +257,12 @@ describe('RendererFactory', () => {
|
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
259
|
it('should reset root HTML', async () => {
|
|
260
|
-
global.document
|
|
261
|
-
|
|
260
|
+
global.document
|
|
261
|
+
.getElementById('storybook-root')
|
|
262
|
+
.appendChild(global.document.createElement('👾'));
|
|
263
|
+
expect(global.document.getElementById('storybook-root').innerHTML).toContain('Canvas 🖼');
|
|
262
264
|
const render = await rendererFactory.getRendererInstance('my-story-in-docs', rootDocstargetDOMNode);
|
|
263
|
-
expect(global.document.getElementById('root').innerHTML).toBe('');
|
|
265
|
+
expect(global.document.getElementById('storybook-root').innerHTML).toBe('');
|
|
264
266
|
});
|
|
265
267
|
});
|
|
266
268
|
it('should get DocsRenderer instance', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DecoratorFunction, LegacyStoryFn } from '@storybook/types';
|
|
2
|
-
import {
|
|
3
|
-
export default function decorateStory(mainStoryFn: LegacyStoryFn<
|
|
2
|
+
import { AngularRenderer } from './types';
|
|
3
|
+
export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularRenderer>, decorators: DecoratorFunction<AngularRenderer>[]): LegacyStoryFn<AngularRenderer>;
|
|
4
4
|
export { decorateStory };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
2
|
import { DecoratorFunction, StoryContext } from '@storybook/types';
|
|
3
|
-
import { ICollection, NgModuleMetadata,
|
|
4
|
-
export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<
|
|
5
|
-
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<
|
|
3
|
+
import { ICollection, NgModuleMetadata, AngularRenderer } from './types';
|
|
4
|
+
export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularRenderer, TArgs>;
|
|
5
|
+
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection)) => DecoratorFunction<AngularRenderer, TArgs>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
-
import { StoryContext,
|
|
2
|
+
import { StoryContext, AngularRenderer } 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<
|
|
9
|
+
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularRenderer>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="webpack-env" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types';
|
|
4
|
-
import {
|
|
4
|
+
import { AngularRenderer } from './types';
|
|
5
5
|
export * from './public-types';
|
|
6
|
-
interface ClientApi extends Addon_ClientStoryApi<
|
|
6
|
+
interface ClientApi extends Addon_ClientStoryApi<AngularRenderer['storyResult']> {
|
|
7
7
|
configure(loader: Addon_Loadable, module: NodeModule): void;
|
|
8
8
|
forceReRender(): void;
|
|
9
9
|
raw: () => any;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { AnnotatedStoryFn, Args, ComponentAnnotations, StoryAnnotations } from '@storybook/types';
|
|
2
|
-
import {
|
|
3
|
-
export type { Args, ArgTypes } from '@storybook/types';
|
|
1
|
+
import { AnnotatedStoryFn, Args, ComponentAnnotations, DecoratorFunction, LoaderFunction, StoryAnnotations, StoryContext as GenericStoryContext, StrictArgs } from '@storybook/types';
|
|
2
|
+
import { AngularRenderer } from './types';
|
|
3
|
+
export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
|
|
4
|
+
export type { Parameters as AngularParameters } from './types';
|
|
5
|
+
export type { AngularRenderer };
|
|
4
6
|
/**
|
|
5
7
|
* Metadata to configure the stories for a component.
|
|
6
8
|
*
|
|
7
9
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
8
10
|
*/
|
|
9
|
-
export declare type Meta<TArgs = Args> = ComponentAnnotations<
|
|
11
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TArgs>;
|
|
10
12
|
/**
|
|
11
13
|
* Story function that represents a CSFv2 component example.
|
|
12
14
|
*
|
|
13
15
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
14
16
|
*/
|
|
15
|
-
export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<
|
|
17
|
+
export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TArgs>;
|
|
16
18
|
/**
|
|
17
19
|
* Story function that represents a CSFv3 component example.
|
|
18
20
|
*
|
|
19
21
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
20
22
|
*/
|
|
21
|
-
export declare type StoryObj<TArgs = Args> = StoryAnnotations<
|
|
23
|
+
export declare type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TArgs>;
|
|
22
24
|
/**
|
|
23
25
|
* @deprecated Use `StoryFn` instead.
|
|
24
26
|
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
|
|
@@ -29,3 +31,6 @@ export declare type StoryObj<TArgs = Args> = StoryAnnotations<AngularFramework,
|
|
|
29
31
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
30
32
|
*/
|
|
31
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>;
|
package/dist/client/render.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Store_RenderContext, ArgsStoryFn } from '@storybook/types';
|
|
2
|
-
import {
|
|
2
|
+
import { AngularRenderer } from './types';
|
|
3
3
|
import { RendererFactory } from './angular-beta/RendererFactory';
|
|
4
4
|
export declare const rendererFactory: RendererFactory;
|
|
5
|
-
export declare const render: ArgsStoryFn<
|
|
6
|
-
export declare function renderToCanvas({ storyFn, showMain, forceRemount, storyContext: { parameters, component }, id, }: Store_RenderContext<
|
|
5
|
+
export declare const render: ArgsStoryFn<AngularRenderer>;
|
|
6
|
+
export declare function renderToCanvas({ storyFn, showMain, forceRemount, storyContext: { parameters, component }, id, }: Store_RenderContext<AngularRenderer>, element: HTMLElement): Promise<void>;
|
package/dist/client/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parameters as DefaultParameters, StoryContext as DefaultStoryContext,
|
|
1
|
+
import { Parameters as DefaultParameters, StoryContext as DefaultStoryContext, WebRenderer } from '@storybook/types';
|
|
2
2
|
export interface NgModuleMetadata {
|
|
3
3
|
declarations?: any[];
|
|
4
4
|
entryComponents?: any[];
|
|
@@ -20,7 +20,11 @@ export interface StoryFnAngularReturnType {
|
|
|
20
20
|
styles?: string[];
|
|
21
21
|
userDefinedTemplate?: boolean;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `AngularRenderer` instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare type AngularFramework = AngularRenderer;
|
|
27
|
+
export interface AngularRenderer extends WebRenderer {
|
|
24
28
|
component: any;
|
|
25
29
|
storyResult: StoryFnAngularReturnType;
|
|
26
30
|
}
|
|
@@ -29,6 +33,6 @@ export declare type Parameters = DefaultParameters & {
|
|
|
29
33
|
angularLegacyRendering?: boolean;
|
|
30
34
|
bootstrapModuleOptions?: unknown;
|
|
31
35
|
};
|
|
32
|
-
export declare type StoryContext = DefaultStoryContext<
|
|
36
|
+
export declare type StoryContext = DefaultStoryContext<AngularRenderer> & {
|
|
33
37
|
parameters: Parameters;
|
|
34
38
|
};
|
package/jest.config.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
4
|
+
displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
|
|
2
5
|
preset: 'jest-preset-angular',
|
|
3
6
|
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
|
|
4
|
-
transformIgnorePatterns: ['
|
|
7
|
+
transformIgnorePatterns: ['/node_modules/(?!@angular|rxjs|nanoid|uuid)'],
|
|
8
|
+
snapshotFormat: {
|
|
9
|
+
escapeString: true,
|
|
10
|
+
printBasicPrototype: true,
|
|
11
|
+
},
|
|
5
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.50",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -34,23 +34,24 @@
|
|
|
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.
|
|
38
|
-
"@storybook/api": "7.0.0-alpha.
|
|
39
|
-
"@storybook/builder-webpack5": "7.0.0-alpha.
|
|
40
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
41
|
-
"@storybook/core-client": "7.0.0-alpha.
|
|
42
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
43
|
-
"@storybook/core-events": "7.0.0-alpha.
|
|
44
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
45
|
-
"@storybook/core-webpack": "7.0.0-alpha.
|
|
46
|
-
"@storybook/docs-tools": "7.0.0-alpha.
|
|
47
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
48
|
-
"@storybook/store": "7.0.0-alpha.
|
|
49
|
-
"@storybook/types": "7.0.0-alpha.
|
|
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
50
|
"@types/node": "^16.0.0",
|
|
51
51
|
"@types/react": "^16.14.23",
|
|
52
52
|
"@types/react-dom": "^16.9.14",
|
|
53
53
|
"@types/semver": "^7.3.4",
|
|
54
|
+
"@types/webpack-env": "^1.18.0",
|
|
54
55
|
"core-js": "^3.8.2",
|
|
55
56
|
"find-up": "^5.0.0",
|
|
56
57
|
"global": "^4.4.0",
|
|
@@ -80,9 +81,9 @@
|
|
|
80
81
|
"@types/rimraf": "^3.0.2",
|
|
81
82
|
"@types/tmp": "^0.2.3",
|
|
82
83
|
"cross-spawn": "^7.0.3",
|
|
83
|
-
"jest": "^
|
|
84
|
+
"jest": "^28.0.0",
|
|
84
85
|
"jest-preset-angular": "^12.0.0",
|
|
85
|
-
"jest-specific-snapshot": "^
|
|
86
|
+
"jest-specific-snapshot": "^6.0.0",
|
|
86
87
|
"rimraf": "^3.0.2",
|
|
87
88
|
"tmp": "^0.2.1",
|
|
88
89
|
"typescript": "~4.6.3",
|
|
@@ -122,5 +123,5 @@
|
|
|
122
123
|
"access": "public"
|
|
123
124
|
},
|
|
124
125
|
"builders": "dist/builders/builders.json",
|
|
125
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "77184d039091f4782dc4540df6d271a24fb3e242"
|
|
126
127
|
}
|