storybook 10.0.0-beta.5 → 10.0.0-beta.6

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.
Files changed (79) hide show
  1. package/assets/server/openBrowser.applescript +94 -0
  2. package/dist/_browser-chunks/{WithTooltip-ERFLZL6W.js → WithTooltip-SK46ZJ2J.js} +1 -1
  3. package/dist/_browser-chunks/{chunk-EOILZP2R.js → chunk-BOOOPFZF.js} +7 -2
  4. package/dist/_node-chunks/{builder-manager-ZTS4EIKQ.js → builder-manager-V33CQT2M.js} +21 -151
  5. package/dist/_node-chunks/camelcase-BZ55OCHI.js +18 -0
  6. package/dist/_node-chunks/{chunk-WCSHG2QT.js → chunk-2DMFI367.js} +7 -7
  7. package/dist/_node-chunks/{chunk-VQN4WAIA.js → chunk-4TOI4VSK.js} +7 -7
  8. package/dist/_node-chunks/{chunk-TBWOUVTA.js → chunk-55VWKF63.js} +709 -935
  9. package/dist/_node-chunks/{chunk-P3TWEOO5.js → chunk-5IEY46LQ.js} +7 -7
  10. package/dist/_node-chunks/{chunk-EIHJ5J3O.js → chunk-6PTV7XGR.js} +8 -8
  11. package/dist/_node-chunks/{chunk-D7SDB4XE.js → chunk-7NJGTQ3W.js} +8 -8
  12. package/dist/_node-chunks/{chunk-4VDRH7SM.js → chunk-7WH7AGOR.js} +7 -7
  13. package/dist/_node-chunks/{chunk-AK5PHLUA.js → chunk-A7CUP23N.js} +7 -7
  14. package/dist/_node-chunks/{chunk-K4YETNYJ.js → chunk-B3AMFGAL.js} +7 -7
  15. package/dist/_node-chunks/{chunk-PIKDGR3O.js → chunk-BNOZ3EKF.js} +7 -7
  16. package/dist/_node-chunks/{chunk-F7YW5W6B.js → chunk-DC7OWBHB.js} +12 -12
  17. package/dist/_node-chunks/{chunk-VX5P3IYA.js → chunk-E6TLN2J2.js} +7 -7
  18. package/dist/_node-chunks/{chunk-TVKUJ3SE.js → chunk-EAOPWIKA.js} +8 -8
  19. package/dist/_node-chunks/{chunk-TKN5TEZV.js → chunk-EY5PTUZL.js} +13 -13
  20. package/dist/_node-chunks/{chunk-DZJNLBBL.js → chunk-F3PO67U3.js} +7 -7
  21. package/dist/_node-chunks/chunk-FDDJHDCE.js +62 -0
  22. package/dist/_node-chunks/{chunk-KZB7ELL6.js → chunk-HEBHWRWL.js} +7 -7
  23. package/dist/_node-chunks/{chunk-VWSUFVUF.js → chunk-HPFXREVG.js} +7 -7
  24. package/dist/_node-chunks/{chunk-OC3TVLYU.js → chunk-IINJT47N.js} +7 -7
  25. package/dist/_node-chunks/{chunk-J3DQMIO4.js → chunk-JNHUDBJL.js} +7 -7
  26. package/dist/_node-chunks/{chunk-SW3VZAH7.js → chunk-JOXYGIZK.js} +9 -9
  27. package/dist/_node-chunks/{chunk-P7YMEOXF.js → chunk-MLBTKECD.js} +7 -7
  28. package/dist/_node-chunks/{chunk-UTCFHTQH.js → chunk-NJXBURX7.js} +7 -7
  29. package/dist/_node-chunks/{chunk-H52PBBSK.js → chunk-NKZ4UPPV.js} +7 -7
  30. package/dist/_node-chunks/{chunk-F3WE3456.js → chunk-NUVGSFQI.js} +7 -7
  31. package/dist/_node-chunks/chunk-R5DIBOM6.js +18 -0
  32. package/dist/_node-chunks/{chunk-ACUNHBEO.js → chunk-RIPA4LFD.js} +22 -22
  33. package/dist/_node-chunks/{chunk-KU3JBNPY.js → chunk-TJIMCNYJ.js} +8 -8
  34. package/dist/_node-chunks/{chunk-4KRR46V2.js → chunk-UYKQJMQY.js} +15 -15
  35. package/dist/_node-chunks/{chunk-3VVGIILJ.js → chunk-VQH4ZFTS.js} +8 -8
  36. package/dist/_node-chunks/{chunk-QHIU5I7C.js → chunk-VSC6LSCQ.js} +6 -6
  37. package/dist/_node-chunks/{chunk-2VMDKLSW.js → chunk-XZTBG2TG.js} +6 -6
  38. package/dist/_node-chunks/{dist-OGRBL76N.js → dist-CGGAYWME.js} +9 -9
  39. package/dist/_node-chunks/{globby-65LOULA6.js → globby-3IFB7BJC.js} +17 -13
  40. package/dist/_node-chunks/{lib-TF7JCT3A.js → lib-IT6OBSID.js} +7 -7
  41. package/dist/_node-chunks/{mdx-N42X6CFJ-6ZJEUZMZ.js → mdx-N42X6CFJ-WM36SSZ6.js} +8 -8
  42. package/dist/_node-chunks/{p-limit-PF7JSPDT.js → p-limit-3V5XIKA7.js} +7 -7
  43. package/dist/_node-chunks/{plugin-LGHGAC6J.js → plugin-3YREMMJJ.js} +10 -10
  44. package/dist/_node-chunks/{plugin-A6XAWMXN.js → plugin-GJUBUKCT.js} +10 -10
  45. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-HDSEOU3Z.js → webpack-inject-mocker-runtime-plugin-DCJQFJQ5.js} +10 -10
  46. package/dist/_node-chunks/{webpack-mock-plugin-ZJJVMJUS.js → webpack-mock-plugin-XJNFAHBI.js} +9 -9
  47. package/dist/babel/index.js +11 -11
  48. package/dist/bin/core.js +11 -11
  49. package/dist/bin/dispatcher.js +11 -11
  50. package/dist/bin/loader.js +8 -8
  51. package/dist/cli/index.js +27 -22
  52. package/dist/common/index.js +21 -21
  53. package/dist/components/index.js +3 -3
  54. package/dist/core-events/index.d.ts +18 -2
  55. package/dist/core-events/index.js +7 -1
  56. package/dist/core-server/index.js +1104 -999
  57. package/dist/core-server/presets/common-manager.js +67 -27
  58. package/dist/core-server/presets/common-override-preset.js +9 -9
  59. package/dist/core-server/presets/common-preset.js +691 -29
  60. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  61. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  62. package/dist/csf-tools/index.js +9 -9
  63. package/dist/manager/globals-runtime.js +1250 -972
  64. package/dist/manager/globals.d.ts +0 -4
  65. package/dist/manager/globals.js +1 -6
  66. package/dist/manager/runtime.js +1724 -464
  67. package/dist/manager-api/index.d.ts +2 -0
  68. package/dist/manager-api/index.js +284 -48
  69. package/dist/node-logger/index.js +14 -14
  70. package/dist/preview/runtime.js +7 -1
  71. package/dist/server-errors.js +10 -10
  72. package/dist/telemetry/index.d.ts +1 -1
  73. package/dist/telemetry/index.js +24 -24
  74. package/dist/types/index.d.ts +4 -0
  75. package/package.json +5 -4
  76. package/dist/_node-chunks/camelcase-K3BM7RII.js +0 -18
  77. package/dist/_node-chunks/chunk-7LG5CLCT.js +0 -18
  78. package/dist/_node-chunks/chunk-DWJ7TV2O.js +0 -62
  79. package/dist/_node-chunks/default-browser-id-4RZZMHJE.js +0 -1719
