@storybook/angular 8.3.0-alpha.6 → 8.3.0-alpha.7
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/client/angular-beta/AbstractRenderer.d.ts +16 -15
- package/dist/client/angular-beta/AbstractRenderer.js +16 -15
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +4 -2
- package/dist/client/angular-beta/ComputesTemplateFromComponent.js +7 -8
- package/dist/client/angular-beta/DocsRenderer.js +6 -9
- package/dist/client/angular-beta/StorybookModule.js +1 -3
- package/dist/client/angular-beta/StorybookModule.test.js +6 -6
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +1 -3
- package/dist/client/angular-beta/StorybookWrapperComponent.js +1 -3
- package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +5 -7
- package/dist/client/angular-beta/utils/BootstrapQueue.js +8 -13
- package/dist/client/angular-beta/utils/BootstrapQueue.test.js +2 -1
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +3 -10
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +3 -10
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +0 -2
- package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -2
- package/dist/client/angular-beta/utils/StoryUID.d.ts +8 -9
- package/dist/client/angular-beta/utils/StoryUID.js +9 -12
- package/dist/client/argsToTemplate.d.ts +13 -12
- package/dist/client/argsToTemplate.js +8 -6
- package/dist/client/decorators.d.ts +3 -4
- package/dist/client/decorators.js +3 -4
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +7 -8
- package/dist/client/docs/__testfixtures__/doc-button/input.js +7 -8
- package/dist/client/docs/sourceDecorator.d.ts +2 -1
- package/dist/client/docs/sourceDecorator.js +2 -1
- package/dist/client/globals.d.ts +9 -11
- package/dist/client/globals.js +14 -20
- package/dist/client/types.d.ts +6 -6
- package/dist/server/angular-cli-webpack.js +6 -10
- package/dist/server/framework-preset-angular-cli.js +6 -15
- package/dist/server/framework-preset-angular-ivy.d.ts +2 -2
- package/dist/server/framework-preset-angular-ivy.js +10 -10
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +4 -3
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +4 -3
- package/dist/types.d.ts +1 -3
- package/package.json +8 -8
- package/scripts/postbuild.js +5 -4
- package/template/cli/button.component.ts +11 -19
- package/template/cli/header.component.ts +47 -50
- package/template/cli/page.component.ts +54 -54
- package/.eslintrc.js +0 -16
|
@@ -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`
|
|
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
|
|
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`
|
|
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
|
|
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);
|
|
@@ -3,7 +3,8 @@ 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
|
|
8
|
+
* @param context StoryContext
|
|
8
9
|
*/
|
|
9
10
|
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularRenderer>, context: StoryContext) => import("../types").StoryFnAngularReturnType;
|
|
@@ -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
|
|
22
|
+
* @param context StoryContext
|
|
22
23
|
*/
|
|
23
24
|
const sourceDecorator = (storyFn, context) => {
|
|
24
25
|
const story = storyFn();
|
package/dist/client/globals.d.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
-
*
|
|
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
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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';
|
package/dist/client/globals.js
CHANGED
|
@@ -2,40 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const global_1 = require("@storybook/global");
|
|
4
4
|
/**
|
|
5
|
-
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
6
|
-
*
|
|
5
|
+
* This file includes polyfills needed by Angular and is loaded before the app. You can add your own
|
|
6
|
+
* extra polyfills to this file.
|
|
7
7
|
*
|
|
8
8
|
* This file is divided into 2 sections:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
11
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main file.
|
|
12
12
|
*
|
|
13
13
|
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
14
14
|
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
15
|
-
* Edge
|
|
15
|
+
* Edge> = 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
16
16
|
*
|
|
17
17
|
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
|
-
* Required to support Web Animations `@angular/animation`.
|
|
21
|
-
*
|
|
22
|
-
* */
|
|
23
|
-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
24
|
-
/** *************************************************************************************************
|
|
25
|
-
* Zone JS is required by Angular itself.
|
|
20
|
+
* Required to support Web Animations `@angular/animation`. Needed for: All but Chrome, Firefox and
|
|
21
|
+
* Opera. http://caniuse.com/#feat=web-animation
|
|
26
22
|
*/
|
|
23
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
24
|
+
/** Zone JS is required by Angular itself. */
|
|
27
25
|
require("zone.js");
|
|
28
26
|
// Included with Angular CLI.
|
|
29
|
-
/**
|
|
30
|
-
* APPLICATION IMPORTS
|
|
31
|
-
*/
|
|
27
|
+
/** APPLICATION IMPORTS */
|
|
32
28
|
/**
|
|
33
|
-
* Date, currency, decimal and percent pipes.
|
|
34
|
-
*
|
|
29
|
+
* Date, currency, decimal and percent pipes. Needed for: All but Chrome, Firefox, Edge, IE11 and
|
|
30
|
+
* Safari 10
|
|
35
31
|
*/
|
|
36
32
|
// import 'intl'; // Run `npm install --save intl`.
|
|
37
|
-
/**
|
|
38
|
-
* Need to import at least one locale-data with intl.
|
|
39
|
-
*/
|
|
33
|
+
/** Need to import at least one locale-data with intl. */
|
|
40
34
|
// import 'intl/locale-data/jsonp/en';
|
|
41
35
|
global_1.global.STORYBOOK_ENV = 'angular';
|
package/dist/client/types.d.ts
CHANGED
|
@@ -2,20 +2,20 @@ import { Parameters as DefaultParameters, StoryContext as DefaultStoryContext, W
|
|
|
2
2
|
import { Provider } from '@angular/core';
|
|
3
3
|
import { ApplicationConfig } from '@angular/platform-browser';
|
|
4
4
|
export interface NgModuleMetadata {
|
|
5
|
-
/**
|
|
6
|
-
* List of components, directives, and pipes that belong to your component.
|
|
7
|
-
*/
|
|
5
|
+
/** List of components, directives, and pipes that belong to your component. */
|
|
8
6
|
declarations?: any[];
|
|
9
7
|
entryComponents?: any[];
|
|
10
8
|
/**
|
|
11
9
|
* List of modules that should be available to the root Storybook Component and all its children.
|
|
12
|
-
* If you want to register application providers or if you want to use the forRoot() pattern,
|
|
10
|
+
* If you want to register application providers or if you want to use the forRoot() pattern,
|
|
11
|
+
* please use the `applicationConfig` decorator in combination with the importProvidersFrom helper
|
|
12
|
+
* function from @angular/core instead.
|
|
13
13
|
*/
|
|
14
14
|
imports?: any[];
|
|
15
15
|
schemas?: any[];
|
|
16
16
|
/**
|
|
17
|
-
* List of providers that should be available on the root component and all its children.
|
|
18
|
-
*
|
|
17
|
+
* List of providers that should be available on the root component and all its children. Use the
|
|
18
|
+
* `applicationConfig` decorator to register environemt and application-wide providers.
|
|
19
19
|
*/
|
|
20
20
|
providers?: Provider[];
|
|
21
21
|
}
|
|
@@ -27,17 +27,15 @@ const getAngularWebpackUtils = () => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* Extract webpack config from angular-cli 13.x.x
|
|
31
|
-
*
|
|
30
|
+
* Extract webpack config from angular-cli 13.x.x ⚠️ This file is in JavaScript to not use
|
|
31
|
+
* TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
32
32
|
* FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
|
|
33
33
|
*
|
|
34
|
-
* @param {
|
|
35
|
-
* @param {
|
|
34
|
+
* @param {any} baseConfig Previous webpack config from storybook
|
|
35
|
+
* @param {any} options { builderOptions, builderContext }
|
|
36
36
|
*/
|
|
37
37
|
exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
|
|
38
|
-
/**
|
|
39
|
-
* Get angular-cli Webpack config
|
|
40
|
-
*/
|
|
38
|
+
/** Get angular-cli Webpack config */
|
|
41
39
|
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig } = getAngularWebpackUtils();
|
|
42
40
|
const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
|
|
43
41
|
// Default options
|
|
@@ -62,9 +60,7 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }
|
|
|
62
60
|
getStylesConfig(wco),
|
|
63
61
|
getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
|
|
64
62
|
]);
|
|
65
|
-
/**
|
|
66
|
-
* Merge baseConfig Webpack with angular-cli Webpack
|
|
67
|
-
*/
|
|
63
|
+
/** Merge baseConfig Webpack with angular-cli Webpack */
|
|
68
64
|
const entry = [
|
|
69
65
|
...baseConfig.entry,
|
|
70
66
|
...(cliConfig.entry.styles ?? []),
|
|
@@ -25,10 +25,7 @@ async function webpackFinal(baseConfig, options) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
exports.webpackFinal = webpackFinal;
|
|
28
|
-
/**
|
|
29
|
-
* Get Builder Context
|
|
30
|
-
* If storybook is not start by angular builder create dumb BuilderContext
|
|
31
|
-
*/
|
|
28
|
+
/** Get Builder Context If storybook is not start by angular builder create dumb BuilderContext */
|
|
32
29
|
function getBuilderContext(options) {
|
|
33
30
|
return (options.angularBuilderContext ??
|
|
34
31
|
{
|
|
@@ -39,23 +36,16 @@ function getBuilderContext(options) {
|
|
|
39
36
|
logger: new core_1.logging.Logger('Storybook'),
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Get builder options
|
|
44
|
-
* Merge target options from browser target and from storybook options
|
|
45
|
-
*/
|
|
39
|
+
/** Get builder options Merge target options from browser target and from storybook options */
|
|
46
40
|
async function getBuilderOptions(options, builderContext) {
|
|
47
|
-
/**
|
|
48
|
-
* Get Browser Target options
|
|
49
|
-
*/
|
|
41
|
+
/** Get Browser Target options */
|
|
50
42
|
let browserTargetOptions = {};
|
|
51
43
|
if (options.angularBrowserTarget) {
|
|
52
44
|
const browserTarget = (0, architect_1.targetFromTargetString)(options.angularBrowserTarget);
|
|
53
45
|
node_logger_1.logger.info(`=> Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ''}"`);
|
|
54
46
|
browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
|
|
55
47
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Merge target options from browser target options and from storybook options
|
|
58
|
-
*/
|
|
48
|
+
/** Merge target options from browser target options and from storybook options */
|
|
59
49
|
const builderOptions = {
|
|
60
50
|
...browserTargetOptions,
|
|
61
51
|
...options.angularBuilderOptions,
|
|
@@ -67,7 +57,8 @@ async function getBuilderOptions(options, builderContext) {
|
|
|
67
57
|
return builderOptions;
|
|
68
58
|
}
|
|
69
59
|
/**
|
|
70
|
-
* Checks if using legacy configuration that doesn't use builder and logs message referring to
|
|
60
|
+
* Checks if using legacy configuration that doesn't use builder and logs message referring to
|
|
61
|
+
* migration docs.
|
|
71
62
|
*/
|
|
72
63
|
function checkForLegacyBuildOptions(options) {
|
|
73
64
|
if (options.angularBrowserTarget !== undefined) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
2
|
import { PresetOptions } from './preset-options';
|
|
3
3
|
/**
|
|
4
|
-
* Run ngcc for converting modules to ivy format before starting storybook
|
|
5
|
-
*
|
|
4
|
+
* Run ngcc for converting modules to ivy format before starting storybook This step is needed in
|
|
5
|
+
* order to support Ivy in storybook
|
|
6
6
|
*
|
|
7
7
|
* Information about Ivy can be found here https://angular.io/guide/ivy
|
|
8
8
|
*/
|
|
@@ -4,14 +4,14 @@ exports.webpack = exports.runNgcc = void 0;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
/**
|
|
7
|
-
* Source :
|
|
8
|
-
*
|
|
9
|
-
* CommonJS code can load ESM code via
|
|
10
|
-
* will currently, unconditionally downlevel dynamic
|
|
11
|
-
* require calls cannot load ESM code and will result in a runtime
|
|
12
|
-
* this, a Function constructor is used to prevent TypeScript from changing the
|
|
13
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround
|
|
14
|
-
* be dropped.
|
|
7
|
+
* Source :
|
|
8
|
+
* https://github.com/angular/angular-cli/blob/ebccb5de4a455af813c5e82483db6af20666bdbd/packages/angular_devkit/build_angular/src/utils/load-esm.ts#L23
|
|
9
|
+
* This uses a dynamic import to load a module which may be ESM. CommonJS code can load ESM code via
|
|
10
|
+
* a dynamic import. Unfortunately, TypeScript will currently, unconditionally downlevel dynamic
|
|
11
|
+
* import into a require call. require calls cannot load ESM code and will result in a runtime
|
|
12
|
+
* error. To workaround this, a Function constructor is used to prevent TypeScript from changing the
|
|
13
|
+
* dynamic import. Once TypeScript provides support for keeping the dynamic import this workaround
|
|
14
|
+
* can be dropped.
|
|
15
15
|
*
|
|
16
16
|
* @param modulePath The path of the module to load.
|
|
17
17
|
* @returns A Promise that resolves to the dynamically imported module.
|
|
@@ -21,8 +21,8 @@ function loadEsmModule(modulePath) {
|
|
|
21
21
|
return new Function('modulePath', `return import(modulePath);`)(modulePath);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Run ngcc for converting modules to ivy format before starting storybook
|
|
25
|
-
*
|
|
24
|
+
* Run ngcc for converting modules to ivy format before starting storybook This step is needed in
|
|
25
|
+
* order to support Ivy in storybook
|
|
26
26
|
*
|
|
27
27
|
* Information about Ivy can be found here https://angular.io/guide/ivy
|
|
28
28
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This plugin is designed to modify the Webpack configuration for Storybook projects that use
|
|
3
|
-
* specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
|
|
4
|
-
* It ensures that only one runtime bundle is generated to avoid
|
|
2
|
+
* This plugin is designed to modify the Webpack configuration for Storybook projects that use
|
|
3
|
+
* Angular, specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
|
|
4
|
+
* entry points. It ensures that only one runtime bundle is generated to avoid
|
|
5
|
+
* '**webpack_require**.nmd is not a function' errors.
|
|
5
6
|
*/
|
|
6
7
|
export default class StorybookNormalizeAngularEntryPlugin {
|
|
7
8
|
constructor(options: any);
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const PLUGIN_NAME = 'storybook-normalize-angular-entry-plugin';
|
|
4
4
|
/**
|
|
5
|
-
* This plugin is designed to modify the Webpack configuration for Storybook projects that use
|
|
6
|
-
* specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
|
|
7
|
-
* It ensures that only one runtime bundle is generated to avoid
|
|
5
|
+
* This plugin is designed to modify the Webpack configuration for Storybook projects that use
|
|
6
|
+
* Angular, specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
|
|
7
|
+
* entry points. It ensures that only one runtime bundle is generated to avoid
|
|
8
|
+
* '**webpack_require**.nmd is not a function' errors.
|
|
8
9
|
*/
|
|
9
10
|
class StorybookNormalizeAngularEntryPlugin {
|
|
10
11
|
constructor(options) {
|
package/dist/types.d.ts
CHANGED
|
@@ -19,9 +19,7 @@ type StorybookConfigFramework = {
|
|
|
19
19
|
};
|
|
20
20
|
typescript?: Partial<TypescriptOptionsBuilder & TypescriptOptionsReact> & StorybookConfigBase['typescript'];
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* The interface for Storybook configuration in `main.ts` files.
|
|
24
|
-
*/
|
|
22
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
25
23
|
export type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
|
|
26
24
|
export interface AngularOptions {
|
|
27
25
|
enableIvy?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "8.3.0-alpha.
|
|
3
|
+
"version": "8.3.0-alpha.7",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@storybook/builder-webpack5": "8.3.0-alpha.
|
|
41
|
-
"@storybook/components": "^8.3.0-alpha.
|
|
42
|
-
"@storybook/core-webpack": "8.3.0-alpha.
|
|
40
|
+
"@storybook/builder-webpack5": "8.3.0-alpha.7",
|
|
41
|
+
"@storybook/components": "^8.3.0-alpha.7",
|
|
42
|
+
"@storybook/core-webpack": "8.3.0-alpha.7",
|
|
43
43
|
"@storybook/global": "^5.0.0",
|
|
44
|
-
"@storybook/manager-api": "^8.3.0-alpha.
|
|
45
|
-
"@storybook/preview-api": "^8.3.0-alpha.
|
|
46
|
-
"@storybook/theming": "^8.3.0-alpha.
|
|
44
|
+
"@storybook/manager-api": "^8.3.0-alpha.7",
|
|
45
|
+
"@storybook/preview-api": "^8.3.0-alpha.7",
|
|
46
|
+
"@storybook/theming": "^8.3.0-alpha.7",
|
|
47
47
|
"@types/node": "^22.0.0",
|
|
48
48
|
"@types/react": "^18.0.37",
|
|
49
49
|
"@types/react-dom": "^18.0.11",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@angular/platform-browser": ">=15.0.0 < 19.0.0",
|
|
94
94
|
"@angular/platform-browser-dynamic": ">=15.0.0 < 19.0.0",
|
|
95
95
|
"rxjs": "^6.0.0 || ^7.4.0",
|
|
96
|
-
"storybook": "^8.3.0-alpha.
|
|
96
|
+
"storybook": "^8.3.0-alpha.7",
|
|
97
97
|
"typescript": "^4.0.0 || ^5.0.0",
|
|
98
98
|
"zone.js": ">= 0.11.1 < 1.0.0"
|
|
99
99
|
},
|
package/scripts/postbuild.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This postbuild fix is needed to add a ts-ignore to the generated public-types.d.ts file.
|
|
3
|
-
*
|
|
4
|
-
* versions < 17.2. In these versions, the unresolved types will error and prevent Storybook from
|
|
5
|
-
* This postbuild script adds a ts-ignore statement above the unresolved types to
|
|
2
|
+
* This postbuild fix is needed to add a ts-ignore to the generated public-types.d.ts file. The
|
|
3
|
+
* AngularCore.InputSignal and AngularCore.InputSignalWithTransform types do not exist in Angular
|
|
4
|
+
* versions < 17.2. In these versions, the unresolved types will error and prevent Storybook from
|
|
5
|
+
* starting/building. This postbuild script adds a ts-ignore statement above the unresolved types to
|
|
6
|
+
* prevent the errors.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const fs = require('fs');
|
|
@@ -6,31 +6,25 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
|
6
6
|
standalone: true,
|
|
7
7
|
imports: [CommonModule],
|
|
8
8
|
template: ` <button
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
type="button"
|
|
10
|
+
(click)="onClick.emit($event)"
|
|
11
|
+
[ngClass]="classes"
|
|
12
|
+
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
13
|
+
>
|
|
14
|
+
{{ label }}
|
|
15
|
+
</button>`,
|
|
16
16
|
styleUrls: ['./button.css'],
|
|
17
17
|
})
|
|
18
18
|
export class ButtonComponent {
|
|
19
|
-
/**
|
|
20
|
-
* Is this the principal call to action on the page?
|
|
21
|
-
*/
|
|
19
|
+
/** Is this the principal call to action on the page? */
|
|
22
20
|
@Input()
|
|
23
21
|
primary = false;
|
|
24
22
|
|
|
25
|
-
/**
|
|
26
|
-
* What background color to use
|
|
27
|
-
*/
|
|
23
|
+
/** What background color to use */
|
|
28
24
|
@Input()
|
|
29
25
|
backgroundColor?: string;
|
|
30
26
|
|
|
31
|
-
/**
|
|
32
|
-
* How large should the button be?
|
|
33
|
-
*/
|
|
27
|
+
/** How large should the button be? */
|
|
34
28
|
@Input()
|
|
35
29
|
size: 'small' | 'medium' | 'large' = 'medium';
|
|
36
30
|
|
|
@@ -42,9 +36,7 @@ export class ButtonComponent {
|
|
|
42
36
|
@Input()
|
|
43
37
|
label = 'Button';
|
|
44
38
|
|
|
45
|
-
/**
|
|
46
|
-
* Optional click handler
|
|
47
|
-
*/
|
|
39
|
+
/** Optional click handler */
|
|
48
40
|
@Output()
|
|
49
41
|
onClick = new EventEmitter<Event>();
|
|
50
42
|
|
|
@@ -9,59 +9,56 @@ import type { User } from './user';
|
|
|
9
9
|
standalone: true,
|
|
10
10
|
imports: [CommonModule, ButtonComponent],
|
|
11
11
|
template: `<header>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
<div class="storybook-header">
|
|
13
|
+
<div>
|
|
14
|
+
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
+
<g fill="none" fillRule="evenodd">
|
|
16
|
+
<path
|
|
17
|
+
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
18
|
+
fill="#FFF"
|
|
19
|
+
/>
|
|
20
|
+
<path
|
|
21
|
+
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
22
|
+
fill="#555AB9"
|
|
23
|
+
/>
|
|
24
|
+
<path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
<h1>Acme</h1>
|
|
28
|
+
</div>
|
|
29
|
+
<div>
|
|
30
|
+
<div *ngIf="user">
|
|
31
|
+
<span class="welcome">
|
|
32
|
+
Welcome, <b>{{ user.name }}</b
|
|
33
|
+
>!
|
|
34
|
+
</span>
|
|
35
|
+
<storybook-button
|
|
36
|
+
*ngIf="user"
|
|
37
|
+
size="small"
|
|
38
|
+
(onClick)="onLogout.emit($event)"
|
|
39
|
+
label="Log out"
|
|
40
|
+
></storybook-button>
|
|
31
41
|
</div>
|
|
32
|
-
<div>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
size="small"
|
|
49
|
-
class="margin-left"
|
|
50
|
-
(onClick)="onLogin.emit($event)"
|
|
51
|
-
label="Log in"
|
|
52
|
-
></storybook-button>
|
|
53
|
-
<storybook-button
|
|
54
|
-
*ngIf="!user"
|
|
55
|
-
size="small"
|
|
56
|
-
[primary]="true"
|
|
57
|
-
class="margin-left"
|
|
58
|
-
(onClick)="onCreateAccount.emit($event)"
|
|
59
|
-
label="Sign up"
|
|
60
|
-
></storybook-button>
|
|
61
|
-
</div>
|
|
42
|
+
<div *ngIf="!user">
|
|
43
|
+
<storybook-button
|
|
44
|
+
*ngIf="!user"
|
|
45
|
+
size="small"
|
|
46
|
+
class="margin-left"
|
|
47
|
+
(onClick)="onLogin.emit($event)"
|
|
48
|
+
label="Log in"
|
|
49
|
+
></storybook-button>
|
|
50
|
+
<storybook-button
|
|
51
|
+
*ngIf="!user"
|
|
52
|
+
size="small"
|
|
53
|
+
[primary]="true"
|
|
54
|
+
class="margin-left"
|
|
55
|
+
(onClick)="onCreateAccount.emit($event)"
|
|
56
|
+
label="Sign up"
|
|
57
|
+
></storybook-button>
|
|
62
58
|
</div>
|
|
63
59
|
</div>
|
|
64
|
-
</
|
|
60
|
+
</div>
|
|
61
|
+
</header>`,
|
|
65
62
|
styleUrls: ['./header.css'],
|
|
66
63
|
})
|
|
67
64
|
export class HeaderComponent {
|