storybook 10.0.0-beta.6 → 10.0.0-beta.8

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 (80) hide show
  1. package/dist/_browser-chunks/{chunk-YQV3EGQ5.js → chunk-OQ6NCFPL.js} +38 -15
  2. package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
  3. package/dist/_node-chunks/{builder-manager-V33CQT2M.js → builder-manager-Y34L3HC4.js} +30 -15
  4. package/dist/_node-chunks/camelcase-W6EWLMZP.js +18 -0
  5. package/dist/_node-chunks/{chunk-A7CUP23N.js → chunk-3VCGPS3V.js} +7 -7
  6. package/dist/_node-chunks/{chunk-EAOPWIKA.js → chunk-4QSDBUYK.js} +8 -8
  7. package/dist/_node-chunks/{chunk-UYKQJMQY.js → chunk-4SIVISOF.js} +21 -27
  8. package/dist/_node-chunks/{chunk-MLBTKECD.js → chunk-5SPDSTWP.js} +7 -7
  9. package/dist/_node-chunks/{chunk-VQH4ZFTS.js → chunk-6NAUDAPE.js} +8 -8
  10. package/dist/_node-chunks/{chunk-NUVGSFQI.js → chunk-6SXRGPL6.js} +7 -7
  11. package/dist/_node-chunks/{chunk-2DMFI367.js → chunk-7JZFWQN4.js} +72 -8
  12. package/dist/_node-chunks/{chunk-IINJT47N.js → chunk-7Q5EKYUL.js} +7 -7
  13. package/dist/_node-chunks/{chunk-B3AMFGAL.js → chunk-AND2M2X5.js} +7 -7
  14. package/dist/_node-chunks/{chunk-RIPA4LFD.js → chunk-AZWKFSEJ.js} +108 -76
  15. package/dist/_node-chunks/{chunk-7NJGTQ3W.js → chunk-CL53RP5L.js} +8 -8
  16. package/dist/_node-chunks/{chunk-BNOZ3EKF.js → chunk-CZLW5B2W.js} +7 -7
  17. package/dist/_node-chunks/{chunk-DC7OWBHB.js → chunk-DRNU7FEF.js} +12 -12
  18. package/dist/_node-chunks/{chunk-VSC6LSCQ.js → chunk-EMCS3ZKS.js} +6 -6
  19. package/dist/_node-chunks/{chunk-EY5PTUZL.js → chunk-F43CI3CD.js} +10 -10
  20. package/dist/_node-chunks/{chunk-XZTBG2TG.js → chunk-FRTUAT3V.js} +6 -6
  21. package/dist/_node-chunks/{chunk-JNHUDBJL.js → chunk-HRBWZFVH.js} +7 -7
  22. package/dist/_node-chunks/{chunk-55VWKF63.js → chunk-IE2VBA4V.js} +9 -9
  23. package/dist/_node-chunks/{chunk-5IEY46LQ.js → chunk-JEIQPNWQ.js} +7 -7
  24. package/dist/_node-chunks/{chunk-NKZ4UPPV.js → chunk-JG7IEUS3.js} +7 -7
  25. package/dist/_node-chunks/{chunk-HEBHWRWL.js → chunk-LKGWQEHR.js} +7 -7
  26. package/dist/_node-chunks/{chunk-6PTV7XGR.js → chunk-MIJKYKSO.js} +264 -109
  27. package/dist/_node-chunks/{chunk-F3PO67U3.js → chunk-O33XSHQE.js} +7 -7
  28. package/dist/_node-chunks/{chunk-HPFXREVG.js → chunk-SOIRRZYG.js} +7 -7
  29. package/dist/_node-chunks/chunk-T46D5USU.js +18 -0
  30. package/dist/_node-chunks/{chunk-NJXBURX7.js → chunk-T5VNV7FG.js} +7 -7
  31. package/dist/_node-chunks/{chunk-E6TLN2J2.js → chunk-TL5UYDH2.js} +7 -7
  32. package/dist/_node-chunks/{chunk-JOXYGIZK.js → chunk-UORO6DG4.js} +9 -9
  33. package/dist/_node-chunks/chunk-USP6T4QU.js +62 -0
  34. package/dist/_node-chunks/{chunk-7WH7AGOR.js → chunk-WS3L7DA7.js} +7 -7
  35. package/dist/_node-chunks/{chunk-4TOI4VSK.js → chunk-YMZK6547.js} +7 -7
  36. package/dist/_node-chunks/{dist-CGGAYWME.js → dist-RINWIIFC.js} +9 -9
  37. package/dist/_node-chunks/{globby-3IFB7BJC.js → globby-G3CLKE4Y.js} +9 -9
  38. package/dist/_node-chunks/{lib-IT6OBSID.js → lib-67I574Z7.js} +7 -7
  39. package/dist/_node-chunks/{mdx-N42X6CFJ-WM36SSZ6.js → mdx-N42X6CFJ-6DP2YFMY.js} +8 -8
  40. package/dist/_node-chunks/{p-limit-3V5XIKA7.js → p-limit-JBOY5PGK.js} +7 -7
  41. package/dist/_node-chunks/{plugin-3YREMMJJ.js → plugin-2IR6AOYP.js} +10 -10
  42. package/dist/_node-chunks/{plugin-GJUBUKCT.js → plugin-5XCSTKS6.js} +10 -10
  43. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-DCJQFJQ5.js → webpack-inject-mocker-runtime-plugin-5FUND5HJ.js} +10 -10
  44. package/dist/_node-chunks/{webpack-mock-plugin-XJNFAHBI.js → webpack-mock-plugin-JVWSZ2PI.js} +9 -9
  45. package/dist/babel/index.js +11 -11
  46. package/dist/bin/core.js +11 -11
  47. package/dist/bin/dispatcher.js +11 -11
  48. package/dist/bin/loader.js +8 -8
  49. package/dist/cli/index.js +20 -20
  50. package/dist/common/index.js +20 -21
  51. package/dist/components/index.js +7 -3
  52. package/dist/core-server/index.js +90 -63
  53. package/dist/core-server/presets/common-manager.js +575 -531
  54. package/dist/core-server/presets/common-override-preset.js +9 -9
  55. package/dist/core-server/presets/common-preset.js +22 -22
  56. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  57. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  58. package/dist/csf/index.d.ts +9 -4
  59. package/dist/csf/index.js +37 -8
  60. package/dist/csf-tools/index.d.ts +13 -6
  61. package/dist/csf-tools/index.js +9 -9
  62. package/dist/manager/globals-runtime.js +73 -34
  63. package/dist/manager/runtime.js +501 -257
  64. package/dist/manager-api/index.d.ts +11 -6
  65. package/dist/manager-api/index.js +69 -34
  66. package/dist/node-logger/index.js +14 -14
  67. package/dist/preview/globals.js +1 -1
  68. package/dist/preview/runtime.js +97 -63
  69. package/dist/preview-api/index.d.ts +70 -71
  70. package/dist/preview-api/index.js +1 -1
  71. package/dist/server-errors.js +10 -10
  72. package/dist/telemetry/index.js +23 -24
  73. package/dist/types/index.d.ts +24 -7
  74. package/dist/viewport/index.d.ts +36 -4
  75. package/dist/viewport/index.js +1 -1
  76. package/package.json +1 -33
  77. package/dist/_node-chunks/camelcase-BZ55OCHI.js +0 -18
  78. package/dist/_node-chunks/chunk-FDDJHDCE.js +0 -62
  79. package/dist/_node-chunks/chunk-R5DIBOM6.js +0 -18
  80. package/dist/_node-chunks/chunk-TJIMCNYJ.js +0 -80