@@ -6893,7 +6893,9 @@ import {
6893
6893
  experimental_useStatusStore,
6894
6894
  useAddonState as useAddonState2,
6895
6895
  useChannel as useChannel2,
6896
- useParameter as useParameter2
6896
+ useParameter as useParameter2,
6897
+ useStorybookApi as useStorybookApi5,
6898
+ useStorybookState as useStorybookState2
6897
6899
  } from "storybook/manager-api";
6898
6900
 
6899
6901
  // src/component-testing/constants.ts
@@ -8623,8 +8625,10 @@ var StyledIconButton2 = styled39(IconButton6)(({ theme: theme3 }) => ({
8623
8625
  var StyledSeparator = styled39(Separator)({
8624
8626
  marginTop: 0
8625
8627
  });
8626
- var StyledLocation = styled39(P2)(({ theme: theme3 }) => ({
8627
- color: theme3.textMutedColor,
8628
+ var StyledLocation = styled39(P2)(({ theme: theme3, isText }) => ({
8629
+ color: isText ? theme3.textMutedColor : theme3.color.secondary,
8630
+ cursor: isText ? "default" : "pointer",
8631
+ fontWeight: isText ? theme3.typography.weight.regular : theme3.typography.weight.bold,
8628
8632
  justifyContent: "flex-end",
8629
8633
  textAlign: "right",
8630
8634
  whiteSpace: "nowrap",
@@ -8657,7 +8661,10 @@ var Subnav = /* @__PURE__ */ __name(({
8657
8661
  controlStates,
8658
8662
  status,
8659
8663
  storyFileName,
8660
- onScrollToEnd
8664
+ onScrollToEnd,
8665
+ importPath,
8666
+ canOpenInEditor,
8667
+ api
8661
8668
  }) => {
8662
8669
  const buttonText = status === "errored" ? "Scroll to error" : "Scroll to end";
8663
8670
  const theme3 = useTheme7();
@@ -8693,7 +8700,26 @@ var Subnav = /* @__PURE__ */ __name(({
8693
8700
  disabled: !controlStates.end
8694
8701
  },
8695
8702
  React63.createElement(FastForwardIcon, null)
8696
- )), React63.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React63.createElement(Note2, { note: "Rerun" }) }, React63.createElement(RerunButton, { "aria-label": "Rerun", onClick: controls.rerun }, React63.createElement(SyncIcon, null)))), storyFileName && React63.createElement(Group, null, React63.createElement(StyledLocation, null, storyFileName)))));
8703
+ )), React63.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React63.createElement(Note2, { note: "Rerun" }) }, React63.createElement(RerunButton, { "aria-label": "Rerun", onClick: controls.rerun }, React63.createElement(SyncIcon, null)))), (importPath || storyFileName) && React63.createElement(Group, null, canOpenInEditor ? React63.createElement(
8704
+ WithTooltip3,
8705
+ {
8706
+ trigger: "hover",
8707
+ hasChrome: false,
8708
+ tooltip: React63.createElement(Note2, { note: "Open in editor" })
8709
+ },
8710
+ React63.createElement(
8711
+ StyledLocation,
8712
+ {
8713
+ "aria-label": "Open in editor",
8714
+ onClick: () => {
8715
+ api.openInEditor({
8716
+ file: importPath
8717
+ });
8718
+ }
8719
+ },
8720
+ storyFileName
8721
+ )
8722
+ ) : React63.createElement(StyledLocation, { isText: true }, storyFileName)))));
8697
8723
  }, "Subnav");
