@storybook/angular 8.5.0 → 8.6.0-alpha.1

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.
@@ -16,11 +16,12 @@ export type StorybookBuilderOptions = JsonObject & {
16
16
  preserveSymlinks?: boolean;
17
17
  assets?: AssetPattern[];
18
18
  sourceMap?: SourceMapUnion;
19
+ experimentalZoneless?: boolean;
19
20
  } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'test' | 'webpackStatsJson' | 'statsJson' | 'disableTelemetry' | 'debugWebpack' | 'previewUrl'>;
20
21
  export type StorybookBuilderOutput = JsonObject & BuilderOutput & {
21
22
  [key: string]: any;
22
23
  };
23
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<JsonObject & {
24
+ declare const _default: import("@angular-devkit/architect").Builder<JsonObject & {
24
25
  browserTarget?: string | null | undefined;
25
26
  tsConfig?: string | undefined;
26
27
  test: boolean;
@@ -33,5 +34,6 @@ declare const _default: import("@angular-devkit/architect/src/internal").Builder
33
34
  preserveSymlinks?: boolean | undefined;
34
35
  assets?: AssetPattern[] | undefined;
35
36
  sourceMap?: SourceMapUnion | undefined;
37
+ experimentalZoneless?: boolean | undefined;
36
38
  } & Pick<CLIOptions, "statsJson" | "outputDir" | "configDir" | "loglevel" | "quiet" | "test" | "webpackStatsJson" | "disableTelemetry" | "debugWebpack" | "previewUrl">>;
37
39
  export default _default;
@@ -24,7 +24,7 @@ const commandBuilder = (options, context) => {
24
24
  outputDir: 'SBCONFIG_OUTPUT_DIR',
25
25
  configDir: 'SBCONFIG_CONFIG_DIR',
26
26
  });
27
- const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, test, outputDir, quiet, enableProdMode = true, webpackStatsJson, statsJson, debugWebpack, disableTelemetry, assets, previewUrl, sourceMap = false, preserveSymlinks = false, } = options;
27
+ const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, test, outputDir, quiet, enableProdMode = true, webpackStatsJson, statsJson, debugWebpack, disableTelemetry, assets, previewUrl, sourceMap = false, preserveSymlinks = false, experimentalZoneless = false, } = options;
28
28
  const standaloneOptions = {
29
29
  packageJson: (0, fd_package_json_1.findPackageSync)(__dirname),
30
30
  configDir,
@@ -43,6 +43,7 @@ const commandBuilder = (options, context) => {
43
43
  ...(assets ? { assets } : {}),
44
44
  sourceMap,
45
45
  preserveSymlinks,
46
+ experimentalZoneless,
46
47
  },
47
48
  tsConfig,
48
49
  webpackStatsJson,
@@ -121,6 +121,11 @@
121
121
  "type": ["boolean", "object"],
122
122
  "description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
123
123
  "default": false
124
+ },
125
+ "experimentalZoneless": {
126
+ "type": "boolean",
127
+ "description": "Experimental: Use zoneless change detection.",
128
+ "default": false
124
129
  }
125
130
  },
126
131
  "additionalProperties": false,
@@ -14,9 +14,10 @@ export type StorybookBuilderOptions = JsonObject & {
14
14
  assets?: AssetPattern[];
15
15
  preserveSymlinks?: boolean;
16
16
  sourceMap?: SourceMapUnion;
17
+ experimentalZoneless?: boolean;
17
18
  } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'disableTelemetry' | 'initialPath' | 'open' | 'docs' | 'debugWebpack' | 'webpackStatsJson' | 'statsJson' | 'loglevel' | 'previewUrl'>;
18
19
  export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
19
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<JsonObject & {
20
+ declare const _default: import("@angular-devkit/architect").Builder<JsonObject & {
20
21
  browserTarget?: string | null | undefined;
21
22
  tsConfig?: string | undefined;
22
23
  compodoc: boolean;
@@ -27,5 +28,6 @@ declare const _default: import("@angular-devkit/architect/src/internal").Builder
27
28
  assets?: AssetPattern[] | undefined;
28
29
  preserveSymlinks?: boolean | undefined;
29
30
  sourceMap?: SourceMapUnion | undefined;
31
+ experimentalZoneless?: boolean | undefined;
30
32
  } & Pick<CLIOptions, "docs" | "statsJson" | "configDir" | "loglevel" | "quiet" | "webpackStatsJson" | "disableTelemetry" | "debugWebpack" | "previewUrl" | "port" | "host" | "initialPath" | "https" | "sslCa" | "sslCert" | "sslKey" | "smokeTest" | "open" | "ci">>;
31
33
  export default _default;
@@ -30,7 +30,7 @@ const commandBuilder = (options, context) => {
30
30
  ci: 'CI',
31
31
  });
