storybook 9.0.0-alpha.12 → 9.0.0-alpha.13
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/docs/addon-backgrounds.gif +0 -0
- package/assets/docs/highlight.png +0 -0
- 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 +63 -71
- package/dist/bin/index.js +53 -61
- package/dist/builder-manager/index.cjs +390 -380
- package/dist/builder-manager/index.js +489 -479
- package/dist/cli/bin/index.cjs +225 -225
- package/dist/cli/bin/index.js +234 -234
- package/dist/cli/index.cjs +0 -2
- package/dist/cli/index.js +0 -2
- package/dist/common/index.cjs +2399 -2378
- package/dist/common/index.d.ts +0 -8
- package/dist/common/index.js +2607 -2586
- package/dist/components/index.cjs +3394 -3372
- package/dist/components/index.js +3922 -3900
- package/dist/core-events/index.cjs +72 -84
- package/dist/core-events/index.d.ts +2 -77
- package/dist/core-events/index.js +61 -73
- package/dist/core-server/index.cjs +5258 -5168
- package/dist/core-server/index.js +6539 -6449
- package/dist/core-server/presets/common-manager.js +9815 -12
- package/dist/core-server/presets/common-preset.cjs +2809 -3005
- package/dist/core-server/presets/common-preset.js +2891 -3087
- package/dist/docs-tools/index.cjs +626 -600
- package/dist/docs-tools/index.js +613 -587
- package/dist/highlight/index.cjs +27 -0
- package/dist/highlight/index.d.ts +17 -0
- package/dist/highlight/index.js +7 -0
- package/dist/highlight/preview.cjs +81 -0
- package/dist/highlight/preview.d.ts +54 -0
- package/dist/highlight/preview.js +67 -0
- package/dist/instrumenter/index.cjs +70 -60
- package/dist/instrumenter/index.d.ts +8 -7
- package/dist/instrumenter/index.js +98 -88
- package/dist/manager/globals-module-info.cjs +12 -22
- package/dist/manager/globals-module-info.js +2 -12
- package/dist/manager/globals-runtime.js +24173 -23140
- package/dist/manager/runtime.js +3419 -3522
- package/dist/manager-api/index.cjs +1055 -1167
- package/dist/manager-api/index.d.ts +7 -21
- package/dist/manager-api/index.js +761 -877
- package/dist/measure/index.cjs +474 -0
- package/dist/measure/index.d.ts +66 -0
- package/dist/measure/index.js +462 -0
- package/dist/measure/preview.cjs +464 -0
- package/dist/measure/preview.d.ts +59 -0
- package/dist/measure/preview.js +448 -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/runtime.js +14441 -13330
- package/dist/preview-api/index.cjs +1067 -1071
- package/dist/preview-api/index.d.ts +61 -102
- package/dist/preview-api/index.js +1090 -1092
- package/dist/test/index.cjs +1547 -1546
- package/dist/test/index.js +2308 -2307
- package/dist/test/preview.cjs +1906 -1905
- package/dist/test/preview.d.ts +0 -6
- package/dist/test/preview.js +1439 -1438
- package/dist/test/spy.cjs +65 -64
- package/dist/test/spy.js +59 -58
- package/dist/types/index.cjs +10 -10
- package/dist/types/index.d.ts +206 -243
- package/package.json +121 -16
- package/dist/actions/manager.js +0 -1195
- package/dist/component-testing/manager.js +0 -3126
- package/dist/controls/manager.js +0 -5593
- package/dist/viewport/manager.js +0 -400
- /package/dist/{component-testing/manager.css → core-server/presets/common-manager.css} +0 -0
package/dist/test/spy.cjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var v = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var L = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var Y = Object.getOwnPropertyNames;
|
|
5
|
+
var N = Object.prototype.hasOwnProperty;
|
|
6
6
|
var n = (t, e) => v(t, "name", { value: e, configurable: !0 });
|
|
7
|
-
var
|
|
7
|
+
var K = (t, e) => {
|
|
8
8
|
for (var r in e)
|
|
9
9
|
v(t, r, { get: e[r], enumerable: !0 });
|
|
10
|
-
},
|
|
10
|
+
}, B = (t, e, r, l) => {
|
|
11
11
|
if (e && typeof e == "object" || typeof e == "function")
|
|
12
|
-
for (let o of
|
|
13
|
-
!
|
|
12
|
+
for (let o of Y(e))
|
|
13
|
+
!N.call(t, o) && o !== r && v(t, o, { get: () => e[o], enumerable: !(l = L(e, o)) || l.enumerable });
|
|
14
14
|
return t;
|
|
15
15
|
};
|
|
16
|
-
var
|
|
16
|
+
var U = (t) => B(v({}, "__esModule", { value: !0 }), t);
|
|
17
17
|
|
|
18
18
|
// src/test/spy.ts
|
|
19
19
|
var oe = {};
|
|
20
|
-
|
|
20
|
+
K(oe, {
|
|
21
21
|
clearAllMocks: () => Z,
|
|
22
22
|
fn: () => X,
|
|
23
|
-
isMockFunction: () =>
|
|
23
|
+
isMockFunction: () => j,
|
|
24
24
|
mocked: () => ne,
|
|
25
|
-
mocks: () =>
|
|
25
|
+
mocks: () => h,
|
|
26
26
|
onMockCall: () => J,
|
|
27
27
|
resetAllMocks: () => ee,
|
|
28
28
|
restoreAllMocks: () => te,
|
|
29
29
|
spyOn: () => Q
|
|
30
30
|
});
|
|
31
|
-
module.exports =
|
|
31
|
+
module.exports = U(oe);
|
|
32
32
|
|
|
33
33
|
// ../node_modules/tinyspy/dist/index.js
|
|
34
34
|
function O(t, e) {
|
|
@@ -40,29 +40,29 @@ function g(t, e) {
|
|
|
40
40
|
return typeof e === t;
|
|
41
41
|
}
|
|
42
42
|
n(g, "y");
|
|
43
|
-
function
|
|
43
|
+
function W(t) {
|
|
44
44
|
return t instanceof Promise;
|
|
45
45
|
}
|
|
46
|
-
n(
|
|
47
|
-
function
|
|
46
|
+
n(W, "w");
|
|
47
|
+
function S(t, e, r) {
|
|
48
48
|
Object.defineProperty(t, e, r);
|
|
49
49
|
}
|
|
50
|
-
n(
|
|
50
|
+
n(S, "f");
|
|
51
51
|
function M(t, e, r) {
|
|
52
52
|
Object.defineProperty(t, e, { value: r });
|
|
53
53
|
}
|
|
54
54
|
n(M, "l");
|
|
55
|
-
var x = Symbol.for("tinyspy:spy"),
|
|
55
|
+
var x = Symbol.for("tinyspy:spy"), $ = /* @__PURE__ */ new Set(), q = /* @__PURE__ */ n((t) => {
|
|
56
56
|
t.called = !1, t.callCount = 0, t.calls = [], t.results = [], t.resolves = [], t.next = [];
|
|
57
|
-
}, "P"),
|
|
58
|
-
(t) => t[x] ||
|
|
57
|
+
}, "P"), z = /* @__PURE__ */ n((t) => (S(t, x, { value: { reset: /* @__PURE__ */ n(() => q(t[x]), "reset") } }), t[x]), "K"), T = /* @__PURE__ */ n(
|
|
58
|
+
(t) => t[x] || z(t), "T");
|
|
59
59
|
function G(t) {
|
|
60
60
|
O(
|
|
61
61
|
g("function", t) || g("undefined", t),
|
|
62
62
|
"cannot spy on a non-function value"
|
|
63
63
|
);
|
|
64
64
|
let e = /* @__PURE__ */ n(function(...l) {
|
|
65
|
-
let o =
|
|
65
|
+
let o = T(e);
|
|
66
66
|
o.called = !0, o.callCount++, o.calls.push(l);
|
|
67
67
|
let p = o.next.shift();
|
|
68
68
|
if (p) {
|
|
@@ -80,20 +80,20 @@ function G(t) {
|
|
|
80
80
|
throw c = i, y = "error", o.results.push([y, i]), i;
|
|
81
81
|
}
|
|
82
82
|
let m = [y, c];
|
|
83
|
-
return
|
|
83
|
+
return W(c) && c.then(
|
|
84
84
|
(i) => o.resolves[a] = ["ok", i],
|
|
85
85
|
(i) => o.resolves[a] = ["error", i]
|
|
86
86
|
), o.results.push(m), c;
|
|
87
87
|
}, "t");
|
|
88
88
|
M(e, "_isMockFunction", !0), M(e, "length", t ? t.length : 0), M(e, "name", t && t.name || "spy");
|
|
89
|
-
let r =
|
|
89
|
+
let r = T(e);
|
|
90
90
|
return r.reset(), r.impl = t, e;
|
|
91
91
|
}
|
|
92
92
|
n(G, "m");
|
|
93
|
-
var C = /* @__PURE__ */ n((t, e) => Object.getOwnPropertyDescriptor(t, e), "k"),
|
|
93
|
+
var C = /* @__PURE__ */ n((t, e) => Object.getOwnPropertyDescriptor(t, e), "k"), _ = /* @__PURE__ */ n((t, e) => {
|
|
94
94
|
e != null && typeof e == "function" && e.prototype != null && Object.setPrototypeOf(t.prototype, e.prototype);
|
|
95
95
|
}, "O");
|
|
96
|
-
function
|
|
96
|
+
function w(t, e, r) {
|
|
97
97
|
O(
|
|
98
98
|
!g("undefined", t),
|
|
99
99
|
"spyOn could not find an object to spy upon"
|
|
@@ -121,39 +121,39 @@ function R(t, e, r) {
|
|
|
121
121
|
let i;
|
|
122
122
|
a ? i = a[o] : o !== "value" ? i = /* @__PURE__ */ n(() => t[l], "o") : i = t[l];
|
|
123
123
|
let f = /* @__PURE__ */ n((k) => {
|
|
124
|
-
let { value:
|
|
124
|
+
let { value: R, ...d } = a || {
|
|
125
125
|
configurable: !0,
|
|
126
126
|
writable: !0
|
|
127
127
|
};
|
|
128
|
-
o !== "value" && delete d.writable, d[o] = k,
|
|
129
|
-
}, "g"),
|
|
128
|
+
o !== "value" && delete d.writable, d[o] = k, S(t, l, d);
|
|
129
|
+
}, "g"), b = /* @__PURE__ */ n(() => a ? S(t, l, a) : f(i), "b");
|
|
130
130
|
r || (r = i);
|
|
131
131
|
let s = G(r);
|
|
132
|
-
o === "value" &&
|
|
132
|
+
o === "value" && _(s, i);
|
|
133
133
|
let u = s[x];
|
|
134
|
-
return M(u, "restore",
|
|
135
|
-
m ? () => (
|
|
136
|
-
),
|
|
134
|
+
return M(u, "restore", b), M(u, "getOriginal", () => m ? i() : i), M(u, "willCall", (k) => (u.impl = k, s)), f(
|
|
135
|
+
m ? () => (_(s, r), s) : s
|
|
136
|
+
), $.add(s), s;
|
|
137
137
|
}
|
|
138
|
-
n(
|
|
138
|
+
n(w, "C");
|
|
139
139
|
|
|
140
140
|
// ../node_modules/@vitest/spy/dist/index.js
|
|
141
|
-
var
|
|
142
|
-
function
|
|
141
|
+
var h = /* @__PURE__ */ new Set();
|
|
142
|
+
function j(t) {
|
|
143
143
|
return typeof t == "function" && "_isMockFunction" in t && t._isMockFunction;
|
|
144
144
|
}
|
|
145
|
-
n(
|
|
146
|
-
function
|
|
145
|
+
n(j, "isMockFunction");
|
|
146
|
+
function A(t, e, r) {
|
|
147
147
|
let o = r ? { [{
|
|
148
148
|
get: "getter",
|
|
149
149
|
set: "setter"
|
|
150
|
-
}[r]]: e } : e, p =
|
|
151
|
-
return
|
|
150
|
+
}[r]]: e } : e, p = w(t, o);
|
|
151
|
+
return V(p);
|
|
152
152
|
}
|
|
153
|
-
n(
|
|
153
|
+
n(A, "spyOn");
|
|
154
154
|
var H = 0;
|
|
155
|
-
function
|
|
156
|
-
let e = t, r, l = [], o = [], p = [], c =
|
|
155
|
+
function V(t) {
|
|
156
|
+
let e = t, r, l = [], o = [], p = [], c = T(t), y = {
|
|
157
157
|
get calls() {
|
|
158
158
|
return c.calls;
|
|
159
159
|
},
|
|
@@ -185,26 +185,26 @@ function D(t) {
|
|
|
185
185
|
e.getMockName = () => f || "vi.fn()", e.mockName = (s) => (f = s, e), e.mockClear = () => (c.reset(), l = [], o = [], p = [], e), e.mockReset =
|
|
186
186
|
() => (e.mockClear(), r = void 0, a = [], e), e.mockRestore = () => (e.mockReset(), c.restore(), e), e.getMockImplementation = () => m ? r :
|
|
187
187
|
a.at(0) || r, e.mockImplementation = (s) => (r = s, c.willCall(i), e), e.mockImplementationOnce = (s) => (a.push(s), e);
|
|
188
|
-
function
|
|
188
|
+
function b(s, u) {
|
|
189
189
|
let k = r;
|
|
190
190
|
r = s, c.willCall(i), m = !0;
|
|
191
|
-
let
|
|
191
|
+
let R = /* @__PURE__ */ n(() => {
|
|
192
192
|
r = k, m = !1;
|
|
193
193
|
}, "reset"), d = u();
|
|
194
|
-
return d instanceof Promise ? d.then(() => (
|
|
194
|
+
return d instanceof Promise ? d.then(() => (R(), e)) : (R(), e);
|
|
195
195
|
}
|
|
196
|
-
return n(
|
|
196
|
+
return n(b, "withImplementation"), e.withImplementation = b, e.mockReturnThis = () => e.mockImplementation(function() {
|
|
197
197
|
return this;
|
|
198
198
|
}), e.mockReturnValue = (s) => e.mockImplementation(() => s), e.mockReturnValueOnce = (s) => e.mockImplementationOnce(() => s), e.mockResolvedValue =
|
|
199
199
|
(s) => e.mockImplementation(() => Promise.resolve(s)), e.mockResolvedValueOnce = (s) => e.mockImplementationOnce(() => Promise.resolve(s)),
|
|
200
200
|
e.mockRejectedValue = (s) => e.mockImplementation(() => Promise.reject(s)), e.mockRejectedValueOnce = (s) => e.mockImplementationOnce(() => Promise.
|
|
201
201
|
reject(s)), Object.defineProperty(e, "mock", {
|
|
202
202
|
get: /* @__PURE__ */ n(() => y, "get")
|
|
203
|
-
}), c.willCall(i),
|
|
203
|
+
}), c.willCall(i), h.add(e), e;
|
|
204
204
|
}
|
|
205
|
-
n(
|
|
205
|
+
n(V, "enhanceSpy");
|
|
206
206
|
function P(t) {
|
|
207
|
-
let e =
|
|
207
|
+
let e = V(w({
|
|
208
208
|
spy: t || function() {
|
|
209
209
|
}
|
|
210
210
|
}, "spy"));
|
|
@@ -213,42 +213,43 @@ function P(t) {
|
|
|
213
213
|
n(P, "fn");
|
|
214
214
|
|
|
215
215
|
// src/test/spy.ts
|
|
216
|
-
var
|
|
216
|
+
var I = globalThis.__STORYBOOK_TEST_SPY_LISTENERS__ || /* @__PURE__ */ new Set();
|
|
217
|
+
globalThis.__STORYBOOK_TEST_SPY_LISTENERS__ = I;
|
|
217
218
|
function J(t) {
|
|
218
|
-
return
|
|
219
|
+
return I.add(t), () => void I.delete(t);
|
|
219
220
|
}
|
|
220
221
|
n(J, "onMockCall");
|
|
221
222
|
var Q = /* @__PURE__ */ n((...t) => {
|
|
222
|
-
let e =
|
|
223
|
-
return
|
|
223
|
+
let e = A(...t);
|
|
224
|
+
return F(e);
|
|
224
225
|
}, "spyOn");
|
|
225
226
|
function X(t) {
|
|
226
227
|
let e = t ? P(t) : P();
|
|
227
|
-
return
|
|
228
|
+
return F(e);
|
|
228
229
|
}
|
|
229
230
|
n(X, "fn");
|
|
230
|
-
function L(t) {
|
|
231
|
-
let e = F(t), r = e.mockImplementation.bind(null);
|
|
232
|
-
return e.mockImplementation = (l) => F(r(l)), e;
|
|
233
|
-
}
|
|
234
|
-
n(L, "reactiveMock");
|
|
235
231
|
function F(t) {
|
|
236
|
-
let e =
|
|
232
|
+
let e = D(t), r = e.mockImplementation.bind(null);
|
|
233
|
+
return e.mockImplementation = (l) => D(r(l)), e;
|
|
234
|
+
}
|
|
235
|
+
n(F, "reactiveMock");
|
|
236
|
+
function D(t) {
|
|
237
|
+
let e = T(t), r = e.impl;
|
|
237
238
|
return e.willCall(function(...l) {
|
|
238
|
-
return
|
|
239
|
+
return I.forEach((o) => o(t, l)), r?.apply(this, l);
|
|
239
240
|
}), t;
|
|
240
241
|
}
|
|
241
|
-
n(
|
|
242
|
+
n(D, "listenWhenCalled");
|
|
242
243
|
function Z() {
|
|
243
|
-
|
|
244
|
+
h.forEach((t) => t.mockClear());
|
|
244
245
|
}
|
|
245
246
|
n(Z, "clearAllMocks");
|
|
246
247
|
function ee() {
|
|
247
|
-
|
|
248
|
+
h.forEach((t) => t.mockReset());
|
|
248
249
|
}
|
|
249
250
|
n(ee, "resetAllMocks");
|
|
250
251
|
function te() {
|
|
251
|
-
|
|
252
|
+
h.forEach((t) => t.mockRestore());
|
|
252
253
|
}
|
|
253
254
|
n(te, "restoreAllMocks");
|
|
254
255
|
function ne(t, e = {}) {
|
package/dist/test/spy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var n = (t, e) =>
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var n = (t, e) => D(t, "name", { value: e, configurable: !0 });
|
|
3
3
|
|
|
4
4
|
// ../node_modules/tinyspy/dist/index.js
|
|
5
5
|
function v(t, e) {
|
|
@@ -11,29 +11,29 @@ function g(t, e) {
|
|
|
11
11
|
return typeof e === t;
|
|
12
12
|
}
|
|
13
13
|
n(g, "y");
|
|
14
|
-
function
|
|
14
|
+
function F(t) {
|
|
15
15
|
return t instanceof Promise;
|
|
16
16
|
}
|
|
17
|
-
n(
|
|
18
|
-
function
|
|
17
|
+
n(F, "w");
|
|
18
|
+
function R(t, e, r) {
|
|
19
19
|
Object.defineProperty(t, e, r);
|
|
20
20
|
}
|
|
21
|
-
n(
|
|
21
|
+
n(R, "f");
|
|
22
22
|
function M(t, e, r) {
|
|
23
23
|
Object.defineProperty(t, e, { value: r });
|
|
24
24
|
}
|
|
25
25
|
n(M, "l");
|
|
26
|
-
var
|
|
26
|
+
var h = Symbol.for("tinyspy:spy"), L = /* @__PURE__ */ new Set(), Y = /* @__PURE__ */ n((t) => {
|
|
27
27
|
t.called = !1, t.callCount = 0, t.calls = [], t.results = [], t.resolves = [], t.next = [];
|
|
28
|
-
}, "P"),
|
|
29
|
-
(t) => t[
|
|
30
|
-
function
|
|
28
|
+
}, "P"), N = /* @__PURE__ */ n((t) => (R(t, h, { value: { reset: /* @__PURE__ */ n(() => Y(t[h]), "reset") } }), t[h]), "K"), T = /* @__PURE__ */ n(
|
|
29
|
+
(t) => t[h] || N(t), "T");
|
|
30
|
+
function K(t) {
|
|
31
31
|
v(
|
|
32
32
|
g("function", t) || g("undefined", t),
|
|
33
33
|
"cannot spy on a non-function value"
|
|
34
34
|
);
|
|
35
35
|
let e = /* @__PURE__ */ n(function(...l) {
|
|
36
|
-
let s =
|
|
36
|
+
let s = T(e);
|
|
37
37
|
s.called = !0, s.callCount++, s.calls.push(l);
|
|
38
38
|
let p = s.next.shift();
|
|
39
39
|
if (p) {
|
|
@@ -51,20 +51,20 @@ function U(t) {
|
|
|
51
51
|
throw c = i, y = "error", s.results.push([y, i]), i;
|
|
52
52
|
}
|
|
53
53
|
let m = [y, c];
|
|
54
|
-
return
|
|
54
|
+
return F(c) && c.then(
|
|
55
55
|
(i) => s.resolves[a] = ["ok", i],
|
|
56
56
|
(i) => s.resolves[a] = ["error", i]
|
|
57
57
|
), s.results.push(m), c;
|
|
58
58
|
}, "t");
|
|
59
59
|
M(e, "_isMockFunction", !0), M(e, "length", t ? t.length : 0), M(e, "name", t && t.name || "spy");
|
|
60
|
-
let r =
|
|
60
|
+
let r = T(e);
|
|
61
61
|
return r.reset(), r.impl = t, e;
|
|
62
62
|
}
|
|
63
|
-
n(
|
|
64
|
-
var
|
|
63
|
+
n(K, "m");
|
|
64
|
+
var P = /* @__PURE__ */ n((t, e) => Object.getOwnPropertyDescriptor(t, e), "k"), C = /* @__PURE__ */ n((t, e) => {
|
|
65
65
|
e != null && typeof e == "function" && e.prototype != null && Object.setPrototypeOf(t.prototype, e.prototype);
|
|
66
66
|
}, "O");
|
|
67
|
-
function
|
|
67
|
+
function S(t, e, r) {
|
|
68
68
|
v(
|
|
69
69
|
!g("undefined", t),
|
|
70
70
|
"spyOn could not find an object to spy upon"
|
|
@@ -82,7 +82,7 @@ function w(t, e, r) {
|
|
|
82
82
|
if ("setter" in e)
|
|
83
83
|
return [e.setter, "set"];
|
|
84
84
|
throw new Error("specify getter or setter to spy on");
|
|
85
|
-
})(), p =
|
|
85
|
+
})(), p = P(t, l), c = Object.getPrototypeOf(t), y = c && P(c, l), a = p || y;
|
|
86
86
|
v(
|
|
87
87
|
a || l in t,
|
|
88
88
|
`${String(l)} does not exist`
|
|
@@ -92,39 +92,39 @@ function w(t, e, r) {
|
|
|
92
92
|
let i;
|
|
93
93
|
a ? i = a[s] : s !== "value" ? i = /* @__PURE__ */ n(() => t[l], "o") : i = t[l];
|
|
94
94
|
let f = /* @__PURE__ */ n((k) => {
|
|
95
|
-
let { value:
|
|
95
|
+
let { value: b, ...d } = a || {
|
|
96
96
|
configurable: !0,
|
|
97
97
|
writable: !0
|
|
98
98
|
};
|
|
99
|
-
s !== "value" && delete d.writable, d[s] = k,
|
|
100
|
-
}, "g"),
|
|
99
|
+
s !== "value" && delete d.writable, d[s] = k, R(t, l, d);
|
|
100
|
+
}, "g"), I = /* @__PURE__ */ n(() => a ? R(t, l, a) : f(i), "b");
|
|
101
101
|
r || (r = i);
|
|
102
|
-
let o =
|
|
102
|
+
let o = K(r);
|
|
103
103
|
s === "value" && C(o, i);
|
|
104
|
-
let u = o[
|
|
105
|
-
return M(u, "restore",
|
|
104
|
+
let u = o[h];
|
|
105
|
+
return M(u, "restore", I), M(u, "getOriginal", () => m ? i() : i), M(u, "willCall", (k) => (u.impl = k, o)), f(
|
|
106
106
|
m ? () => (C(o, r), o) : o
|
|
107
|
-
),
|
|
107
|
+
), L.add(o), o;
|
|
108
108
|
}
|
|
109
|
-
n(
|
|
109
|
+
n(S, "C");
|
|
110
110
|
|
|
111
111
|
// ../node_modules/@vitest/spy/dist/index.js
|
|
112
112
|
var x = /* @__PURE__ */ new Set();
|
|
113
|
-
function
|
|
113
|
+
function B(t) {
|
|
114
114
|
return typeof t == "function" && "_isMockFunction" in t && t._isMockFunction;
|
|
115
115
|
}
|
|
116
|
-
n(
|
|
117
|
-
function
|
|
116
|
+
n(B, "isMockFunction");
|
|
117
|
+
function E(t, e, r) {
|
|
118
118
|
let s = r ? { [{
|
|
119
119
|
get: "getter",
|
|
120
120
|
set: "setter"
|
|
121
|
-
}[r]]: e } : e, p =
|
|
122
|
-
return
|
|
121
|
+
}[r]]: e } : e, p = S(t, s);
|
|
122
|
+
return j(p);
|
|
123
123
|
}
|
|
124
|
-
n(
|
|
125
|
-
var
|
|
126
|
-
function
|
|
127
|
-
let e = t, r, l = [], s = [], p = [], c =
|
|
124
|
+
n(E, "spyOn");
|
|
125
|
+
var U = 0;
|
|
126
|
+
function j(t) {
|
|
127
|
+
let e = t, r, l = [], s = [], p = [], c = T(t), y = {
|
|
128
128
|
get calls() {
|
|
129
129
|
return c.calls;
|
|
130
130
|
},
|
|
@@ -148,7 +148,7 @@ function E(t) {
|
|
|
148
148
|
}
|
|
149
149
|
}, a = [], m = !1;
|
|
150
150
|
function i(...o) {
|
|
151
|
-
return l.push(this), s.push(this), p.push(++
|
|
151
|
+
return l.push(this), s.push(this), p.push(++U), (m ? r : a.shift() || r || c.getOriginal() || (() => {
|
|
152
152
|
})).apply(this, o);
|
|
153
153
|
}
|
|
154
154
|
n(i, "mockCall");
|
|
@@ -156,15 +156,15 @@ function E(t) {
|
|
|
156
156
|
e.getMockName = () => f || "vi.fn()", e.mockName = (o) => (f = o, e), e.mockClear = () => (c.reset(), l = [], s = [], p = [], e), e.mockReset =
|
|
157
157
|
() => (e.mockClear(), r = void 0, a = [], e), e.mockRestore = () => (e.mockReset(), c.restore(), e), e.getMockImplementation = () => m ? r :
|
|
158
158
|
a.at(0) || r, e.mockImplementation = (o) => (r = o, c.willCall(i), e), e.mockImplementationOnce = (o) => (a.push(o), e);
|
|
159
|
-
function
|
|
159
|
+
function I(o, u) {
|
|
160
160
|
let k = r;
|
|
161
161
|
r = o, c.willCall(i), m = !0;
|
|
162
|
-
let
|
|
162
|
+
let b = /* @__PURE__ */ n(() => {
|
|
163
163
|
r = k, m = !1;
|
|
164
164
|
}, "reset"), d = u();
|
|
165
|
-
return d instanceof Promise ? d.then(() => (
|
|
165
|
+
return d instanceof Promise ? d.then(() => (b(), e)) : (b(), e);
|
|
166
166
|
}
|
|
167
|
-
return n(
|
|
167
|
+
return n(I, "withImplementation"), e.withImplementation = I, e.mockReturnThis = () => e.mockImplementation(function() {
|
|
168
168
|
return this;
|
|
169
169
|
}), e.mockReturnValue = (o) => e.mockImplementation(() => o), e.mockReturnValueOnce = (o) => e.mockImplementationOnce(() => o), e.mockResolvedValue =
|
|
170
170
|
(o) => e.mockImplementation(() => Promise.resolve(o)), e.mockResolvedValueOnce = (o) => e.mockImplementationOnce(() => Promise.resolve(o)),
|
|
@@ -173,43 +173,44 @@ function E(t) {
|
|
|
173
173
|
get: /* @__PURE__ */ n(() => y, "get")
|
|
174
174
|
}), c.willCall(i), x.add(e), e;
|
|
175
175
|
}
|
|
176
|
-
n(
|
|
177
|
-
function
|
|
178
|
-
let e =
|
|
176
|
+
n(j, "enhanceSpy");
|
|
177
|
+
function w(t) {
|
|
178
|
+
let e = j(S({
|
|
179
179
|
spy: t || function() {
|
|
180
180
|
}
|
|
181
181
|
}, "spy"));
|
|
182
182
|
return t && e.mockImplementation(t), e;
|
|
183
183
|
}
|
|
184
|
-
n(
|
|
184
|
+
n(w, "fn");
|
|
185
185
|
|
|
186
186
|
// src/test/spy.ts
|
|
187
|
-
var
|
|
187
|
+
var O = globalThis.__STORYBOOK_TEST_SPY_LISTENERS__ || /* @__PURE__ */ new Set();
|
|
188
|
+
globalThis.__STORYBOOK_TEST_SPY_LISTENERS__ = O;
|
|
188
189
|
function H(t) {
|
|
189
|
-
return
|
|
190
|
+
return O.add(t), () => void O.delete(t);
|
|
190
191
|
}
|
|
191
192
|
n(H, "onMockCall");
|
|
192
193
|
var J = /* @__PURE__ */ n((...t) => {
|
|
193
|
-
let e =
|
|
194
|
-
return
|
|
194
|
+
let e = E(...t);
|
|
195
|
+
return V(e);
|
|
195
196
|
}, "spyOn");
|
|
196
197
|
function Q(t) {
|
|
197
|
-
let e = t ?
|
|
198
|
-
return
|
|
198
|
+
let e = t ? w(t) : w();
|
|
199
|
+
return V(e);
|
|
199
200
|
}
|
|
200
201
|
n(Q, "fn");
|
|
201
|
-
function D(t) {
|
|
202
|
-
let e = V(t), r = e.mockImplementation.bind(null);
|
|
203
|
-
return e.mockImplementation = (l) => V(r(l)), e;
|
|
204
|
-
}
|
|
205
|
-
n(D, "reactiveMock");
|
|
206
202
|
function V(t) {
|
|
207
|
-
let e =
|
|
203
|
+
let e = A(t), r = e.mockImplementation.bind(null);
|
|
204
|
+
return e.mockImplementation = (l) => A(r(l)), e;
|
|
205
|
+
}
|
|
206
|
+
n(V, "reactiveMock");
|
|
207
|
+
function A(t) {
|
|
208
|
+
let e = T(t), r = e.impl;
|
|
208
209
|
return e.willCall(function(...l) {
|
|
209
|
-
return
|
|
210
|
+
return O.forEach((s) => s(t, l)), r?.apply(this, l);
|
|
210
211
|
}), t;
|
|
211
212
|
}
|
|
212
|
-
n(
|
|
213
|
+
n(A, "listenWhenCalled");
|
|
213
214
|
function X() {
|
|
214
215
|
x.forEach((t) => t.mockClear());
|
|
215
216
|
}
|
|
@@ -229,7 +230,7 @@ n(te, "mocked");
|
|
|
229
230
|
export {
|
|
230
231
|
X as clearAllMocks,
|
|
231
232
|
Q as fn,
|
|
232
|
-
|
|
233
|
+
B as isMockFunction,
|
|
233
234
|
te as mocked,
|
|
234
235
|
x as mocks,
|
|
235
236
|
H as onMockCall,
|
package/dist/types/index.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var d = Object.defineProperty;
|
|
3
3
|
var y = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var i = Object.getOwnPropertyNames;
|
|
5
|
+
var A = Object.prototype.hasOwnProperty;
|
|
6
|
+
var s = (r, e) => {
|
|
7
7
|
for (var n in e)
|
|
8
8
|
d(r, n, { get: e[n], enumerable: !0 });
|
|
9
|
-
},
|
|
9
|
+
}, _ = (r, e, n, a) => {
|
|
10
10
|
if (e && typeof e == "object" || typeof e == "function")
|
|
11
|
-
for (let o of
|
|
12
|
-
!
|
|
11
|
+
for (let o of i(e))
|
|
12
|
+
!A.call(r, o) && o !== n && d(r, o, { get: () => e[o], enumerable: !(a = y(e, o)) || a.enumerable });
|
|
13
13
|
return r;
|
|
14
14
|
};
|
|
15
|
-
var
|
|
15
|
+
var T = (r) => _(d({}, "__esModule", { value: !0 }), r);
|
|
16
16
|
|
|
17
17
|
// src/types/index.ts
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var m = {};
|
|
19
|
+
s(m, {
|
|
20
20
|
Addon_TypesEnum: () => p
|
|
21
21
|
});
|
|
22
|
-
module.exports =
|
|
22
|
+
module.exports = T(m);
|
|
23
23
|
|
|
24
24
|
// src/types/modules/addons.ts
|
|
25
25
|
var p = /* @__PURE__ */ ((t) => (t.TAB = "tab", t.PANEL = "panel", t.TOOL = "tool", t.TOOLEXTRA = "toolextra", t.PREVIEW = "preview", t.experimental_PAGE =
|