8698
8724
 
8699
8725
  // src/component-testing/components/TestDiscrepancyMessage.tsx
@@ -8787,7 +8813,10 @@ var InteractionsPanel = React65.memo(
8787
8813
  onScrollToEnd,
8788
8814
  endRef,
8789
8815
  hasResultMismatch,
8790
- browserTestStatus
8816
+ browserTestStatus,
8817
+ importPath,
8818
+ canOpenInEditor,
8819
+ api
8791
8820
  }) {
8792
8821
  const filter = useAnsiToHtmlFilter();
8793
8822
  const hasRealInteractions = interactions.some((i2) => i2.id !== INTERNAL_RENDER_CALL_ID);
@@ -8798,7 +8827,10 @@ var InteractionsPanel = React65.memo(
8798
8827
  controlStates,
8799
8828
  status,
8800
8829
  storyFileName: fileName,
8801
- onScrollToEnd
8830
+ onScrollToEnd,
8831
+ importPath,
8832
+ canOpenInEditor,
8833
+ api
8802
8834
  }
8803
8835
  ), React65.createElement("div", { "aria-label": "Interactions list" }, interactions.map((call) => React65.createElement(
8804
8836
  Interaction,
@@ -8933,13 +8965,18 @@ var getInternalRenderLogItem = /* @__PURE__ */ __name((status) => ({
8933
8965
  }), "getInternalRenderLogItem");
8934
8966
  var Panel = memo4(
8935
8967
  /* @__PURE__ */ __name(function PanelMemoized({ refId, storyId, storyUrl }) {
8936
- const { statusValue, testRunId } = experimental_useStatusStore((state) => {
8937
- const storyStatus = refId ? void 0 : state[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST];
8968
+ const { statusValue, testRunId } = experimental_useStatusStore((state2) => {
8969
+ const storyStatus = refId ? void 0 : state2[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST];
8938
8970
  return {
8939
8971
  statusValue: storyStatus?.value,
8940
8972
  testRunId: storyStatus?.data?.testRunId
8941
8973
  };
8942
8974
  });
8975
+ const state = useStorybookState2();
8976
+ const api = useStorybookApi5();
8977
+ const data = api.getData(state.storyId, state.refId);
8978
+ const importPath = data?.importPath;
8979
+ const canOpenInEditor = global2.CONFIG_TYPE === "DEVELOPMENT" && !state.refId;
8943
8980
  const [panelState, set] = useAddonState2(ADDON_ID7, {
8944
8981
  status: "rendering",
8945
8982
  controlStates: INITIAL_CONTROL_STATES,
@@ -8987,8 +9024,8 @@ var Panel = memo4(
8987
9024
  [EVENTS.SYNC]: (payload) => {
8988
9025
  log.current = [getInternalRenderLogItem("done" /* DONE */), ...payload.logItems];
8989
9026
  set(
8990
- (state) => getPanelState(
8991
- { ...state, controlStates: payload.controlStates, pausedAt: payload.pausedAt },
9027
+ (state2) => getPanelState(
9028
+ { ...state2, controlStates: payload.controlStates, pausedAt: payload.pausedAt },
8992
9029
  { log: log.current, calls: calls.current, collapsed, setCollapsed }
8993
9030
  )
8994
9031
  );
@@ -9015,10 +9052,10 @@ var Panel = memo4(
9015
9052
  unhandledErrors: void 0
9016
9053
  });
9017
9054
  } else {
9018
- set((state) => {
9019
- const status2 = event.newPhase in playStatusMap ? playStatusMap[event.newPhase] : state.status;
9055
+ set((state2) => {
9056
+ const status2 = event.newPhase in playStatusMap ? playStatusMap[event.newPhase] : state2.status;
9020
9057
  return getPanelState(
9021
- { ...state, status: status2, pausedAt: void 0 },
9058
+ { ...state2, status: status2, pausedAt: void 0 },
9022
9059
  { log: log.current, calls: calls.current, collapsed, setCollapsed }
9023
9060
  );
9024
9061
  });
@@ -9031,9 +9068,9 @@ var Panel = memo4(
9031
9068
  getInternalRenderCall(storyId, { ...e2, callId: INTERNAL_RENDER_CALL_ID })
9032
9069
  );
9033
9070
  set(
9034
- (state) => getPanelState(
9071
+ (state2) => getPanelState(
9035
9072
  {
9036
- ...state,
9073
+ ...state2,
9037
9074
  hasException: true,
9038
9075
  caughtException: void 0,
9039
9076
  controlStates: INITIAL_CONTROL_STATES,
@@ -9044,17 +9081,17 @@ var Panel = memo4(
9044
9081
  );
9045
9082
  },
9046
9083
  [PLAY_FUNCTION_THREW_EXCEPTION]: (caughtException2) => {
9047
- set((state) => ({ ...state, caughtException: caughtException2, hasException: true }));
9084
+ set((state2) => ({ ...state2, caughtException: caughtException2, hasException: true }));
9048
9085
  },
9049
9086
  [UNHANDLED_ERRORS_WHILE_PLAYING]: (unhandledErrors2) => {
9050
- set((state) => ({ ...state, unhandledErrors: unhandledErrors2, hasException: true }));
9087
+ set((state2) => ({ ...state2, unhandledErrors: unhandledErrors2, hasException: true }));
9051
9088
  }
9052
9089
  },
9053
9090
  [collapsed]
9054
9091
  );
9055
9092
  useEffect17(() => {
9056
9093
  set(
9057
- (state) => getPanelState(state, { log: log.current, calls: calls.current, collapsed, setCollapsed })
9094
+ (state2) => getPanelState(state2, { log: log.current, calls: calls.current, collapsed, setCollapsed })
9058
9095
  );
9059
9096
  }, [set, collapsed]);
9060
9097
  const controls = useMemo5(
@@ -9122,7 +9159,10 @@ var Panel = memo4(
9122
9159
  unhandledErrors,
9123
9160
  pausedAt,
9124
9161
  endRef,
9125
- onScrollToEnd: scrollTarget && scrollToTarget
9162
+ onScrollToEnd: scrollTarget && scrollToTarget,
9163
+ importPath,
9164
+ canOpenInEditor,
9165
+ api
9126
9166
  }
9127
9167
  ));
9128
9168
  }, "PanelMemoized")
@@ -9131,9 +9171,9 @@ var Panel = memo4(
9131
9171
  // src/component-testing/components/PanelTitle.tsx
9132
9172
  import React67 from "react";
9133
9173
  import { Badge as Badge3 } from "storybook/internal/components";
9134
- import { useAddonState as useAddonState3, useStorybookApi as useStorybookApi5 } from "storybook/manager-api";
9174
+ import { useAddonState as useAddonState3, useStorybookApi as useStorybookApi6 } from "storybook/manager-api";
9135
9175
  function PanelTitle() {
9136
- const api = useStorybookApi5();
9176
+ const api = useStorybookApi6();
9137
9177
  const selectedPanel = api.getSelectedPanel();
9138
9178
  const [addonState = {}] = useAddonState3(ADDON_ID7);
9139
9179
  const { status, hasException, interactionsCount } = addonState;
@@ -9306,11 +9346,11 @@ import { addons as addons5, types as types5 } from "storybook/manager-api";
9306
9346
  import React71, { useCallback as useCallback9, useEffect as useEffect18 } from "react";
9307
9347
  import { IconButton as IconButton8 } from "storybook/internal/components";
9308
9348
  import { RulerIcon } from "@storybook/icons";
9309
- import { useGlobals as useGlobals3, useStorybookApi as useStorybookApi6 } from "storybook/manager-api";
9349
+ import { useGlobals as useGlobals3, useStorybookApi as useStorybookApi7 } from "storybook/manager-api";
9310
9350
  var Tool = /* @__PURE__ */ __name(() => {
9311
9351
  const [globals, updateGlobals] = useGlobals3();
9312
9352
  const { measureEnabled } = globals || {};
9313
- const api = useStorybookApi6();
9353
+ const api = useStorybookApi7();
9314
9354
  const toggleMeasure = useCallback9(
9315
9355
  () => updateGlobals({
9316
9356
  measureEnabled: !measureEnabled
@@ -9319,7 +9359,7 @@ var Tool = /* @__PURE__ */ __name(() => {
9319
9359
  );
9320
9360
  useEffect18(() => {
9321
9361
  api.setAddonShortcut(ADDON_ID4, {
9322
- label: "Toggle Measure [M]",
9362
+ label: "Toggle Measure",
9323
9363
  defaultShortcut: ["M"],
9324
9364
  actionName: "measure",
9325
9365
  showInMenu: false,
@@ -9358,10 +9398,10 @@ import { addons as addons6, types as types6 } from "storybook/manager-api";
9358
9398
  import React74, { memo as memo6, useCallback as useCallback10, useEffect as useEffect19 } from "react";
9359
9399
  import { IconButton as IconButton9 } from "storybook/internal/components";
9360
9400
  import { OutlineIcon } from "@storybook/icons";
9361
- import { useGlobals as useGlobals4, useStorybookApi as useStorybookApi7 } from "storybook/manager-api";
9401
+ import { useGlobals as useGlobals4, useStorybookApi as useStorybookApi8 } from "storybook/manager-api";
9362
9402
  var OutlineSelector = memo6(/* @__PURE__ */ __name(function OutlineSelector2() {
9363
9403
  const [globals, updateGlobals] = useGlobals4();
9364
- const api = useStorybookApi7();
9404
+ const api = useStorybookApi8();
9365
9405
  const isActive = [true, "true"].includes(globals[PARAM_KEY4]);
9366
9406
  const toggleOutline = useCallback10(
9367
9407
  () => updateGlobals({
@@ -1,23 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_0oz6lpav6bgq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0oz6lpav6bgq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0oz6lpav6bgq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0oz6lpav6bgq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0oz6lpav6bgq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0oz6lpav6bgq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.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
  glob
14
- } from "../../_node-chunks/chunk-UTCFHTQH.js";
14
+ } from "../../_node-chunks/chunk-NJXBURX7.js";
15
15
  import {
16
16
  slash
17
- } from "../../_node-chunks/chunk-J3DQMIO4.js";
17
+ } from "../../_node-chunks/chunk-JNHUDBJL.js";
18
18
  import {
19
19
  __name
20
- } from "../../_node-chunks/chunk-2VMDKLSW.js";
20
+ } from "../../_node-chunks/chunk-XZTBG2TG.js";
21
21
 
22
22
  // src/core-server/utils/remove-mdx-entries.ts
23
23
  import { isAbsolute, join, relative } from "node:path";