32
32
  options.port = parseInt(`${options.port}`, 10);
33
- const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, debugWebpack, loglevel, webpackStatsJson, statsJson, previewUrl, sourceMap = false, preserveSymlinks = false, } = options;
33
+ const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, debugWebpack, loglevel, webpackStatsJson, statsJson, previewUrl, sourceMap = false, preserveSymlinks = false, experimentalZoneless = false, } = options;
34
34
  const standaloneOptions = {
35
35
  packageJson: (0, fd_package_json_1.findPackageSync)(__dirname),
36
36
  ci,
@@ -54,6 +54,7 @@ const commandBuilder = (options, context) => {
54
54
  ...(assets ? { assets } : {}),
55
55
  preserveSymlinks,
56
56
  sourceMap,
57
+ experimentalZoneless,
57
58
  },
58
59
  tsConfig,
59
60
  initialPath,
@@ -157,6 +157,11 @@
157
157
  "type": ["boolean", "object"],
158
158
  "description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
159
159
  "default": false
160
+ },
161
+ "experimentalZoneless": {
162
+ "type": "boolean",
163
+ "description": "Experimental: Use zoneless change detection.",
164
+ "default": false
160
165
  }
161
166
  },
162
167
  "additionalProperties": false,
@@ -11,6 +11,7 @@ export type StandaloneOptions = CLIOptions & LoadOptions & BuilderOptions & {
11
11
  assets?: AssetPattern[];
12
12
  sourceMap?: SourceMapUnion;
13
13
  preserveSymlinks?: boolean;
14
+ experimentalZoneless?: boolean;
14
15
  };
15
16
  angularBuilderContext?: BuilderContext | null;
16
17
  tsConfig?: string;
@@ -4,6 +4,11 @@ type StoryRenderInfo = {
4
4
  storyFnAngular: StoryFnAngularReturnType;
5
5
  moduleMetadataSnapshot: string;
6
6
  };
7
+ declare global {
8
+ const STORYBOOK_ANGULAR_OPTIONS: {
9
+ experimentalZoneless: boolean;
10
+ };
11
+ }
7
12
  /**
8
13
  * Attribute name for the story UID that may be written to the targetDOMNode.
9
14
  *
@@ -50,6 +55,19 @@ export declare abstract class AbstractRenderer {
50
55
  * @protected
51
56
  */
52
57
  protected generateTargetSelectorFromStoryId(id: string): string;
58
+ /**
59
+ * Angular is unable to handle components that have selectors with accented attributes.
60
+ *
61
+ * Therefore, stories break when meta's title contains accents.
62
+ * https://github.com/storybookjs/storybook/issues/29132
63
+ *
64
+ * This method filters accents from a given raw id. For example, this method converts
65
+ * 'Example/Button with an "é" accent' into 'Example/Button with an "e" accent'.
66
+ *
67
+ * @memberof AbstractRenderer
68
+ * @protected
69
+ */
70
+ protected generateStoryUIdFromRawStoryUid(rawStoryUid: string | null): string | null;
53
71
  /** Adds DOM element that angular will use as bootstrap component. */
54
72
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
55
73
  private fullRendererRequired;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.AbstractRenderer = exports.STORY_UID_ATTRIBUTE = void 0;
4
27
  const platform_browser_1 = require("@angular/platform-browser");