@@ -2,7 +2,7 @@ import React, { FC, ReactNode, ReactElement, Component } from 'react';
2
2
  import { Channel, Listener as Listener$1 } from 'storybook/internal/channels';
3
3
  export { Listener as ChannelListener } from 'storybook/internal/channels';
4
4
  import { RouterData, NavigateOptions } from 'storybook/internal/router';
5
- import { Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, Addon_BaseType, Addon_TestProviderType, Addon_PageType, Addon_WrapperType, Addon_Config, API_ProviderData, API_StateMerger, API_Provider, Globals, GlobalTypes, API_PanelPositions, API_Layout, API_LayoutCustomisations, API_UI, API_Notification, API_IframeRenderer, API_ComposedRef, API_SetRefData, API_ComposedRefUpdate, API_Refs, StoryId, API_Settings, API_HashEntry, API_ViewMode, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, Args, API_IndexHash, API_DocsEntry, API_FilterFunction, API_LoadedRefData, API_Version, API_Versions, API_UnknownEntries, API_OptionsData, Parameters, ArgTypes, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn } from 'storybook/internal/types';
5
+ import { Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, Addon_BaseType, Addon_TestProviderType, Addon_PageType, Addon_WrapperType, Addon_Config, API_ProviderData, API_StateMerger, API_Provider, Globals, GlobalTypes, API_PanelPositions, API_Layout, API_LayoutCustomisations, API_UI, API_Notification, API_IframeRenderer, API_ComposedRef, API_SetRefData, API_ComposedRefUpdate, API_Refs, StoryId, API_Settings, API_HashEntry, API_ViewMode, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, API_TestEntry, Args, API_IndexHash, API_DocsEntry, API_FilterFunction, API_LoadedRefData, API_Version, API_Versions, API_UnknownEntries, API_OptionsData, Parameters, ArgTypes, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn } from 'storybook/internal/types';
6
6
  export { Addon_Type as Addon, API_ComponentEntry as ComponentEntry, API_ComposedRef as ComposedRef, API_DocsEntry as DocsEntry, API_GroupEntry as GroupEntry, API_HashEntry as HashEntry, API_IndexHash as IndexHash, API_LeafEntry as LeafEntry, API_Refs as Refs, API_RootEntry as RootEntry, API_IndexHash as StoriesHash, API_StoryEntry as StoryEntry } from 'storybook/internal/types';
7
7
  import { ThemeVars } from 'storybook/theming';
8
8
  import { toId, StoryId as StoryId$1 } from 'storybook/internal/csf';
