@storybook/angular 11.0.0-alpha.0 → 11.0.0-alpha.2
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/build-schema.json +0 -4
- package/dist/_browser-chunks/{chunk-VRHTETWH.js → chunk-A7CCO6TU.js} +1 -1
- package/dist/_browser-chunks/{chunk-TDP52VBS.js → chunk-M5CWHAJJ.js} +4 -4
- package/dist/_browser-chunks/{chunk-RV6FL7AO.js → chunk-OU5A7FPZ.js} +1 -1
- package/dist/_browser-chunks/{chunk-FPQDYJYM.js → chunk-ZATG2N4T.js} +41 -31
- package/dist/_node-chunks/{angular-cli-webpack-2R43YQZV.js → angular-cli-webpack-DJ37RLNT.js} +9 -7
- package/dist/_node-chunks/{chunk-MTZDRM3U.js → chunk-QC32CNUK.js} +6 -6
- package/dist/_node-chunks/{chunk-2NUFSTH3.js → chunk-X2BF55MD.js} +7 -7
- package/dist/builders/build-storybook/index.js +19 -17
- package/dist/builders/start-storybook/index.js +23 -19
- package/dist/client/config.js +2 -2
- package/dist/client/docs/config.js +2 -2
- package/dist/client/index.js +4 -4
- package/dist/index.d.ts +20 -859
- package/dist/index.js +4 -4
- package/dist/node/index.js +6 -6
- package/dist/preset.js +6 -6
- package/dist/server/framework-preset-angular-cli.js +16 -9
- package/dist/server/framework-preset-angular-ivy.js +6 -6
- package/package.json +30 -30
- package/start-schema.json +0 -4
package/build-schema.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"description": "Write stats JSON to disk",
|
|
87
87
|
"default": false
|
|
88
88
|
},
|
|
89
|
-
"previewUrl": {
|
|
90
|
-
"type": "string",
|
|
91
|
-
"description": "Disables the default storybook preview and lets you use your own"
|
|
92
|
-
},
|
|
93
89
|
"styles": {
|
|
94
90
|
"type": "array",
|
|
95
91
|
"description": "Global styles to be included in the build.",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A7CCO6TU.js";
|
|
4
4
|
import {
|
|
5
5
|
config_exports as config_exports2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OU5A7FPZ.js";
|
|
7
7
|
import {
|
|
8
8
|
computesTemplateFromComponent,
|
|
9
9
|
formatPropInTemplate,
|
|
10
10
|
isComponent,
|
|
11
11
|
render_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZATG2N4T.js";
|
|
13
13
|
|
|
14
14
|
// src/client/portable-stories.ts
|
|
15
15
|
import {
|
|
@@ -62,7 +62,7 @@ function applicationConfig(config) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
var componentWrapperDecorator = (element, props) => (storyFn, storyContext) => {
|
|
65
|
-
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
65
|
+
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template ?? "");
|
|
66
66
|
return {
|
|
67
67
|
...story,
|
|
68
68
|
template,
|
|
@@ -42,7 +42,7 @@ var reflectionCapabilities = new ReflectionCapabilities(), getComponentInputsOut
|
|
|
42
42
|
componentMetadata && componentMetadata.inputs && initialValue.inputs.push(
|
|
43
43
|
...componentMetadata.inputs.map((i) => ({
|
|
44
44
|
propName: typeof i == "string" ? i : i.name,
|
|
45
|
-
templateName: typeof i == "string" ? i : i.alias
|
|
45
|
+
templateName: typeof i == "string" ? i : i.alias ?? i.name
|
|
46
46
|
}))
|
|
47
47
|
), componentMetadata && componentMetadata.outputs && initialValue.outputs.push(
|
|
48
48
|
...componentMetadata.outputs.map((i) => ({ propName: i, templateName: i }))
|
|
@@ -111,6 +111,8 @@ var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), forma
|
|
|
111
111
|
};
|
|
112
112
|
}, computesTemplateFromComponent = (component, initialProps, innerTemplate = "") => {
|
|
113
113
|
let ngComponentMetadata = getComponentDecoratorMetadata(component), ngComponentInputsOutputs = getComponentInputsOutputs(component);
|
|
114
|
+
if (!ngComponentMetadata)
|
|
115
|
+
throw new Error(`${component.name} is not an Angular component`);
|
|
114
116
|
if (!ngComponentMetadata.selector)
|
|
115
117
|
return '<ng-container *ngComponentOutlet="storyComponent"></ng-container>';
|
|
116
118
|
let { inputs: initialInputs, outputs: initialOutputs } = separateInputsOutputsAttributes(
|
|
@@ -164,7 +166,7 @@ var createAngularInputProperty = ({
|
|
|
164
166
|
), templateInputs = initialInputs.length > 0 ? ` ${initialInputs.map(
|
|
165
167
|
(propertyName) => createAngularInputProperty({
|
|
166
168
|
propertyName,
|
|
167
|
-
value: initialProps[propertyName],
|
|
169
|
+
value: initialProps?.[propertyName],
|
|
168
170
|
argType: argTypes?.[propertyName]
|
|
169
171
|
})
|
|
170
172
|
).join(" ")}` : "", templateOutputs = initialOutputs.length > 0 ? ` ${initialOutputs.map((i) => `(${i})="${formatPropInTemplate(i)}($event)"`).join(" ")}` : "";
|
|
@@ -254,8 +256,7 @@ import {
|
|
|
254
256
|
Input as Input2,
|
|
255
257
|
Output as Output2,
|
|
256
258
|
Pipe as Pipe2,
|
|
257
|
-
\u0275ReflectionCapabilities as ReflectionCapabilities3
|
|
258
|
-
VERSION
|
|
259
|
+
\u0275ReflectionCapabilities as ReflectionCapabilities3
|
|
259
260
|
} from "@angular/core";
|
|
260
261
|
import { BrowserModule } from "@angular/platform-browser";
|
|
261
262
|
import { dedent } from "ts-dedent";
|
|
@@ -285,6 +286,9 @@ var reflectionCapabilities3 = new ReflectionCapabilities3(), REMOVED_MODULES = n
|
|
|
285
286
|
this.metadata = metadata;
|
|
286
287
|
this.component = component;
|
|
287
288
|
this.declarations = [];
|
|
289
|
+
this.imports = [];
|
|
290
|
+
this.providers = [];
|
|
291
|
+
this.applicationProviders = [];
|
|
288
292
|
/**
|
|
289
293
|
* Analyze NgModule Metadata
|
|
290
294
|
*
|
|
@@ -371,10 +375,10 @@ _PropertyExtractor.analyzeRestricted = async (ngModule) => {
|
|
|
371
375
|
}
|
|
372
376
|
return [!1];
|
|
373
377
|
}, _PropertyExtractor.analyzeDecorators = (component) => {
|
|
374
|
-
let decorators = reflectionCapabilities3.annotations(component), isComponent2 = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Component")), isDirective = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Directive")), isPipe = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Pipe")), isDeclarable = isComponent2 || isDirective || isPipe, isStandalone = (isComponent2 || isDirective) && [...decorators].reverse().find(
|
|
378
|
+
let decorators = reflectionCapabilities3.annotations(component), isComponent2 = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Component")), isDirective = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Directive")), isPipe = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Pipe")), isDeclarable = isComponent2 || isDirective || isPipe, isStandalone = (isComponent2 || isDirective) && ([...decorators].reverse().find(
|
|
375
379
|
(d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Component") || _PropertyExtractor.isDecoratorInstanceOf(d, "Directive")
|
|
376
|
-
)?.standalone;
|
|
377
|
-
return
|
|
380
|
+
)?.standalone ?? !0);
|
|
381
|
+
return { isDeclarable, isStandalone };
|
|
378
382
|
}, _PropertyExtractor.isDecoratorInstanceOf = (decorator, name) => {
|
|
379
383
|
let factory;
|
|
380
384
|
switch (name) {
|
|
@@ -413,7 +417,7 @@ var getNonInputsOutputsProps = (ngComponentInputsOutputs, props = {}) => {
|
|
|
413
417
|
storyComponent,
|
|
414
418
|
styles,
|
|
415
419
|
moduleMetadata,
|
|
416
|
-
initialProps,
|
|
420
|
+
initialProps = {},
|
|
417
421
|
analyzedMetadata
|
|
418
422
|
}) => {
|
|
419
423
|
let viewChildSelector = storyComponent ?? "__storybook-noop", { imports, declarations, providers } = analyzedMetadata, StorybookComponentModule = class {
|
|
@@ -438,15 +442,16 @@ var getNonInputsOutputsProps = (ngComponentInputsOutputs, props = {}) => {
|
|
|
438
442
|
});
|
|
439
443
|
}
|
|
440
444
|
ngAfterViewInit() {
|
|
441
|
-
|
|
445
|
+
let { storyComponentElementRef, storyComponentViewContainerRef } = this;
|
|
446
|
+
if (storyComponentElementRef && storyComponentViewContainerRef) {
|
|
442
447
|
let ngComponentInputsOutputs = getComponentInputsOutputs(storyComponent);
|
|
443
448
|
getNonInputsOutputsProps(ngComponentInputsOutputs, initialProps).forEach((p) => {
|
|
444
|
-
|
|
445
|
-
}),
|
|
449
|
+
Object.assign(storyComponentElementRef, { [p]: initialProps[p] });
|
|
450
|
+
}), storyComponentViewContainerRef.injector.get(ChangeDetectorRef).markForCheck(), this.changeDetectorRef.detectChanges(), this.storyComponentPropsSubscription = this.storyProps$.pipe(
|
|
446
451
|
skip(1),
|
|
447
|
-
map((props) => getNonInputsOutputsProps(ngComponentInputsOutputs, props).reduce((acc, p) => ({ ...acc, [p]: props[p] }), {}))
|
|
452
|
+
map((props = {}) => getNonInputsOutputsProps(ngComponentInputsOutputs, props).reduce((acc, p) => ({ ...acc, [p]: props[p] }), {}))
|
|
448
453
|
).subscribe((props) => {
|
|
449
|
-
Object.assign(
|
|
454
|
+
Object.assign(storyComponentElementRef, props), storyComponentViewContainerRef.injector.get(ChangeDetectorRef).markForCheck(), this.changeDetectorRef.detectChanges();
|
|
450
455
|
});
|
|
451
456
|
}
|
|
452
457
|
}
|
|
@@ -549,15 +554,15 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
549
554
|
component,
|
|
550
555
|
targetDOMNode
|
|
551
556
|
}) {
|
|
552
|
-
let targetSelector = this.generateTargetSelectorFromStoryId(storyId), newStoryProps$ = new BehaviorSubject(storyFnAngular.props)
|
|
553
|
-
if (!this.fullRendererRequired({
|
|
557
|
+
let targetSelector = this.generateTargetSelectorFromStoryId(storyId), newStoryProps$ = new BehaviorSubject(storyFnAngular.props), fullRendererRequired = this.fullRendererRequired({
|
|
554
558
|
targetDOMNode,
|
|
555
559
|
storyFnAngular,
|
|
556
560
|
moduleMetadata: {
|
|
557
561
|
...storyFnAngular.moduleMetadata
|
|
558
562
|
},
|
|
559
563
|
forced
|
|
560
|
-
})
|
|
564
|
+
});
|
|
565
|
+
if (this.storyProps$ && !fullRendererRequired) {
|
|
561
566
|
this.storyProps$.next(storyFnAngular.props);
|
|
562
567
|
return;
|
|
563
568
|
}
|
|
@@ -567,7 +572,12 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
567
572
|
let storyUid = this.generateStoryUIdFromRawStoryUid(
|
|
568
573
|
targetDOMNode.getAttribute(STORY_UID_ATTRIBUTE)
|
|
569
574
|
), componentSelector = storyUid !== null ? `${targetSelector}[${storyUid}]` : targetSelector;
|
|
570
|
-
storyUid !== null
|
|
575
|
+
if (storyUid !== null) {
|
|
576
|
+
let element = targetDOMNode.querySelector(targetSelector);
|
|
577
|
+
if (!element)
|
|
578
|
+
throw new Error(`Storybook could not find the story root element "${targetSelector}"`);
|
|
579
|
+
element.toggleAttribute(storyUid, !0);
|
|
580
|
+
}
|
|
571
581
|
let application = getApplication({
|
|
572
582
|
storyFnAngular,
|
|
573
583
|
component,
|
|
@@ -640,9 +650,7 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
640
650
|
storyFnAngular,
|
|
641
651
|
moduleMetadataSnapshot: stringify(moduleMetadata, { maxDepth: 50 })
|
|
642
652
|
};
|
|
643
|
-
return this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender),
|
|
644
|
-
!forced || // if it's the first rendering and storyProps$ is not init
|
|
645
|
-
!this.storyProps$ || !!storyFnAngular?.template && previousStoryRenderInfo?.storyFnAngular?.template !== storyFnAngular.template ? !0 : currentStoryRender.moduleMetadataSnapshot !== previousStoryRenderInfo?.moduleMetadataSnapshot;
|
|
653
|
+
return this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender), !forced || !!storyFnAngular?.template && previousStoryRenderInfo?.storyFnAngular?.template !== storyFnAngular.template ? !0 : currentStoryRender.moduleMetadataSnapshot !== previousStoryRenderInfo?.moduleMetadataSnapshot;
|
|
646
654
|
}
|
|
647
655
|
};
|
|
648
656
|
|
|
@@ -662,8 +670,7 @@ import { addons } from "storybook/preview-api";
|
|
|
662
670
|
|
|
663
671
|
// src/client/angular-beta/utils/StoryUID.ts
|
|
664
672
|
var storyCounts = /* @__PURE__ */ new Map(), getNextStoryUID = (storyId) => {
|
|
665
|
-
storyCounts.
|
|
666
|
-
let count = storyCounts.get(storyId) + 1;
|
|
673
|
+
let count = (storyCounts.get(storyId) ?? -1) + 1;
|
|
667
674
|
return storyCounts.set(storyId, count), `${storyId}-${count}`;
|
|
668
675
|
};
|
|
669
676
|
|
|
@@ -691,11 +698,10 @@ var RendererFactory = class {
|
|
|
691
698
|
this.rendererMap = /* @__PURE__ */ new Map();
|
|
692
699
|
}
|
|
693
700
|
async getRendererInstance(targetDOMNode) {
|
|
694
|
-
let targetId = targetDOMNode.id;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
return this.lastRenderType && this.lastRenderType !== renderType && (await AbstractRenderer.resetApplications(), clearRootHTMLElement(renderType), this.rendererMap.clear()), this.rendererMap.has(targetId) || this.rendererMap.set(targetId, this.buildRenderer(renderType)), this.lastRenderType = renderType, this.rendererMap.get(targetId);
|
|
701
|
+
let targetId = targetDOMNode.id, renderType = getRenderType(targetDOMNode);
|
|
702
|
+
this.lastRenderType && this.lastRenderType !== renderType && (await AbstractRenderer.resetApplications(), clearRootHTMLElement(renderType), this.rendererMap.clear());
|
|
703
|
+
let renderer = this.rendererMap.get(targetId);
|
|
704
|
+
return renderer || (renderer = this.buildRenderer(renderType), this.rendererMap.set(targetId, renderer)), this.lastRenderType = renderType, renderer;
|
|
699
705
|
}
|
|
700
706
|
buildRenderer(renderType) {
|
|
701
707
|
return renderType === "docs" ? new DocsRenderer() : new CanvasRenderer();
|
|
@@ -703,12 +709,16 @@ var RendererFactory = class {
|
|
|
703
709
|
}, getRenderType = (targetDOMNode) => targetDOMNode.id === "storybook-root" ? "canvas" : "docs";
|
|
704
710
|
function clearRootHTMLElement(renderType) {
|
|
705
711
|
switch (renderType) {
|
|
706
|
-
case "canvas":
|
|
707
|
-
global.document.getElementById("storybook-docs")
|
|
712
|
+
case "canvas": {
|
|
713
|
+
let docsRoot = global.document.getElementById("storybook-docs");
|
|
714
|
+
docsRoot && (docsRoot.innerHTML = "");
|
|
708
715
|
break;
|
|
709
|
-
|
|
710
|
-
|
|
716
|
+
}
|
|
717
|
+
case "docs": {
|
|
718
|
+
let canvasRoot = global.document.getElementById("storybook-root");
|
|
719
|
+
canvasRoot && (canvasRoot.innerHTML = "");
|
|
711
720
|
break;
|
|
721
|
+
}
|
|
712
722
|
default:
|
|
713
723
|
break;
|
|
714
724
|
}
|
package/dist/_node-chunks/{angular-cli-webpack-2R43YQZV.js → angular-cli-webpack-DJ37RLNT.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bh3ft757e7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bh3ft757e7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bh3ft757e7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bh3ft757e7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bh3ft757e7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bh3ft757e7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -50,7 +50,9 @@ var PLUGIN_NAME = "storybook-normalize-angular-entry-plugin", StorybookNormalize
|
|
|
50
50
|
var isStylingRule = (rule) => {
|
|
51
51
|
let { test } = rule;
|
|
52
52
|
return !test || !(test instanceof RegExp) ? !1 : test.test(".css") || test.test(".scss") || test.test(".sass");
|
|
53
|
-
}, filterOutStylingRules = (config) => config.module
|
|
53
|
+
}, filterOutStylingRules = (config) => (config.module?.rules ?? []).filter(
|
|
54
|
+
(rule) => !rule || rule === "..." || !isStylingRule(rule)
|
|
55
|
+
);
|
|
54
56
|
|
|
55
57
|
// src/server/angular-cli-webpack.js
|
|
56
58
|
var require2 = createRequire(import.meta.url), {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bh3ft757e7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bh3ft757e7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bh3ft757e7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bh3ft757e7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bh3ft757e7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bh3ft757e7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bh3ft757e7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bh3ft757e7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bh3ft757e7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bh3ft757e7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bh3ft757e7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bh3ft757e7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
up
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QC32CNUK.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/empathic/package.mjs
|
|
17
17
|
function up2(options) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bh3ft757e7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bh3ft757e7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bh3ft757e7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bh3ft757e7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bh3ft757e7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bh3ft757e7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
runCompodoc,
|
|
16
16
|
up as up2
|
|
17
|
-
} from "../../_node-chunks/chunk-
|
|
17
|
+
} from "../../_node-chunks/chunk-X2BF55MD.js";
|
|
18
18
|
import {
|
|
19
19
|
up
|
|
20
|
-
} from "../../_node-chunks/chunk-
|
|
20
|
+
} from "../../_node-chunks/chunk-QC32CNUK.js";
|
|
21
21
|
|
|
22
22
|
// src/builders/build-storybook/index.ts
|
|
23
23
|
import { readFileSync } from "node:fs";
|
|
@@ -26,7 +26,6 @@ import { buildStaticStandalone, withTelemetry } from "storybook/internal/core-se
|
|
|
26
26
|
import { addToGlobalContext } from "storybook/internal/telemetry";
|
|
27
27
|
import { logger, logTracker } from "storybook/internal/node-logger";
|
|
28
28
|
import { createBuilder, targetFromTargetString } from "@angular-devkit/architect";
|
|
29
|
-
import { VERSION } from "@angular/core";
|
|
30
29
|
import { Channel } from "storybook/internal/channels";
|
|
31
30
|
addToGlobalContext("cliVersion", versions.storybook);
|
|
32
31
|
var commandBuilder = async (options, context) => {
|
|
@@ -59,10 +58,10 @@ var commandBuilder = async (options, context) => {
|
|
|
59
58
|
debugWebpack,
|
|
60
59
|
disableTelemetry,
|
|
61
60
|
assets,
|
|
62
|
-
previewUrl,
|
|
63
61
|
sourceMap = !1,
|
|
64
62
|
preserveSymlinks = !1,
|
|
65
|
-
|
|
63
|
+
// Angular 21+ always supports zoneless; users still opt out via `experimentalZoneless: false`
|
|
64
|
+
experimentalZoneless = !0
|
|
66
65
|
} = options, packageJsonPath = up2({ cwd: __dirname }), standaloneOptions = {
|
|
67
66
|
packageJson: packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null,
|
|
68
67
|
configDir,
|
|
@@ -86,8 +85,7 @@ var commandBuilder = async (options, context) => {
|
|
|
86
85
|
tsConfig,
|
|
87
86
|
webpackStatsJson,
|
|
88
87
|
statsJson,
|
|
89
|
-
debugWebpack
|
|
90
|
-
previewUrl
|
|
88
|
+
debugWebpack
|
|
91
89
|
};
|
|
92
90
|
if (await runInstance({ ...standaloneOptions, mode: "static" }), logTracker.shouldWriteLogsToFile) {
|
|
93
91
|
let logFile = await logTracker.writeToFile(options.logfile);
|
|
@@ -97,12 +95,16 @@ var commandBuilder = async (options, context) => {
|
|
|
97
95
|
}, build_storybook_default = createBuilder(commandBuilder);
|
|
98
96
|
async function setup(options, context) {
|
|
99
97
|
let browserOptions, browserTarget;
|
|
100
|
-
|
|
98
|
+
options.browserTarget && (browserTarget = targetFromTargetString(options.browserTarget), browserOptions = await context.validateOptions(
|
|
101
99
|
await context.getTargetOptions(browserTarget),
|
|
102
100
|
await context.getBuilderNameForTarget(browserTarget)
|
|
103
|
-
))
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
));
|
|
102
|
+
let tsConfig = options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserOptions?.tsConfig;
|
|
103
|
+
if (tsConfig === void 0)
|
|
104
|
+
throw new Error(
|
|
105
|
+
'Storybook could not find a tsconfig.json. Set the "tsConfig" or "browserTarget" option of the Storybook builder.'
|
|
106
|
+
);
|
|
107
|
+
return { tsConfig };
|
|
106
108
|
}
|
|
107
109
|
async function runInstance(options) {
|
|
108
110
|
try {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bh3ft757e7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bh3ft757e7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bh3ft757e7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bh3ft757e7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bh3ft757e7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bh3ft757e7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
runCompodoc,
|
|
16
16
|
up as up2
|
|
17
|
-
} from "../../_node-chunks/chunk-
|
|
17
|
+
} from "../../_node-chunks/chunk-X2BF55MD.js";
|
|
18
18
|
import {
|
|
19
19
|
up
|
|
20
|
-
} from "../../_node-chunks/chunk-
|
|
20
|
+
} from "../../_node-chunks/chunk-QC32CNUK.js";
|
|
21
21
|
|
|
22
22
|
// src/builders/start-storybook/index.ts
|
|
23
23
|
import { readFileSync } from "node:fs";
|
|
@@ -27,7 +27,6 @@ import { addToGlobalContext } from "storybook/internal/telemetry";
|
|
|
27
27
|
import { logger, logTracker } from "storybook/internal/node-logger";
|
|
28
28
|
import { createBuilder, targetFromTargetString } from "@angular-devkit/architect";
|
|
29
29
|
import { Observable } from "rxjs";
|
|
30
|
-
import { VERSION } from "@angular/core";
|
|
31
30
|
import { Channel } from "storybook/internal/channels";
|
|
32
31
|
addToGlobalContext("cliVersion", versions.storybook);
|
|
33
32
|
var commandBuilder = (options, context) => new Observable((observer) => {
|
|
@@ -75,10 +74,10 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
75
74
|
loglevel,
|
|
76
75
|
webpackStatsJson,
|
|
77
76
|
statsJson,
|
|
78
|
-
previewUrl,
|
|
79
77
|
sourceMap = !1,
|
|
80
78
|
preserveSymlinks = !1,
|
|
81
|
-
|
|
79
|
+
// Angular 21+ always supports zoneless; users still opt out via `experimentalZoneless: false`
|
|
80
|
+
experimentalZoneless = !0
|
|
82
81
|
} = options, packageJsonPath = up2({ cwd: __dirname }), standaloneOptions = {
|
|
83
82
|
packageJson: packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null,
|
|
84
83
|
ci,
|
|
@@ -110,8 +109,7 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
110
109
|
debugWebpack,
|
|
111
110
|
webpackStatsJson,
|
|
112
111
|
statsJson,
|
|
113
|
-
loglevel
|
|
114
|
-
previewUrl
|
|
112
|
+
loglevel
|
|
115
113
|
}, startedPort = await runInstance(standaloneOptions);
|
|
116
114
|
observer.next({ success: !0, info: { port: startedPort } });
|
|
117
115
|
} catch (error) {
|
|
@@ -130,16 +128,20 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
130
128
|
}), start_storybook_default = createBuilder(commandBuilder);
|
|
131
129
|
async function setup(options, context) {
|
|
132
130
|
let browserOptions, browserTarget;
|
|
133
|
-
|
|
131
|
+
options.browserTarget && (browserTarget = targetFromTargetString(options.browserTarget), browserOptions = await context.validateOptions(
|
|
134
132
|
await context.getTargetOptions(browserTarget),
|
|
135
133
|
await context.getBuilderNameForTarget(browserTarget)
|
|
136
|
-
))
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
));
|
|
135
|
+
let tsConfig = options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir }) ?? browserOptions?.tsConfig;
|
|
136
|
+
if (tsConfig === void 0)
|
|
137
|
+
throw new Error(
|
|
138
|
+
'Storybook could not find a tsconfig.json. Set the "tsConfig" or "browserTarget" option of the Storybook builder.'
|
|
139
|
+
);
|
|
140
|
+
return { tsConfig };
|
|
139
141
|
}
|
|
140
142
|
async function runInstance(options) {
|
|
141
143
|
try {
|
|
142
|
-
let
|
|
144
|
+
let result = await withTelemetry(
|
|
143
145
|
"dev",
|
|
144
146
|
{
|
|
145
147
|
cliOptions: options,
|
|
@@ -153,7 +155,9 @@ async function runInstance(options) {
|
|
|
153
155
|
},
|
|
154
156
|
() => buildDevStandalone(options)
|
|
155
157
|
);
|
|
156
|
-
|
|
158
|
+
if (!result)
|
|
159
|
+
throw new Error("Storybook dev server did not start");
|
|
160
|
+
return result.port;
|
|
157
161
|
} catch (error) {
|
|
158
162
|
let summarized = errorSummary(error);
|
|
159
163
|
throw new Error(String(summarized));
|
package/dist/client/config.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
argTypesEnhancers,
|
|
3
3
|
decorateStory,
|
|
4
4
|
parameters
|
|
5
|
-
} from "../_browser-chunks/chunk-
|
|
5
|
+
} from "../_browser-chunks/chunk-A7CCO6TU.js";
|
|
6
6
|
import {
|
|
7
7
|
render,
|
|
8
8
|
renderToCanvas
|
|
9
|
-
} from "../_browser-chunks/chunk-
|
|
9
|
+
} from "../_browser-chunks/chunk-ZATG2N4T.js";
|
|
10
10
|
export {
|
|
11
11
|
decorateStory as applyDecorators,
|
|
12
12
|
argTypesEnhancers,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decorators,
|
|
3
3
|
parameters
|
|
4
|
-
} from "../../_browser-chunks/chunk-
|
|
5
|
-
import "../../_browser-chunks/chunk-
|
|
4
|
+
} from "../../_browser-chunks/chunk-OU5A7FPZ.js";
|
|
5
|
+
import "../../_browser-chunks/chunk-ZATG2N4T.js";
|
|
6
6
|
export {
|
|
7
7
|
decorators,
|
|
8
8
|
parameters
|
package/dist/client/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
componentWrapperDecorator,
|
|
6
6
|
moduleMetadata,
|
|
7
7
|
setProjectAnnotations
|
|
8
|
-
} from "../_browser-chunks/chunk-
|
|
9
|
-
import "../_browser-chunks/chunk-
|
|
10
|
-
import "../_browser-chunks/chunk-
|
|
11
|
-
import "../_browser-chunks/chunk-
|
|
8
|
+
} from "../_browser-chunks/chunk-M5CWHAJJ.js";
|
|
9
|
+
import "../_browser-chunks/chunk-A7CCO6TU.js";
|
|
10
|
+
import "../_browser-chunks/chunk-OU5A7FPZ.js";
|
|
11
|
+
import "../_browser-chunks/chunk-ZATG2N4T.js";
|
|
12
12
|
export {
|
|
13
13
|
__definePreview,
|
|
14
14
|
applicationConfig,
|