@@ -63,7 +86,7 @@ class AbstractRenderer {
63
86
  this.storyProps$ = newStoryProps$;
64
87
  this.initAngularRootElement(targetDOMNode, targetSelector);
65
88
  const analyzedMetadata = new PropertyExtractor_1.PropertyExtractor(storyFnAngular.moduleMetadata, component);
66
- const storyUid = targetDOMNode.getAttribute(exports.STORY_UID_ATTRIBUTE);
89
+ const storyUid = this.generateStoryUIdFromRawStoryUid(targetDOMNode.getAttribute(exports.STORY_UID_ATTRIBUTE));
67
90
  const componentSelector = storyUid !== null ? `${targetSelector}[${storyUid}]` : targetSelector;
68
91
  if (storyUid !== null) {
69
92
  const element = targetDOMNode.querySelector(targetSelector);
@@ -75,14 +98,24 @@ class AbstractRenderer {
75
98
  targetSelector: componentSelector,
76
99
  analyzedMetadata,
77
100
  });
101
+ const providers = [
102
+ (0, StorybookProvider_1.storyPropsProvider)(newStoryProps$),
103
+ ...analyzedMetadata.applicationProviders,
104
+ ...(storyFnAngular.applicationConfig?.providers ?? []),
105
+ ];
106
+ if (STORYBOOK_ANGULAR_OPTIONS?.experimentalZoneless) {
107
+ const { provideExperimentalZonelessChangeDetection } = await Promise.resolve().then(() => __importStar(require('@angular/core')));
108
+ if (!provideExperimentalZonelessChangeDetection) {
109
+ throw new Error('Experimental zoneless change detection requires Angular 18 or higher');
110
+ }
111
+ else {
112
+ providers.unshift(provideExperimentalZonelessChangeDetection());
113
+ }
114
+ }
78
115
  const applicationRef = await (0, BootstrapQueue_1.queueBootstrapping)(() => {
79
116
  return (0, platform_browser_1.bootstrapApplication)(application, {
80
117
  ...storyFnAngular.applicationConfig,
81
- providers: [
82
- (0, StorybookProvider_1.storyPropsProvider)(newStoryProps$),
83
- ...analyzedMetadata.applicationProviders,
84
- ...(storyFnAngular.applicationConfig?.providers ?? []),
85
- ],
118
+ providers,
86
119
  });
87
120
  });
88
121
  applicationRefs.set(targetDOMNode, applicationRef);
@@ -105,6 +138,25 @@ class AbstractRenderer {
105
138
  const storyIdIsInvalidHtmlTagName = invalidHtmlTag.test(id);
106
139
  return storyIdIsInvalidHtmlTagName ? `sb-${id.replace(invalidHtmlTag, '')}-component` : id;
107
140
  }
141
+ /**
142
+ * Angular is unable to handle components that have selectors with accented attributes.
143
+ *
144
+ * Therefore, stories break when meta's title contains accents.
145
+ * https://github.com/storybookjs/storybook/issues/29132
146
+ *
147
+ * This method filters accents from a given raw id. For example, this method converts
148
+ * 'Example/Button with an "é" accent' into 'Example/Button with an "e" accent'.
149
+ *
150
+ * @memberof AbstractRenderer
151
+ * @protected
152
+ */
153
+ generateStoryUIdFromRawStoryUid(rawStoryUid) {
154
+ if (rawStoryUid === null) {
155
+ return rawStoryUid;
156
+ }
157
+ const accentCharacters = /[\u0300-\u036f]/g;
158
+ return rawStoryUid.normalize('NFD').replace(accentCharacters, '');
159
+ }
108
160
  /** Adds DOM element that angular will use as bootstrap component. */
109
161
  initAngularRootElement(targetDOMNode, targetSelector) {
110
162
  targetDOMNode.innerHTML = '';
@@ -28,6 +28,8 @@ vitest_1.vi.mock('@angular/platform-browser-dynamic');
28
28
  rootDocstargetDOMNode = global.document.getElementById('root-docs');
29
29
  platform_browser_dynamic_1.platformBrowserDynamic.mockImplementation(testing_1.platformBrowserDynamicTesting);
30
30
  vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
31
+ // @ts-expect-error Ignore
32
+ globalThis.STORYBOOK_ANGULAR_OPTIONS = { experimentalZoneless: false };
31
33
  });
32
34
  (0, vitest_1.afterEach)(() => {
33
35
  vitest_1.vi.clearAllMocks();
@@ -20,7 +20,9 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
20
20
  let FooComponent = class FooComponent {
21
21
  };
22
22
  FooComponent = __decorate([
23
- (0, core_1.Component)({})
23
+ (0, core_1.Component)({
24
+ standalone: false,
25
+ })
24
26
  ], FooComponent);
25
27
  (0, vitest_1.expect)((0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent)).toEqual({
26
28
  inputs: [],
@@ -36,8 +38,13 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
36
38
  (0, vitest_1.it)('should return I/O', () => {
37
39
  let FooComponent = class FooComponent {
38
40
  constructor() {
41
+ this.signalInput = (0, core_1.input)();
42
+ this.signalInputAliased = (0, core_1.input)('signalInputAliased', {
43
+ alias: 'signalInputAliasedAlias',
44
+ });
39
45
  this.output = new core_1.EventEmitter();
40
46
  this.outputWithBindingPropertyName = new core_1.EventEmitter();
47
+ this.signalOutput = (0, core_1.output)();
41
48
  }
42
49
  };
43
50
  __decorate([
@@ -61,6 +68,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
61
68
  template: '',
62
69
  inputs: ['inputInComponentMetadata'],
63
70
  outputs: ['outputInComponentMetadata'],
71
+ standalone: false,
64
72
  })
65
73
  ], FooComponent);
66
74
  const fooComponentFactory = resolveComponentFactory(FooComponent);
@@ -77,7 +85,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
77
85
  { propName: 'outputWithBindingPropertyName', templateName: 'outputPropertyName' },
78
86
  ],
79
87
  });
80
- (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
88
+ (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs.map(({ isSignal, ...rest }) => rest)));
81
89
  (0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
82
90
  });