@@ -271,6 +271,11 @@ interface SubAPI$9 {
271
271
  * account customisations requested by the end user via a layoutCustomisations function.
272
272
  */
273
273
  getShowToolbarWithCustomisations: (showToolbar: boolean) => boolean;
274
+ /**
275
+ * GetShowPanelWithCustomisations - Returns the current visibility of the addon panel, taking into
276
+ * account customisations requested by the end user via a layoutCustomisations function.
277
+ */
278
+ getShowPanelWithCustomisations: (showPanel: boolean) => boolean;
274
279
  /**
275
280
  * GetNavSizeWithCustomisations - Returns the size to apply to the sidebar/nav, taking into
276
281
  * account customisations requested by the end user via a layoutCustomisations function.
@@ -388,7 +393,7 @@ interface SubState$5 {
388
393
 
389
394
  declare const isMacLike: () => boolean;
390
395
  declare const controlOrMetaSymbol: () => "⌘" | "ctrl";
391
- declare const controlOrMetaKey: () => "control" | "meta";
396
+ declare const controlOrMetaKey: () => "meta" | "control";
392
397
  declare const optionOrAltSymbol: () => "⌥" | "alt";
393
398
  declare const isShortcutTaken: (arr1: string[], arr2: string[]) => boolean;
394
399
  type KeyboardEventLike = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'key' | 'code' | 'keyCode' | 'preventDefault'>;
@@ -619,20 +624,20 @@ interface SubAPI$3 {
619
624
  /**
620
625
  * Updates the arguments for the given story with the provided new arguments.
621
626
  *
622
- * @param {API_StoryEntry} story - The story to update the arguments for.
627
+ * @param {API_StoryEntry | API_TestEntry} story - The story to update the arguments for.
623
628
  * @param {Args} newArgs - The new arguments to set for the story.
624
629
  * @returns {void}
625
630
  */
626
- updateStoryArgs(story: API_StoryEntry, newArgs: Args): void;
631
+ updateStoryArgs(story: API_StoryEntry | API_TestEntry, newArgs: Args): void;
627
632
  /**
628
633
  * Resets the arguments for the given story to their initial values.
629
634
  *
630
- * @param {API_StoryEntry} story - The story to reset the arguments for.
635
+ * @param {API_StoryEntry | API_TestEntry} story - The story to reset the arguments for.
631
636
  * @param {string[]} [argNames] - An optional array of argument names to reset. If not provided,
632
637
  * all arguments will be reset.
633
638
  * @returns {void}
634
639
  */
635
- resetStoryArgs: (story: API_StoryEntry, argNames?: string[]) => void;
640
+ resetStoryArgs: (story: API_StoryEntry | API_TestEntry, argNames?: string[]) => void;
636
641
  /**
637
642
  * Finds the leaf entry for the given story ID in the given story index.
638
643
  *
@@ -895,6 +895,7 @@ var transformSetStoriesStoryDataToPreparedStoryIndex = /* @__PURE__ */ __name((s
895
895
  const { argTypes, args, initialArgs } = story;
896
896
  acc[id] = {
897
897
  type: "story",
898
+ subtype: "story",
898
899
  ...base,
899
900
  parameters,
900
901
  argTypes,
@@ -972,19 +973,18 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input, { provider
972
973
  index = index.v === 3 ? transformStoryIndexV3toV4(index) : index;
973
974
  index = index.v === 4 ? transformStoryIndexV4toV5(index) : index;
974
975
  index = index;
975
- const entryValues = Object.values(index.entries).filter((entry) => {
976
- let result = true;
977
- const storyStatuses = allStatuses[entry.id] ?? {};
978
- if (Object.values(storyStatuses).some(({ value }) => value === "status-value:error")) {
979
- return result;
976
+ const indexEntries = Object.values(index.entries);
977
+ const filterFunctions = Object.values(filters);
978
+ const entryValues = indexEntries.filter((entry) => {
979
+ const statuses = allStatuses[entry.id] ?? {};
980
+ if (Object.values(statuses).some(({ value }) => value === "status-value:error")) {
981
+ return true;
980
982
  }
981
- Object.values(filters).forEach((filter) => {
982
- if (result === false) {
983
- return;
984
- }
985
- result = filter({ ...entry, statuses: storyStatuses });
986
- });
987
- return result;
983
+ if (filterFunctions.every((fn) => fn({ ...entry, statuses }))) {
984
+ return true;
985
+ }
986
+ const children = indexEntries.filter((item) => "parent" in item && item.parent === entry.id);
987
+ return children.some((child) => filterFunctions.every((fn) => fn({ ...child, statuses })));
988
988
  });
989
989
  const { sidebar = {} } = provider.getConfig();
990
990
  const { showRoots, collapsedRoots = [], renderLabel } = sidebar;
@@ -1007,7 +1007,7 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input, { provider
1007
1007
  throw new Error(
1008
1008
  dedent`
1009
1009
  Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}'
1010
-
1010
+
1011
1011
  Did you create a path that uses the separator char accidentally, such as 'Vue <docs/>' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128
1012
1012
  `
1013
1013
  );
@@ -1058,36 +1058,60 @@ var transformStoryIndexToStoriesHash = /* @__PURE__ */ __name((input, { provider
1058
1058
  }
1059
1059
  });
1060
1060
  acc[item.id] = {
1061
- type: "story",
1062
1061
  tags: [],
1063
1062
  ...item,
1064
1063
  depth: paths.length,
1065
- parent: paths[paths.length - 1],
1064
+ parent: "parent" in item ? item.parent : paths[paths.length - 1],
1066
1065
  renderLabel,
1067
1066
  prepared: !!item.parameters
1068
1067
  };
1069
1068
  return acc;
1070
1069
  }, {});
1071
1070
  function addItem(acc, item) {
1072
- if (acc[item.id]) {
1073
- return acc;
1074
- }
1075
- acc[item.id] = item;
1076
- if (item.type === "root" || item.type === "group" || item.type === "component") {
1077
- item.children.forEach((childId) => addItem(acc, storiesHashOutOfOrder[childId]));
1078
- item.tags = item.children.reduce((currentTags, childId) => {
1079
- const child = acc[childId];
1080
- return currentTags === null ? child.tags : intersect_default(currentTags, child.tags);
1081
- }, null);
1071
+ if (!acc[item.id]) {
1072
+ acc[item.id] = item;
1073
+ if ("children" in item && item.children) {
1074
+ item.children.forEach((childId) => addItem(acc, storiesHashOutOfOrder[childId]));
1075
+ item.tags = item.children.reduce((currentTags, childId) => {
1076
+ return currentTags === null ? acc[childId].tags : intersect_default(currentTags, acc[childId].tags);
1077
+ }, null) || [];
1078
+ }
1082
1079
  }
1083
1080
  if (item.type === "component") {
1084
- item.importPath = acc[item.children[0]].importPath;
1081
+ const firstChild = acc[item.children[0]];
1082
+ if (firstChild && "importPath" in firstChild) {
1083
+ item.importPath = firstChild.importPath;
1084
+ }
1085
1085
  }
1086
1086
  return acc;
1087
1087
  }
1088
1088
  __name(addItem, "addItem");
1089
- const orphanHash = Object.values(storiesHashOutOfOrder).filter((i) => i.type !== "root" && !i.parent).reduce(addItem, {});
1090
- return Object.values(storiesHashOutOfOrder).filter((i) => i.type === "root").reduce(addItem, orphanHash);
1089
+ let storiesHash = Object.values(storiesHashOutOfOrder).filter((i) => i.type !== "root" && !i.parent).reduce((acc, item) => addItem(acc, item), {});
1090
+ storiesHash = Object.values(storiesHashOutOfOrder).filter((i) => i.type === "root").reduce(addItem, storiesHash);
1091
+ storiesHash = Object.values(storiesHash).reduce((acc, item) => {
1092
+ if (item.type === "story" && item.subtype === "test") {
1093
+ const story = acc[item.parent];
1094
+ const component = acc[story.parent];
1095
+ acc[component.id] = {
1096
+ ...component,
1097
+ // Remove test from the component node as it will be attached to the story node instead
1098
+ children: component.children && component.children.filter((id) => id !== item.id)
1099
+ };
1100
+ acc[story.id] = {
1101
+ ...story,
1102
+ // Add test to the story node
1103
+ children: (story.children || []).concat(item.id)
1104
+ };
1105
+ acc[item.id] = {
1106
+ ...item,
1107
+ depth: item.depth + 1
1108
+ };
1109
+ } else {
1110
+ acc[item.id] = item;
1111
+ }
1112
+ return acc;
1113
+ }, {});
1114
+ return storiesHash;
1091
1115
  }, "transformStoryIndexToStoriesHash");
1092
1116
  var addPreparedStories = /* @__PURE__ */ __name((newHash, oldHash) => {
1093
1117
  if (!oldHash) {
@@ -1097,6 +1121,9 @@ var addPreparedStories = /* @__PURE__ */ __name((newHash, oldHash) => {
1097
1121
  Object.entries(newHash).map(([id, newEntry]) => {
1098
1122
  const oldEntry = oldHash[id];
1099
1123
  if (newEntry.type === "story" && oldEntry?.type === "story" && oldEntry.prepared) {
1124
+ if ("children" in oldEntry) {
1125
+ delete oldEntry.children;
1126
+ }
1100
1127
  return [id, { ...oldEntry, ...newEntry, prepared: true }];
1101
1128
  }
1102
1129
  return [id, newEntry];
@@ -1704,6 +1731,13 @@ var init5 = /* @__PURE__ */ __name(({ store: store2, provider, singleStory }) =>
1704
1731
  }
1705
1732
  return showToolbar;
1706
1733
  },
1734
+ getShowPanelWithCustomisations(showPanel) {
1735
+ const state = store2.getState();
1736
+ if (isFunction(state.layoutCustomisations.showPanel)) {
1737
+ return state.layoutCustomisations.showPanel(state, showPanel) ?? showPanel;
1738
+ }
1739
+ return showPanel;
1740
+ },
1707
1741
  getNavSizeWithCustomisations(navSize) {
1708
1742
  const state = store2.getState();
1709
1743
  if (isFunction(state.layoutCustomisations.showSidebar)) {
@@ -1812,7 +1846,6 @@ import {
1812
1846
  OPEN_IN_EDITOR_RESPONSE
1813
1847
  } from "storybook/internal/core-events";
1814
1848
  import { FailedIcon } from "@storybook/icons";
1815
- import { color } from "storybook/theming";
1816
1849
  var init7 = /* @__PURE__ */ __name(({ provider, fullAPI }) => {
1817
1850
  const api = {
1818
1851
  openInEditor(payload) {
@@ -1834,6 +1867,7 @@ var init7 = /* @__PURE__ */ __name(({ provider, fullAPI }) => {
1834
1867
  api,
1835
1868
  state,
1836
1869
  init: /* @__PURE__ */ __name(async () => {
1870
+ const { color } = await import("../theming/index.js");
1837
1871
  provider.channel?.on(OPEN_IN_EDITOR_RESPONSE, (payload) => {
1838
1872
  if (payload.error !== null) {
1839
1873
  fullAPI.addNotification({
@@ -2730,8 +2764,9 @@ var init11 = /* @__PURE__ */ __name(({
2730
2764
  }
2731
2765
  if (node.type === "story") {
2732
2766
  results.push(node.id);
2733
- } else if ("children" in node) {
2734
- node.children.forEach((childId) => findChildEntriesRecursively(childId, results));
2767
+ }
2768
+ if ("children" in node) {
2769
+ node.children?.forEach((childId) => findChildEntriesRecursively(childId, results));
2735
2770
  }
2736
2771
  return results;
2737
2772
  }, "findChildEntriesRecursively");
@@ -3254,7 +3289,7 @@ import { global as global8 } from "@storybook/global";
3254
3289
  import semver from "semver";
3255
3290
 
3256
3291
  // src/manager-api/version.ts
3257
- var version = "10.0.0-beta.6";
3292
+ var version = "10.0.0-beta.8";
3258
3293
 
3259
3294
  // src/manager-api/modules/versions.ts
3260
3295
  var { VERSIONCHECK } = global8;
@@ -3371,7 +3406,7 @@ import {
3371
3406
  } from "storybook/internal/core-events";
3372
3407
  import { global as global9 } from "@storybook/global";
3373
3408
  var WHATS_NEW_NOTIFICATION_ID = "whats-new";
3374
- var StorybookIcon = /* @__PURE__ */ __name(({ color: color2 = "currentColor", size = 14 }) => {
3409
+ var StorybookIcon = /* @__PURE__ */ __name(({ color = "currentColor", size = 14 }) => {
3375
3410
  return React3.createElement(
3376
3411
  "svg",
3377
3412
  {
@@ -3387,7 +3422,7 @@ var StorybookIcon = /* @__PURE__ */ __name(({ color: color2 = "currentColor", si
3387
3422
  fillRule: "evenodd",
3388
3423
  clipRule: "evenodd",
3389
3424
  d: "M2.042.616a.704.704 0 00-.66.729L1.816 12.9c.014.367.306.66.672.677l9.395.422h.032a.704.704 0 00.704-.703V.704c0-.015 0-.03-.002-.044a.704.704 0 00-.746-.659l-.773.049.057 1.615a.105.105 0 01-.17.086l-.52-.41-.617.468a.105.105 0 01-.168-.088L9.746.134 2.042.616zm8.003 4.747c-.247.192-2.092.324-2.092.05.04-1.045-.429-1.091-.689-1.091-.247 0-.662.075-.662.634 0 .57.607.893 1.32 1.27 1.014.538 2.24 1.188 2.24 2.823 0 1.568-1.273 2.433-2.898 2.433-1.676 0-3.141-.678-2.976-3.03.065-.275 2.197-.21 2.197 0-.026.971.195 1.256.753 1.256.43 0 .624-.236.624-.634 0-.602-.633-.958-1.361-1.367-.987-.554-2.148-1.205-2.148-2.7 0-1.494 1.027-2.489 2.86-2.489 1.832 0 2.832.98 2.832 2.845z",
3390
- fill: color2
3425
+ fill: color
3391
3426
  }
3392
3427
  )
3393
3428
  );
@@ -1,43 +1,43 @@
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";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
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);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.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
  require_pretty_hrtime
14
- } from "../_node-chunks/chunk-NUVGSFQI.js";
14
+ } from "../_node-chunks/chunk-6SXRGPL6.js";
15
15
  import {
16
16
  ansi_styles_default,
17
17
  boxen,
18
18
  require_string_width,
19
19
  stripAnsi
20
- } from "../_node-chunks/chunk-EAOPWIKA.js";
21
- import "../_node-chunks/chunk-A7CUP23N.js";
20
+ } from "../_node-chunks/chunk-4QSDBUYK.js";
21
+ import "../_node-chunks/chunk-3VCGPS3V.js";
22
22
  import {
23
23
  execaSync,
24
24
  optionalEnvToBoolean
25
- } from "../_node-chunks/chunk-55VWKF63.js";
26
- import "../_node-chunks/chunk-F3PO67U3.js";
25
+ } from "../_node-chunks/chunk-IE2VBA4V.js";
26
+ import "../_node-chunks/chunk-O33XSHQE.js";
27
27
  import {
28
28
  require_prompts,
29
29
  require_src
30
- } from "../_node-chunks/chunk-E6TLN2J2.js";
30
+ } from "../_node-chunks/chunk-TL5UYDH2.js";
31
31
  import {
32
32
  require_picocolors
33
- } from "../_node-chunks/chunk-5IEY46LQ.js";
33
+ } from "../_node-chunks/chunk-JEIQPNWQ.js";
34
34
  import {
35
35
  __commonJS,
36
36
  __export,
37
37
  __name,
38
38
  __require,
39
39
  __toESM
40
- } from "../_node-chunks/chunk-XZTBG2TG.js";
40
+ } from "../_node-chunks/chunk-FRTUAT3V.js";
41
41
 
42
42
  // ../node_modules/are-we-there-yet/lib/tracker-base.js
43
43
  var require_tracker_base = __commonJS({
@@ -11,7 +11,7 @@ var globalsNameReferenceMap = {
11
11
  "storybook/internal/core-events": "__STORYBOOK_MODULE_CORE_EVENTS__",
12
12
  "storybook/internal/preview-errors": "__STORYBOOK_MODULE_CORE_EVENTS_PREVIEW_ERRORS__",
13
13
  "storybook/internal/types": "__STORYBOOK_MODULE_TYPES__",
14
- // @deprecated TODO: Remove in 9.1
14
+ // @deprecated TODO: Remove in 9.1 or some point in the future, I guess
15
15
  "storybook/internal/preview-api": "__STORYBOOK_MODULE_PREVIEW_API__"
16
16
  };
17
17
  var globalPackages = Object.keys(globalsNameReferenceMap);
@@ -21115,7 +21115,7 @@ var globalsNameReferenceMap = {
21115
21115
  "storybook/internal/core-events": "__STORYBOOK_MODULE_CORE_EVENTS__",
21116
21116
  "storybook/internal/preview-errors": "__STORYBOOK_MODULE_CORE_EVENTS_PREVIEW_ERRORS__",
21117
21117
  "storybook/internal/types": "__STORYBOOK_MODULE_TYPES__",
21118
- // @deprecated TODO: Remove in 9.1
21118
+ // @deprecated TODO: Remove in 9.1 or some point in the future, I guess
21119
21119
  "storybook/internal/preview-api": "__STORYBOOK_MODULE_PREVIEW_API__"
21120
21120
  };
21121
21121
  var globalPackages = Object.keys(globalsNameReferenceMap);
@@ -24911,6 +24911,55 @@ var includeConditionalArg = /* @__PURE__ */ __name((argType, args, globals) => {
24911
24911
  return testValue(argType.if, value);
24912
24912
  }, "includeConditionalArg");
24913
24913
 
24914
+ // src/preview-api/modules/preview-web/render/mount-utils.ts
24915
+ function mountDestructured(playFunction) {
24916
+ return playFunction != null && getUsedProps(playFunction).includes("mount");
24917
+ }
24918
+ __name(mountDestructured, "mountDestructured");
24919
+ function getUsedProps(fn3) {
24920
+ const match = fn3.toString().match(/[^(]*\(([^)]*)/);
24921
+ if (!match) {
24922
+ return [];
24923
+ }
24924
+ const args = splitByComma(match[1]);
24925
+ if (!args.length) {
24926
+ return [];
24927
+ }
24928
+ const first = args[0];
24929
+ if (!(first.startsWith("{") && first.endsWith("}"))) {
24930
+ return [];
24931
+ }
24932
+ const props = splitByComma(first.slice(1, -1).replace(/\s/g, "")).map((prop) => {
24933
+ return prop.replace(/:.*|=.*/g, "");
24934
+ });
24935
+ return props;
24936
+ }
24937
+ __name(getUsedProps, "getUsedProps");
24938
+ function splitByComma(s3) {
24939
+ const result = [];
24940
+ const stack = [];
24941
+ let start = 0;
24942
+ for (let i2 = 0; i2 < s3.length; i2++) {
24943
+ if (s3[i2] === "{" || s3[i2] === "[") {
24944
+ stack.push(s3[i2] === "{" ? "}" : "]");
24945
+ } else if (s3[i2] === stack[stack.length - 1]) {
24946
+ stack.pop();
24947
+ } else if (!stack.length && s3[i2] === ",") {
24948
+ const token = s3.substring(start, i2).trim();
24949
+ if (token) {
24950
+ result.push(token);
24951
+ }
24952
+ start = i2 + 1;
24953
+ }
24954
+ }
24955
+ const lastToken = s3.substring(start).trim();
24956
+ if (lastToken) {
24957
+ result.push(lastToken);
24958
+ }
24959
+ return result;
24960
+ }
24961
+ __name(splitByComma, "splitByComma");
24962
+
24914
24963
  // src/actions/addArgs.ts
24915
24964
  var addArgs_exports = {};
24916
24965
  __export(addArgs_exports, {
@@ -49462,10 +49511,21 @@ function definePreviewAddon(preview) {
49462
49511
  return preview;
49463
49512
  }
49464
49513
  __name(definePreviewAddon, "definePreviewAddon");
49514
+ function isMeta(input2) {
49515
+ return input2 != null && typeof input2 === "object" && "_tag" in input2 && input2?._tag === "Meta";
49516
+ }
49517
+ __name(isMeta, "isMeta");
49465
49518
  function isStory(input2) {
49466
49519
  return input2 != null && typeof input2 === "object" && "_tag" in input2 && input2?._tag === "Story";
49467
49520
  }
49468
49521
  __name(isStory, "isStory");
49522
+ function getStoryChildren(story) {
49523
+ if ("__children" in story) {
49524
+ return story.__children;
49525
+ }
49526
+ return [];
49527
+ }
49528
+ __name(getStoryChildren, "getStoryChildren");
49469
49529
 
49470
49530
  // src/csf/index.ts
49471
49531
  var sanitize = /* @__PURE__ */ __name((string) => {
@@ -49479,6 +49539,7 @@ var sanitizeSafe = /* @__PURE__ */ __name((string, part) => {
49479
49539
  return sanitized;
49480
49540
  }, "sanitizeSafe");
49481
49541
  var toId = /* @__PURE__ */ __name((kind, name) => `${sanitizeSafe(kind, "kind")}${name ? `--${sanitizeSafe(name, "name")}` : ""}`, "toId");
49542
+ var toTestId = /* @__PURE__ */ __name((parentId, testName2) => `${parentId}:${sanitizeSafe(testName2, "test")}`, "toTestId");
49482
49543
  var storyNameFromExport = /* @__PURE__ */ __name((key) => toStartCaseStr(key), "storyNameFromExport");
49483
49544
  function matches3(storyKey, arrayOrRegex) {
49484
49545
  if (Array.isArray(arrayOrRegex)) {
@@ -49835,6 +49896,13 @@ var map = /* @__PURE__ */ __name((arg, argType) => {
49835
49896
  const mapped = map(val, { type: type5.value[key] });
49836
49897
  return mapped === INCOMPATIBLE ? acc : Object.assign(acc, { [key]: mapped });
49837
49898
  }, {});
49899
+ case "other": {
49900
+ const isPrimitiveArg = typeof arg === "string" || typeof arg === "number" || typeof arg === "boolean";
49901
+ if (type5.value === "ReactNode" && isPrimitiveArg) {
49902
+ return arg;
49903
+ }
49904
+ return INCOMPATIBLE;
49905
+ }
49838
49906
  default:
49839
49907
  return INCOMPATIBLE;
49840
49908
  }
@@ -50245,9 +50313,17 @@ function processCSFFile(moduleExports, importPath, title) {
50245
50313
  const csfFile2 = { meta: meta2, stories: {}, moduleExports };
50246
50314
  Object.keys(namedExports).forEach((key) => {
50247
50315
  if (isExportStory(key, meta2)) {
50248
- const storyMeta = normalizeStory(key, namedExports[key].input, meta2);
50316
+ const story = namedExports[key];
50317
+ const storyMeta = normalizeStory(key, story.input, meta2);
50249
50318
  checkDisallowedParameters(storyMeta.parameters);
50250
50319
  csfFile2.stories[storyMeta.id] = storyMeta;
50320
+ getStoryChildren(story).forEach((child) => {
50321
+ const name = child.input.name;
50322
+ const childId = toTestId(storyMeta.id, name);
50323
+ child.input.parameters ??= {};
50324
+ child.input.parameters.__id = childId;
50325
+ csfFile2.stories[childId] = normalizeStory(name, child.input, meta2);
50326
+ });
50251
50327
  }
50252
50328
  });
50253
50329
  csfFile2.projectAnnotations = firstStory.meta.preview.composed;
@@ -50271,55 +50347,6 @@ function processCSFFile(moduleExports, importPath, title) {
50271
50347
  }
50272
50348
  __name(processCSFFile, "processCSFFile");
50273
50349
 
50274
- // src/preview-api/modules/preview-web/render/mount-utils.ts
50275
- function mountDestructured(playFunction) {
50276
- return playFunction != null && getUsedProps(playFunction).includes("mount");
50277
- }
50278
- __name(mountDestructured, "mountDestructured");
50279
- function getUsedProps(fn3) {
50280
- const match = fn3.toString().match(/[^(]*\(([^)]*)/);
50281
- if (!match) {
50282
- return [];
50283
- }
50284
- const args = splitByComma(match[1]);
50285
- if (!args.length) {
50286
- return [];
50287
- }
50288
- const first = args[0];
50289
- if (!(first.startsWith("{") && first.endsWith("}"))) {
50290
- return [];
50291
- }
50292
- const props = splitByComma(first.slice(1, -1).replace(/\s/g, "")).map((prop) => {
50293
- return prop.replace(/:.*|=.*/g, "");
50294
- });
50295
- return props;
50296
- }
50297
- __name(getUsedProps, "getUsedProps");
50298
- function splitByComma(s3) {
50299
- const result = [];
50300
- const stack = [];
50301
- let start = 0;
50302
- for (let i2 = 0; i2 < s3.length; i2++) {
50303
- if (s3[i2] === "{" || s3[i2] === "[") {
50304
- stack.push(s3[i2] === "{" ? "}" : "]");
50305
- } else if (s3[i2] === stack[stack.length - 1]) {
50306
- stack.pop();
50307
- } else if (!stack.length && s3[i2] === ",") {
50308
- const token = s3.substring(start, i2).trim();
50309
- if (token) {
50310
- result.push(token);
50311
- }
50312
- start = i2 + 1;
50313
- }
50314
- }
50315
- const lastToken = s3.substring(start).trim();
50316
- if (lastToken) {
50317
- result.push(lastToken);
50318
- }
50319
- return result;
50320
- }
50321
- __name(splitByComma, "splitByComma");
50322
-
50323
50350
  // src/preview-api/modules/store/decorators.ts
50324
50351
  function decorateStory(storyFn, decorator, bindWithContext) {
50325
50352
  const boundStoryFunction = bindWithContext(storyFn);
@@ -50500,11 +50527,13 @@ __name(prepareMeta, "prepareMeta");
50500
50527
  function preparePartialAnnotations(storyAnnotations, componentAnnotations, projectAnnotations) {
50501
50528
  const defaultTags = ["dev", "test"];
50502
50529
  const extraTags = scope.DOCS_OPTIONS?.autodocs === true ? ["autodocs"] : [];
50530
+ const overrideTags = storyAnnotations?.tags?.includes("test-fn") ? ["!autodocs"] : [];
50503
50531
  const tags = combineTags(
50504
50532
  ...defaultTags,
50505
50533
  ...extraTags,
50506
50534
  ...projectAnnotations.tags ?? [],
50507
50535
  ...componentAnnotations.tags ?? [],
50536
+ ...overrideTags,
50508
50537
  ...storyAnnotations?.tags ?? []
50509
50538
  );
50510
50539
  const parameters2 = combineParameters(
@@ -50960,7 +50989,7 @@ function getCsfFactoryAnnotations(story, meta, projectAnnotations) {
50960
50989
  story: story.input,
50961
50990
  meta: story.meta.input,
50962
50991
  preview: story.meta.preview.composed
50963
- } : { story, meta, preview: projectAnnotations };
50992
+ } : { story, meta: isMeta(meta) ? meta.input : meta, preview: projectAnnotations };
50964
50993
  }
50965
50994
  __name(getCsfFactoryAnnotations, "getCsfFactoryAnnotations");
50966
50995
 
@@ -51359,7 +51388,7 @@ var _StoryStore = class _StoryStore {
51359
51388
  return { entryExports, csfFiles };
51360
51389
  }
51361
51390
  // A prepared story does not include args, globals or hooks. These are stored in the story store
51362
- // and updated separtely to the (immutable) story.
51391
+ // and updated separately to the (immutable) story.
51363
51392
  getStoryContext(story, { forceInitialArgs = false } = {}) {
51364
51393
  const userGlobals = this.userGlobals.get();
51365
51394
  const { initialGlobals: initialGlobals5 } = this.userGlobals;
@@ -51393,21 +51422,25 @@ var _StoryStore = class _StoryStore {
51393
51422
  }
51394
51423
  extract(options = { includeDocsOnly: false }) {
51395
51424
  const { cachedCSFFiles } = this;
51425
+ console.log("extract: extracting stories", cachedCSFFiles);
51396
51426
  if (!cachedCSFFiles) {
51397
51427
  throw new CalledExtractOnStoreError();
51398
51428
  }
51399
- return Object.entries(this.storyIndex.entries).reduce(
51400
- (acc, [storyId, { type: type5, importPath }]) => {
51401
- if (type5 === "docs") {
51429
+ const stories = Object.entries(this.storyIndex.entries).reduce(
51430
+ (acc, [storyId, entry]) => {
51431
+ if (entry.type === "docs") {
51402
51432
  return acc;
51403
51433
  }
51404
- const csfFile = cachedCSFFiles[importPath];
51434
+ const csfFile = cachedCSFFiles[entry.importPath];
51405
51435
  const story = this.storyFromCSFFile({ storyId, csfFile });
51406
51436
  if (!options.includeDocsOnly && story.parameters.docsOnly) {
51407
51437
  return acc;
51408
51438
  }
51409
51439
  acc[storyId] = Object.entries(story).reduce(
51410
51440
  (storyAcc, [key, value]) => {
51441
+ if (key === "story" && entry.subtype === "test") {
51442
+ return { ...storyAcc, story: entry.parentName };
51443
+ }
51411
51444
  if (key === "moduleExport") {
51412
51445
  return storyAcc;
51413
51446
  }
@@ -51420,19 +51453,21 @@ var _StoryStore = class _StoryStore {
51420
51453
  return Object.assign(storyAcc, { [key]: value });
51421
51454
  },
51422
51455
  {
51423
- //
51424
51456
  args: story.initialArgs,
51425
51457
  globals: {
51426
51458
  ...this.userGlobals.initialGlobals,
51427
51459
  ...this.userGlobals.globals,
51428
51460
  ...story.storyGlobals
51429
- }
51461
+ },
51462
+ storyId: entry.parent ? entry.parent : storyId
51430
51463
  }
51431
51464
  );
51432
51465
  return acc;
51433
51466
  },
51434
51467
  {}
51435
51468
  );
51469
+ console.log("extract: stories", stories);
51470
+ return stories;
51436
51471
  }
51437
51472
  };
51438
51473
  __name(_StoryStore, "StoryStore");
@@ -51590,7 +51625,7 @@ var sortStoriesV7 = /* @__PURE__ */ __name((stories, storySortParameter, fileNam
51590
51625
  Error sorting stories with sort parameter ${storySortParameter}:
51591
51626
 
51592
51627
  > ${err.message}
51593
-
51628
+
51594
51629
  Are you using a V6-style sort function in V7 mode?
51595
51630
 
51596
51631
  More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
@@ -51648,16 +51683,15 @@ var _StoryRender = class _StoryRender {
51648
51683
  }
51649
51684
  }
51650
51685
  checkIfAborted(signal) {
51651
- if (signal.aborted) {
51686
+ if (signal.aborted && !["finished", "aborted", "errored"].includes(this.phase)) {
51652
51687
  this.phase = "aborted";
51653
51688
  this.channel.emit(STORY_RENDER_PHASE_CHANGED, {
51654
51689
  newPhase: this.phase,
51655
51690
  renderId: this.renderId,
51656
51691
  storyId: this.id
51657
51692
  });
51658
- return true;
51659
51693
  }
51660
- return false;
51694
+ return signal.aborted;
51661
51695
  }
51662
51696
  async prepare() {
51663
51697
  await this.runPhase(this.abortController.signal, "preparing", async () => {