storybook 10.0.0-beta.6 → 10.0.0-beta.7
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-YQV3EGQ5.js → chunk-OQ6NCFPL.js} +38 -15
- package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
- package/dist/_node-chunks/{builder-manager-V33CQT2M.js → builder-manager-VFP7HSCF.js} +13 -13
- package/dist/_node-chunks/camelcase-ZLZNQMDD.js +18 -0
- package/dist/_node-chunks/{chunk-4TOI4VSK.js → chunk-2GCKJYK6.js} +7 -7
- package/dist/_node-chunks/{chunk-NKZ4UPPV.js → chunk-3NIQHNDU.js} +7 -7
- package/dist/_node-chunks/{chunk-VQH4ZFTS.js → chunk-3QZ7KLON.js} +8 -8
- package/dist/_node-chunks/{chunk-HPFXREVG.js → chunk-3XXQRL3A.js} +7 -7
- package/dist/_node-chunks/{chunk-IINJT47N.js → chunk-46BWYN3K.js} +7 -7
- package/dist/_node-chunks/{chunk-E6TLN2J2.js → chunk-4DIDWIST.js} +7 -7
- package/dist/_node-chunks/{chunk-55VWKF63.js → chunk-5YUTWYNI.js} +9 -9
- package/dist/_node-chunks/{chunk-7WH7AGOR.js → chunk-A2DKPKBY.js} +7 -7
- package/dist/_node-chunks/{chunk-TJIMCNYJ.js → chunk-BC23FKU4.js} +8 -8
- package/dist/_node-chunks/{chunk-HEBHWRWL.js → chunk-BID2X7MU.js} +7 -7
- package/dist/_node-chunks/{chunk-BNOZ3EKF.js → chunk-C4EOB63P.js} +7 -7
- package/dist/_node-chunks/{chunk-EAOPWIKA.js → chunk-DH7BCQMG.js} +8 -8
- package/dist/_node-chunks/{chunk-JNHUDBJL.js → chunk-FCNWWJV7.js} +7 -7
- package/dist/_node-chunks/{chunk-6PTV7XGR.js → chunk-GBZZSL2K.js} +264 -109
- package/dist/_node-chunks/{chunk-DC7OWBHB.js → chunk-GCWAGPDV.js} +12 -12
- package/dist/_node-chunks/{chunk-B3AMFGAL.js → chunk-I7SRMFT5.js} +7 -7
- package/dist/_node-chunks/{chunk-EY5PTUZL.js → chunk-IEFSRAX2.js} +10 -10
- package/dist/_node-chunks/{chunk-A7CUP23N.js → chunk-IGWCAXA2.js} +7 -7
- package/dist/_node-chunks/chunk-IYOHZPPC.js +18 -0
- package/dist/_node-chunks/{chunk-NUVGSFQI.js → chunk-KVOP6ASA.js} +7 -7
- package/dist/_node-chunks/{chunk-F3PO67U3.js → chunk-MHVF6Y35.js} +7 -7
- package/dist/_node-chunks/{chunk-NJXBURX7.js → chunk-MRCMZPA2.js} +7 -7
- package/dist/_node-chunks/chunk-RNHUADRS.js +62 -0
- package/dist/_node-chunks/{chunk-UYKQJMQY.js → chunk-RP3VMQPF.js} +15 -15
- package/dist/_node-chunks/{chunk-MLBTKECD.js → chunk-TFIGR2HH.js} +7 -7
- package/dist/_node-chunks/{chunk-JOXYGIZK.js → chunk-TXDIOSHI.js} +9 -9
- package/dist/_node-chunks/{chunk-2DMFI367.js → chunk-U6MJQ7C6.js} +7 -7
- package/dist/_node-chunks/{chunk-RIPA4LFD.js → chunk-XXVKM2ZR.js} +26 -23
- package/dist/_node-chunks/{chunk-VSC6LSCQ.js → chunk-YWU65VY4.js} +6 -6
- package/dist/_node-chunks/{chunk-5IEY46LQ.js → chunk-Z3PLI7S2.js} +7 -7
- package/dist/_node-chunks/{chunk-XZTBG2TG.js → chunk-ZM2HT2RW.js} +6 -6
- package/dist/_node-chunks/{chunk-7NJGTQ3W.js → chunk-ZPNXCXIT.js} +8 -8
- package/dist/_node-chunks/{dist-CGGAYWME.js → dist-PG4I7ZDU.js} +9 -9
- package/dist/_node-chunks/{globby-3IFB7BJC.js → globby-HXB6X43W.js} +9 -9
- package/dist/_node-chunks/{lib-IT6OBSID.js → lib-4JJTZC7T.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-WM36SSZ6.js → mdx-N42X6CFJ-3JBJ7PQF.js} +8 -8
- package/dist/_node-chunks/{p-limit-3V5XIKA7.js → p-limit-WBBNX4KI.js} +7 -7
- package/dist/_node-chunks/{plugin-GJUBUKCT.js → plugin-SEQ2OPRK.js} +10 -10
- package/dist/_node-chunks/{plugin-3YREMMJJ.js → plugin-SG6I7RFC.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-DCJQFJQ5.js → webpack-inject-mocker-runtime-plugin-5O25VYCQ.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-XJNFAHBI.js → webpack-mock-plugin-35I32SAF.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.js +20 -20
- package/dist/common/index.js +21 -21
- package/dist/components/index.js +5 -1
- package/dist/core-server/index.js +91 -63
- package/dist/core-server/presets/common-manager.js +25 -20
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +22 -22
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf/index.d.ts +9 -4
- package/dist/csf/index.js +37 -8
- package/dist/csf-tools/index.d.ts +13 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +71 -32
- package/dist/manager/runtime.js +459 -242
- package/dist/manager-api/index.d.ts +10 -5
- package/dist/manager-api/index.js +66 -31
- package/dist/node-logger/index.js +14 -14
- package/dist/preview/runtime.js +96 -62
- package/dist/preview-api/index.d.ts +70 -71
- package/dist/preview-api/index.js +1 -1
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/types/index.d.ts +24 -7
- package/dist/viewport/index.d.ts +36 -4
- package/dist/viewport/index.js +1 -1
- package/package.json +1 -1
- package/dist/_node-chunks/camelcase-BZ55OCHI.js +0 -18
- package/dist/_node-chunks/chunk-FDDJHDCE.js +0 -62
- package/dist/_node-chunks/chunk-R5DIBOM6.js +0 -18
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_srln17sp2zh from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_srln17sp2zh from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_srln17sp2zh from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_srln17sp2zh.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_srln17sp2zh.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_srln17sp2zh.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
|
getAutomockCode
|
|
14
|
-
} from "../../../../_node-chunks/chunk-
|
|
14
|
+
} from "../../../../_node-chunks/chunk-I7SRMFT5.js";
|
|
15
15
|
import {
|
|
16
16
|
babelParser
|
|
17
|
-
} from "../../../../_node-chunks/chunk-
|
|
18
|
-
import "../../../../_node-chunks/chunk-
|
|
17
|
+
} from "../../../../_node-chunks/chunk-3QZ7KLON.js";
|
|
18
|
+
import "../../../../_node-chunks/chunk-A2DKPKBY.js";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
21
|
-
} from "../../../../_node-chunks/chunk-
|
|
21
|
+
} from "../../../../_node-chunks/chunk-ZM2HT2RW.js";
|
|
22
22
|
|
|
23
23
|
// src/core-server/presets/webpack/loaders/webpack-automock-loader.ts
|
|
24
24
|
function webpackAutomockLoader(source) {
|
package/dist/csf/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StorybookTypes, Renderer as Renderer$1, ProjectAnnotations as ProjectAnnotations$1, NormalizedProjectAnnotations, Args as Args$1, ComponentAnnotations as ComponentAnnotations$1, StoryAnnotations as StoryAnnotations$1, ComposedStoryFn } from 'storybook/internal/types';
|
|
1
|
+
import { StorybookTypes, Renderer as Renderer$1, ProjectAnnotations as ProjectAnnotations$1, NormalizedProjectAnnotations, Args as Args$1, ComponentAnnotations as ComponentAnnotations$1, StoryAnnotations as StoryAnnotations$1, ComposedStoryFn, TestFunction as TestFunction$1 } from 'storybook/internal/types';
|
|
2
2
|
import { AddonTypes as AddonTypes$1, StoryContext as StoryContext$1 } from 'storybook/internal/csf';
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
@@ -758,6 +758,7 @@ interface PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Arg
|
|
|
758
758
|
type StepLabel = string;
|
|
759
759
|
type StepFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>) => Promise<void> | void;
|
|
760
760
|
type PlayFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: PlayFunctionContext<TRenderer, TArgs>) => Promise<void> | void;
|
|
761
|
+
type TestFunction<TRenderer extends Renderer = Renderer, TArgs = TRenderer['args']> = (context: StoryContext<TRenderer, TArgs>) => Promise<void> | void;
|
|
761
762
|
type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
|
|
762
763
|
type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
763
764
|
type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => (TRenderer & {
|
|
@@ -992,12 +993,14 @@ interface Story<TRenderer extends Renderer$1, TInput extends StoryAnnotations$1<
|
|
|
992
993
|
name: string;
|
|
993
994
|
};
|
|
994
995
|
meta: Meta<TRenderer>;
|
|
995
|
-
__compose: () => ComposedStoryFn<TRenderer>;
|
|
996
996
|
play: TInput['play'];
|
|
997
|
-
run: (context?: Partial<StoryContext$1<TRenderer, Partial<TRenderer['args']
|
|
997
|
+
run: (context?: Partial<StoryContext$1<TRenderer, Partial<TRenderer['args']>>>, testName?: string) => Promise<void>;
|
|
998
998
|
extend<TInput extends StoryAnnotations$1<TRenderer, TRenderer['args']>>(input: TInput): Story<TRenderer, TInput>;
|
|
999
|
+
test(name: string, fn: TestFunction$1<TRenderer>): void;
|
|
1000
|
+
test(name: string, annotations: StoryAnnotations$1<TRenderer, TRenderer['args']>, fn: TestFunction$1<TRenderer>): void;
|
|
999
1001
|
}
|
|
1000
1002
|
declare function isStory<TRenderer extends Renderer$1>(input: unknown): input is Story<TRenderer>;
|
|
1003
|
+
declare function getStoryChildren<TRenderer extends Renderer$1>(story: Story<TRenderer>): Story<TRenderer>[];
|
|
1001
1004
|
|
|
1002
1005
|
/**
|
|
1003
1006
|
* Remove punctuation and illegal characters from a story ID.
|
|
@@ -1007,6 +1010,8 @@ declare function isStory<TRenderer extends Renderer$1>(input: unknown): input is
|
|
|
1007
1010
|
declare const sanitize: (string: string) => string;
|
|
1008
1011
|
/** Generate a storybook ID from a component/kind and story name. */
|
|
1009
1012
|
declare const toId: (kind: string, name?: string) => string;
|
|
1013
|
+
/** Generate a storybook test ID from a story ID and test name. */
|
|
1014
|
+
declare const toTestId: (parentId: string, testName: string) => string;
|
|
1010
1015
|
/** Transform a CSF named export into a readable story name */
|
|
1011
1016
|
declare const storyNameFromExport: (key: string) => string;
|
|
1012
1017
|
type StoryDescriptor = string[] | RegExp;
|
|
@@ -1028,4 +1033,4 @@ declare const parseKind: (kind: string, { rootSeparator, groupSeparator }: Separ
|
|
|
1028
1033
|
/** Combine a set of project / meta / story tags, removing duplicates and handling negations. */
|
|
1029
1034
|
declare const combineTags: (...tags: string[]) => string[];
|
|
1030
1035
|
|
|
1031
|
-
export { type AddonTypes, type AfterEach, type AnnotatedStoryFn, type AnyFramework, type ArgTypes, type ArgTypesEnhancer, type Args, type ArgsEnhancer, type ArgsFromMeta, type ArgsStoryFn, type BaseAnnotations, type BeforeAll, type BeforeEach, type Canvas, type CleanupCallback, type ComponentAnnotations, type ComponentId, type ComponentTitle, type Conditional, type CoreTypes, type DecoratorApplicator, type DecoratorFunction, type GlobalTypes, type Globals, type IncludeExcludeOptions, type InferTypes, type InputType, type LegacyAnnotatedStoryFn, type LegacyStoryAnnotationsOrFn, type LegacyStoryFn, type LoaderFunction, type Meta, type Parameters, type PartialStoryFn, type PlayFunction, type PlayFunctionContext, type Preview, type PreviewAddon, type ProjectAnnotations, type Renderer, type SBArrayType, type SBEnumType, type SBIntersectionType, type SBObjectType, type SBOtherType, type SBScalarType, type SBType, type SBUnionType, type SeparatorOptions, type StepFunction, type StepLabel, type StepRunner, type Story, type StoryAnnotations, type StoryAnnotationsOrFn, type StoryContext, type StoryContextForEnhancers, type StoryContextForLoaders, type StoryContextUpdate, type StoryFn, type StoryId, type StoryIdentifier, type StoryKind, type StoryName, type StrictArgTypes, type StrictArgs, type StrictGlobalTypes, type StrictInputType, type StrictParameters, type Tag, type ViewMode, combineTags, definePreview, definePreviewAddon, getCoreAnnotations, includeConditionalArg, isExportStory, isMeta, isPreview, isStory, parseKind, sanitize, storyNameFromExport, toId };
|
|
1036
|
+
export { type AddonTypes, type AfterEach, type AnnotatedStoryFn, type AnyFramework, type ArgTypes, type ArgTypesEnhancer, type Args, type ArgsEnhancer, type ArgsFromMeta, type ArgsStoryFn, type BaseAnnotations, type BeforeAll, type BeforeEach, type Canvas, type CleanupCallback, type ComponentAnnotations, type ComponentId, type ComponentTitle, type Conditional, type CoreTypes, type DecoratorApplicator, type DecoratorFunction, type GlobalTypes, type Globals, type IncludeExcludeOptions, type InferTypes, type InputType, type LegacyAnnotatedStoryFn, type LegacyStoryAnnotationsOrFn, type LegacyStoryFn, type LoaderFunction, type Meta, type Parameters, type PartialStoryFn, type PlayFunction, type PlayFunctionContext, type Preview, type PreviewAddon, type ProjectAnnotations, type Renderer, type SBArrayType, type SBEnumType, type SBIntersectionType, type SBObjectType, type SBOtherType, type SBScalarType, type SBType, type SBUnionType, type SeparatorOptions, type StepFunction, type StepLabel, type StepRunner, type Story, type StoryAnnotations, type StoryAnnotationsOrFn, type StoryContext, type StoryContextForEnhancers, type StoryContextForLoaders, type StoryContextUpdate, type StoryFn, type StoryId, type StoryIdentifier, type StoryKind, type StoryName, type StrictArgTypes, type StrictArgs, type StrictGlobalTypes, type StrictInputType, type StrictParameters, type Tag, type TestFunction, type ViewMode, combineTags, definePreview, definePreviewAddon, getCoreAnnotations, getStoryChildren, includeConditionalArg, isExportStory, isMeta, isPreview, isStory, parseKind, sanitize, storyNameFromExport, toId, toTestId };
|
package/dist/csf/index.js
CHANGED
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
composeConfigs,
|
|
9
9
|
composeStory,
|
|
10
|
+
mountDestructured,
|
|
10
11
|
normalizeArrays,
|
|
11
12
|
normalizeProjectAnnotations
|
|
12
|
-
} from "../_browser-chunks/chunk-
|
|
13
|
+
} from "../_browser-chunks/chunk-OQ6NCFPL.js";
|
|
13
14
|
import "../_browser-chunks/chunk-LYCSRYYR.js";
|
|
14
15
|
import "../_browser-chunks/chunk-Y3M7TW6K.js";
|
|
15
16
|
import {
|
|
@@ -2434,9 +2435,6 @@ function defineMeta(input, preview) {
|
|
|
2434
2435
|
_tag: "Meta",
|
|
2435
2436
|
input,
|
|
2436
2437
|
preview,
|
|
2437
|
-
get composed() {
|
|
2438
|
-
throw new Error("Not implemented");
|
|
2439
|
-
},
|
|
2440
2438
|
// @ts-expect-error hard
|
|
2441
2439
|
story(story = {}) {
|
|
2442
2440
|
return defineStory(typeof story === "function" ? { render: story } : story, this);
|
|
@@ -2461,11 +2459,14 @@ function defineStory(input, meta) {
|
|
|
2461
2459
|
}
|
|
2462
2460
|
return composed;
|
|
2463
2461
|
}, "compose");
|
|
2462
|
+
const __children = [];
|
|
2464
2463
|
return {
|
|
2465
2464
|
_tag: "Story",
|
|
2466
2465
|
input,
|
|
2467
2466
|
meta,
|
|
2467
|
+
// @ts-expect-error this is a private property used only once in renderers/react/src/preview
|
|
2468
2468
|
__compose: compose,
|
|
2469
|
+
__children,
|
|
2469
2470
|
get composed() {
|
|
2470
2471
|
const composed2 = compose();
|
|
2471
2472
|
const { args, argTypes, parameters: parameters2, id, tags, globals, storyName: name } = composed2;
|
|
@@ -2475,16 +2476,34 @@ function defineStory(input, meta) {
|
|
|
2475
2476
|
return input.play ?? meta.input?.play ?? (async () => {
|
|
2476
2477
|
});
|
|
2477
2478
|
},
|
|
2478
|
-
|
|
2479
|
-
|
|
2479
|
+
async run(context) {
|
|
2480
|
+
await compose().run(context);
|
|
2481
|
+
},
|
|
2482
|
+
test(name, overridesOrTestFn, testFn) {
|
|
2483
|
+
const annotations = typeof overridesOrTestFn !== "function" ? overridesOrTestFn : {};
|
|
2484
|
+
const testFunction = typeof overridesOrTestFn !== "function" ? testFn : overridesOrTestFn;
|
|
2485
|
+
const play = mountDestructured(this.play) || mountDestructured(testFunction) ? async ({ context }) => {
|
|
2486
|
+
await this.play?.(context);
|
|
2487
|
+
await testFunction(context);
|
|
2488
|
+
} : async (context) => {
|
|
2489
|
+
await this.play?.(context);
|
|
2490
|
+
await testFunction(context);
|
|
2491
|
+
};
|
|
2492
|
+
const test = this.extend({
|
|
2493
|
+
...annotations,
|
|
2494
|
+
name,
|
|
2495
|
+
tags: ["test-fn", "!autodocs", ...annotations.tags ?? []],
|
|
2496
|
+
play
|
|
2480
2497
|
});
|
|
2498
|
+
__children.push(test);
|
|
2499
|
+
return test;
|
|
2481
2500
|
},
|
|
2482
2501
|
extend(input2) {
|
|
2483
2502
|
return defineStory(
|
|
2484
2503
|
{
|
|
2485
2504
|
...this.input,
|
|
2486
2505
|
...input2,
|
|
2487
|
-
args: { ...this.input.args, ...input2.args },
|
|
2506
|
+
args: { ...this.input.args || {}, ...input2.args },
|
|
2488
2507
|
argTypes: combineParameters(this.input.argTypes, input2.argTypes),
|
|
2489
2508
|
afterEach: [
|
|
2490
2509
|
...normalizeArrays(this.input?.afterEach ?? []),
|
|
@@ -2512,6 +2531,13 @@ function defineStory(input, meta) {
|
|
|
2512
2531
|
};
|
|
2513
2532
|
}
|
|
2514
2533
|
__name(defineStory, "defineStory");
|
|
2534
|
+
function getStoryChildren(story) {
|
|
2535
|
+
if ("__children" in story) {
|
|
2536
|
+
return story.__children;
|
|
2537
|
+
}
|
|
2538
|
+
return [];
|
|
2539
|
+
}
|
|
2540
|
+
__name(getStoryChildren, "getStoryChildren");
|
|
2515
2541
|
|
|
2516
2542
|
// src/csf/index.ts
|
|
2517
2543
|
var sanitize = /* @__PURE__ */ __name((string) => {
|
|
@@ -2525,6 +2551,7 @@ var sanitizeSafe = /* @__PURE__ */ __name((string, part) => {
|
|
|
2525
2551
|
return sanitized;
|
|
2526
2552
|
}, "sanitizeSafe");
|
|
2527
2553
|
var toId = /* @__PURE__ */ __name((kind, name) => `${sanitizeSafe(kind, "kind")}${name ? `--${sanitizeSafe(name, "name")}` : ""}`, "toId");
|
|
2554
|
+
var toTestId = /* @__PURE__ */ __name((parentId, testName) => `${parentId}:${sanitizeSafe(testName, "test")}`, "toTestId");
|
|
2528
2555
|
var storyNameFromExport = /* @__PURE__ */ __name((key) => toStartCaseStr(key), "storyNameFromExport");
|
|
2529
2556
|
function matches(storyKey, arrayOrRegex) {
|
|
2530
2557
|
if (Array.isArray(arrayOrRegex)) {
|
|
@@ -2564,6 +2591,7 @@ export {
|
|
|
2564
2591
|
definePreview,
|
|
2565
2592
|
definePreviewAddon9 as definePreviewAddon,
|
|
2566
2593
|
getCoreAnnotations,
|
|
2594
|
+
getStoryChildren,
|
|
2567
2595
|
includeConditionalArg,
|
|
2568
2596
|
isExportStory,
|
|
2569
2597
|
isMeta,
|
|
@@ -2572,5 +2600,6 @@ export {
|
|
|
2572
2600
|
parseKind,
|
|
2573
2601
|
sanitize,
|
|
2574
2602
|
storyNameFromExport,
|
|
2575
|
-
toId
|
|
2603
|
+
toId,
|
|
2604
|
+
toTestId
|
|
2576
2605
|
};
|
|
@@ -49,6 +49,16 @@ interface StaticStory extends Pick<StoryAnnotations, 'name' | 'parameters' | 'ta
|
|
|
49
49
|
localName?: string;
|
|
50
50
|
__stats: IndexInputStats;
|
|
51
51
|
}
|
|
52
|
+
interface StoryTest {
|
|
53
|
+
node: types.Node;
|
|
54
|
+
function: types.Node;
|
|
55
|
+
name: string;
|
|
56
|
+
id: string;
|
|
57
|
+
tags: string[];
|
|
58
|
+
parent: {
|
|
59
|
+
node: types.Node;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
52
62
|
declare class CsfFile {
|
|
53
63
|
_ast: types.File;
|
|
54
64
|
_file: BabelFile;
|
|
@@ -69,6 +79,7 @@ declare class CsfFile {
|
|
|
69
79
|
_templates: Record<string, types.Expression>;
|
|
70
80
|
_namedExportsOrder?: string[];
|
|
71
81
|
imports: string[];
|
|
82
|
+
_tests: StoryTest[];
|
|
72
83
|
constructor(ast: types.File, options: CsfOptions, file: BabelFile);
|
|
73
84
|
_parseTitle(value: types.Node): string;
|
|
74
85
|
_parseMeta(declaration: types.ObjectExpression, program: types.Program): void;
|
|
@@ -76,6 +87,7 @@ declare class CsfFile {
|
|
|
76
87
|
parse(): CsfFile & IndexedCSFFile;
|
|
77
88
|
get meta(): StaticMeta | undefined;
|
|
78
89
|
get stories(): StaticStory[];
|
|
90
|
+
getStoryTests(story: string | types.Node): StoryTest[];
|
|
79
91
|
get indexInputs(): IndexInput[];
|
|
80
92
|
}
|
|
81
93
|
/** Using new babel.File is more powerful and give access to API such as buildCodeFrameError */
|
|
@@ -263,11 +275,6 @@ type TagsFilter = {
|
|
|
263
275
|
exclude: string[];
|
|
264
276
|
skip: string[];
|
|
265
277
|
};
|
|
266
|
-
/**
|
|
267
|
-
* TODO: the functionality in this file can be moved back to the vitest plugin itself It can use
|
|
268
|
-
* `storybook/internal/babel` for all it's babel needs, without duplicating babel embedding in our
|
|
269
|
-
* bundles.
|
|
270
|
-
*/
|
|
271
278
|
declare function vitestTransform({ code, fileName, configDir, stories, tagsFilter, previewLevelTags, }: {
|
|
272
279
|
code: string;
|
|
273
280
|
fileName: string;
|
|
@@ -277,4 +284,4 @@ declare function vitestTransform({ code, fileName, configDir, stories, tagsFilte
|
|
|
277
284
|
previewLevelTags: Tag[];
|
|
278
285
|
}): Promise<ReturnType<typeof formatCsf>>;
|
|
279
286
|
|
|
280
|
-
export { BadMetaError, ConfigFile, CsfFile, type CsfOptions, type EnrichCsfOptions, MixedFactoryError, MultipleMetaError, NoMetaError, type StaticMeta, type StaticStory, babelParseFile, enrichCsf, enrichCsfMeta, enrichCsfStory, extractDescription, extractSource, formatConfig, formatCsf, getStorySortParameter, isCsfFactoryPreview, isModuleMock, isValidPreviewPath, loadConfig, loadCsf, printConfig, printCsf, readConfig, readCsf, vitestTransform, writeConfig, writeCsf };
|
|
287
|
+
export { BadMetaError, ConfigFile, CsfFile, type CsfOptions, type EnrichCsfOptions, MixedFactoryError, MultipleMetaError, NoMetaError, type StaticMeta, type StaticStory, type StoryTest, babelParseFile, enrichCsf, enrichCsfMeta, enrichCsfStory, extractDescription, extractSource, formatConfig, formatCsf, getStorySortParameter, isCsfFactoryPreview, isModuleMock, isValidPreviewPath, loadConfig, loadCsf, printConfig, printCsf, readConfig, readCsf, vitestTransform, writeConfig, writeCsf };
|
package/dist/csf-tools/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_srln17sp2zh from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_srln17sp2zh from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_srln17sp2zh from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_srln17sp2zh.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_srln17sp2zh.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_srln17sp2zh.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -38,9 +38,9 @@ import {
|
|
|
38
38
|
vitestTransform,
|
|
39
39
|
writeConfig,
|
|
40
40
|
writeCsf
|
|
41
|
-
} from "../_node-chunks/chunk-
|
|
42
|
-
import "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
41
|
+
} from "../_node-chunks/chunk-GBZZSL2K.js";
|
|
42
|
+
import "../_node-chunks/chunk-TFIGR2HH.js";
|
|
43
|
+
import "../_node-chunks/chunk-ZM2HT2RW.js";
|
|
44
44
|
export {
|
|
45
45
|
BadMetaError,
|
|
46
46
|
ConfigFile,
|
|
@@ -117728,7 +117728,9 @@ var Center = styled.span(
|
|
|
117728
117728
|
flex: 1,
|
|
117729
117729
|
textAlign: "left",
|
|
117730
117730
|
display: "flex",
|
|
117731
|
-
flexDirection: "column"
|
|
117731
|
+
flexDirection: "column",
|
|
117732
|
+
minWidth: 0
|
|
117733
|
+
// required for overflow
|
|
117732
117734
|
},
|
|
117733
117735
|
({ isIndented }) => isIndented ? { marginLeft: 24 } : {}
|
|
117734
117736
|
);
|
|
@@ -117756,6 +117758,8 @@ var Left = styled.span(
|
|
|
117756
117758
|
var Item = styled.div(
|
|
117757
117759
|
({ theme: theme3 }) => ({
|
|
117758
117760
|
width: "100%",
|
|
117761
|
+
minWidth: 0,
|
|
117762
|
+
// required for overflow
|
|
117759
117763
|
border: "none",
|
|
117760
117764
|
borderRadius: theme3.appBorderRadius,
|
|
117761
117765
|
background: "none",
|
|
@@ -146170,6 +146174,7 @@ var transformSetStoriesStoryDataToPreparedStoryIndex = /* @__PURE__ */ __name((s
|
|
|
146170
146174
|
const { argTypes, args, initialArgs } = story;
|
|
146171
146175
|
acc[id] = {
|
|
146172
146176
|
type: "story",
|
|
146177
|
+
subtype: "story",
|
|
146173
146178
|
...base,
|
|
146174
146179
|
parameters: parameters2,
|
|
146175
146180
|
argTypes,
|
|
@@ -146247,19 +146252,18 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input2, { provide
|
|
|
146247
146252
|
index4 = index4.v === 3 ? transformStoryIndexV3toV4(index4) : index4;
|
|
146248
146253
|
index4 = index4.v === 4 ? transformStoryIndexV4toV5(index4) : index4;
|
|
146249
146254
|
index4 = index4;
|
|
146250
|
-
const
|
|
146251
|
-
|
|
146252
|
-
|
|
146253
|
-
|
|
146254
|
-
|
|
146255
|
+
const indexEntries = Object.values(index4.entries);
|
|
146256
|
+
const filterFunctions = Object.values(filters);
|
|
146257
|
+
const entryValues = indexEntries.filter((entry) => {
|
|
146258
|
+
const statuses = allStatuses[entry.id] ?? {};
|
|
146259
|
+
if (Object.values(statuses).some(({ value }) => value === "status-value:error")) {
|
|
146260
|
+
return true;
|
|
146255
146261
|
}
|
|
146256
|
-
|
|
146257
|
-
|
|
146258
|
-
|
|
146259
|
-
|
|
146260
|
-
|
|
146261
|
-
});
|
|
146262
|
-
return result;
|
|
146262
|
+
if (filterFunctions.every((fn4) => fn4({ ...entry, statuses }))) {
|
|
146263
|
+
return true;
|
|
146264
|
+
}
|
|
146265
|
+
const children = indexEntries.filter((item) => "parent" in item && item.parent === entry.id);
|
|
146266
|
+
return children.some((child) => filterFunctions.every((fn4) => fn4({ ...child, statuses })));
|
|
146263
146267
|
});
|
|
146264
146268
|
const { sidebar = {} } = provider.getConfig();
|
|
146265
146269
|
const { showRoots, collapsedRoots = [], renderLabel } = sidebar;
|
|
@@ -146282,7 +146286,7 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input2, { provide
|
|
|
146282
146286
|
throw new Error(
|
|
146283
146287
|
dedent`
|
|
146284
146288
|
Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}'
|
|
146285
|
-
|
|
146289
|
+
|
|
146286
146290
|
Did you create a path that uses the separator char accidentally, such as 'Vue <docs/>' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128
|
|
146287
146291
|
`
|
|
146288
146292
|
);
|
|
@@ -146333,36 +146337,60 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input2, { provide
|
|
|
146333
146337
|
}
|
|
146334
146338
|
});
|
|
146335
146339
|
acc[item.id] = {
|
|
146336
|
-
type: "story",
|
|
146337
146340
|
tags: [],
|
|
146338
146341
|
...item,
|
|
146339
146342
|
depth: paths.length,
|
|
146340
|
-
parent: paths[paths.length - 1],
|
|
146343
|
+
parent: "parent" in item ? item.parent : paths[paths.length - 1],
|
|
146341
146344
|
renderLabel,
|
|
146342
146345
|
prepared: !!item.parameters
|
|
146343
146346
|
};
|
|
146344
146347
|
return acc;
|
|
146345
146348
|
}, {});
|
|
146346
146349
|
function addItem(acc, item) {
|
|
146347
|
-
if (acc[item.id]) {
|
|
146348
|
-
|
|
146349
|
-
|
|
146350
|
-
|
|
146351
|
-
|
|
146352
|
-
|
|
146353
|
-
|
|
146354
|
-
|
|
146355
|
-
return currentTags === null ? child.tags : intersect_default(currentTags, child.tags);
|
|
146356
|
-
}, null);
|
|
146350
|
+
if (!acc[item.id]) {
|
|
146351
|
+
acc[item.id] = item;
|
|
146352
|
+
if ("children" in item && item.children) {
|
|
146353
|
+
item.children.forEach((childId) => addItem(acc, storiesHashOutOfOrder[childId]));
|
|
146354
|
+
item.tags = item.children.reduce((currentTags, childId) => {
|
|
146355
|
+
return currentTags === null ? acc[childId].tags : intersect_default(currentTags, acc[childId].tags);
|
|
146356
|
+
}, null) || [];
|
|
146357
|
+
}
|
|
146357
146358
|
}
|
|
146358
146359
|
if (item.type === "component") {
|
|
146359
|
-
|
|
146360
|
+
const firstChild = acc[item.children[0]];
|
|
146361
|
+
if (firstChild && "importPath" in firstChild) {
|
|
146362
|
+
item.importPath = firstChild.importPath;
|
|
146363
|
+
}
|
|
146360
146364
|
}
|
|
146361
146365
|
return acc;
|
|
146362
146366
|
}
|
|
146363
146367
|
__name(addItem, "addItem");
|
|
146364
|
-
|
|
146365
|
-
|
|
146368
|
+
let storiesHash = Object.values(storiesHashOutOfOrder).filter((i2) => i2.type !== "root" && !i2.parent).reduce((acc, item) => addItem(acc, item), {});
|
|
146369
|
+
storiesHash = Object.values(storiesHashOutOfOrder).filter((i2) => i2.type === "root").reduce(addItem, storiesHash);
|
|
146370
|
+
storiesHash = Object.values(storiesHash).reduce((acc, item) => {
|
|
146371
|
+
if (item.type === "story" && item.subtype === "test") {
|
|
146372
|
+
const story = acc[item.parent];
|
|
146373
|
+
const component = acc[story.parent];
|
|
146374
|
+
acc[component.id] = {
|
|
146375
|
+
...component,
|
|
146376
|
+
// Remove test from the component node as it will be attached to the story node instead
|
|
146377
|
+
children: component.children && component.children.filter((id) => id !== item.id)
|
|
146378
|
+
};
|
|
146379
|
+
acc[story.id] = {
|
|
146380
|
+
...story,
|
|
146381
|
+
// Add test to the story node
|
|
146382
|
+
children: (story.children || []).concat(item.id)
|
|
146383
|
+
};
|
|
146384
|
+
acc[item.id] = {
|
|
146385
|
+
...item,
|
|
146386
|
+
depth: item.depth + 1
|
|
146387
|
+
};
|
|
146388
|
+
} else {
|
|
146389
|
+
acc[item.id] = item;
|
|
146390
|
+
}
|
|
146391
|
+
return acc;
|
|
146392
|
+
}, {});
|
|
146393
|
+
return storiesHash;
|
|
146366
146394
|
}, "transformStoryIndexToStoriesHash");
|
|
146367
146395
|
var addPreparedStories = /* @__PURE__ */ __name((newHash, oldHash) => {
|
|
146368
146396
|
if (!oldHash) {
|
|
@@ -146372,6 +146400,9 @@ var addPreparedStories = /* @__PURE__ */ __name((newHash, oldHash) => {
|
|
|
146372
146400
|
Object.entries(newHash).map(([id, newEntry]) => {
|
|
146373
146401
|
const oldEntry = oldHash[id];
|
|
146374
146402
|
if (newEntry.type === "story" && oldEntry?.type === "story" && oldEntry.prepared) {
|
|
146403
|
+
if ("children" in oldEntry) {
|
|
146404
|
+
delete oldEntry.children;
|
|
146405
|
+
}
|
|
146375
146406
|
return [id, { ...oldEntry, ...newEntry, prepared: true }];
|
|
146376
146407
|
}
|
|
146377
146408
|
return [id, newEntry];
|
|
@@ -146978,6 +147009,13 @@ var init6 = /* @__PURE__ */ __name(({ store: store2, provider, singleStory }) =>
|
|
|
146978
147009
|
}
|
|
146979
147010
|
return showToolbar;
|
|
146980
147011
|
},
|
|
147012
|
+
getShowPanelWithCustomisations(showPanel) {
|
|
147013
|
+
const state3 = store2.getState();
|
|
147014
|
+
if (isFunction5(state3.layoutCustomisations.showPanel)) {
|
|
147015
|
+
return state3.layoutCustomisations.showPanel(state3, showPanel) ?? showPanel;
|
|
147016
|
+
}
|
|
147017
|
+
return showPanel;
|
|
147018
|
+
},
|
|
146981
147019
|
getNavSizeWithCustomisations(navSize) {
|
|
146982
147020
|
const state3 = store2.getState();
|
|
146983
147021
|
if (isFunction5(state3.layoutCustomisations.showSidebar)) {
|
|
@@ -147973,8 +148011,9 @@ var init12 = /* @__PURE__ */ __name(({
|
|
|
147973
148011
|
}
|
|
147974
148012
|
if (node2.type === "story") {
|
|
147975
148013
|
results.push(node2.id);
|
|
147976
|
-
}
|
|
147977
|
-
|
|
148014
|
+
}
|
|
148015
|
+
if ("children" in node2) {
|
|
148016
|
+
node2.children?.forEach((childId) => findChildEntriesRecursively(childId, results));
|
|
147978
148017
|
}
|
|
147979
148018
|
return results;
|
|
147980
148019
|
}, "findChildEntriesRecursively");
|
|
@@ -148489,7 +148528,7 @@ var import_memoizerific10 = __toESM(require_memoizerific(), 1);
|
|
|
148489
148528
|
var import_semver = __toESM(require_semver2(), 1);
|
|
148490
148529
|
|
|
148491
148530
|
// src/manager-api/version.ts
|
|
148492
|
-
var version = "10.0.0-beta.
|
|
148531
|
+
var version = "10.0.0-beta.7";
|
|
148493
148532
|
|
|
148494
148533
|
// src/manager-api/modules/versions.ts
|
|
148495
148534
|
var { VERSIONCHECK } = scope;
|