storybook 10.0.0-beta.0 → 10.0.0-beta.10
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/assets/server/openBrowser.applescript +94 -0
- package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
- package/dist/_browser-chunks/{WithTooltip-2E62HIBN.js → WithTooltip-SK46ZJ2J.js} +1 -1
- package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
- package/dist/_browser-chunks/{chunk-FWKO3E35.js → chunk-BOOOPFZF.js} +10 -3
- package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
- package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
- package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
- package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
- package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
- package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
- package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
- package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
- package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
- package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
- package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
- package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
- package/dist/_node-chunks/{builder-manager-OW6YGKXV.js → builder-manager-SJGIDEN6.js} +45 -155
- package/dist/_node-chunks/camelcase-VZHWABQV.js +18 -0
- package/dist/_node-chunks/{chunk-6JSVPEAU.js → chunk-6CZW7AGN.js} +7 -7
- package/dist/_node-chunks/{chunk-CD3IP6HA.js → chunk-6XT5OLNL.js} +12 -12
- package/dist/_node-chunks/{chunk-2H7LZ2SD.js → chunk-AHRH5RPR.js} +7 -7
- package/dist/_node-chunks/{chunk-5HLANIBM.js → chunk-AOH6ABSV.js} +7 -7
- package/dist/_node-chunks/chunk-C5V22GP7.js +79 -0
- package/dist/_node-chunks/{chunk-IBXERYDG.js → chunk-FIROF4DV.js} +7 -7
- package/dist/_node-chunks/{chunk-I3YCPGZJ.js → chunk-GUJVZUYI.js} +7 -7
- package/dist/_node-chunks/chunk-IHPLRRAR.js +4741 -0
- package/dist/_node-chunks/{chunk-7TISOZS6.js → chunk-JMXKCRWR.js} +30 -21
- package/dist/_node-chunks/{chunk-YWGNEBRO.js → chunk-JUMUXWEV.js} +162 -103
- package/dist/_node-chunks/{chunk-UIREEOC7.js → chunk-KGX33KXX.js} +7 -7
- package/dist/_node-chunks/{chunk-3QB3ZG6H.js → chunk-KLVABNEU.js} +7 -7
- package/dist/_node-chunks/{chunk-H5LTFJHQ.js → chunk-OL6DY6BT.js} +631 -752
- package/dist/_node-chunks/{chunk-X5GAZ3EW.js → chunk-ONJV3K2L.js} +399 -116
- package/dist/_node-chunks/{chunk-LKB7KRSV.js → chunk-PTHTD4RO.js} +223 -243
- package/dist/_node-chunks/{chunk-UHHZPSP7.js → chunk-QQ3Z5KGJ.js} +6 -6
- package/dist/_node-chunks/{chunk-MUD3GH3L.js → chunk-QRTDDTZJ.js} +9 -9
- package/dist/_node-chunks/chunk-R54K4KSM.js +1540 -0
- package/dist/_node-chunks/{chunk-IQAUGVYR.js → chunk-S2LZC6JK.js} +8 -8
- package/dist/_node-chunks/chunk-SFJFSPRT.js +62 -0
- package/dist/_node-chunks/{chunk-LH3BEEIR.js → chunk-SSN5PKIY.js} +6 -6
- package/dist/_node-chunks/{chunk-NOQITS3C.js → chunk-SXR2DITB.js} +7 -7
- package/dist/_node-chunks/{chunk-FWUE7SRE.js → chunk-TH5QVQRL.js} +7 -7
- package/dist/_node-chunks/chunk-U34NWAU2.js +18 -0
- package/dist/_node-chunks/{chunk-FBMMEEO4.js → chunk-UV3CZ3KS.js} +7 -7
- package/dist/_node-chunks/{chunk-NZGJJABJ.js → chunk-UVUGJDAI.js} +60 -102
- package/dist/_node-chunks/{chunk-GZUNYRFU.js → chunk-VOUNSD2E.js} +7 -7
- package/dist/_node-chunks/chunk-WFCPBKQJ.js +64656 -0
- package/dist/_node-chunks/{chunk-BFXER3XW.js → chunk-XHF3WWNP.js} +623 -750
- package/dist/_node-chunks/{chunk-ANEKBWDX.js → chunk-XU45KXNQ.js} +16 -25
- package/dist/_node-chunks/{camelcase-2K3EMR6G.js → chunk-YHO6XR7U.js} +9 -8
- package/dist/_node-chunks/{dist-465RSKRC.js → dist-IIC5PBL7.js} +9 -9
- package/dist/_node-chunks/{globby-LJ3MVB6M.js → globby-CJACC3HJ.js} +17 -13
- package/dist/_node-chunks/{lib-OW3DENXB.js → lib-ZY4TKSOR.js} +40 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-PYX2IFUO.js → mdx-N42X6CFJ-3XNW3DFO.js} +8 -8
- package/dist/_node-chunks/{p-limit-X4OG45RB.js → p-limit-R2OFT5HE.js} +76 -10
- package/dist/_node-chunks/{plugin-ALTIQMDE.js → plugin-5XD5R2KD.js} +10 -10
- package/dist/_node-chunks/{plugin-GE36R32R.js → plugin-WAWVQMVR.js} +10 -12
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-NLCAF7S6.js → webpack-inject-mocker-runtime-plugin-SCRGJLIS.js} +1307 -847
- package/dist/_node-chunks/{webpack-mock-plugin-BRYODMCC.js → webpack-mock-plugin-3VAXEGG2.js} +9 -11
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/index.js +11 -12
- package/dist/bin/core.js +638 -187
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.d.ts +62 -75
- package/dist/cli/index.js +66 -56
- package/dist/common/index.d.ts +3 -1
- package/dist/common/index.js +22 -22
- package/dist/components/index.d.ts +234 -2
- package/dist/components/index.js +74 -5741
- package/dist/core-events/index.d.ts +18 -2
- package/dist/core-events/index.js +7 -1
- package/dist/core-server/index.d.ts +540 -39
- package/dist/core-server/index.js +4647 -4182
- package/dist/core-server/presets/common-manager.js +1570 -1272
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +691 -38
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -11
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -12
- package/dist/csf/index.d.ts +9 -4
- package/dist/csf/index.js +50 -15
- package/dist/csf-tools/index.d.ts +47 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +4 -4
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +9233 -18113
- package/dist/manager/globals.d.ts +0 -4
- package/dist/manager/globals.js +1 -6
- package/dist/manager/runtime.js +13396 -11518
- package/dist/manager-api/index.d.ts +540 -32
- package/dist/manager-api/index.js +364 -90
- package/dist/manager-errors.d.ts +527 -0
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +1136 -662
- package/dist/preview/globals.js +1 -1
- package/dist/preview/runtime.js +12103 -21579
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +10 -10
- package/dist/preview-errors.d.ts +527 -0
- package/dist/router/index.d.ts +668 -10
- package/dist/router/index.js +2 -2
- package/dist/server-errors.d.ts +527 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +23 -25
- package/dist/test/index.js +1874 -4024
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js +6 -6
- package/dist/types/index.d.ts +553 -16
- package/dist/viewport/index.d.ts +36 -4
- package/dist/viewport/index.js +1 -1
- package/package.json +9 -46
- package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
- package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
- package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
- package/dist/_node-chunks/chunk-27W2Z6VL.js +0 -28502
- package/dist/_node-chunks/chunk-G46DWX7Z.js +0 -266
- package/dist/_node-chunks/chunk-GZZDIJIB.js +0 -80
- package/dist/_node-chunks/chunk-JDKH3XYB.js +0 -9845
- package/dist/_node-chunks/chunk-R7RKO2DC.js +0 -35783
- package/dist/_node-chunks/chunk-T23YQHYB.js +0 -62
- package/dist/_node-chunks/chunk-VKKLKNFC.js +0 -2377
- package/dist/_node-chunks/chunk-W6GKFQ7F.js +0 -87
- package/dist/_node-chunks/chunk-YUYBO6S7.js +0 -18
- package/dist/_node-chunks/default-browser-id-Z6WQ7DZA.js +0 -1719
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.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
|
rewriteSbMockImportCalls
|
|
14
|
-
} from "../../../../_node-chunks/chunk-
|
|
15
|
-
import "../../../../_node-chunks/chunk-
|
|
16
|
-
import "../../../../_node-chunks/chunk-R7RKO2DC.js";
|
|
17
|
-
import "../../../../_node-chunks/chunk-YWGNEBRO.js";
|
|
14
|
+
} from "../../../../_node-chunks/chunk-XU45KXNQ.js";
|
|
15
|
+
import "../../../../_node-chunks/chunk-AOH6ABSV.js";
|
|
18
16
|
import {
|
|
19
17
|
__name
|
|
20
|
-
} from "../../../../_node-chunks/chunk-
|
|
18
|
+
} from "../../../../_node-chunks/chunk-SSN5PKIY.js";
|
|
21
19
|
|
|
22
20
|
// src/core-server/presets/webpack/loaders/storybook-mock-transform-loader.ts
|
|
23
21
|
import { logger } from "storybook/internal/node-logger";
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.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-JMXKCRWR.js";
|
|
15
15
|
import {
|
|
16
16
|
babelParser
|
|
17
|
-
} from "../../../../_node-chunks/chunk-
|
|
18
|
-
import "../../../../_node-chunks/chunk-
|
|
19
|
-
import "../../../../_node-chunks/chunk-R7RKO2DC.js";
|
|
20
|
-
import "../../../../_node-chunks/chunk-YWGNEBRO.js";
|
|
17
|
+
} from "../../../../_node-chunks/chunk-XU45KXNQ.js";
|
|
18
|
+
import "../../../../_node-chunks/chunk-AOH6ABSV.js";
|
|
21
19
|
import {
|
|
22
20
|
__name
|
|
23
|
-
} from "../../../../_node-chunks/chunk-
|
|
21
|
+
} from "../../../../_node-chunks/chunk-SSN5PKIY.js";
|
|
24
22
|
|
|
25
23
|
// src/core-server/presets/webpack/loaders/webpack-automock-loader.ts
|
|
26
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,22 +7,23 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
composeConfigs,
|
|
9
9
|
composeStory,
|
|
10
|
+
mountDestructured,
|
|
10
11
|
normalizeArrays,
|
|
11
12
|
normalizeProjectAnnotations
|
|
12
|
-
} from "../_browser-chunks/chunk-
|
|
13
|
-
import "../_browser-chunks/chunk-
|
|
14
|
-
import "../_browser-chunks/chunk-T7RCAJIX.js";
|
|
13
|
+
} from "../_browser-chunks/chunk-PS3AOQI4.js";
|
|
14
|
+
import "../_browser-chunks/chunk-Y3M7TW6K.js";
|
|
15
15
|
import {
|
|
16
16
|
combineParameters
|
|
17
|
-
} from "../_browser-chunks/chunk-
|
|
18
|
-
import "../_browser-chunks/chunk-
|
|
17
|
+
} from "../_browser-chunks/chunk-6E2SHJSL.js";
|
|
18
|
+
import "../_browser-chunks/chunk-FA42P6MO.js";
|
|
19
19
|
import "../_browser-chunks/chunk-WKCVJYVJ.js";
|
|
20
20
|
import {
|
|
21
21
|
invariant
|
|
22
22
|
} from "../_browser-chunks/chunk-FUOHXXZT.js";
|
|
23
23
|
import "../_browser-chunks/chunk-F4Q6SGTB.js";
|
|
24
|
-
import "../_browser-chunks/chunk-
|
|
25
|
-
import "../_browser-chunks/chunk-
|
|
24
|
+
import "../_browser-chunks/chunk-LYCSRYYR.js";
|
|
25
|
+
import "../_browser-chunks/chunk-QK3L5AXO.js";
|
|
26
|
+
import "../_browser-chunks/chunk-JJZMHC3A.js";
|
|
26
27
|
import "../_browser-chunks/chunk-NVV6MIOE.js";
|
|
27
28
|
import {
|
|
28
29
|
dedent
|
|
@@ -230,6 +231,9 @@ var logActionsWhenMockCalled = /* @__PURE__ */ __name((context) => {
|
|
|
230
231
|
if (name === "spy") {
|
|
231
232
|
return;
|
|
232
233
|
}
|
|
234
|
+
if (name === "vi.fn()") {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
233
237
|
if (!/^next\/.*::/.test(name) || [
|
|
234
238
|
"next/router::useRouter()",
|
|
235
239
|
"next/navigation::useRouter()",
|
|
@@ -2328,7 +2332,10 @@ var enhanceContext = /* @__PURE__ */ __name(async (context) => {
|
|
|
2328
2332
|
if (clipboard) {
|
|
2329
2333
|
context.userEvent = instrument2(
|
|
2330
2334
|
{ userEvent: uninstrumentedUserEvent.setup() },
|
|
2331
|
-
{
|
|
2335
|
+
{
|
|
2336
|
+
intercept: true,
|
|
2337
|
+
getKeys: /* @__PURE__ */ __name((obj) => Object.keys(obj).filter((key) => key !== "eventWrapper"), "getKeys")
|
|
2338
|
+
}
|
|
2332
2339
|
).userEvent;
|
|
2333
2340
|
Object.defineProperty(globalThis.window.navigator, "clipboard", {
|
|
2334
2341
|
get: /* @__PURE__ */ __name(() => clipboard, "get"),
|
|
@@ -2428,9 +2435,6 @@ function defineMeta(input, preview) {
|
|
|
2428
2435
|
_tag: "Meta",
|
|
2429
2436
|
input,
|
|
2430
2437
|
preview,
|
|
2431
|
-
get composed() {
|
|
2432
|
-
throw new Error("Not implemented");
|
|
2433
|
-
},
|
|
2434
2438
|
// @ts-expect-error hard
|
|
2435
2439
|
story(story = {}) {
|
|
2436
2440
|
return defineStory(typeof story === "function" ? { render: story } : story, this);
|
|
@@ -2455,11 +2459,14 @@ function defineStory(input, meta) {
|
|
|
2455
2459
|
}
|
|
2456
2460
|
return composed;
|
|
2457
2461
|
}, "compose");
|
|
2462
|
+
const __children = [];
|
|
2458
2463
|
return {
|
|
2459
2464
|
_tag: "Story",
|
|
2460
2465
|
input,
|
|
2461
2466
|
meta,
|
|
2467
|
+
// @ts-expect-error this is a private property used only once in renderers/react/src/preview
|
|
2462
2468
|
__compose: compose,
|
|
2469
|
+
__children,
|
|
2463
2470
|
get composed() {
|
|
2464
2471
|
const composed2 = compose();
|
|
2465
2472
|
const { args, argTypes, parameters: parameters2, id, tags, globals, storyName: name } = composed2;
|
|
@@ -2469,16 +2476,34 @@ function defineStory(input, meta) {
|
|
|
2469
2476
|
return input.play ?? meta.input?.play ?? (async () => {
|
|
2470
2477
|
});
|
|
2471
2478
|
},
|
|
2472
|
-
|
|
2473
|
-
|
|
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
|
|
2474
2497
|
});
|
|
2498
|
+
__children.push(test);
|
|
2499
|
+
return test;
|
|
2475
2500
|
},
|
|
2476
2501
|
extend(input2) {
|
|
2477
2502
|
return defineStory(
|
|
2478
2503
|
{
|
|
2479
2504
|
...this.input,
|
|
2480
2505
|
...input2,
|
|
2481
|
-
args: { ...this.input.args, ...input2.args },
|
|
2506
|
+
args: { ...this.input.args || {}, ...input2.args },
|
|
2482
2507
|
argTypes: combineParameters(this.input.argTypes, input2.argTypes),
|
|
2483
2508
|
afterEach: [
|
|
2484
2509
|
...normalizeArrays(this.input?.afterEach ?? []),
|
|
@@ -2506,6 +2531,13 @@ function defineStory(input, meta) {
|
|
|
2506
2531
|
};
|
|
2507
2532
|
}
|
|
2508
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");
|
|
2509
2541
|
|
|
2510
2542
|
// src/csf/index.ts
|
|
2511
2543
|
var sanitize = /* @__PURE__ */ __name((string) => {
|
|
@@ -2519,6 +2551,7 @@ var sanitizeSafe = /* @__PURE__ */ __name((string, part) => {
|
|
|
2519
2551
|
return sanitized;
|
|
2520
2552
|
}, "sanitizeSafe");
|
|
2521
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");
|
|
2522
2555
|
var storyNameFromExport = /* @__PURE__ */ __name((key) => toStartCaseStr(key), "storyNameFromExport");
|
|
2523
2556
|
function matches(storyKey, arrayOrRegex) {
|
|
2524
2557
|
if (Array.isArray(arrayOrRegex)) {
|
|
@@ -2558,6 +2591,7 @@ export {
|
|
|
2558
2591
|
definePreview,
|
|
2559
2592
|
definePreviewAddon9 as definePreviewAddon,
|
|
2560
2593
|
getCoreAnnotations,
|
|
2594
|
+
getStoryChildren,
|
|
2561
2595
|
includeConditionalArg,
|
|
2562
2596
|
isExportStory,
|
|
2563
2597
|
isMeta,
|
|
@@ -2566,5 +2600,6 @@ export {
|
|
|
2566
2600
|
parseKind,
|
|
2567
2601
|
sanitize,
|
|
2568
2602
|
storyNameFromExport,
|
|
2569
|
-
toId
|
|
2603
|
+
toId,
|
|
2604
|
+
toTestId
|
|
2570
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 */
|
|
@@ -204,6 +216,40 @@ declare class ConfigFile {
|
|
|
204
216
|
setImport(importSpecifier: string[] | string | {
|
|
205
217
|
namespace: string;
|
|
206
218
|
} | null, fromImport: string): void;
|
|
219
|
+
_removeRequireImport(importSpecifier: string[] | string | {
|
|
220
|
+
namespace: string;
|
|
221
|
+
} | null, fromImport: string): void;
|
|
222
|
+
_removeImport(importSpecifier: string[] | string | {
|
|
223
|
+
namespace: string;
|
|
224
|
+
} | null, fromImport: string): void;
|
|
225
|
+
/**
|
|
226
|
+
* Remove import specifiers for a given import statement.
|
|
227
|
+
*
|
|
228
|
+
* Does not support removing type imports (yet)
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
*
|
|
232
|
+
* ```ts
|
|
233
|
+
* // import { foo } from 'bar';
|
|
234
|
+
* setImport(['foo'], 'bar');
|
|
235
|
+
*
|
|
236
|
+
* // import foo from 'bar';
|
|
237
|
+
* setImport('foo', 'bar');
|
|
238
|
+
*
|
|
239
|
+
* // import * as foo from 'bar';
|
|
240
|
+
* setImport({ namespace: 'foo' }, 'bar');
|
|
241
|
+
*
|
|
242
|
+
* // import 'bar';
|
|
243
|
+
* setImport(null, 'bar');
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* @param importSpecifiers - The import specifiers to remove. If a string is passed in, will only
|
|
247
|
+
* remove the default import. Otherwise, named imports matching the array will be removed.
|
|
248
|
+
* @param fromImport - The module to import from
|
|
249
|
+
*/
|
|
250
|
+
removeImport(importSpecifier: string[] | string | {
|
|
251
|
+
namespace: string;
|
|
252
|
+
} | null, fromImport: string): void;
|
|
207
253
|
}
|
|
208
254
|
declare const loadConfig: (code: string, fileName?: string) => ConfigFile;
|
|
209
255
|
declare const formatConfig: (config: ConfigFile) => string;
|
|
@@ -229,11 +275,6 @@ type TagsFilter = {
|
|
|
229
275
|
exclude: string[];
|
|
230
276
|
skip: string[];
|
|
231
277
|
};
|
|
232
|
-
/**
|
|
233
|
-
* TODO: the functionality in this file can be moved back to the vitest plugin itself It can use
|
|
234
|
-
* `storybook/internal/babel` for all it's babel needs, without duplicating babel embedding in our
|
|
235
|
-
* bundles.
|
|
236
|
-
*/
|
|
237
278
|
declare function vitestTransform({ code, fileName, configDir, stories, tagsFilter, previewLevelTags, }: {
|
|
238
279
|
code: string;
|
|
239
280
|
fileName: string;
|
|
@@ -243,4 +284,4 @@ declare function vitestTransform({ code, fileName, configDir, stories, tagsFilte
|
|
|
243
284
|
previewLevelTags: Tag[];
|
|
244
285
|
}): Promise<ReturnType<typeof formatCsf>>;
|
|
245
286
|
|
|
246
|
-
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_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.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-ONJV3K2L.js";
|
|
42
|
+
import "../_node-chunks/chunk-GUJVZUYI.js";
|
|
43
|
+
import "../_node-chunks/chunk-SSN5PKIY.js";
|
|
44
44
|
export {
|
|
45
45
|
BadMetaError,
|
|
46
46
|
ConfigFile,
|
package/dist/docs-tools/index.js
CHANGED
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
normalizeNewlines,
|
|
25
25
|
parseJsDoc,
|
|
26
26
|
str
|
|
27
|
-
} from "../_browser-chunks/chunk-
|
|
28
|
-
import "../_browser-chunks/chunk-
|
|
27
|
+
} from "../_browser-chunks/chunk-6E2SHJSL.js";
|
|
28
|
+
import "../_browser-chunks/chunk-FA42P6MO.js";
|
|
29
29
|
import "../_browser-chunks/chunk-WKCVJYVJ.js";
|
|
30
|
-
import "../_browser-chunks/chunk-
|
|
31
|
-
import "../_browser-chunks/chunk-
|
|
30
|
+
import "../_browser-chunks/chunk-QK3L5AXO.js";
|
|
31
|
+
import "../_browser-chunks/chunk-JJZMHC3A.js";
|
|
32
32
|
import "../_browser-chunks/chunk-MM7DTO55.js";
|
|
33
33
|
export {
|
|
34
34
|
ADDON_ID,
|