@storybook/angular 9.2.0-alpha.2 → 10.0.0-beta.0
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/README.md +3 -1
- package/dist/_browser-chunks/chunk-CV6HSYTZ.js +92 -0
- package/dist/_browser-chunks/chunk-DAHG2CDK.js +3 -0
- package/dist/_browser-chunks/chunk-L4GU2V72.js +939 -0
- package/dist/_node-chunks/chunk-76OGQITJ.js +330 -0
- package/dist/_node-chunks/chunk-JXWXEIYP.js +17 -0
- package/dist/_node-chunks/chunk-YXFPXXZP.js +135 -0
- package/dist/builders/build-storybook/index.js +137 -28
- package/dist/builders/start-storybook/index.js +161 -28
- package/dist/client/config.js +304 -46
- package/dist/client/docs/config.js +54 -15
- package/dist/client/index.js +16 -47
- package/dist/client/preview-prod.js +3 -5
- package/dist/index.d.ts +177 -6
- package/dist/index.js +16 -47
- package/dist/node/index.d.ts +56 -0
- package/dist/node/index.js +23 -0
- package/dist/preset.js +54 -7
- package/dist/server/framework-preset-angular-cli.js +309 -16
- package/dist/server/framework-preset-angular-ivy.js +57 -5
- package/package.json +24 -70
- package/preset.js +1 -1
- package/dist/chunk-CUDJAP6K.mjs +0 -3
- package/dist/chunk-KMSSK3DZ.mjs +0 -6
- package/dist/chunk-LXSTVAFF.mjs +0 -40
- package/dist/client/config.d.ts +0 -20
- package/dist/client/config.mjs +0 -11
- package/dist/client/docs/config.d.ts +0 -6
- package/dist/client/docs/config.mjs +0 -7
- package/dist/client/index.d.ts +0 -144
- package/dist/client/index.mjs +0 -3
- package/dist/client/preview-prod.d.ts +0 -2
- package/dist/client/preview-prod.mjs +0 -3
- package/dist/index.mjs +0 -3
- package/dist/types-3b0b7107.d.ts +0 -42
- package/renderer.d.ts +0 -1
- package/renderer.js +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
# Storybook for Angular
|
|
2
2
|
|
|
3
|
-
See [documentation](https://storybook.js.org/docs/get-started/frameworks/angular?renderer=angular) for installation instructions, usage examples, APIs, and more.
|
|
3
|
+
See [documentation](https://storybook.js.org/docs/get-started/frameworks/angular?renderer=angular&ref=readme) for installation instructions, usage examples, APIs, and more.
|
|
4
|
+
|
|
5
|
+
Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme).
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name,
|
|
3
|
+
computesTemplateFromComponent,
|
|
4
|
+
formatPropInTemplate,
|
|
5
|
+
isComponent,
|
|
6
|
+
render_exports
|
|
7
|
+
} from "./chunk-L4GU2V72.js";
|
|
8
|
+
|
|
9
|
+
// src/client/portable-stories.ts
|
|
10
|
+
import {
|
|
11
|
+
setProjectAnnotations as originalSetProjectAnnotations,
|
|
12
|
+
setDefaultProjectAnnotations
|
|
13
|
+
} from "storybook/preview-api";
|
|
14
|
+
function setProjectAnnotations(projectAnnotations) {
|
|
15
|
+
setDefaultProjectAnnotations(render_exports);
|
|
16
|
+
return originalSetProjectAnnotations(
|
|
17
|
+
projectAnnotations
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
__name(setProjectAnnotations, "setProjectAnnotations");
|
|
21
|
+
|
|
22
|
+
// src/client/decorators.ts
|
|
23
|
+
var moduleMetadata = /* @__PURE__ */ __name((metadata) => (storyFn) => {
|
|
24
|
+
const story = storyFn();
|
|
25
|
+
const storyMetadata = story.moduleMetadata || {};
|
|
26
|
+
metadata = metadata || {};
|
|
27
|
+
return {
|
|
28
|
+
...story,
|
|
29
|
+
moduleMetadata: {
|
|
30
|
+
declarations: [...metadata.declarations || [], ...storyMetadata.declarations || []],
|
|
31
|
+
entryComponents: [
|
|
32
|
+
...metadata.entryComponents || [],
|
|
33
|
+
...storyMetadata.entryComponents || []
|
|
34
|
+
],
|
|
35
|
+
imports: [...metadata.imports || [], ...storyMetadata.imports || []],
|
|
36
|
+
schemas: [...metadata.schemas || [], ...storyMetadata.schemas || []],
|
|
37
|
+
providers: [...metadata.providers || [], ...storyMetadata.providers || []]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, "moduleMetadata");
|
|
41
|
+
function applicationConfig(config) {
|
|
42
|
+
return (storyFn) => {
|
|
43
|
+
const story = storyFn();
|
|
44
|
+
const storyConfig = story.applicationConfig;
|
|
45
|
+
return {
|
|
46
|
+
...story,
|
|
47
|
+
applicationConfig: storyConfig || config ? {
|
|
48
|
+
...config,
|
|
49
|
+
...storyConfig,
|
|
50
|
+
providers: [...config?.providers || [], ...storyConfig?.providers || []]
|
|
51
|
+
} : void 0
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
__name(applicationConfig, "applicationConfig");
|
|
56
|
+
var componentWrapperDecorator = /* @__PURE__ */ __name((element, props) => (storyFn, storyContext) => {
|
|
57
|
+
const story = storyFn();
|
|
58
|
+
const currentProps = typeof props === "function" ? props(storyContext) : props;
|
|
59
|
+
const template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
60
|
+
return {
|
|
61
|
+
...story,
|
|
62
|
+
template,
|
|
63
|
+
...currentProps || story.props ? {
|
|
64
|
+
props: {
|
|
65
|
+
...currentProps,
|
|
66
|
+
...story.props
|
|
67
|
+
}
|
|
68
|
+
} : {}
|
|
69
|
+
};
|
|
70
|
+
}, "componentWrapperDecorator");
|
|
71
|
+
|
|
72
|
+
// src/client/argsToTemplate.ts
|
|
73
|
+
function argsToTemplate(args, options = {}) {
|
|
74
|
+
const includeSet = options.include ? new Set(options.include) : null;
|
|
75
|
+
const excludeSet = options.exclude ? new Set(options.exclude) : null;
|
|
76
|
+
return Object.entries(args).filter(([key]) => args[key] !== void 0).filter(([key]) => {
|
|
77
|
+
if (includeSet) return includeSet.has(key);
|
|
78
|
+
if (excludeSet) return !excludeSet.has(key);
|
|
79
|
+
return true;
|
|
80
|
+
}).map(
|
|
81
|
+
([key, value]) => typeof value === "function" ? `(${key})="${formatPropInTemplate(key)}($event)"` : `[${key}]="${formatPropInTemplate(key)}"`
|
|
82
|
+
).join(" ");
|
|
83
|
+
}
|
|
84
|
+
__name(argsToTemplate, "argsToTemplate");
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
setProjectAnnotations,
|
|
88
|
+
moduleMetadata,
|
|
89
|
+
applicationConfig,
|
|
90
|
+
componentWrapperDecorator,
|
|
91
|
+
argsToTemplate
|
|
92
|
+
};
|