83
91
  (0, vitest_1.it)("should return I/O when some of component metadata has the same name as one of component's properties", () => {
@@ -108,11 +116,12 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
108
116
  template: '',
109
117
  inputs: ['input', 'inputWithBindingPropertyName'],
110
118
  outputs: ['outputWithBindingPropertyName'],
119
+ standalone: false,
111
120
  })
112
121
  ], FooComponent);
113
122
  const fooComponentFactory = resolveComponentFactory(FooComponent);
114
123
  const { inputs, outputs } = (0, NgComponentAnalyzer_1.getComponentInputsOutputs)(FooComponent);
115
- (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
124
+ (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs.map(({ isSignal, ...rest }) => rest)));
116
125
  (0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
117
126
  });
118
127
  (0, vitest_1.it)('should return I/O in the presence of multiple decorators', () => {
@@ -131,6 +140,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
131
140
  FooComponent = __decorate([
132
141
  (0, core_1.Component)({
133
142
  template: '',
143
+ standalone: false,
134
144
  })
135
145
  ], FooComponent);
136
146
  const fooComponentFactory = resolveComponentFactory(FooComponent);
@@ -142,7 +152,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
142
152
  ],
143
153
  outputs: [],
144
154
  });
145
- (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
155
+ (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs.map(({ isSignal, ...rest }) => rest)));
146
156
  (0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
147
157
  });
148
158
  (0, vitest_1.it)('should return I/O with extending classes', () => {
@@ -159,6 +169,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
159
169
  BarComponent = __decorate([
160
170
  (0, core_1.Component)({
161
171
  template: '',
172
+ standalone: false,
162
173
  })
163
174
  ], BarComponent);
164
175
  let FooComponent = class FooComponent extends BarComponent {
@@ -174,6 +185,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
174
185
  FooComponent = __decorate([
175
186
  (0, core_1.Component)({
176
187
  template: '',
188
+ standalone: false,
177
189
  })
178
190
  ], FooComponent);
179
191
  const fooComponentFactory = resolveComponentFactory(FooComponent);
@@ -186,7 +198,7 @@ const NgComponentAnalyzer_1 = require("./NgComponentAnalyzer");
186
198
  ],
187
199
  outputs: [],
188
200
  });
189
- (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs));
201
+ (0, vitest_1.expect)(sortByPropName(inputs)).toEqual(sortByPropName(fooComponentFactory.inputs.map(({ isSignal, ...rest }) => rest)));
190
202
  (0, vitest_1.expect)(sortByPropName(outputs)).toEqual(sortByPropName(fooComponentFactory.outputs));
191
203
  });
192
204
  });
@@ -11,19 +11,19 @@ const TEST_TOKEN = new core_1.InjectionToken('testToken');
11
11
  const TestTokenProvider = { provide: TEST_TOKEN, useValue: 123 };
12
12
  const TestService = (0, core_1.Injectable)()(class {
13
13
  });
