@storybook/angular 9.0.0-alpha.13 → 9.0.0-alpha.14
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.
|
@@ -177,7 +177,7 @@ class AbstractRenderer {
|
|
|
177
177
|
const previousStoryRenderInfo = this.previousStoryRenderInfo.get(targetDOMNode);
|
|
178
178
|
const currentStoryRender = {
|
|
179
179
|
storyFnAngular,
|
|
180
|
-
moduleMetadataSnapshot: (0, telejson_1.stringify)(moduleMetadata, {
|
|
180
|
+
moduleMetadataSnapshot: (0, telejson_1.stringify)(moduleMetadata, { maxDepth: 50 }),
|
|
181
181
|
};
|
|
182
182
|
this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender);
|
|
183
183
|
if (
|
|
@@ -23,39 +23,31 @@ exports.skipSourceRender = skipSourceRender;
|
|
|
23
23
|
*/
|
|
24
24
|
const sourceDecorator = (storyFn, context) => {
|
|
25
25
|
const story = storyFn();
|
|
26
|
-
|
|
27
|
-
return story;
|
|
28
|
-
}
|
|
29
|
-
const channel = preview_api_1.addons.getChannel();
|
|
30
|
-
const { props, userDefinedTemplate } = story;
|
|
31
|
-
const { component, argTypes, parameters } = context;
|
|
32
|
-
const template = parameters.docs?.source?.excludeDecorators
|
|
33
|
-
? context.originalStoryFn(context.args, context).template
|
|
34
|
-
: story.template;
|
|
35
|
-
let toEmit;
|
|
26
|
+
const source = (0, preview_api_1.useRef)(undefined);
|
|
36
27
|
(0, preview_api_1.useEffect)(() => {
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
const format = parameters?.docs?.source?.format ?? true;
|
|
40
|
-
channel.emit(docs_tools_1.SNIPPET_RENDERED, {
|
|
41
|
-
id,
|
|
42
|
-
args: unmappedArgs,
|
|
43
|
-
source: toEmit,
|
|
44
|
-
format: format === true ? 'angular' : format,
|
|
45
|
-
});
|
|
28
|
+
if ((0, exports.skipSourceRender)(context)) {
|
|
29
|
+
return;
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
31
|
+
const { props, userDefinedTemplate } = story;
|
|
32
|
+
const { component, argTypes, parameters } = context;
|
|
33
|
+
const template = parameters.docs?.source?.excludeDecorators
|
|
34
|
+
? context.originalStoryFn(context.args, context).template
|
|
35
|
+
: story.template;
|
|
36
|
+
if (component && !userDefinedTemplate) {
|
|
37
|
+
const sourceFromComponent = (0, renderer_1.computesTemplateSourceFromComponent)(component, props, argTypes);
|
|
38
|
+
// We might have a story with a Directive or Service defined as the component
|
|
39
|
+
// In these cases there might exist a template, even if we aren't able to create source from component
|
|
40
|
+
const newSource = sourceFromComponent || template;
|
|
41
|
+
if (newSource && newSource !== source.current) {
|
|
42
|
+
(0, preview_api_1.emitTransformCode)(newSource, context);
|
|
43
|
+
source.current = newSource;
|
|
44
|
+
}
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
else if (template && template !== source.current) {
|
|
47
|
+
(0, preview_api_1.emitTransformCode)(template, context);
|
|
48
|
+
source.current = template;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
59
51
|
return story;
|
|
60
52
|
};
|
|
61
53
|
exports.sourceDecorator = sourceDecorator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.14",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@storybook/builder-webpack5": "9.0.0-alpha.
|
|
56
|
-
"@storybook/core-webpack": "9.0.0-alpha.
|
|
55
|
+
"@storybook/builder-webpack5": "9.0.0-alpha.14",
|
|
56
|
+
"@storybook/core-webpack": "9.0.0-alpha.14",
|
|
57
57
|
"@storybook/global": "^5.0.0",
|
|
58
58
|
"@types/react": "^18.0.37",
|
|
59
59
|
"@types/react-dom": "^18.0.11",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"fd-package-json": "^1.2.0",
|
|
63
63
|
"find-up": "^5.0.0",
|
|
64
64
|
"semver": "^7.3.7",
|
|
65
|
-
"telejson": "
|
|
65
|
+
"telejson": "8.0.0--canary.106.377d63b.0",
|
|
66
66
|
"ts-dedent": "^2.0.0",
|
|
67
67
|
"tsconfig-paths-webpack-plugin": "^4.0.1",
|
|
68
68
|
"util-deprecate": "^1.0.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@angular/platform-browser": ">=18.0.0 < 20.0.0",
|
|
107
107
|
"@angular/platform-browser-dynamic": ">=18.0.0 < 20.0.0",
|
|
108
108
|
"rxjs": "^6.5.3 || ^7.4.0",
|
|
109
|
-
"storybook": "^9.0.0-alpha.
|
|
109
|
+
"storybook": "^9.0.0-alpha.14",
|
|
110
110
|
"typescript": "^4.9.0 || ^5.0.0",
|
|
111
111
|
"zone.js": ">=0.14.0"
|
|
112
112
|
},
|