storybook 9.0.0-alpha.2 → 9.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/docs/addon-backgrounds.gif +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/highlight.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/server/base-preview-head.html +1 -3
- package/bin/index.cjs +2 -2
- package/dist/actions/decorator.d.ts +6 -0
- package/dist/actions/decorator.js +134 -0
- package/dist/actions/index.cjs +123 -0
- package/dist/actions/index.d.ts +102 -0
- package/dist/actions/index.js +108 -0
- package/dist/actions/preview.cjs +161 -0
- package/dist/actions/preview.d.ts +54 -0
- package/dist/actions/preview.js +152 -0
- package/dist/babel/index.cjs +822 -816
- package/dist/babel/index.js +822 -816
- package/dist/backgrounds/index.cjs +148 -0
- package/dist/backgrounds/index.d.ts +91 -0
- package/dist/backgrounds/index.js +130 -0
- package/dist/backgrounds/preview.cjs +143 -0
- package/dist/backgrounds/preview.d.ts +54 -0
- package/dist/backgrounds/preview.js +127 -0
- package/dist/bin/index.cjs +49 -70
- package/dist/bin/index.js +49 -70
- package/dist/builder-manager/index.cjs +319 -326
- package/dist/builder-manager/index.js +576 -583
- package/dist/channels/index.cjs +1026 -981
- package/dist/channels/index.js +1258 -1207
- package/dist/cli/bin/index.cjs +483 -483
- package/dist/cli/bin/index.js +495 -495
- package/dist/cli/index.cjs +61735 -7590
- package/dist/cli/index.d.ts +25 -21
- package/dist/cli/index.js +61776 -7631
- package/dist/client-logger/index.cjs +56 -88
- package/dist/client-logger/index.js +41 -47
- package/dist/common/index.cjs +16137 -9085
- package/dist/common/index.d.ts +35 -30
- package/dist/common/index.js +16230 -9172
- package/dist/component-testing/index.cjs +23 -0
- package/dist/component-testing/index.d.ts +3 -0
- package/dist/component-testing/index.js +5 -0
- package/dist/component-testing/preview.cjs +40 -0
- package/dist/component-testing/preview.d.ts +5 -0
- package/dist/component-testing/preview.js +25 -0
- package/dist/components/index.cjs +16268 -24926
- package/dist/components/index.d.ts +98 -347
- package/dist/components/index.js +5905 -19177
- package/dist/controls/decorator.d.ts +5 -0
- package/dist/controls/decorator.js +8 -0
- package/dist/controls/index.cjs +26 -0
- package/dist/controls/index.d.ts +39 -0
- package/dist/controls/index.js +6 -0
- package/dist/controls/preview.cjs +26 -0
- package/dist/controls/preview.d.ts +54 -0
- package/dist/controls/preview.js +9 -0
- package/dist/core-events/index.cjs +91 -106
- package/dist/core-events/index.d.ts +139 -104
- package/dist/core-events/index.js +79 -94
- package/dist/core-server/index.cjs +13898 -13409
- package/dist/core-server/index.d.ts +270 -3
- package/dist/core-server/index.js +13981 -13497
- package/dist/core-server/presets/common-manager.css +170 -0
- package/dist/core-server/presets/common-manager.js +12149 -17
- package/dist/core-server/presets/common-preset.cjs +3009 -3155
- package/dist/core-server/presets/common-preset.js +2862 -3009
- package/dist/csf/index.cjs +76 -120
- package/dist/csf/index.d.ts +2 -6
- package/dist/csf/index.js +69 -113
- package/dist/csf-tools/index.cjs +412 -403
- package/dist/csf-tools/index.d.ts +0 -4
- package/dist/csf-tools/index.js +410 -401
- package/dist/docs-tools/index.cjs +2569 -575
- package/dist/docs-tools/index.d.ts +2 -2
- package/dist/docs-tools/index.js +2565 -564
- package/dist/highlight/index.cjs +27 -0
- package/dist/highlight/index.d.ts +61 -0
- package/dist/highlight/index.js +7 -0
- package/dist/highlight/preview.cjs +535 -0
- package/dist/highlight/preview.d.ts +54 -0
- package/dist/highlight/preview.js +519 -0
- package/dist/instrumenter/index.cjs +2207 -2342
- package/dist/instrumenter/index.d.ts +8 -7
- package/dist/instrumenter/index.js +2430 -2603
- package/dist/manager/globals-module-info.cjs +291 -151
- package/dist/manager/globals-module-info.d.ts +1 -1
- package/dist/manager/globals-module-info.js +275 -135
- package/dist/manager/globals-runtime.js +60263 -28383
- package/dist/manager/globals.cjs +23 -19
- package/dist/manager/globals.d.ts +8 -5
- package/dist/manager/globals.js +10 -6
- package/dist/manager/runtime.js +4625 -3921
- package/dist/manager-api/index.cjs +4228 -3833
- package/dist/manager-api/index.d.ts +398 -102
- package/dist/manager-api/index.js +3500 -3084
- package/dist/manager-errors.d.ts +25 -1
- package/dist/manager-errors.js +50 -30
- package/dist/measure/index.cjs +476 -0
- package/dist/measure/index.d.ts +66 -0
- package/dist/measure/index.js +464 -0
- package/dist/measure/preview.cjs +466 -0
- package/dist/measure/preview.d.ts +59 -0
- package/dist/measure/preview.js +450 -0
- package/dist/outline/index.cjs +528 -0
- package/dist/outline/index.d.ts +66 -0
- package/dist/outline/index.js +500 -0
- package/dist/outline/preview.cjs +518 -0
- package/dist/outline/preview.d.ts +59 -0
- package/dist/outline/preview.js +486 -0
- package/dist/preview/globals.cjs +21 -17
- package/dist/preview/globals.d.ts +4 -1
- package/dist/preview/globals.js +6 -2
- package/dist/preview/runtime.js +46311 -6614
- package/dist/preview-api/index.cjs +1363 -1899
- package/dist/preview-api/index.d.ts +81 -395
- package/dist/preview-api/index.js +1711 -2169
- package/dist/preview-errors.cjs +119 -88
- package/dist/preview-errors.d.ts +30 -2
- package/dist/preview-errors.js +192 -142
- package/dist/router/index.cjs +847 -871
- package/dist/router/index.js +193 -199
- package/dist/server-errors.cjs +188 -124
- package/dist/server-errors.d.ts +36 -2
- package/dist/server-errors.js +188 -124
- package/dist/telemetry/index.cjs +1056 -1979
- package/dist/telemetry/index.d.ts +26 -5
- package/dist/telemetry/index.js +1091 -2010
- package/dist/test/index.cjs +35686 -0
- package/dist/test/index.d.ts +186 -0
- package/dist/test/index.js +33840 -0
- package/dist/test/preview.cjs +15870 -0
- package/dist/test/preview.d.ts +48 -0
- package/dist/test/preview.js +14501 -0
- package/dist/test/spy.cjs +258 -0
- package/dist/test/spy.d.ts +66 -0
- package/dist/test/spy.js +240 -0
- package/dist/theming/create.cjs +79 -2269
- package/dist/theming/create.js +67 -841
- package/dist/theming/index.cjs +1065 -3232
- package/dist/theming/index.js +951 -1719
- package/dist/types/index.cjs +11 -12
- package/dist/types/index.d.ts +684 -163
- package/dist/types/index.js +1 -2
- package/dist/viewport/index.cjs +310 -0
- package/dist/viewport/index.d.ts +320 -0
- package/dist/viewport/index.js +290 -0
- package/dist/viewport/preview.cjs +35 -0
- package/dist/viewport/preview.d.ts +68 -0
- package/dist/viewport/preview.js +19 -0
- package/package.json +359 -12
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var y = Object.defineProperty;
|
|
3
|
+
var C = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var W = Object.getOwnPropertyNames;
|
|
5
|
+
var M = Object.prototype.hasOwnProperty;
|
|
6
|
+
var i = (e, t) => y(e, "name", { value: t, configurable: !0 });
|
|
7
|
+
var l = (e, t) => {
|
|
8
|
+
for (var o in t)
|
|
9
|
+
y(e, o, { get: t[o], enumerable: !0 });
|
|
10
|
+
}, L = (e, t, o, r) => {
|
|
11
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
12
|
+
for (let n of W(t))
|
|
13
|
+
!M.call(e, n) && n !== o && y(e, n, { get: () => t[n], enumerable: !(r = C(t, n)) || r.enumerable });
|
|
14
|
+
return e;
|
|
15
|
+
};
|
|
16
|
+
var V = (e) => L(y({}, "__esModule", { value: !0 }), e);
|
|
17
|
+
|
|
18
|
+
// src/actions/preview.ts
|
|
19
|
+
var U = {};
|
|
20
|
+
l(U, {
|
|
21
|
+
default: () => H
|
|
22
|
+
});
|
|
23
|
+
module.exports = V(U);
|
|
24
|
+
var P = require("storybook/preview-api");
|
|
25
|
+
|
|
26
|
+
// src/actions/addArgs.ts
|
|
27
|
+
var A = {};
|
|
28
|
+
l(A, {
|
|
29
|
+
argsEnhancers: () => B
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// src/actions/runtime/action.ts
|
|
33
|
+
var O = require("storybook/internal/preview-errors"), u = require("@storybook/global"), v = require("storybook/preview-api"), w = require("uuid");
|
|
34
|
+
|
|
35
|
+
// src/actions/constants.ts
|
|
36
|
+
var f = "storybook/actions", J = `${f}/panel`, E = `${f}/action-event`, Q = `${f}/action-clear`;
|
|
37
|
+
|
|
38
|
+
// src/actions/runtime/configureActions.ts
|
|
39
|
+
var R = {
|
|
40
|
+
depth: 10,
|
|
41
|
+
clearOnStoryChange: !0,
|
|
42
|
+
limit: 50
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/actions/runtime/action.ts
|
|
46
|
+
var T = /* @__PURE__ */ i((e, t) => {
|
|
47
|
+
let o = Object.getPrototypeOf(e);
|
|
48
|
+
return !o || t(o) ? o : T(o, t);
|
|
49
|
+
}, "findProto"), N = /* @__PURE__ */ i((e) => !!(typeof e == "object" && e && T(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
|
|
50
|
+
typeof e.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ i((e) => {
|
|
51
|
+
if (N(e)) {
|
|
52
|
+
let t = Object.create(
|
|
53
|
+
e.constructor.prototype,
|
|
54
|
+
Object.getOwnPropertyDescriptors(e)
|
|
55
|
+
);
|
|
56
|
+
t.persist();
|
|
57
|
+
let o = Object.getOwnPropertyDescriptor(t, "view"), r = o?.value;
|
|
58
|
+
return typeof r == "object" && r?.constructor.name === "Window" && Object.defineProperty(t, "view", {
|
|
59
|
+
...o,
|
|
60
|
+
value: Object.create(r.constructor.prototype)
|
|
61
|
+
}), t;
|
|
62
|
+
}
|
|
63
|
+
return e;
|
|
64
|
+
}, "serializeArg"), $ = /* @__PURE__ */ i(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? (0, w.v4)() : (
|
|
65
|
+
// pseudo random id, example response lo1e7zm4832bkr7yfl7
|
|
66
|
+
Date.now().toString(36) + Math.random().toString(36).substring(2)
|
|
67
|
+
), "generateId");
|
|
68
|
+
function g(e, t = {}) {
|
|
69
|
+
let o = {
|
|
70
|
+
...R,
|
|
71
|
+
...t
|
|
72
|
+
}, r = /* @__PURE__ */ i(function(...s) {
|
|
73
|
+
if (t.implicit) {
|
|
74
|
+
let x = ("__STORYBOOK_PREVIEW__" in u.global ? u.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
|
|
75
|
+
(d) => d.phase === "playing" || d.phase === "rendering"
|
|
76
|
+
);
|
|
77
|
+
if (x) {
|
|
78
|
+
let d = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, b = new O.ImplicitActionsDuringRendering({
|
|
79
|
+
phase: x.phase,
|
|
80
|
+
name: e,
|
|
81
|
+
deprecated: d
|
|
82
|
+
});
|
|
83
|
+
if (d)
|
|
84
|
+
console.warn(b);
|
|
85
|
+
else
|
|
86
|
+
throw b;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
let a = v.addons.getChannel(), c = $(), p = 5, m = s.map(Y), S = s.length > 1 ? m : m[0], F = {
|
|
90
|
+
id: c,
|
|
91
|
+
count: 0,
|
|
92
|
+
data: { name: e, args: S },
|
|
93
|
+
options: {
|
|
94
|
+
...o,
|
|
95
|
+
maxDepth: p + (o.depth || 3)
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
a.emit(E, F);
|
|
99
|
+
}, "actionHandler");
|
|
100
|
+
return r.isAction = !0, r.implicit = t.implicit, r;
|
|
101
|
+
}
|
|
102
|
+
i(g, "action");
|
|
103
|
+
|
|
104
|
+
// src/actions/addArgsHelpers.ts
|
|
105
|
+
var _ = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), D = /* @__PURE__ */ i((e) => {
|
|
106
|
+
let {
|
|
107
|
+
initialArgs: t,
|
|
108
|
+
argTypes: o,
|
|
109
|
+
id: r,
|
|
110
|
+
parameters: { actions: n }
|
|
111
|
+
} = e;
|
|
112
|
+
if (!n || n.disable || !n.argTypesRegex || !o)
|
|
113
|
+
return {};
|
|
114
|
+
let s = new RegExp(n.argTypesRegex);
|
|
115
|
+
return Object.entries(o).filter(
|
|
116
|
+
([c]) => !!s.test(c)
|
|
117
|
+
).reduce((c, [p, m]) => (_(p, t) && (c[p] = g(p, { implicit: !0, id: r })), c), {});
|
|
118
|
+
}, "inferActionsFromArgTypesRegex"), k = /* @__PURE__ */ i((e) => {
|
|
119
|
+
let {
|
|
120
|
+
initialArgs: t,
|
|
121
|
+
argTypes: o,
|
|
122
|
+
parameters: { actions: r }
|
|
123
|
+
} = e;
|
|
124
|
+
return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (_(a, t) && (s[a] = g(typeof c.action ==
|
|
125
|
+
"string" ? c.action : a)), s), {});
|
|
126
|
+
}, "addActionsFromArgTypes");
|
|
127
|
+
|
|
128
|
+
// src/actions/addArgs.ts
|
|
129
|
+
var B = [
|
|
130
|
+
k,
|
|
131
|
+
D
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
// src/actions/loaders.ts
|
|
135
|
+
var h = {};
|
|
136
|
+
l(h, {
|
|
137
|
+
loaders: () => z
|
|
138
|
+
});
|
|
139
|
+
var j = require("storybook/test/spy");
|
|
140
|
+
var I = !1, K = /* @__PURE__ */ i((e) => {
|
|
141
|
+
let { parameters: t } = e;
|
|
142
|
+
t?.actions?.disable || I || ((0, j.onMockCall)((o, r) => {
|
|
143
|
+
let n = o.getMockName();
|
|
144
|
+
n !== "spy" && (!/^next\/.*::/.test(n) || [
|
|
145
|
+
"next/router::useRouter()",
|
|
146
|
+
"next/navigation::useRouter()",
|
|
147
|
+
"next/navigation::redirect",
|
|
148
|
+
"next/cache::",
|
|
149
|
+
"next/headers::cookies().set",
|
|
150
|
+
"next/headers::cookies().delete",
|
|
151
|
+
"next/headers::headers().set",
|
|
152
|
+
"next/headers::headers().delete"
|
|
153
|
+
].some((s) => n.startsWith(s))) && g(n)(r);
|
|
154
|
+
}), I = !0);
|
|
155
|
+
}, "logActionsWhenMockCalled"), z = [K];
|
|
156
|
+
|
|
157
|
+
// src/actions/preview.ts
|
|
158
|
+
var H = /* @__PURE__ */ i(() => (0, P.definePreview)({
|
|
159
|
+
...A,
|
|
160
|
+
...h
|
|
161
|
+
}), "default");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Renderer as Renderer$1, ProjectAnnotations as ProjectAnnotations$1, StoryIdentifier, StoryContext, PartialStoryFn, LegacyStoryFn } from 'storybook/internal/csf';
|
|
2
|
+
import { NormalizedProjectAnnotations, ProjectAnnotations as ProjectAnnotations$2, ComposedStoryFn } from 'storybook/internal/types';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface SymbolConstructor {
|
|
6
|
+
readonly observable: symbol;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Renderer extends Renderer$1 {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
14
|
+
type TeardownRenderToCanvas = () => MaybePromise<void>;
|
|
15
|
+
type RenderToCanvas<TRenderer extends Renderer> = (context: RenderContext<TRenderer>, element: TRenderer['canvasElement']) => MaybePromise<void | TeardownRenderToCanvas>;
|
|
16
|
+
interface ProjectAnnotations<TRenderer extends Renderer> extends ProjectAnnotations$1<TRenderer> {
|
|
17
|
+
addons?: ProjectAnnotations<TRenderer>[];
|
|
18
|
+
testingLibraryRender?: (...args: never[]) => {
|
|
19
|
+
unmount: () => void;
|
|
20
|
+
};
|
|
21
|
+
renderToCanvas?: RenderToCanvas<TRenderer>;
|
|
22
|
+
}
|
|
23
|
+
declare type RenderContext<TRenderer extends Renderer = Renderer> = StoryIdentifier & {
|
|
24
|
+
showMain: () => void;
|
|
25
|
+
showError: (error: {
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
showException: (err: Error) => void;
|
|
30
|
+
forceRemount: boolean;
|
|
31
|
+
storyContext: StoryContext<TRenderer>;
|
|
32
|
+
storyFn: PartialStoryFn<TRenderer>;
|
|
33
|
+
unboundStoryFn: LegacyStoryFn<TRenderer>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
var globalProjectAnnotations: NormalizedProjectAnnotations<any>;
|
|
38
|
+
var defaultProjectAnnotations: ProjectAnnotations$2<any>;
|
|
39
|
+
}
|
|
40
|
+
type WrappedStoryRef = {
|
|
41
|
+
__pw_type: 'jsx' | 'importRef';
|
|
42
|
+
};
|
|
43
|
+
type UnwrappedJSXStoryRef = {
|
|
44
|
+
__pw_type: 'jsx';
|
|
45
|
+
type: UnwrappedImportStoryRef;
|
|
46
|
+
};
|
|
47
|
+
type UnwrappedImportStoryRef = ComposedStoryFn;
|
|
48
|
+
declare global {
|
|
49
|
+
function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise<UnwrappedJSXStoryRef | UnwrappedImportStoryRef>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare const _default: () => ProjectAnnotations<Renderer>;
|
|
53
|
+
|
|
54
|
+
export { _default as default };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var n = (t, e) => h(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
var x = (t, e) => {
|
|
4
|
+
for (var o in e)
|
|
5
|
+
h(t, o, { get: e[o], enumerable: !0 });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/actions/preview.ts
|
|
9
|
+
import { definePreview as N } from "storybook/preview-api";
|
|
10
|
+
|
|
11
|
+
// src/actions/addArgs.ts
|
|
12
|
+
var l = {};
|
|
13
|
+
x(l, {
|
|
14
|
+
argsEnhancers: () => W
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// src/actions/runtime/action.ts
|
|
18
|
+
import { ImplicitActionsDuringRendering as I } from "storybook/internal/preview-errors";
|
|
19
|
+
import { global as R } from "@storybook/global";
|
|
20
|
+
import { addons as j } from "storybook/preview-api";
|
|
21
|
+
import { v4 as P } from "uuid";
|
|
22
|
+
|
|
23
|
+
// src/actions/constants.ts
|
|
24
|
+
var m = "storybook/actions", B = `${m}/panel`, b = `${m}/action-event`, K = `${m}/action-clear`;
|
|
25
|
+
|
|
26
|
+
// src/actions/runtime/configureActions.ts
|
|
27
|
+
var E = {
|
|
28
|
+
depth: 10,
|
|
29
|
+
clearOnStoryChange: !0,
|
|
30
|
+
limit: 50
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/actions/runtime/action.ts
|
|
34
|
+
var O = /* @__PURE__ */ n((t, e) => {
|
|
35
|
+
let o = Object.getPrototypeOf(t);
|
|
36
|
+
return !o || e(o) ? o : O(o, e);
|
|
37
|
+
}, "findProto"), S = /* @__PURE__ */ n((t) => !!(typeof t == "object" && t && O(t, (e) => /^Synthetic(?:Base)?Event$/.test(e.constructor.name)) &&
|
|
38
|
+
typeof t.persist == "function"), "isReactSyntheticEvent"), F = /* @__PURE__ */ n((t) => {
|
|
39
|
+
if (S(t)) {
|
|
40
|
+
let e = Object.create(
|
|
41
|
+
t.constructor.prototype,
|
|
42
|
+
Object.getOwnPropertyDescriptors(t)
|
|
43
|
+
);
|
|
44
|
+
e.persist();
|
|
45
|
+
let o = Object.getOwnPropertyDescriptor(e, "view"), r = o?.value;
|
|
46
|
+
return typeof r == "object" && r?.constructor.name === "Window" && Object.defineProperty(e, "view", {
|
|
47
|
+
...o,
|
|
48
|
+
value: Object.create(r.constructor.prototype)
|
|
49
|
+
}), e;
|
|
50
|
+
}
|
|
51
|
+
return t;
|
|
52
|
+
}, "serializeArg"), C = /* @__PURE__ */ n(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? P() : (
|
|
53
|
+
// pseudo random id, example response lo1e7zm4832bkr7yfl7
|
|
54
|
+
Date.now().toString(36) + Math.random().toString(36).substring(2)
|
|
55
|
+
), "generateId");
|
|
56
|
+
function g(t, e = {}) {
|
|
57
|
+
let o = {
|
|
58
|
+
...E,
|
|
59
|
+
...e
|
|
60
|
+
}, r = /* @__PURE__ */ n(function(...s) {
|
|
61
|
+
if (e.implicit) {
|
|
62
|
+
let u = ("__STORYBOOK_PREVIEW__" in R ? R.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
|
|
63
|
+
(d) => d.phase === "playing" || d.phase === "rendering"
|
|
64
|
+
);
|
|
65
|
+
if (u) {
|
|
66
|
+
let d = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, A = new I({
|
|
67
|
+
phase: u.phase,
|
|
68
|
+
name: t,
|
|
69
|
+
deprecated: d
|
|
70
|
+
});
|
|
71
|
+
if (d)
|
|
72
|
+
console.warn(A);
|
|
73
|
+
else
|
|
74
|
+
throw A;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let a = j.getChannel(), c = C(), p = 5, y = s.map(F), D = s.length > 1 ? y : y[0], k = {
|
|
78
|
+
id: c,
|
|
79
|
+
count: 0,
|
|
80
|
+
data: { name: t, args: D },
|
|
81
|
+
options: {
|
|
82
|
+
...o,
|
|
83
|
+
maxDepth: p + (o.depth || 3)
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
a.emit(b, k);
|
|
87
|
+
}, "actionHandler");
|
|
88
|
+
return r.isAction = !0, r.implicit = e.implicit, r;
|
|
89
|
+
}
|
|
90
|
+
n(g, "action");
|
|
91
|
+
|
|
92
|
+
// src/actions/addArgsHelpers.ts
|
|
93
|
+
var v = /* @__PURE__ */ n((t, e) => typeof e[t] > "u" && !(t in e), "isInInitialArgs"), w = /* @__PURE__ */ n((t) => {
|
|
94
|
+
let {
|
|
95
|
+
initialArgs: e,
|
|
96
|
+
argTypes: o,
|
|
97
|
+
id: r,
|
|
98
|
+
parameters: { actions: i }
|
|
99
|
+
} = t;
|
|
100
|
+
if (!i || i.disable || !i.argTypesRegex || !o)
|
|
101
|
+
return {};
|
|
102
|
+
let s = new RegExp(i.argTypesRegex);
|
|
103
|
+
return Object.entries(o).filter(
|
|
104
|
+
([c]) => !!s.test(c)
|
|
105
|
+
).reduce((c, [p, y]) => (v(p, e) && (c[p] = g(p, { implicit: !0, id: r })), c), {});
|
|
106
|
+
}, "inferActionsFromArgTypesRegex"), T = /* @__PURE__ */ n((t) => {
|
|
107
|
+
let {
|
|
108
|
+
initialArgs: e,
|
|
109
|
+
argTypes: o,
|
|
110
|
+
parameters: { actions: r }
|
|
111
|
+
} = t;
|
|
112
|
+
return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (v(a, e) && (s[a] = g(typeof c.action ==
|
|
113
|
+
"string" ? c.action : a)), s), {});
|
|
114
|
+
}, "addActionsFromArgTypes");
|
|
115
|
+
|
|
116
|
+
// src/actions/addArgs.ts
|
|
117
|
+
var W = [
|
|
118
|
+
T,
|
|
119
|
+
w
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
// src/actions/loaders.ts
|
|
123
|
+
var f = {};
|
|
124
|
+
x(f, {
|
|
125
|
+
loaders: () => V
|
|
126
|
+
});
|
|
127
|
+
import { onMockCall as M } from "storybook/test/spy";
|
|
128
|
+
var _ = !1, L = /* @__PURE__ */ n((t) => {
|
|
129
|
+
let { parameters: e } = t;
|
|
130
|
+
e?.actions?.disable || _ || (M((o, r) => {
|
|
131
|
+
let i = o.getMockName();
|
|
132
|
+
i !== "spy" && (!/^next\/.*::/.test(i) || [
|
|
133
|
+
"next/router::useRouter()",
|
|
134
|
+
"next/navigation::useRouter()",
|
|
135
|
+
"next/navigation::redirect",
|
|
136
|
+
"next/cache::",
|
|
137
|
+
"next/headers::cookies().set",
|
|
138
|
+
"next/headers::cookies().delete",
|
|
139
|
+
"next/headers::headers().set",
|
|
140
|
+
"next/headers::headers().delete"
|
|
141
|
+
].some((s) => i.startsWith(s))) && g(i)(r);
|
|
142
|
+
}), _ = !0);
|
|
143
|
+
}, "logActionsWhenMockCalled"), V = [L];
|
|
144
|
+
|
|
145
|
+
// src/actions/preview.ts
|
|
146
|
+
var dt = /* @__PURE__ */ n(() => N({
|
|
147
|
+
...l,
|
|
148
|
+
...f
|
|
149
|
+
}), "default");
|
|
150
|
+
export {
|
|
151
|
+
dt as default
|
|
152
|
+
};
|