14
- const TestComponent1 = (0, core_1.Component)({})(class {
14
+ const TestComponent1 = (0, core_1.Component)({ standalone: false })(class {
15
15
  });
16
- const TestComponent2 = (0, core_1.Component)({})(class {
16
+ const TestComponent2 = (0, core_1.Component)({ standalone: false })(class {
17
17
  });
18
- const StandaloneTestComponent = (0, core_1.Component)({ standalone: true })(class {
18
+ const StandaloneTestComponent = (0, core_1.Component)({})(class {
19
19
  });
20
- const StandaloneTestDirective = (0, core_1.Directive)({ standalone: true })(class {
20
+ const StandaloneTestDirective = (0, core_1.Directive)({})(class {
21
21
  });
22
- const MixedTestComponent1 = (0, core_1.Component)({ standalone: true })(class extends StandaloneTestComponent {
22
+ const MixedTestComponent1 = (0, core_1.Component)({})(class extends StandaloneTestComponent {
23
23
  });
24
- const MixedTestComponent2 = (0, core_1.Component)({})(class extends MixedTestComponent1 {
24
+ const MixedTestComponent2 = (0, core_1.Component)({ standalone: false })(class extends MixedTestComponent1 {
25
25
  });
26
- const MixedTestComponent3 = (0, core_1.Component)({ standalone: true })(class extends MixedTestComponent2 {
26
+ const MixedTestComponent3 = (0, core_1.Component)({})(class extends MixedTestComponent2 {
27
27
  });
28
28
  const TestModuleWithDeclarations = (0, core_1.NgModule)({ declarations: [TestComponent1] })(class {
29
29
  });
@@ -1,21 +1 @@
1
- /**
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
- *
5
- * This file is divided into 2 sections:
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
- *
10
- * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
- * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
- * Edge> = 13 on the desktop, and iOS 10 and Chrome on mobile.
13
- *
14
- * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15
- */
16
- /**
17
- * Required to support Web Animations `@angular/animation`. Needed for: All but Chrome, Firefox and
18
- * Opera. http://caniuse.com/#feat=web-animation
19
- */
20
- /** Zone JS is required by Angular itself. */
21
- import 'zone.js';
1
+ export {};
@@ -21,8 +21,6 @@ const global_1 = require("@storybook/global");
21
21
  * Opera. http://caniuse.com/#feat=web-animation
22
22
  */
23
23
  // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
24
- /** Zone JS is required by Angular itself. */
25
- require("zone.js");
26
24
  // Included with Angular CLI.
27
25
  /** APPLICATION IMPORTS */
28
26
  /**
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackFinal = void 0;
4
4
  const node_logger_1 = require("storybook/internal/node-logger");
5
5
  const server_errors_1 = require("storybook/internal/server-errors");
6
+ const builder_webpack5_1 = require("@storybook/builder-webpack5");
6
7
  const architect_1 = require("@angular-devkit/architect");
7
8
  const core_1 = require("@angular-devkit/core");
8
9
  const find_up_1 = require("find-up");
@@ -16,13 +17,20 @@ async function webpackFinal(baseConfig, options) {
16
17
  checkForLegacyBuildOptions(options);
17
18
  const builderContext = getBuilderContext(options);
18
19
  const builderOptions = await getBuilderOptions(options, builderContext);
19
- return (0, angular_cli_webpack_1.getWebpackConfig)(baseConfig, {
20
+ const webpackConfig = await (0, angular_cli_webpack_1.getWebpackConfig)(baseConfig, {
20
21
  builderOptions: {
21
22
  watch: options.configType === 'DEVELOPMENT',
22
23
  ...builderOptions,
23
24
  },
24
25
  builderContext,
25
26
  });
27
+ webpackConfig.plugins = webpackConfig.plugins ?? [];
28
+ webpackConfig.plugins.push(new builder_webpack5_1.WebpackDefinePlugin({
29
+ STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
30
+ experimentalZoneless: builderOptions.experimentalZoneless,
31
+ }),
32
+ }));
33
+ return webpackConfig;
26
34
  }
27
35
  exports.webpackFinal = webpackFinal;
28
36
  /** Get Builder Context If storybook is not start by angular builder create dumb BuilderContext */
@@ -1,13 +1,9 @@
1
1
  import { Options as CoreOptions } from 'storybook/internal/types';
2
2
  import { BuilderContext } from '@angular-devkit/architect';
3
- import { StylePreprocessorOptions } from '@angular-devkit/build-angular';
4
- import { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema';
3
+ import { StandaloneOptions } from '../builders/utils/standalone-options';
5
4
  export type PresetOptions = CoreOptions & {
6
5
  angularBrowserTarget?: string | null;
7
- angularBuilderOptions?: {
8
- styles?: StyleElement[];
9
- stylePreprocessorOptions?: StylePreprocessorOptions;
10
- };
6
+ angularBuilderOptions?: StandaloneOptions['angularBuilderOptions'];
11
7
  angularBuilderContext?: BuilderContext | null;
12
8
  tsConfig?: string;
13
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.5.0",
3
+ "version": "8.6.0-alpha.1",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -33,17 +33,17 @@
33
33
  "!src/**/*"
34
34
  ],
35
35
  "scripts": {
36
- "check": "node ../../../scripts/node_modules/.bin/tsc",
36
+ "check": "yarn run -T tsc",
37
37
  "prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@storybook/builder-webpack5": "8.5.0",
41
- "@storybook/components": "8.5.0",
42
- "@storybook/core-webpack": "8.5.0",
40
+ "@storybook/builder-webpack5": "8.6.0-alpha.1",
41
+ "@storybook/components": "8.6.0-alpha.1",
42
+ "@storybook/core-webpack": "8.6.0-alpha.1",
43
43
  "@storybook/global": "^5.0.0",
44
- "@storybook/manager-api": "8.5.0",
45
- "@storybook/preview-api": "8.5.0",
46
- "@storybook/theming": "8.5.0",
44
+ "@storybook/manager-api": "8.6.0-alpha.1",
45
+ "@storybook/preview-api": "8.6.0-alpha.1",
46
+ "@storybook/theming": "8.6.0-alpha.1",
47
47
  "@types/react": "^18.0.37",
48
48
  "@types/react-dom": "^18.0.11",
49
49
  "@types/semver": "^7.3.4",
@@ -58,27 +58,28 @@
58
58
  "webpack": "5"
59
59
  },
60
60
  "devDependencies": {
61
- "@analogjs/vite-plugin-angular": "^0.2.24",
62
- "@angular-devkit/architect": "^0.1703.0",
63
- "@angular-devkit/build-angular": "^17.3.0",
64
- "@angular-devkit/core": "^17.3.0",
65
- "@angular/animations": "^17.3.0",
66
- "@angular/cli": "^17.3.0",
67
- "@angular/common": "^17.3.0",
68
- "@angular/compiler": "^17.3.0",
69
- "@angular/compiler-cli": "^17.3.0",
70
- "@angular/core": "^17.3.0",
71
- "@angular/forms": "^17.3.0",
72
- "@angular/platform-browser": "^17.3.0",
73
- "@angular/platform-browser-dynamic": "^17.3.0",
61
+ "@analogjs/vite-plugin-angular": "^1.12.1",
62
+ "@angular-devkit/architect": "^0.1901.1",
63
+ "@angular-devkit/build-angular": "^19.1.1",
64
+ "@angular-devkit/core": "^19.1.1",
65
+ "@angular/animations": "^19.1.1",
66
+ "@angular/cli": "^19.1.1",
67
+ "@angular/common": "^19.1.1",
68
+ "@angular/compiler": "^19.1.1",
69
+ "@angular/compiler-cli": "^19.1.1",
70
+ "@angular/core": "^19.1.1",
71
+ "@angular/forms": "^19.1.1",
72
+ "@angular/platform-browser": "^19.1.1",
73
+ "@angular/platform-browser-dynamic": "^19.1.1",
74
74
  "@types/cross-spawn": "^6.0.2",
75
75
  "@types/node": "^22.0.0",
76
76
  "@types/tmp": "^0.2.3",
77
77
  "cross-spawn": "^7.0.3",
78
+ "rimraf": "^6.0.1",
78
79
  "tmp": "^0.2.1",
79
80
  "typescript": "^5.3.2",
80
81
  "webpack": "5",
81
- "zone.js": "^0.14.2"
82
+ "zone.js": "^0.15.0"
82
83
  },
83
84
  "peerDependencies": {
84
85
  "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0",
@@ -93,13 +94,16 @@
93
94
  "@angular/platform-browser": ">=15.0.0 < 20.0.0",
94
95
  "@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0",
95
96
  "rxjs": "^6.0.0 || ^7.4.0",
96
- "storybook": "^8.5.0",
97
+ "storybook": "^8.6.0-alpha.1",
97
98
  "typescript": "^4.0.0 || ^5.0.0",
98
99
  "zone.js": ">= 0.11.1 < 1.0.0"
99
100
  },
100
101
  "peerDependenciesMeta": {
101
102
  "@angular/cli": {
102
103
  "optional": true
104
+ },
105
+ "zone.js": {
106
+ "optional": true
103
107
  }
104
108
  },
105
109
  "engines": {
@@ -17,7 +17,7 @@ type Story = StoryObj<PageComponent>;
17
17
 
18
18
  export const LoggedOut: Story = {};
19
19
 
20
- // More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
20
+ // More on component testing: https://storybook.js.org/docs/writing-tests/component-testing
21
21
  export const LoggedIn: Story = {
22
22
  play: async ({ canvasElement }) => {
23
23
  const canvas = within(canvasElement);