@storybook/angular 10.1.0-alpha.8 → 10.1.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/dist/_browser-chunks/chunk-6CHBWP5J.js +711 -0
- package/dist/_browser-chunks/{chunk-CV6HSYTZ.js → chunk-T32Z4CGF.js} +13 -28
- package/dist/_node-chunks/chunk-YMPHFUN2.js +43 -0
- package/dist/_node-chunks/chunk-Z5FLT7AH.js +62 -0
- package/dist/builders/build-storybook/index.js +87 -102
- package/dist/builders/start-storybook/index.js +104 -124
- package/dist/client/config.js +84 -179
- package/dist/client/docs/config.js +15 -33
- package/dist/client/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/node/index.js +6 -10
- package/dist/preset.js +19 -29
- package/dist/server/framework-preset-angular-cli.js +156 -158
- package/dist/server/framework-preset-angular-ivy.js +16 -25
- package/package.json +16 -17
- package/dist/_browser-chunks/chunk-L4GU2V72.js +0 -939
- package/dist/_node-chunks/chunk-5KBZJOS2.js +0 -17
- package/dist/_node-chunks/chunk-C7I5GKOQ.js +0 -58
- package/dist/_node-chunks/chunk-CKMZCINS.js +0 -93
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__name,
|
|
3
2
|
computesTemplateFromComponent,
|
|
4
3
|
formatPropInTemplate,
|
|
5
4
|
isComponent,
|
|
6
5
|
render_exports
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6CHBWP5J.js";
|
|
8
7
|
|
|
9
8
|
// src/client/portable-stories.ts
|
|
10
9
|
import {
|
|
@@ -12,19 +11,15 @@ import {
|
|
|
12
11
|
setDefaultProjectAnnotations
|
|
13
12
|
} from "storybook/preview-api";
|
|
14
13
|
function setProjectAnnotations(projectAnnotations) {
|
|
15
|
-
setDefaultProjectAnnotations(render_exports)
|
|
16
|
-
return originalSetProjectAnnotations(
|
|
14
|
+
return setDefaultProjectAnnotations(render_exports), originalSetProjectAnnotations(
|
|
17
15
|
projectAnnotations
|
|
18
16
|
);
|
|
19
17
|
}
|
|
20
|
-
__name(setProjectAnnotations, "setProjectAnnotations");
|
|
21
18
|
|
|
22
19
|
// src/client/decorators.ts
|
|
23
|
-
var moduleMetadata =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
metadata = metadata || {};
|
|
27
|
-
return {
|
|
20
|
+
var moduleMetadata = (metadata) => (storyFn) => {
|
|
21
|
+
let story = storyFn(), storyMetadata = story.moduleMetadata || {};
|
|
22
|
+
return metadata = metadata || {}, {
|
|
28
23
|
...story,
|
|
29
24
|
moduleMetadata: {
|
|
30
25
|
declarations: [...metadata.declarations || [], ...storyMetadata.declarations || []],
|
|
@@ -37,11 +32,10 @@ var moduleMetadata = /* @__PURE__ */ __name((metadata) => (storyFn) => {
|
|
|
37
32
|
providers: [...metadata.providers || [], ...storyMetadata.providers || []]
|
|
38
33
|
}
|
|
39
34
|
};
|
|
40
|
-
}
|
|
35
|
+
};
|
|
41
36
|
function applicationConfig(config) {
|
|
42
37
|
return (storyFn) => {
|
|
43
|
-
|
|
44
|
-
const storyConfig = story.applicationConfig;
|
|
38
|
+
let story = storyFn(), storyConfig = story.applicationConfig;
|
|
45
39
|
return {
|
|
46
40
|
...story,
|
|
47
41
|
applicationConfig: storyConfig || config ? {
|
|
@@ -52,11 +46,8 @@ function applicationConfig(config) {
|
|
|
52
46
|
};
|
|
53
47
|
};
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
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);
|
|
49
|
+
var componentWrapperDecorator = (element, props) => (storyFn, storyContext) => {
|
|
50
|
+
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
60
51
|
return {
|
|
61
52
|
...story,
|
|
62
53
|
template,
|
|
@@ -67,21 +58,15 @@ var componentWrapperDecorator = /* @__PURE__ */ __name((element, props) => (stor
|
|
|
67
58
|
}
|
|
68
59
|
} : {}
|
|
69
60
|
};
|
|
70
|
-
}
|
|
61
|
+
};
|
|
71
62
|
|
|
72
63
|
// src/client/argsToTemplate.ts
|
|
73
64
|
function argsToTemplate(args, options = {}) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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)}"`
|
|
65
|
+
let includeSet = options.include ? new Set(options.include) : null, excludeSet = options.exclude ? new Set(options.exclude) : null;
|
|
66
|
+
return Object.entries(args).filter(([key]) => args[key] !== void 0).filter(([key]) => includeSet ? includeSet.has(key) : excludeSet ? !excludeSet.has(key) : !0).map(
|
|
67
|
+
([key, value]) => typeof value == "function" ? `(${key})="${formatPropInTemplate(key)}($event)"` : `[${key}]="${formatPropInTemplate(key)}"`
|
|
82
68
|
).join(" ");
|
|
83
69
|
}
|
|
84
|
-
__name(argsToTemplate, "argsToTemplate");
|
|
85
70
|
|
|
86
71
|
export {
|
|
87
72
|
setProjectAnnotations,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ysqodpy6j9j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ysqodpy6j9j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ysqodpy6j9j from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ysqodpy6j9j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ysqodpy6j9j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ysqodpy6j9j.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// ../../node_modules/empathic/find.mjs
|
|
14
|
+
import { join as join2 } from "node:path";
|
|
15
|
+
import { existsSync, statSync } from "node:fs";
|
|
16
|
+
|
|
17
|
+
// ../../node_modules/empathic/walk.mjs
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/empathic/resolve.mjs
|
|
21
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
22
|
+
function absolute(input, root) {
|
|
23
|
+
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ../../node_modules/empathic/walk.mjs
|
|
27
|
+
function up(base, options) {
|
|
28
|
+
let { last, cwd } = options || {}, tmp = absolute(base, cwd), root = absolute(last || "/", cwd), prev, arr = [];
|
|
29
|
+
for (; prev !== root && (arr.push(tmp), tmp = dirname(prev = tmp), tmp !== prev); )
|
|
30
|
+
;
|
|
31
|
+
return arr;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/empathic/find.mjs
|
|
35
|
+
function up2(name, options) {
|
|
36
|
+
let dir, tmp, start = options && options.cwd || "";
|
|
37
|
+
for (dir of up(start, options))
|
|
38
|
+
if (tmp = join2(dir, name), existsSync(tmp)) return tmp;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
up2 as up
|
|
43
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ysqodpy6j9j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ysqodpy6j9j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ysqodpy6j9j from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ysqodpy6j9j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ysqodpy6j9j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ysqodpy6j9j.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
up
|
|
14
|
+
} from "./chunk-YMPHFUN2.js";
|
|
15
|
+
|
|
16
|
+
// ../../node_modules/empathic/package.mjs
|
|
17
|
+
function up2(options) {
|
|
18
|
+
return up("package.json", options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/builders/utils/error-handler.ts
|
|
22
|
+
import { logger, instance as npmLog } from "storybook/internal/node-logger";
|
|
23
|
+
import { dedent } from "ts-dedent";
|
|
24
|
+
var printErrorDetails = (error) => {
|
|
25
|
+
npmLog.heading = "", error instanceof Error ? error.error ? logger.error(error.error) : error.stats && error.stats.compilation.errors ? error.stats.compilation.errors.forEach((e) => logger.log(e)) : logger.error(error) : error.compilation?.errors && error.compilation.errors.forEach((e) => logger.log(e));
|
|
26
|
+
}, errorSummary = (error) => error.close ? dedent`
|
|
27
|
+
FATAL broken build!, will close the process,
|
|
28
|
+
Fix the error below and restart storybook.
|
|
29
|
+
` : dedent`
|
|
30
|
+
Broken build, fix the error above.
|
|
31
|
+
You may need to refresh the browser.
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
// src/builders/utils/run-compodoc.ts
|
|
35
|
+
import { isAbsolute, relative } from "node:path";
|
|
36
|
+
import { JsPackageManagerFactory } from "storybook/internal/common";
|
|
37
|
+
import { Observable } from "rxjs";
|
|
38
|
+
var hasTsConfigArg = (args) => args.indexOf("-p") !== -1, hasOutputArg = (args) => args.indexOf("-d") !== -1 || args.indexOf("--output") !== -1, toRelativePath = (pathToTsConfig) => isAbsolute(pathToTsConfig) ? relative(".", pathToTsConfig) : pathToTsConfig, runCompodoc = ({ compodocArgs, tsconfig }, context) => new Observable((observer) => {
|
|
39
|
+
let tsConfigPath = toRelativePath(tsconfig), finalCompodocArgs = [
|
|
40
|
+
"compodoc",
|
|
41
|
+
...hasTsConfigArg(compodocArgs) ? [] : ["-p", tsConfigPath],
|
|
42
|
+
...hasOutputArg(compodocArgs) ? [] : ["-d", `${context.workspaceRoot || "."}`],
|
|
43
|
+
...compodocArgs
|
|
44
|
+
], packageManager = JsPackageManagerFactory.getPackageManager();
|
|
45
|
+
try {
|
|
46
|
+
packageManager.runPackageCommand({
|
|
47
|
+
args: finalCompodocArgs,
|
|
48
|
+
cwd: context.workspaceRoot
|
|
49
|
+
}).then((result) => {
|
|
50
|
+
context.logger.info(result.stdout), observer.next(), observer.complete();
|
|
51
|
+
});
|
|
52
|
+
} catch (e) {
|
|
53
|
+
context.logger.error(e), observer.error();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
up2 as up,
|
|
59
|
+
printErrorDetails,
|
|
60
|
+
errorSummary,
|
|
61
|
+
runCompodoc
|
|
62
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ysqodpy6j9j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ysqodpy6j9j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ysqodpy6j9j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ysqodpy6j9j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ysqodpy6j9j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ysqodpy6j9j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,117 +14,99 @@ import {
|
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
runCompodoc,
|
|
16
16
|
up as up2
|
|
17
|
-
} from "../../_node-chunks/chunk-
|
|
17
|
+
} from "../../_node-chunks/chunk-Z5FLT7AH.js";
|
|
18
18
|
import {
|
|
19
19
|
up
|
|
20
|
-
} from "../../_node-chunks/chunk-
|
|
21
|
-
import {
|
|
22
|
-
__name
|
|
23
|
-
} from "../../_node-chunks/chunk-5KBZJOS2.js";
|
|
20
|
+
} from "../../_node-chunks/chunk-YMPHFUN2.js";
|
|
24
21
|
|
|
25
22
|
// src/builders/build-storybook/index.ts
|
|
26
23
|
import { readFileSync } from "node:fs";
|
|
27
24
|
import { getEnvConfig, getProjectRoot, versions } from "storybook/internal/common";
|
|
28
25
|
import { buildStaticStandalone, withTelemetry } from "storybook/internal/core-server";
|
|
29
26
|
import { addToGlobalContext } from "storybook/internal/telemetry";
|
|
27
|
+
import { logger } from "storybook/internal/node-logger";
|
|
30
28
|
import { createBuilder, targetFromTargetString } from "@angular-devkit/architect";
|
|
31
29
|
import { from, of, throwError } from "rxjs";
|
|
32
30
|
import { catchError, map, mapTo, switchMap } from "rxjs/operators";
|
|
33
31
|
import { VERSION } from "@angular/core";
|
|
34
32
|
addToGlobalContext("cliVersion", versions.storybook);
|
|
35
|
-
var commandBuilder =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return standaloneOptions;
|
|
104
|
-
}),
|
|
105
|
-
switchMap((standaloneOptions) => runInstance({ ...standaloneOptions, mode: "static" })),
|
|
106
|
-
map(() => {
|
|
107
|
-
return { success: true };
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
return builder;
|
|
111
|
-
}, "commandBuilder");
|
|
112
|
-
var build_storybook_default = createBuilder(commandBuilder);
|
|
33
|
+
var commandBuilder = (options, context) => from(setup(options, context)).pipe(
|
|
34
|
+
switchMap(({ tsConfig }) => {
|
|
35
|
+
let docTSConfig = up("tsconfig.doc.json", {
|
|
36
|
+
cwd: options.configDir,
|
|
37
|
+
last: getProjectRoot()
|
|
38
|
+
});
|
|
39
|
+
return (options.compodoc ? runCompodoc(
|
|
40
|
+
{ compodocArgs: options.compodocArgs, tsconfig: docTSConfig ?? tsConfig },
|
|
41
|
+
context
|
|
42
|
+
).pipe(mapTo({ tsConfig })) : of({})).pipe(mapTo({ tsConfig }));
|
|
43
|
+
}),
|
|
44
|
+
map(({ tsConfig }) => {
|
|
45
|
+
getEnvConfig(options, {
|
|
46
|
+
staticDir: "SBCONFIG_STATIC_DIR",
|
|
47
|
+
outputDir: "SBCONFIG_OUTPUT_DIR",
|
|
48
|
+
configDir: "SBCONFIG_CONFIG_DIR"
|
|
49
|
+
});
|
|
50
|
+
let {
|
|
51
|
+
browserTarget,
|
|
52
|
+
stylePreprocessorOptions,
|
|
53
|
+
styles,
|
|
54
|
+
configDir,
|
|
55
|
+
docs,
|
|
56
|
+
loglevel,
|
|
57
|
+
test,
|
|
58
|
+
outputDir,
|
|
59
|
+
quiet,
|
|
60
|
+
enableProdMode = !0,
|
|
61
|
+
webpackStatsJson,
|
|
62
|
+
statsJson,
|
|
63
|
+
debugWebpack,
|
|
64
|
+
disableTelemetry,
|
|
65
|
+
assets,
|
|
66
|
+
previewUrl,
|
|
67
|
+
sourceMap = !1,
|
|
68
|
+
preserveSymlinks = !1,
|
|
69
|
+
experimentalZoneless = !!(VERSION.major && Number(VERSION.major) >= 21)
|
|
70
|
+
} = options, packageJsonPath = up2({ cwd: __dirname });
|
|
71
|
+
return {
|
|
72
|
+
packageJson: packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null,
|
|
73
|
+
configDir,
|
|
74
|
+
...docs ? { docs } : {},
|
|
75
|
+
loglevel,
|
|
76
|
+
outputDir,
|
|
77
|
+
test,
|
|
78
|
+
quiet,
|
|
79
|
+
enableProdMode,
|
|
80
|
+
disableTelemetry,
|
|
81
|
+
angularBrowserTarget: browserTarget,
|
|
82
|
+
angularBuilderContext: context,
|
|
83
|
+
angularBuilderOptions: {
|
|
84
|
+
...stylePreprocessorOptions ? { stylePreprocessorOptions } : {},
|
|
85
|
+
...styles ? { styles } : {},
|
|
86
|
+
...assets ? { assets } : {},
|
|
87
|
+
sourceMap,
|
|
88
|
+
preserveSymlinks,
|
|
89
|
+
experimentalZoneless
|
|
90
|
+
},
|
|
91
|
+
tsConfig,
|
|
92
|
+
webpackStatsJson,
|
|
93
|
+
statsJson,
|
|
94
|
+
debugWebpack,
|
|
95
|
+
previewUrl
|
|
96
|
+
};
|
|
97
|
+
}),
|
|
98
|
+
switchMap((standaloneOptions) => runInstance({ ...standaloneOptions, mode: "static" })),
|
|
99
|
+
map(() => ({ success: !0 }))
|
|
100
|
+
), build_storybook_default = createBuilder(commandBuilder);
|
|
113
101
|
async function setup(options, context) {
|
|
114
|
-
let browserOptions;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await context.getTargetOptions(browserTarget),
|
|
120
|
-
await context.getBuilderNameForTarget(browserTarget)
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
102
|
+
let browserOptions, browserTarget;
|
|
103
|
+
return options.browserTarget && (browserTarget = targetFromTargetString(options.browserTarget), browserOptions = await context.validateOptions(
|
|
104
|
+
await context.getTargetOptions(browserTarget),
|
|
105
|
+
await context.getBuilderNameForTarget(browserTarget)
|
|
106
|
+
)), {
|
|
124
107
|
tsConfig: options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserOptions.tsConfig
|
|
125
108
|
};
|
|
126
109
|
}
|
|
127
|
-
__name(setup, "setup");
|
|
128
110
|
function runInstance(options) {
|
|
129
111
|
return from(
|
|
130
112
|
withTelemetry(
|
|
@@ -134,11 +116,14 @@ function runInstance(options) {
|
|
|
134
116
|
presetOptions: { ...options, corePresets: [], overridePresets: [] },
|
|
135
117
|
printError: printErrorDetails
|
|
136
118
|
},
|
|
137
|
-
() =>
|
|
119
|
+
async () => {
|
|
120
|
+
logger.intro("Building storybook");
|
|
121
|
+
let result = await buildStaticStandalone(options);
|
|
122
|
+
return logger.outro("Storybook build completed successfully"), result;
|
|
123
|
+
}
|
|
138
124
|
)
|
|
139
125
|
).pipe(catchError((error) => throwError(errorSummary(error))));
|
|
140
126
|
}
|
|
141
|
-
__name(runInstance, "runInstance");
|
|
142
127
|
export {
|
|
143
128
|
build_storybook_default as default
|
|
144
129
|
};
|