@storybook/angular-vite 11.0.0-alpha.9 → 11.0.0-beta.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.
- package/dist/_node-chunks/{chunk-HHXKBK6J.js → chunk-77GXSRPT.js} +6 -6
- package/dist/_node-chunks/{chunk-3NOOT4P4.js → chunk-HKTBFY7T.js} +9 -9
- package/dist/_node-chunks/{chunk-IIBIIU2W.js → chunk-MJSL2O6Q.js} +6 -6
- package/dist/_node-chunks/{story-docs-template-analysis-R5ORZ5HO.js → story-docs-template-analysis-SKEZCPXI.js} +6 -6
- package/dist/builders/build-storybook/index.js +8 -8
- package/dist/builders/start-storybook/index.js +8 -8
- package/dist/client/vitest-compiler-setup.js +2 -0
- package/dist/docgen/docgen-worker.js +11 -11
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +8 -8
- package/dist/preset.js +9 -9
- package/package.json +6 -5
- package/start-schema.json +1 -1
- package/template/cli/button.stories.ts +11 -14
- package/template/cli/header.stories.ts +6 -9
- package/template/cli/page.stories.ts +6 -9
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.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_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.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-77GXSRPT.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/empathic/package.mjs
|
|
17
17
|
function up2(options) {
|
|
@@ -32,10 +32,10 @@ function requireBuilderTarget(context) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// src/builders/utils/error-handler.ts
|
|
35
|
-
import { logger
|
|
35
|
+
import { logger } from "storybook/internal/node-logger";
|
|
36
36
|
import { dedent } from "ts-dedent";
|
|
37
37
|
var printErrorDetails = (error) => {
|
|
38
|
-
|
|
38
|
+
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));
|
|
39
39
|
}, errorSummary = (error) => error.close ? dedent`
|
|
40
40
|
FATAL broken build!, will close the process,
|
|
41
41
|
Fix the error below and restart storybook.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
printErrorDetails,
|
|
17
17
|
requireBuilderTarget,
|
|
18
18
|
up
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
19
|
+
} from "../../_node-chunks/chunk-HKTBFY7T.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveTsconfig
|
|
22
|
-
} from "../../_node-chunks/chunk-
|
|
22
|
+
} from "../../_node-chunks/chunk-77GXSRPT.js";
|
|
23
23
|
|
|
24
24
|
// src/builders/build-storybook/index.ts
|
|
25
25
|
import { readFileSync } from "node:fs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
printErrorDetails,
|
|
17
17
|
requireBuilderTarget,
|
|
18
18
|
up
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
19
|
+
} from "../../_node-chunks/chunk-HKTBFY7T.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveTsconfig
|
|
22
|
-
} from "../../_node-chunks/chunk-
|
|
22
|
+
} from "../../_node-chunks/chunk-77GXSRPT.js";
|
|
23
23
|
|
|
24
24
|
// src/builders/start-storybook/index.ts
|
|
25
25
|
import { readFileSync } from "node:fs";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.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
|
resolveStoryComponent
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-MJSL2O6Q.js";
|
|
15
15
|
|
|
16
16
|
// src/docgen/docgen-worker.ts
|
|
17
17
|
import {
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
23
23
|
|
|
24
24
|
// ../../lib/angular-cm/dist/index.js
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
25
|
+
import CJS_COMPAT_NODE_URL_q6p8mh80nmb from "node:url";
|
|
26
|
+
import CJS_COMPAT_NODE_PATH_q6p8mh80nmb from "node:path";
|
|
27
|
+
import CJS_COMPAT_NODE_MODULE_q6p8mh80nmb from "node:module";
|
|
28
28
|
import { isInNodeModules } from "storybook/internal/common";
|
|
29
29
|
import {
|
|
30
30
|
ComponentMetaManager,
|
|
@@ -40,7 +40,7 @@ import { logger as logger3 } from "storybook/internal/node-logger";
|
|
|
40
40
|
import * as path from "node:path";
|
|
41
41
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
42
42
|
import { logger } from "storybook/internal/node-logger";
|
|
43
|
-
var __filename =
|
|
43
|
+
var __filename = CJS_COMPAT_NODE_URL_q6p8mh80nmb.fileURLToPath(import.meta.url), __dirname = CJS_COMPAT_NODE_PATH_q6p8mh80nmb.dirname(__filename), require2 = CJS_COMPAT_NODE_MODULE_q6p8mh80nmb.createRequire(import.meta.url), resolvedSymbol = (ctx, node) => {
|
|
44
44
|
let symbol = ctx.checker.getSymbolAtLocation(node);
|
|
45
45
|
return symbol && symbol.flags & ctx.ts.SymbolFlags.Alias ? ctx.checker.getAliasedSymbol(symbol) : symbol;
|
|
46
46
|
}, resolvedNameSymbol = (ctx, name) => {
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -25,7 +25,7 @@ var ENV_KEY = "STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON", findNodeModulesRoots = (
|
|
|
25
25
|
dir = parent;
|
|
26
26
|
}
|
|
27
27
|
return roots;
|
|
28
|
-
}, COMPILER_SETUP = "@angular/compiler";
|
|
28
|
+
}, COMPILER_SETUP = "@storybook/angular-vite/internal/vitest-compiler-setup";
|
|
29
29
|
function storybookAngularVitest(options = {}) {
|
|
30
30
|
let serialized;
|
|
31
31
|
try {
|
|
@@ -47,7 +47,7 @@ function storybookAngularVitest(options = {}) {
|
|
|
47
47
|
// `node_modules` (with `@angular/compiler`) lives at the workspace root. Vite only treats
|
|
48
48
|
// `pnpm-workspace.yaml`, `lerna.json`, or a `workspaces` field as workspace-root markers, so a
|
|
49
49
|
// plain Angular workspace resolves the root to the library folder — and the `@angular/compiler`
|
|
50
|
-
// setup file
|
|
50
|
+
// module that the setup file imports falls outside `server.fs.allow`, failing to load in the browser with
|
|
51
51
|
// "Failed to fetch dynamically imported module". Allow every ancestor that contains
|
|
52
52
|
// `node_modules`. `configureServer` is required: Vitest builds the browser server's allow-list
|
|
53
53
|
// itself, so entries added via the `config` hook or static config never reach it.
|
package/dist/preset.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_pugqswta62p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_pugqswta62p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_pugqswta62p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_pugqswta62p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_pugqswta62p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_pugqswta62p.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
|
findTsconfigUp
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-77GXSRPT.js";
|
|
15
15
|
import {
|
|
16
16
|
parseStoryFile
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-MJSL2O6Q.js";
|
|
18
18
|
|
|
19
19
|
// src/preset.ts
|
|
20
20
|
import { findConfigFile, isTypeScriptReadyForDocgen } from "storybook/internal/common";
|
|
@@ -941,7 +941,7 @@ var buildStoryDocsPayload = async (input, context) => {
|
|
|
941
941
|
fields: fields2
|
|
942
942
|
});
|
|
943
943
|
if (userMarkup?.kind === "literal") {
|
|
944
|
-
let { analyzeStoryTemplate } = await import("./_node-chunks/story-docs-template-analysis-
|
|
944
|
+
let { analyzeStoryTemplate } = await import("./_node-chunks/story-docs-template-analysis-SKEZCPXI.js"), analysis = analyzeStoryTemplate(userMarkup.markup, userMarkup.expansions), referencedNames = new Set(analysis.kind === "resolved" ? analysis.referencedNames : []), boundOutputs = analysis.kind === "resolved" ? snippetMeta.outputs.filter((name) => analysis.boundOutputs.includes(name)) : [], hostArgs = referencedArgFields(
|
|
945
945
|
referencedNames,
|
|
946
946
|
userMarkup.representedArgs,
|
|
947
947
|
shape,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular-vite",
|
|
3
|
-
"version": "11.0.0-
|
|
3
|
+
"version": "11.0.0-beta.1",
|
|
4
4
|
"description": "Storybook for Angular: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./client/docs/config": "./dist/client/docs/config.js",
|
|
38
38
|
"./client/preview-prod": "./dist/client/preview-prod.js",
|
|
39
39
|
"./internal/docgen-worker": "./dist/docgen/docgen-worker.js",
|
|
40
|
+
"./internal/vitest-compiler-setup": "./dist/client/vitest-compiler-setup.js",
|
|
40
41
|
"./node": {
|
|
41
42
|
"types": "./dist/node/index.d.ts",
|
|
42
43
|
"code": "./src/node/index.ts",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"!src/**/*"
|
|
64
65
|
],
|
|
65
66
|
"dependencies": {
|
|
66
|
-
"@storybook/builder-vite": "11.0.0-
|
|
67
|
+
"@storybook/builder-vite": "11.0.0-beta.1",
|
|
67
68
|
"@storybook/global": "^5.0.0",
|
|
68
69
|
"telejson": "8.0.0",
|
|
69
70
|
"ts-dedent": "^2.2.0",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
"@angular/forms": "^21.2.14",
|
|
82
83
|
"@angular/platform-browser": "^21.2.14",
|
|
83
84
|
"@angular/platform-browser-dynamic": "^21.2.14",
|
|
84
|
-
"@storybook/angular-cm": "11.0.0-
|
|
85
|
-
"@storybook/angular-compodoc": "11.0.0-
|
|
85
|
+
"@storybook/angular-cm": "11.0.0-beta.1",
|
|
86
|
+
"@storybook/angular-compodoc": "11.0.0-beta.1",
|
|
86
87
|
"@types/node": "^22.19.1",
|
|
87
88
|
"empathic": "^2.0.0",
|
|
88
89
|
"memfs": "^4.11.1",
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"rxjs": "^7.4.0",
|
|
106
107
|
"sass": "^1.0.0",
|
|
107
108
|
"sass-embedded": "^1.0.0",
|
|
108
|
-
"storybook": "^11.0.0-
|
|
109
|
+
"storybook": "^11.0.0-beta.1",
|
|
109
110
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
|
|
110
111
|
"vite": ">=8.0.0",
|
|
111
112
|
"zone.js": ">=0.14.0"
|
package/start-schema.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { ButtonComponent } from './button.component';
|
|
5
5
|
|
|
6
6
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const meta
|
|
7
|
+
const meta = preview.meta({
|
|
8
8
|
title: 'Example/Button',
|
|
9
9
|
component: ButtonComponent,
|
|
10
10
|
tags: ['autodocs'],
|
|
@@ -15,35 +15,32 @@ const meta: Meta<ButtonComponent> = {
|
|
|
15
15
|
},
|
|
16
16
|
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
17
17
|
args: { onClick: fn() },
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
type Story = StoryObj<ButtonComponent>;
|
|
18
|
+
});
|
|
22
19
|
|
|
23
20
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
-
export const Primary
|
|
21
|
+
export const Primary = meta.story({
|
|
25
22
|
args: {
|
|
26
23
|
primary: true,
|
|
27
24
|
label: 'Button',
|
|
28
25
|
},
|
|
29
|
-
};
|
|
26
|
+
});
|
|
30
27
|
|
|
31
|
-
export const Secondary
|
|
28
|
+
export const Secondary = meta.story({
|
|
32
29
|
args: {
|
|
33
30
|
label: 'Button',
|
|
34
31
|
},
|
|
35
|
-
};
|
|
32
|
+
});
|
|
36
33
|
|
|
37
|
-
export const Large
|
|
34
|
+
export const Large = meta.story({
|
|
38
35
|
args: {
|
|
39
36
|
size: 'large',
|
|
40
37
|
label: 'Button',
|
|
41
38
|
},
|
|
42
|
-
};
|
|
39
|
+
});
|
|
43
40
|
|
|
44
|
-
export const Small
|
|
41
|
+
export const Small = meta.story({
|
|
45
42
|
args: {
|
|
46
43
|
size: 'small',
|
|
47
44
|
label: 'Button',
|
|
48
45
|
},
|
|
49
|
-
};
|
|
46
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { HeaderComponent } from './header.component';
|
|
5
5
|
|
|
6
|
-
const meta
|
|
6
|
+
const meta = preview.meta({
|
|
7
7
|
title: 'Example/Header',
|
|
8
8
|
component: HeaderComponent,
|
|
9
9
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
@@ -17,17 +17,14 @@ const meta: Meta<HeaderComponent> = {
|
|
|
17
17
|
onLogout: fn(),
|
|
18
18
|
onCreateAccount: fn(),
|
|
19
19
|
},
|
|
20
|
-
};
|
|
20
|
+
});
|
|
21
21
|
|
|
22
|
-
export
|
|
23
|
-
type Story = StoryObj<HeaderComponent>;
|
|
24
|
-
|
|
25
|
-
export const LoggedIn: Story = {
|
|
22
|
+
export const LoggedIn = meta.story({
|
|
26
23
|
args: {
|
|
27
24
|
user: {
|
|
28
25
|
name: 'Jane Doe',
|
|
29
26
|
},
|
|
30
27
|
},
|
|
31
|
-
};
|
|
28
|
+
});
|
|
32
29
|
|
|
33
|
-
export const LoggedOut
|
|
30
|
+
export const LoggedOut = meta.story();
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
import { expect, userEvent, within } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { PageComponent } from './page.component';
|
|
5
5
|
|
|
6
|
-
const meta
|
|
6
|
+
const meta = preview.meta({
|
|
7
7
|
title: 'Example/Page',
|
|
8
8
|
component: PageComponent,
|
|
9
9
|
parameters: {
|
|
10
10
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
11
11
|
layout: 'fullscreen',
|
|
12
12
|
},
|
|
13
|
-
};
|
|
13
|
+
});
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
type Story = StoryObj<PageComponent>;
|
|
17
|
-
|
|
18
|
-
export const LoggedOut: Story = {};
|
|
15
|
+
export const LoggedOut = meta.story();
|
|
19
16
|
|
|
20
17
|
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
21
|
-
export const LoggedIn
|
|
18
|
+
export const LoggedIn = meta.story({
|
|
22
19
|
play: async ({ canvasElement }) => {
|
|
23
20
|
const canvas = within(canvasElement);
|
|
24
21
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
@@ -29,4 +26,4 @@ export const LoggedIn: Story = {
|
|
|
29
26
|
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
30
27
|
await expect(logoutButton).toBeInTheDocument();
|
|
31
28
|
},
|
|
32
|
-
};
|
|
29
|
+
});
|