storybook 9.1.0-alpha.9 → 9.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28722,6 +28722,7 @@ s(Cp, "rewriteSbMockImportCalls");
28722
28722
 
28723
28723
  // src/core-server/presets/webpack/loaders/storybook-mock-transform-loader.ts
28724
28724
  function wp(t) {
28725
- return Cp(t).code;
28725
+ let e = Cp(t);
28726
+ this.async()(null, e.code, e.map || void 0);
28726
28727
  }
28727
28728
  s(wp, "storybookMockTransformLoader");
@@ -28720,7 +28720,8 @@ s(vp, "rewriteSbMockImportCalls");
28720
28720
 
28721
28721
  // src/core-server/presets/webpack/loaders/storybook-mock-transform-loader.ts
28722
28722
  function wB(t) {
28723
- return vp(t).code;
28723
+ let e = vp(t);
28724
+ this.async()(null, e.code, e.map || void 0);
28724
28725
  }
28725
28726
  s(wB, "storybookMockTransformLoader");
28726
28727
  export {
@@ -24,8 +24,8 @@ var J = (e, t, r) => (r = e != null ? Eo(ko(e)) : {}, Ot(
24
24
  )), Oo = (e) => Ot(oe({}, "__esModule", { value: !0 }), e);
25
25
 
26
26
  // ../node_modules/@ngard/tiny-isequal/index.js
27
- var $t = Pt((_e) => {
28
- Object.defineProperty(_e, "__esModule", { value: !0 }), _e.isEqual = /* @__PURE__ */ function() {
27
+ var $t = Pt((De) => {
28
+ Object.defineProperty(De, "__esModule", { value: !0 }), De.isEqual = /* @__PURE__ */ function() {
29
29
  var e = Object.prototype.toString, t = Object.getPrototypeOf, r = Object.getOwnPropertySymbols ? function(o) {
30
30
  return Object.keys(o).concat(Object.getOwnPropertySymbols(o));
31
31
  } : Object.keys;
@@ -154,15 +154,15 @@ function Mt(e) {
154
154
  n(Mt, "toStartCaseStr");
155
155
 
156
156
  // src/csf/includeConditionalArg.ts
157
- var De = J($t(), 1);
157
+ var _e = J($t(), 1);
158
158
  var Ft = /* @__PURE__ */ n((e) => e.map((t) => typeof t < "u").filter(Boolean).length, "count"), Mo = /* @__PURE__ */ n((e, t) => {
159
159
  let { exists: r, eq: o, neq: i, truthy: s } = e;
160
160
  if (Ft([r, o, i, s]) > 1)
161
161
  throw new Error(`Invalid conditional test ${JSON.stringify({ exists: r, eq: o, neq: i })}`);
162
162
  if (typeof o < "u")
163
- return (0, De.isEqual)(t, o);
163
+ return (0, _e.isEqual)(t, o);
164
164
  if (typeof i < "u")
165
- return !(0, De.isEqual)(t, i);
165
+ return !(0, _e.isEqual)(t, i);
166
166
  if (typeof r < "u") {
167
167
  let p = typeof t < "u";
168
168
  return r ? p : !p;
@@ -186,7 +186,7 @@ var he = require("@storybook/global");
186
186
 
187
187
  // src/preview-api/modules/addons/storybook-channel-mock.ts
188
188
  var Lt = require("storybook/internal/channels");
189
- function _t() {
189
+ function Dt() {
190
190
  let e = {
191
191
  setHandler: /* @__PURE__ */ n(() => {
192
192
  }, "setHandler"),
@@ -195,14 +195,14 @@ function _t() {
195
195
  };
196
196
  return new Lt.Channel({ transport: e });
197
197
  }
198
- n(_t, "mockChannel");
198
+ n(Dt, "mockChannel");
199
199
 
200
200
  // src/preview-api/modules/addons/main.ts
201
201
  var Ne = class {
202
202
  constructor() {
203
203
  this.getChannel = /* @__PURE__ */ n(() => {
204
204
  if (!this.channel) {
205
- let t = _t();
205
+ let t = Dt();
206
206
  return this.setChannel(t), t;
207
207
  }
208
208
  return this.channel;
@@ -277,7 +277,7 @@ var be = class {
277
277
  je.getChannel().removeListener(K.STORY_RENDERED, this.renderListener);
278
278
  }
279
279
  };
280
- function Dt(e) {
280
+ function _t(e) {
281
281
  let t = /* @__PURE__ */ n((...r) => {
282
282
  let { hooks: o } = typeof r[0] == "function" ? r[1] : r[0], i = o.currentPhase, s = o.currentHooks, a = o.nextHookIndex, p = o.currentDecoratorName;
283
283
  o.currentDecoratorName = e.name, o.prevMountedDecorators.has(e) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(e) || []) :
@@ -294,11 +294,11 @@ function Dt(e) {
294
294
  }, "hookified");
295
295
  return t.originalFn = e, t;
296
296
  }
297
- n(Dt, "hookify");
297
+ n(_t, "hookify");
298
298
  var Be = 0, Io = 25, Ht = /* @__PURE__ */ n((e) => (t, r) => {
299
299
  let o = e(
300
- Dt(t),
301
- r.map((i) => Dt(i))
300
+ _t(t),
301
+ r.map((i) => _t(i))
302
302
  );
303
303
  return (i) => {
304
304
  let { hooks: s } = i;
@@ -348,7 +348,7 @@ n(ze, "pickBy");
348
348
 
349
349
  // src/preview-api/modules/store/args.ts
350
350
  var Lo = require("storybook/internal/client-logger");
351
- var _o = J(Q(), 1);
351
+ var Do = J(Q(), 1);
352
352
  var wi = Symbol("incompatible");
353
353
  var Ei = Symbol("Deeply equal");
354
354
  var Ue = "UNTARGETED";
@@ -369,13 +369,13 @@ var Bt = /* @__PURE__ */ n((e = {}) => Object.entries(e).reduce((t, [r, { defaul
369
369
  tValuesFromArgTypes");
370
370
 
371
371
  // src/preview-api/modules/store/csf/normalizeInputTypes.ts
372
- var Do = /* @__PURE__ */ n((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), Ho = /* @__PURE__ */ n((e) => typeof e == "strin\
372
+ var _o = /* @__PURE__ */ n((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), Ho = /* @__PURE__ */ n((e) => typeof e == "strin\
373
373
  g" ? { type: e } : e, "normalizeControl"), No = /* @__PURE__ */ n((e, t) => {
374
374
  let { type: r, control: o, ...i } = e, s = {
375
375
  name: t,
376
376
  ...i
377
377
  };
378
- return r && (s.type = Do(r)), o ? s.control = Ho(o) : o === !1 && (s.control = { disable: !0 }), s;
378
+ return r && (s.type = _o(r)), o ? s.control = Ho(o) : o === !1 && (s.control = { disable: !0 }), s;
379
379
  }, "normalizeInputType"), q = /* @__PURE__ */ n((e) => G(e, No), "normalizeInputTypes");
380
380
 
381
381
  // src/preview-api/modules/store/csf/normalizeStory.ts
@@ -515,14 +515,14 @@ function We(e, t) {
515
515
  n(We, "defaultDecorateStory");
516
516
 
517
517
  // src/preview-api/modules/store/parameters.ts
518
- var _ = /* @__PURE__ */ n((...e) => {
518
+ var D = /* @__PURE__ */ n((...e) => {
519
519
  let t = {}, r = e.filter(Boolean), o = r.reduce((i, s) => (Object.entries(s).forEach(([a, p]) => {
520
520
  let c = i[a];
521
521
  Array.isArray(p) || typeof c > "u" ? i[a] = p : ne(p) && ne(c) ? t[a] = !0 : typeof p < "u" && (i[a] = p);
522
522
  }), i), {});
523
523
  return Object.keys(t).forEach((i) => {
524
524
  let s = r.filter(Boolean).map((a) => a[i]).filter((a) => typeof a < "u");
525
- s.every((a) => ne(a)) ? o[i] = _(...s) : o[i] = s[s.length - 1];
525
+ s.every((a) => ne(a)) ? o[i] = D(...s) : o[i] = s[s.length - 1];
526
526
  }), o;
527
527
  }, "combineParameters");
528
528
 
@@ -609,11 +609,11 @@ function zo(e, t, r) {
609
609
  ...r.tags ?? [],
610
610
  ...t.tags ?? [],
611
611
  ...e?.tags ?? []
612
- ), a = _(
612
+ ), a = D(
613
613
  r.parameters,
614
614
  t.parameters,
615
615
  e?.parameters
616
- ), { argTypesEnhancers: p = [], argsEnhancers: c = [] } = r, l = _(
616
+ ), { argTypesEnhancers: p = [], argsEnhancers: c = [] } = r, l = D(
617
617
  r.argTypes,
618
618
  t.argTypes,
619
619
  e?.argTypes
@@ -727,7 +727,7 @@ var Ve = /* @__PURE__ */ n((e, t, r) => {
727
727
  })), s = G(r, (a, p) => ({
728
728
  name: p
729
729
  }));
730
- return _(i, s, r);
730
+ return D(i, s, r);
731
731
  }, "inferArgTypes");
732
732
  Ke.secondPass = !0;
733
733
 
@@ -783,7 +783,7 @@ var Uo = /* @__PURE__ */ n((e, t, r) => {
783
783
  if (!r)
784
784
  return t;
785
785
  let a = qe(t, o, i), p = G(a, (c, l) => c?.type && Uo(c, l.toString(), s));
786
- return _(p, a);
786
+ return D(p, a);
787
787
  }, "inferControls");
788
788
  Re.secondPass = !0;
789
789
 
@@ -882,7 +882,7 @@ n(ae, "getSingletonField");
882
882
  function le(e) {
883
883
  let t = Y(e, "argTypesEnhancers"), r = pe(e, "runStep"), o = Y(e, "beforeAll");
884
884
  return {
885
- parameters: _(...pe(e, "parameters")),
885
+ parameters: D(...pe(e, "parameters")),
886
886
  decorators: Y(e, "decorators", {
887
887
  reverseFileOrder: !(nr.global.FEATURES?.legacyDecoratorFileOrder ?? !1)
888
888
  }),
@@ -917,9 +917,8 @@ var Wo = require("storybook/internal/csf"), Yo = require("storybook/internal/csf
917
917
  function ir() {
918
918
  try {
919
919
  return (
920
- // @ts-expect-error this property exists in certain environments
921
- !!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
922
- !!globalThis.__playwright__binding__
920
+ // @ts-expect-error This property exists in Vitest browser mode
921
+ !!globalThis.__vitest_browser__ || !!globalThis.window?.navigator?.userAgent?.match(/StorybookTestRunner/)
923
922
  );
924
923
  } catch {
925
924
  return !1;
@@ -1545,7 +1544,7 @@ ke = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ n((e) => {
1545
1544
  }
1546
1545
  }
1547
1546
  return r;
1548
- }, "mapElements"), _r = /* @__PURE__ */ n((e) => Array.from(e.entries()).map(([t, { selectors: r, styles: o, hoverStyles: i, focusStyles: s,
1547
+ }, "mapElements"), Dr = /* @__PURE__ */ n((e) => Array.from(e.entries()).map(([t, { selectors: r, styles: o, hoverStyles: i, focusStyles: s,
1549
1548
  menu: a }]) => {
1550
1549
  let { top: p, left: c, width: l, height: y } = t.getBoundingClientRect(), { position: u } = getComputedStyle(t);
1551
1550
  return {
@@ -1571,7 +1570,7 @@ menu: a }]) => {
1571
1570
  window.scrollX, i += window.scrollY);
1572
1571
  let { x: p, y: c } = r;
1573
1572
  return p >= o && p <= o + s && c >= i && c <= i + a;
1574
- }, "isTargeted"), Dr = /* @__PURE__ */ n((e, t, r = {}) => {
1573
+ }, "isTargeted"), _r = /* @__PURE__ */ n((e, t, r = {}) => {
1575
1574
  let { x: o, y: i } = t, { margin: s = 5, topOffset: a = 0, centered: p = !1 } = r, { scrollX: c, scrollY: l, innerHeight: y, innerWidth: u } = window,
1576
1575
  h = Math.min(
1577
1576
  e.style.position === "fixed" ? i - l : i,
@@ -1623,7 +1622,7 @@ var C = "storybook-highlights-menu", jr = "storybook-highlights-root", fn = "sto
1623
1622
  f.disconnect();
1624
1623
  };
1625
1624
  }), o.subscribe((d) => {
1626
- let m = /* @__PURE__ */ n(() => requestAnimationFrame(() => i.set(_r(d))), "updateBoxes"), f = new ResizeObserver(m);
1625
+ let m = /* @__PURE__ */ n(() => requestAnimationFrame(() => i.set(Dr(d))), "updateBoxes"), f = new ResizeObserver(m);
1627
1626
  f.observe(t.body), Array.from(d.keys()).forEach((g) => f.observe(g));
1628
1627
  let x = Array.from(t.body.querySelectorAll("*")).filter((g) => {
1629
1628
  let { overflow: E, overflowX: I, overflowY: k } = window.getComputedStyle(g);
@@ -1931,7 +1930,7 @@ ue", Helvetica, Arial, sans-serif;
1931
1930
  display: "block",
1932
1931
  left: `${d.style.position === "fixed" ? x.x - window.scrollX : x.x}px`,
1933
1932
  top: `${d.style.position === "fixed" ? x.y - window.scrollY : x.y}px`
1934
- }), ut(d), requestAnimationFrame(() => Dr(d, x, { topOffset: 15, centered: !0 }))) : (Hr(d), Object.assign(d.style, { display: "none" }));
1933
+ }), ut(d), requestAnimationFrame(() => _r(d, x, { topOffset: 15, centered: !0 }))) : (Hr(d), Object.assign(d.style, { display: "none" }));
1935
1934
  }, "renderMenu");
1936
1935
  p.subscribe(L), y.subscribe(L);
1937
1936
  let O = /* @__PURE__ */ n((d) => {
@@ -2863,17 +2862,17 @@ var Fn = globalThis.FEATURES?.outline ? [mo] : [], In = {
2863
2862
  }, At = /* @__PURE__ */ n(() => (0, uo.definePreviewAddon)({ decorators: Fn, initialGlobals: In }), "default");
2864
2863
 
2865
2864
  // src/test/preview.ts
2866
- var yo = require("storybook/internal/csf"), go = require("storybook/internal/instrumenter"), D = require("storybook/test");
2865
+ var yo = require("storybook/internal/csf"), go = require("storybook/internal/instrumenter"), _ = require("storybook/test");
2867
2866
  var Ln = /* @__PURE__ */ n(({ parameters: e }) => {
2868
- e?.test?.mockReset === !0 ? (0, D.resetAllMocks)() : e?.test?.clearMocks === !0 ? (0, D.clearAllMocks)() : e?.test?.restoreMocks !== !1 &&
2869
- (0, D.restoreAllMocks)();
2867
+ e?.test?.mockReset === !0 ? (0, _.resetAllMocks)() : e?.test?.clearMocks === !0 ? (0, _.clearAllMocks)() : e?.test?.restoreMocks !== !1 &&
2868
+ (0, _.restoreAllMocks)();
2870
2869
  }, "resetAllMocksLoader"), Rt = /* @__PURE__ */ n((e, t = 0, r) => {
2871
2870
  if (t > 5 || e == null)
2872
2871
  return e;
2873
- if ((0, D.isMockFunction)(e))
2872
+ if ((0, _.isMockFunction)(e))
2874
2873
  return r && e.mockName(r), e;
2875
2874
  if (typeof e == "function" && "isAction" in e && e.isAction && !("implicit" in e && e.implicit)) {
2876
- let o = (0, D.fn)(e);
2875
+ let o = (0, _.fn)(e);
2877
2876
  return r && o.mockName(r), o;
2878
2877
  }
2879
2878
  if (Array.isArray(e)) {
@@ -2889,14 +2888,14 @@ var Ln = /* @__PURE__ */ n(({ parameters: e }) => {
2889
2888
  return e;
2890
2889
  }
2891
2890
  return e;
2892
- }, "traverseArgs"), _n = /* @__PURE__ */ n(({ initialArgs: e }) => {
2891
+ }, "traverseArgs"), Dn = /* @__PURE__ */ n(({ initialArgs: e }) => {
2893
2892
  Rt(e);
2894
- }, "nameSpiesAndWrapActionsInSpies"), fo = !1, Dn = /* @__PURE__ */ n(async (e) => {
2895
- globalThis.HTMLElement && e.canvasElement instanceof globalThis.HTMLElement && (e.canvas = (0, D.within)(e.canvasElement));
2893
+ }, "nameSpiesAndWrapActionsInSpies"), fo = !1, _n = /* @__PURE__ */ n(async (e) => {
2894
+ globalThis.HTMLElement && e.canvasElement instanceof globalThis.HTMLElement && (e.canvas = (0, _.within)(e.canvasElement));
2896
2895
  let t = globalThis.window?.navigator?.clipboard;
2897
2896
  if (t) {
2898
2897
  e.userEvent = (0, go.instrument)(
2899
- { userEvent: D.uninstrumentedUserEvent.setup() },
2898
+ { userEvent: _.uninstrumentedUserEvent.setup() },
2900
2899
  { intercept: !0 }
2901
2900
  ).userEvent, Object.defineProperty(globalThis.window.navigator, "clipboard", {
2902
2901
  get: /* @__PURE__ */ n(() => t, "get"),
@@ -2914,7 +2913,7 @@ var Ln = /* @__PURE__ */ n(({ parameters: e }) => {
2914
2913
  });
2915
2914
  }
2916
2915
  }, "enhanceContext"), wt = /* @__PURE__ */ n(() => (0, yo.definePreviewAddon)({
2917
- loaders: [Ln, _n, Dn]
2916
+ loaders: [Ln, Dn, _n]
2918
2917
  }), "default");
2919
2918
 
2920
2919
  // src/viewport/preview.ts
@@ -3034,7 +3033,7 @@ function So(e, t) {
3034
3033
  ...this.input,
3035
3034
  ...i,
3036
3035
  args: { ...this.input.args, ...i.args },
3037
- argTypes: _(this.input.argTypes, i.argTypes),
3036
+ argTypes: D(this.input.argTypes, i.argTypes),
3038
3037
  afterEach: [
3039
3038
  ...b(this.input?.afterEach ?? []),
3040
3039
  ...b(i.afterEach ?? [])
@@ -3052,7 +3051,7 @@ function So(e, t) {
3052
3051
  ...b(this.input?.loaders ?? []),
3053
3052
  ...b(i.loaders ?? [])
3054
3053
  ],
3055
- parameters: _(this.input.parameters, i.parameters),
3054
+ parameters: D(this.input.parameters, i.parameters),
3056
3055
  tags: (0, To.combineTags)(...this.input.tags ?? [], ...i.tags ?? [])
3057
3056
  },
3058
3057
  this.meta
package/dist/csf/index.js CHANGED
@@ -902,9 +902,8 @@ import { MountMustBeDestructuredError as Ao } from "storybook/internal/preview-e
902
902
  function Dt() {
903
903
  try {
904
904
  return (
905
- // @ts-expect-error this property exists in certain environments
906
- !!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
907
- !!globalThis.__playwright__binding__
905
+ // @ts-expect-error This property exists in Vitest browser mode
906
+ !!globalThis.__vitest_browser__ || !!globalThis.window?.navigator?.userAgent?.match(/StorybookTestRunner/)
908
907
  );
909
908
  } catch {
910
909
  return !1;