storybook 10.2.0-alpha.8 → 10.2.0-beta.0

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 (97) hide show
  1. package/dist/_browser-chunks/{Color-E5XDEOX4.js → Color-XESOIGZP.js} +57 -3
  2. package/dist/_browser-chunks/chunk-AFVOZMXQ.js +23 -0
  3. package/dist/_browser-chunks/{chunk-3PJE6VLG.js → chunk-ASKQZAOS.js} +1 -12
  4. package/dist/_browser-chunks/chunk-IYCKG66Y.js +171 -0
  5. package/dist/_browser-chunks/chunk-LCHBOIHN.js +64 -0
  6. package/dist/_browser-chunks/{chunk-IPA5A322.js → chunk-MEXTPDJG.js} +1 -1
  7. package/dist/_browser-chunks/{chunk-54PNNATT.js → chunk-NQJGOFZV.js} +18 -1
  8. package/dist/_browser-chunks/{chunk-VUZYLZ4B.js → chunk-QOXZ7W26.js} +31 -15
  9. package/dist/_browser-chunks/{chunk-LOTN4ZCW.js → chunk-SI6AKD4S.js} +2 -2
  10. package/dist/_browser-chunks/chunk-YK43Z22A.js +263 -0
  11. package/dist/_node-chunks/{builder-manager-2XASU3VS.js → builder-manager-JEJE63VV.js} +15 -12
  12. package/dist/_node-chunks/camelcase-HALRJETF.js +62 -0
  13. package/dist/_node-chunks/{chunk-5GRHJJHD.js → chunk-3SKE4CCB.js} +9 -9
  14. package/dist/_node-chunks/chunk-4UYAC7Y2.js +18 -0
  15. package/dist/_node-chunks/{chunk-S7FIFCTX.js → chunk-6UAQEBJX.js} +10 -10
  16. package/dist/_node-chunks/{chunk-ZKB7MQRR.js → chunk-72K4WVI5.js} +18 -14
  17. package/dist/_node-chunks/{chunk-6TJUL42C.js → chunk-7ZX5CX6B.js} +15 -69
  18. package/dist/_node-chunks/{chunk-LEZENLG7.js → chunk-ADTWC7QJ.js} +7 -7
  19. package/dist/_node-chunks/{chunk-2OC7H5MZ.js → chunk-APUXGW3Y.js} +7 -7
  20. package/dist/_node-chunks/{chunk-5WQXPM6D.js → chunk-AXDM43NU.js} +6 -6
  21. package/dist/_node-chunks/{chunk-LOXLI4XT.js → chunk-B422K4XV.js} +6 -6
  22. package/dist/_node-chunks/{chunk-3K6P75SS.js → chunk-BJOXVTWM.js} +12 -571
  23. package/dist/_node-chunks/{chunk-TTGXODEY.js → chunk-BLGRU6F5.js} +7 -7
  24. package/dist/_node-chunks/{chunk-2KSITKBI.js → chunk-CG47ALAV.js} +7 -7
  25. package/dist/_node-chunks/chunk-FH4FRUMP.js +23 -0
  26. package/dist/_node-chunks/{chunk-DTM4A3DJ.js → chunk-GBZ23FIZ.js} +125 -73
  27. package/dist/_node-chunks/{chunk-IJ34563N.js → chunk-IZ3ATSWZ.js} +5262 -1480
  28. package/dist/_node-chunks/{chunk-JWL5NLJU.js → chunk-IZFEBWVB.js} +6 -6
  29. package/dist/_node-chunks/{chunk-5BRYY6XB.js → chunk-KL5CKFPT.js} +9 -9
  30. package/dist/_node-chunks/{chunk-COGO4JMD.js → chunk-MLXCYULR.js} +7 -7
  31. package/dist/_node-chunks/{chunk-7B4JYHGV.js → chunk-MV2QM7P3.js} +6 -6
  32. package/dist/_node-chunks/chunk-PHX5XNP7.js +144 -0
  33. package/dist/_node-chunks/{chunk-VJFHZL2T.js → chunk-QL6L57W7.js} +533 -144
  34. package/dist/_node-chunks/{chunk-Q6WPGVIW.js → chunk-RPBXVPRB.js} +6 -6
  35. package/dist/_node-chunks/{chunk-DYQ6QR45.js → chunk-UH2GWMFP.js} +260 -162
  36. package/dist/_node-chunks/chunk-WNGL2VRJ.js +126 -0
  37. package/dist/_node-chunks/{chunk-WKC523P7.js → chunk-XAL452XB.js} +36 -14
  38. package/dist/_node-chunks/{chunk-UNHOAAXU.js → chunk-YVXXMWQO.js} +7 -7
  39. package/dist/_node-chunks/chunk-YYDL7JOC.js +61 -0
  40. package/dist/_node-chunks/{chunk-MLYPMYG5.js → chunk-Z7FLE2TR.js} +6 -6
  41. package/dist/_node-chunks/{globby-FWMT4OOQ.js → globby-4D4NBVG7.js} +11 -20
  42. package/dist/_node-chunks/{lib-YCGXIMW5.js → lib-RM2DWHZQ.js} +7 -7
  43. package/dist/_node-chunks/{mdx-N42X6CFJ-CRGM5LTU.js → mdx-N42X6CFJ-RAL72UTP.js} +8 -8
  44. package/dist/_node-chunks/{p-limit-UJIYI4QT.js → p-limit-6PUJQL5X.js} +18 -14
  45. package/dist/babel/index.js +10 -10
  46. package/dist/bin/core.js +12 -12
  47. package/dist/bin/dispatcher.js +11 -11
  48. package/dist/bin/loader.js +9 -9
  49. package/dist/cli/index.d.ts +1504 -424
  50. package/dist/cli/index.js +18 -18
  51. package/dist/common/index.d.ts +1319 -271
  52. package/dist/common/index.js +22 -22
  53. package/dist/components/index.d.ts +4 -1
  54. package/dist/components/index.js +228 -227
  55. package/dist/core-events/index.d.ts +23 -7
  56. package/dist/core-events/index.js +5 -1
  57. package/dist/core-server/index.d.ts +108 -4
  58. package/dist/core-server/index.js +3459 -3086
  59. package/dist/core-server/presets/common-manager.js +208 -160
  60. package/dist/core-server/presets/common-override-preset.js +11 -11
  61. package/dist/core-server/presets/common-preset.js +576 -4536
  62. package/dist/csf/index.d.ts +147 -15
  63. package/dist/csf/index.js +52 -23
  64. package/dist/csf-tools/index.d.ts +19 -1
  65. package/dist/csf-tools/index.js +11 -9
  66. package/dist/docs-tools/index.d.ts +2 -2
  67. package/dist/docs-tools/index.js +4 -5
  68. package/dist/manager/globals-runtime.js +2749 -6907
  69. package/dist/manager/runtime.js +2939 -2295
  70. package/dist/manager-api/index.d.ts +89 -21
  71. package/dist/manager-api/index.js +82 -23
  72. package/dist/mocking-utils/index.js +8 -8
  73. package/dist/node-logger/index.d.ts +1453 -108
  74. package/dist/node-logger/index.js +9 -9
  75. package/dist/preview/runtime.js +784 -5059
  76. package/dist/preview-api/index.d.ts +26 -1
  77. package/dist/preview-api/index.js +11 -8
  78. package/dist/router/index.js +5 -4
  79. package/dist/server-errors.js +11 -11
  80. package/dist/telemetry/index.d.ts +14 -2
  81. package/dist/telemetry/index.js +23 -22
  82. package/dist/theming/index.d.ts +5 -5
  83. package/dist/theming/index.js +21 -2
  84. package/dist/types/index.d.ts +24 -11
  85. package/dist/viewport/index.d.ts +5 -3
  86. package/dist/viewport/index.js +12 -3
  87. package/package.json +27 -26
  88. package/dist/_browser-chunks/chunk-2NDLAB5X.js +0 -363
  89. package/dist/_browser-chunks/chunk-CLSHX4VX.js +0 -4140
  90. package/dist/_browser-chunks/chunk-HPYUT3WS.js +0 -199
  91. package/dist/_browser-chunks/chunk-XCZK5QUJ.js +0 -0
  92. package/dist/_node-chunks/camelcase-KIWRHB2G.js +0 -37
  93. package/dist/_node-chunks/chunk-2ANLCK4Y.js +0 -18
  94. package/dist/_node-chunks/chunk-3TW66YXG.js +0 -70
  95. package/dist/_node-chunks/chunk-UFXCGC4W.js +0 -23
  96. package/dist/_node-chunks/chunk-X4YDIHYE.js +0 -61
  97. package/dist/_node-chunks/dist-GICI6ZHU.js +0 -121
@@ -8,8 +8,9 @@ import {
8
8
  } from "../../_browser-chunks/chunk-UAYGIC3L.js";
9
9
  import "../../_browser-chunks/chunk-242VQQM5.js";
10
10
  import {
11
- dequal
12
- } from "../../_browser-chunks/chunk-54PNNATT.js";
11
+ dequal,
12
+ uniq
13
+ } from "../../_browser-chunks/chunk-NQJGOFZV.js";
13
14
  import {
14
15
  ADDON_ID as ADDON_ID3,
15
16
  ADDON_ID2 as ADDON_ID4,
@@ -37,12 +38,9 @@ import {
37
38
  } from "../../_browser-chunks/chunk-V2VKKSMQ.js";
38
39
  import {
39
40
  cloneDeep,
40
- pickBy,
41
- uniq
42
- } from "../../_browser-chunks/chunk-CLSHX4VX.js";
43
- import "../../_browser-chunks/chunk-HPYUT3WS.js";
44
- import "../../_browser-chunks/chunk-2NDLAB5X.js";
45
- import "../../_browser-chunks/chunk-NZMVUW5T.js";
41
+ pickBy
42
+ } from "../../_browser-chunks/chunk-YK43Z22A.js";
43
+ import "../../_browser-chunks/chunk-LCHBOIHN.js";
46
44
  import {
47
45
  ADDON_ID,
48
46
  CLEAR_ID,
@@ -51,9 +49,8 @@ import {
51
49
  PARAM_KEY
52
50
  } from "../../_browser-chunks/chunk-6XWLIJQL.js";
53
51
  import {
54
- MINIMAL_VIEWPORTS,
55
- responsiveViewport
56
- } from "../../_browser-chunks/chunk-3PJE6VLG.js";
52
+ MINIMAL_VIEWPORTS
53
+ } from "../../_browser-chunks/chunk-ASKQZAOS.js";
57
54
  import {
58
55
  ADDON_ID as ADDON_ID2,
59
56
  PARAM_KEY as PARAM_KEY2,
@@ -65,7 +62,7 @@ import {
65
62
 
66
63
  // src/core-server/presets/common-manager.ts
67
64
  import { global as global3 } from "@storybook/global";
68
- import { addons as addons8 } from "storybook/manager-api";
65
+ import { addons as addons8, Tag } from "storybook/manager-api";
69
66
 
70
67
  // src/controls/manager.tsx
71
68
  import React28 from "react";
@@ -77,7 +74,6 @@ import { color } from "storybook/theming";
77
74
 
78
75
  // src/controls/components/ControlsPanel.tsx
79
76
  import React26, { useEffect as useEffect8, useMemo as useMemo3, useState as useState11 } from "react";
80
- import { ScrollArea } from "storybook/internal/components";
81
77
  import { global } from "@storybook/global";
82
78
  import {
83
79
  useArgTypes,
@@ -2768,7 +2764,7 @@ var FilesControl = ({
2768
2764
  };
2769
2765
 
2770
2766
  // ../addons/docs/src/blocks/controls/index.tsx
2771
- var LazyColorControl = lazy(() => import("../../_browser-chunks/Color-E5XDEOX4.js")), ColorControl = (props) => React16.createElement(Suspense, { fallback: React16.createElement("div", null) }, React16.createElement(LazyColorControl, { ...props }));
2767
+ var LazyColorControl = lazy(() => import("../../_browser-chunks/Color-XESOIGZP.js")), ColorControl = (props) => React16.createElement(Suspense, { fallback: React16.createElement("div", null) }, React16.createElement(LazyColorControl, { ...props }));
2772
2768
 
2773
2769
  // ../addons/docs/src/blocks/components/ArgsTable/ArgControl.tsx
2774
2770
  var Controls2 = {
@@ -3242,7 +3238,7 @@ var TableWrapper2 = styled19.table(({ theme: theme3, compact, inAddonPanel, inTa
3242
3238
  },
3243
3239
  // End Resets
3244
3240
  fontSize: theme3.typography.size.s2 - 1,
3245
- lineHeight: "20px",
3241
+ lineHeight: "19px",
3246
3242
  textAlign: "left",
3247
3243
  width: "100%",
3248
3244
  // Margin collapse
@@ -3503,8 +3499,9 @@ var slideIn = keyframes({
3503
3499
  to: {}
3504
3500
  }), Container2 = styled20.div({
3505
3501
  containerType: "size",
3506
- position: "sticky",
3502
+ position: "absolute",
3507
3503
  bottom: 0,
3504
+ width: "100%",
3508
3505
  height: 41,
3509
3506
  overflow: "hidden",
3510
3507
  zIndex: 1
@@ -3523,6 +3520,7 @@ var slideIn = keyframes({
3523
3520
  display: "flex",
3524
3521
  flex: "99 0 auto",
3525
3522
  alignItems: "center",
3523
+ marginInlineStart: 7,
3526
3524
  marginInlineEnd: 10,
3527
3525
  gap: 6
3528
3526
  }), Actions = styled20.div(({ theme: theme3 }) => ({
@@ -3607,11 +3605,14 @@ var slideIn = keyframes({
3607
3605
  var clean = (obj) => Object.entries(obj).reduce(
3608
3606
  (acc, [key, value2]) => value2 !== void 0 ? Object.assign(acc, { [key]: value2 }) : acc,
3609
3607
  {}
3610
- ), AddonWrapper = styled21.div(({ showSaveFromUI }) => ({
3611
- display: "grid",
3612
- gridTemplateRows: showSaveFromUI ? "1fr 41px" : "1fr",
3608
+ ), AddonWrapper = styled21.div(({ showSaveFromUI, theme: theme3 }) => ({
3613
3609
  height: "100%",
3614
- maxHeight: "100vh"
3610
+ maxHeight: "100vh",
3611
+ paddingBottom: showSaveFromUI ? 41 : 0,
3612
+ backgroundColor: theme3.background.content,
3613
+ table: {
3614
+ backgroundColor: theme3.background.app
3615
+ }
3615
3616
  })), ControlsPanel = ({ saveStory, createStory }) => {
3616
3617
  let api = useStorybookApi(), [isLoading, setIsLoading] = useState11(!0), [args, updateArgs, resetArgs, initialArgs] = useArgs(), [globals] = useGlobals(), rows = useArgTypes(), {
3617
3618
  expanded,
@@ -3629,7 +3630,7 @@ var clean = (obj) => Object.entries(obj).reduce(
3629
3630
  () => !!args && !!initialArgs && !dequal(clean(args), clean(initialArgs)),
3630
3631
  [args, initialArgs]
3631
3632
  ), showSaveFromUI = hasControls && storyData.type === "story" && storyData.subtype !== "test" && hasUpdatedArgs && global.CONFIG_TYPE === "DEVELOPMENT" && disableSaveFromUI !== !0;
3632
- return React26.createElement(AddonWrapper, { showSaveFromUI }, React26.createElement(ScrollArea, { vertical: !0 }, React26.createElement(
3633
+ return React26.createElement(AddonWrapper, { showSaveFromUI }, React26.createElement(
3633
3634
  ArgsTable,
3634
3635
  {
3635
3636
  key: path,
@@ -3643,7 +3644,7 @@ var clean = (obj) => Object.entries(obj).reduce(
3643
3644
  sort,
3644
3645
  isLoading
3645
3646
  }
3646
- )), showSaveFromUI && React26.createElement(SaveStory, { resetArgs, saveStory, createStory }));
3647
+ ), showSaveFromUI && React26.createElement(SaveStory, { resetArgs, saveStory, createStory }));
3647
3648
  };
3648
3649
 
3649
3650
  // src/controls/components/Title.tsx
@@ -3723,7 +3724,7 @@ var manager_default = addons.register(ADDON_ID6, (api) => {
3723
3724
  title: Title,
3724
3725
  type: types.PANEL,
3725
3726
  paramKey: PARAM_KEY5,
3726
- render: ({ active }) => !active || !api.getCurrentStoryData() ? null : React28.createElement(AddonPanel, { active, hasScrollbar: !1 }, React28.createElement(ControlsPanel, { saveStory, createStory }))
3727
+ render: ({ active }) => !active || !api.getCurrentStoryData() ? null : React28.createElement(AddonPanel, { active }, React28.createElement(ControlsPanel, { saveStory, createStory }))
3727
3728
  }), channel.on(SAVE_STORY_RESPONSE, (data) => {
3728
3729
  if (!data.success)
3729
3730
  return;
@@ -3765,7 +3766,7 @@ import { STORY_CHANGED as STORY_CHANGED2 } from "storybook/internal/core-events"
3765
3766
 
3766
3767
  // src/actions/components/ActionLogger/index.tsx
3767
3768
  import React31, { Fragment, forwardRef, useEffect as useEffect9, useRef as useRef5 } from "react";
3768
- import { ActionBar, ScrollArea as ScrollArea2 } from "storybook/internal/components";
3769
+ import { ActionBar, ScrollArea } from "storybook/internal/components";
3769
3770
 
3770
3771
  // ../../node_modules/react-inspector/dist/index.mjs
3771
3772
  import React92 from "react";
@@ -4768,7 +4769,7 @@ var Action = styled22.div({
4768
4769
 
4769
4770
  // src/actions/components/ActionLogger/index.tsx
4770
4771
  var UnstyledWrapped = forwardRef(
4771
- ({ children, className }, ref) => React31.createElement(ScrollArea2, { ref, horizontal: !0, vertical: !0, className }, children)
4772
+ ({ children, className }, ref) => React31.createElement(ScrollArea, { ref, horizontal: !0, vertical: !0, className }, children)
4772
4773
  );
4773
4774
  UnstyledWrapped.displayName = "UnstyledWrapped";
4774
4775
  var Wrapper8 = styled23(UnstyledWrapped)({
@@ -4869,7 +4870,7 @@ import {
4869
4870
  } from "storybook/manager-api";
4870
4871
 
4871
4872
  // src/component-testing/constants.ts
4872
- var ADDON_ID7 = "storybook/interactions", PANEL_ID2 = `${ADDON_ID7}/panel`, DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`, DOCUMENTATION_PLAY_FUNCTION_LINK = "writing-stories/play-function#writing-stories-with-the-play-function", INTERNAL_RENDER_CALL_ID = "internal_render_call";
4873
+ var ADDON_ID7 = "storybook/interactions", PANEL_ID2 = `${ADDON_ID7}/panel`, PARAM_KEY6 = "interactions", DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`, DOCUMENTATION_PLAY_FUNCTION_LINK = "writing-stories/play-function#writing-stories-with-the-play-function", INTERNAL_RENDER_CALL_ID = "internal_render_call";
4873
4874
 
4874
4875
  // ../addons/a11y/src/constants.ts
4875
4876
  var ADDON_ID8 = "storybook/a11y", PANEL_ID3 = `${ADDON_ID8}/panel`;
@@ -4943,6 +4944,9 @@ function stripAnsi(string) {
4943
4944
  }
4944
4945
 
4945
4946
  // src/component-testing/utils.ts
4947
+ function isInteractionsDisabled(parameters) {
4948
+ return !!parameters?.[PARAM_KEY6]?.disable;
4949
+ }
4946
4950
  function isTestAssertionError(error) {
4947
4951
  return isChaiError(error) || isJestError(error);
4948
4952
  }
@@ -6540,7 +6544,7 @@ var INITIAL_CONTROL_STATES = {
6540
6544
  { root: global2.document.querySelector('#storybook-panel-root [role="tabpanel"]') }
6541
6545
  ), endRef.current && observer.observe(endRef.current)), () => observer?.disconnect();
6542
6546
  }, []);
6543
- let lastStoryId = useRef6(void 0), lastRenderId = useRef6(0), emit = useChannel2(
6547
+ let lastStoryId = useRef6(void 0), latestRenderId = useRef6(0), emit = useChannel2(
6544
6548
  {
6545
6549
  [EVENTS.CALL]: setCall,
6546
6550
  [EVENTS.SYNC]: (payload) => {
@@ -6552,7 +6556,7 @@ var INITIAL_CONTROL_STATES = {
6552
6556
  );
6553
6557
  },
6554
6558
  [STORY_RENDER_PHASE_CHANGED]: (event) => {
6555
- lastStoryId.current === event.storyId && ["preparing", "loading"].includes(event.newPhase) || (lastStoryId.current = event.storyId, lastRenderId.current = Math.max(lastRenderId.current, event.renderId || 0), lastRenderId.current === event.renderId && (event.newPhase === "rendering" ? (log.current = [getInternalRenderLogItem("active" /* ACTIVE */)], calls.current.set(INTERNAL_RENDER_CALL_ID, getInternalRenderCall(storyId)), set({
6559
+ lastStoryId.current === event.storyId && ["preparing", "loading"].includes(event.newPhase) || (lastStoryId.current === event.storyId ? latestRenderId.current = Math.max(latestRenderId.current, event.renderId || 0) : (latestRenderId.current = event.renderId || 0, lastStoryId.current = event.storyId), latestRenderId.current === event.renderId && (event.newPhase === "rendering" ? (log.current = [getInternalRenderLogItem("active" /* ACTIVE */)], calls.current.set(INTERNAL_RENDER_CALL_ID, getInternalRenderCall(storyId)), set({
6556
6560
  status: "rendering",
6557
6561
  controlStates: INITIAL_CONTROL_STATES,
6558
6562
  pausedAt: void 0,
@@ -6680,6 +6684,7 @@ var manager_default3 = addons3.register(ADDON_ID7, () => {
6680
6684
  type: types3.PANEL,
6681
6685
  title: () => React57.createElement(PanelTitle, null),
6682
6686
  match: ({ viewMode }) => viewMode === "story",
6687
+ disabled: isInteractionsDisabled,
6683
6688
  render: ({ active }) => React57.createElement(AddonPanel2, { active: !!active }, React57.createElement(Consumer, { filter }, (props) => React57.createElement(Panel, { ...props })))
6684
6689
  });
6685
6690
  }
@@ -6876,164 +6881,207 @@ import * as React67 from "react";
6876
6881
  import { addons as addons7, types as types7 } from "storybook/manager-api";
6877
6882
 
6878
6883
  // src/viewport/components/Tool.tsx
6879
- import React66, { Fragment as Fragment6, useCallback as useCallback10, useEffect as useEffect18, useMemo as useMemo6 } from "react";
6880
- import { Button as Button9, Select as Select2 } from "storybook/internal/components";
6881
- import { GrowIcon, TransferIcon } from "@storybook/icons";
6882
- import { useGlobals as useGlobals5, useParameter as useParameter4 } from "storybook/manager-api";
6883
- import { Global, styled as styled34 } from "storybook/theming";
6884
-
6885
- // src/viewport/shortcuts.ts
6886
- var getCurrentViewportIndex = (viewportsKeys, current) => viewportsKeys.indexOf(current), getNextViewport = (viewportsKeys, current) => {
6887
- let currentViewportIndex = getCurrentViewportIndex(viewportsKeys, current);
6888
- return currentViewportIndex === viewportsKeys.length - 1 ? viewportsKeys[0] : viewportsKeys[currentViewportIndex + 1];
6889
- }, getPreviousViewport = (viewportsKeys, current) => {
6890
- let currentViewportIndex = getCurrentViewportIndex(viewportsKeys, current);
6891
- return currentViewportIndex < 1 ? viewportsKeys[viewportsKeys.length - 1] : viewportsKeys[currentViewportIndex - 1];
6892
- }, registerShortcuts = async (api, viewport, updateGlobals, viewportsKeys) => {
6893
- await api.setAddonShortcut(ADDON_ID2, {
6894
- label: "Previous viewport",
6895
- defaultShortcut: ["alt", "shift", "V"],
6896
- actionName: "previous",
6897
- action: () => {
6898
- updateGlobals({
6899
- viewport: getPreviousViewport(viewportsKeys, viewport)
6900
- });
6901
- }
6902
- }), await api.setAddonShortcut(ADDON_ID2, {
6903
- label: "Next viewport",
6904
- defaultShortcut: ["alt", "V"],
6905
- actionName: "next",
6906
- action: () => {
6907
- updateGlobals({
6908
- viewport: getNextViewport(viewportsKeys, viewport)
6909
- });
6910
- }
6911
- }), await api.setAddonShortcut(ADDON_ID2, {
6912
- label: "Reset viewport",
6913
- defaultShortcut: ["alt", "control", "V"],
6914
- actionName: "reset",
6915
- action: () => {
6916
- updateGlobals({
6917
- viewport: { value: void 0, isRotated: !1 }
6918
- });
6919
- }
6920
- });
6884
+ import React66, { useMemo as useMemo7 } from "react";
6885
+ import { Select as Select2 } from "storybook/internal/components";
6886
+ import { GrowIcon } from "@storybook/icons";
6887
+ import { styled as styled33 } from "storybook/theming";
6888
+
6889
+ // src/viewport/useViewport.ts
6890
+ import { useCallback as useCallback10, useEffect as useEffect18, useMemo as useMemo6, useRef as useRef7 } from "react";
6891
+ import { useGlobals as useGlobals5, useParameter as useParameter4, useStorybookApi as useStorybookApi10 } from "storybook/manager-api";
6892
+ var URL_VALUE_PATTERN = /^([0-9]{1,4})([a-z]{0,4})-([0-9]{1,4})([a-z]{0,4})$/, VIEWPORT_MIN_WIDTH = 40, VIEWPORT_MIN_HEIGHT = 40, cycle = (viewports, current, direction = 1) => {
6893
+ let keys = Object.keys(viewports), nextIndex = (current ? keys.indexOf(current) : -1) + direction;
6894
+ return nextIndex < 0 ? keys[keys.length - 1] : nextIndex >= keys.length ? keys[0] : keys[nextIndex];
6895
+ }, normalizeGlobal = (value2, defaultIsRotated) => typeof value2 == "string" ? { value: value2, isRotated: defaultIsRotated } : { value: value2?.value, isRotated: value2?.isRotated ?? defaultIsRotated }, parseGlobals = (globals, storyGlobals, userGlobals, options, lastSelectedOption, disable, viewMode) => {
6896
+ if (viewMode !== "story")
6897
+ return {
6898
+ name: "Responsive",
6899
+ type: "desktop",
6900
+ width: "100%",
6901
+ height: "100%",
6902
+ value: "100pct-100pct",
6903
+ option: void 0,
6904
+ isCustom: !1,
6905
+ isDefault: !0,
6906
+ isLocked: !0,
6907
+ isRotated: !1
6908
+ };
6909
+ let global4 = normalizeGlobal(globals?.[PARAM_KEY2]), userGlobal = normalizeGlobal(userGlobals?.[PARAM_KEY2]), storyGlobal = normalizeGlobal(storyGlobals?.[PARAM_KEY2]), value2 = userGlobal?.value ?? storyGlobal?.value ?? global4?.value, isRotated = userGlobal?.isRotated ?? storyGlobal?.isRotated ?? global4?.isRotated ?? !1, keys = Object.keys(options), isLocked = disable || PARAM_KEY2 in storyGlobals || !keys.length, [match, vx, ux, vy, uy] = value2?.match(URL_VALUE_PATTERN) || [];
6910
+ if (match) {
6911
+ let x2 = ux && ux !== "px" ? vx : Math.max(Number(vx), VIEWPORT_MIN_WIDTH), y2 = uy && uy !== "px" ? vy : Math.max(Number(vy), VIEWPORT_MIN_HEIGHT), width = `${x2}${ux === "pct" ? "%" : ux || "px"}`, height = `${y2}${uy === "pct" ? "%" : uy || "px"}`, selection = lastSelectedOption ? options[lastSelectedOption] : void 0;
6912
+ return {
6913
+ name: selection?.name ?? "Custom",
6914
+ type: selection?.type ?? "other",
6915
+ width: isRotated ? height : width,
6916
+ height: isRotated ? width : height,
6917
+ value: match,
6918
+ option: void 0,
6919
+ isCustom: !0,
6920
+ isDefault: !1,
6921
+ isLocked,
6922
+ isRotated
6923
+ };
6924
+ }
6925
+ if (value2 && keys.length) {
6926
+ let { name, styles, type = "other" } = options[value2] ?? options[keys[0]];
6927
+ return {
6928
+ name,
6929
+ type,
6930
+ width: isRotated ? styles.height : styles.width,
6931
+ height: isRotated ? styles.width : styles.height,
6932
+ value: value2,
6933
+ option: value2,
6934
+ isCustom: !1,
6935
+ isDefault: !1,
6936
+ isLocked,
6937
+ isRotated
6938
+ };
6939
+ }
6940
+ return {
6941
+ name: "Responsive",
6942
+ type: "desktop",
6943
+ width: "100%",
6944
+ height: "100%",
6945
+ value: "100pct-100pct",
6946
+ option: void 0,
6947
+ isCustom: !1,
6948
+ isDefault: !0,
6949
+ isLocked,
6950
+ isRotated: !1
6951
+ };
6952
+ }, useViewport = () => {
6953
+ let api = useStorybookApi10(), { viewMode } = api.getUrlState(), lastSelectedOption = useRef7(), parameter = useParameter4(PARAM_KEY2), [globals, updateGlobals, storyGlobals, userGlobals] = useGlobals5(), { options = MINIMAL_VIEWPORTS, disable = !1 } = parameter || {}, { name, type, width, height, value: value2, option, isCustom, isDefault, isLocked, isRotated } = parseGlobals(
6954
+ globals,
6955
+ storyGlobals,
6956
+ userGlobals,
6957
+ options,
6958
+ lastSelectedOption.current,
6959
+ disable,
6960
+ viewMode
6961
+ ), update = useCallback10(
6962
+ (input) => updateGlobals({ [PARAM_KEY2]: input }),
6963
+ [updateGlobals]
6964
+ ), resize = useCallback10(
6965
+ (width2, height2) => {
6966
+ let w2 = width2.replace(/px$/, "").replace(/%$/, "pct"), h2 = height2.replace(/px$/, "").replace(/%$/, "pct"), value3 = isRotated ? `${h2}-${w2}` : `${w2}-${h2}`, [match, vx, ux, vy, uy] = value3.match(URL_VALUE_PATTERN) || [];
6967
+ match && (ux || Number(vx) >= 40) && (uy || Number(vy) >= 40) && update({ value: match, isRotated });
6968
+ },
6969
+ [update, isRotated]
6970
+ );
6971
+ return useEffect18(() => {
6972
+ PARAM_KEY2 in storyGlobals && (update(normalizeGlobal(storyGlobals?.[PARAM_KEY2], !1)), lastSelectedOption.current = void 0);
6973
+ }, [storyGlobals, update]), useEffect18(() => {
6974
+ option && (Object.hasOwn(options, option) ? lastSelectedOption.current = option : (lastSelectedOption.current = void 0, update(normalizeGlobal(storyGlobals?.[PARAM_KEY2], !1))));
6975
+ }, [storyGlobals, options, option, update]), useEffect18(() => {
6976
+ api.setAddonShortcut(ADDON_ID2, {
6977
+ label: "Next viewport",
6978
+ defaultShortcut: ["alt", "V"],
6979
+ actionName: "next",
6980
+ action: () => update({ value: cycle(options, lastSelectedOption.current), isRotated })
6981
+ }), api.setAddonShortcut(ADDON_ID2, {
6982
+ label: "Previous viewport",
6983
+ defaultShortcut: ["alt", "shift", "V"],
6984
+ actionName: "previous",
6985
+ action: () => update({ value: cycle(options, lastSelectedOption.current, -1), isRotated })
6986
+ }), api.setAddonShortcut(ADDON_ID2, {
6987
+ label: "Reset viewport",
6988
+ defaultShortcut: ["alt", "control", "V"],
6989
+ actionName: "reset",
6990
+ action: () => update({ value: void 0, isRotated: !1 })
6991
+ });
6992
+ }, [api, update, options, isRotated]), useMemo6(
6993
+ () => ({
6994
+ name,
6995
+ type,
6996
+ width,
6997
+ height,
6998
+ value: value2,
6999
+ option,
7000
+ isCustom,
7001
+ isDefault,
7002
+ isLocked,
7003
+ isRotated,
7004
+ options,
7005
+ lastSelectedOption: lastSelectedOption.current,
7006
+ resize,
7007
+ reset: () => update({ value: void 0, isRotated: !1 }),
7008
+ rotate: () => update({ value: value2, isRotated: !isRotated }),
7009
+ select: (value3) => update({ value: value3, isRotated })
7010
+ }),
7011
+ [
7012
+ name,
7013
+ type,
7014
+ width,
7015
+ height,
7016
+ value2,
7017
+ option,
7018
+ isCustom,
7019
+ isDefault,
7020
+ isRotated,
7021
+ isLocked,
7022
+ options,
7023
+ resize,
7024
+ update
7025
+ ]
7026
+ );
6921
7027
  };
6922
7028
 
6923
- // src/viewport/utils.tsx
6924
- import React65, { Fragment as Fragment5 } from "react";
6925
- import { BrowserIcon, MobileIcon, TabletIcon } from "@storybook/icons";
6926
- import { styled as styled33 } from "storybook/theming";
6927
- var ActiveViewportSize = styled33.div({
6928
- display: "inline-flex",
6929
- alignItems: "center"
6930
- }), ActiveViewportLabel = styled33.div(({ theme: theme3 }) => ({
6931
- display: "inline-block",
6932
- textDecoration: "none",
6933
- padding: 10,
6934
- fontWeight: theme3.typography.weight.bold,
6935
- fontSize: theme3.typography.size.s2 - 1,
6936
- lineHeight: "1",
6937
- height: 40,
6938
- border: "none",
6939
- borderTop: "3px solid transparent",
6940
- borderBottom: "3px solid transparent",
6941
- background: "transparent"
6942
- })), iconsMap = {
7029
+ // src/viewport/viewportIcons.tsx
7030
+ import React65 from "react";
7031
+ import { BrowserIcon, DiamondIcon, MobileIcon, TabletIcon, WatchIcon } from "@storybook/icons";
7032
+ var iconsMap = {
6943
7033
  desktop: React65.createElement(BrowserIcon, null),
6944
7034
  mobile: React65.createElement(MobileIcon, null),
6945
7035
  tablet: React65.createElement(TabletIcon, null),
6946
- other: React65.createElement(Fragment5, null)
7036
+ watch: React65.createElement(WatchIcon, null),
7037
+ other: React65.createElement(DiamondIcon, null)
6947
7038
  };
6948
7039
 
6949
7040
  // src/viewport/components/Tool.tsx
6950
- var ViewportTool = ({ api }) => {
6951
- let config = useParameter4(PARAM_KEY2), [globals, updateGlobals, storyGlobals] = useGlobals5(), { options = MINIMAL_VIEWPORTS, disable } = config || {}, data = globals?.[PARAM_KEY2] || {}, viewportName = typeof data == "string" ? data : data.value, isRotated = typeof data == "string" ? !1 : !!data.isRotated, item = options[viewportName] || responsiveViewport, isLocked = PARAM_KEY2 in storyGlobals, length = Object.keys(options).length;
6952
- if (useEffect18(() => {
6953
- registerShortcuts(api, viewportName, updateGlobals, Object.keys(options));
6954
- }, [options, viewportName, updateGlobals, api]), item.styles === null || !options || length < 1)
6955
- return null;
6956
- if (typeof item.styles == "function")
6957
- return console.warn(
6958
- "Addon Viewport no longer supports dynamic styles using a function, use css calc() instead"
6959
- ), null;
6960
- let width = isRotated ? item.styles.height : item.styles.width, height = isRotated ? item.styles.width : item.styles.height;
6961
- return disable ? null : React66.createElement(
6962
- Pure2,
6963
- {
6964
- item,
6965
- updateGlobals,
6966
- viewportMap: options,
6967
- viewportName,
6968
- isRotated,
6969
- isLocked,
6970
- width,
6971
- height
6972
- }
6973
- );
6974
- }, FirstDimension = styled34(ActiveViewportLabel)({
6975
- order: 1
6976
- }), DimensionSeparator = styled34.div({
6977
- order: 2
6978
- }), LastDimension = styled34(ActiveViewportLabel)({
6979
- order: 3
6980
- }), Pure2 = React66.memo(function(props) {
6981
- let { item, viewportMap, viewportName, isRotated, updateGlobals, isLocked, width, height } = props, update = useCallback10(
6982
- (input) => updateGlobals({ [PARAM_KEY2]: input }),
6983
- [updateGlobals]
6984
- ), options = useMemo6(
6985
- () => Object.entries(viewportMap).map(([k2, value2]) => ({
7041
+ var Dimensions = styled33.div(({ theme: theme3 }) => ({
7042
+ display: "flex",
7043
+ gap: 2,
7044
+ marginLeft: 20,
7045
+ fontFamily: theme3.typography.fonts.mono,
7046
+ fontSize: theme3.typography.size.s1 - 1,
7047
+ fontWeight: theme3.typography.weight.regular,
7048
+ color: theme3.textMutedColor
7049
+ })), ViewportTool = () => {
7050
+ let { name, value: value2, isDefault, isLocked, options: viewportMap, reset, select } = useViewport(), options = useMemo7(
7051
+ () => Object.entries(viewportMap).map(([k2, value3]) => ({
6986
7052
  value: k2,
6987
- title: value2.name,
6988
- icon: iconsMap[value2.type]
7053
+ title: value3.name,
7054
+ icon: iconsMap[value3.type],
7055
+ right: React66.createElement(Dimensions, null, React66.createElement("span", null, value3.styles.width.replace("px", "")), React66.createElement("span", null, "\xD7"), React66.createElement("span", null, value3.styles.height.replace("px", "")))
6989
7056
  })),
6990
7057
  [viewportMap]
6991
7058
  );
6992
- return React66.createElement(Fragment6, null, React66.createElement(
7059
+ return React66.createElement(
6993
7060
  Select2,
6994
7061
  {
6995
7062
  resetLabel: "Reset viewport",
6996
- onReset: () => update({ value: void 0, isRotated: !1 }),
7063
+ onReset: reset,
6997
7064
  key: "viewport",
6998
7065
  disabled: isLocked,
6999
7066
  ariaLabel: isLocked ? "Viewport size set by story parameters" : "Viewport size",
7000
- ariaDescription: "Select a viewport size among predefined options for the preview area, or reset to the default size.",
7001
- tooltip: isLocked ? "Viewport size set by story parameters" : "Resize viewport",
7002
- defaultOptions: viewportName,
7067
+ ariaDescription: "Select a viewport among predefined options for the preview area, or reset to the default viewport.",
7068
+ tooltip: isLocked ? "Viewport set by story parameters" : "Change viewport",
7069
+ defaultOptions: value2,
7003
7070
  options,
7004
- onSelect: (selected) => update({ value: selected, isRotated: !1 }),
7071
+ onSelect: (selected) => select(selected),
7005
7072
  icon: React66.createElement(GrowIcon, null)
7006
7073
  },
7007
- item !== responsiveViewport ? React66.createElement(React66.Fragment, null, item.name, " ", isRotated ? "(L)" : "(P)") : null
7008
- ), React66.createElement(
7009
- Global,
7010
- {
7011
- styles: {
7012
- 'iframe[data-is-storybook="true"]': { width, height }
7013
- }
7014
- }
7015
- ), item !== responsiveViewport ? React66.createElement(ActiveViewportSize, null, React66.createElement(FirstDimension, { title: "Viewport width" }, React66.createElement("span", { className: "sb-sr-only" }, "Viewport width: "), width.replace("px", "")), isLocked && React66.createElement(DimensionSeparator, null, "/"), React66.createElement(LastDimension, { title: "Viewport height" }, React66.createElement("span", { className: "sb-sr-only" }, "Viewport height: "), height.replace("px", "")), !isLocked && React66.createElement(DimensionSeparator, null, React66.createElement(
7016
- Button9,
7017
- {
7018
- key: "viewport-rotate",
7019
- padding: "small",
7020
- variant: "ghost",
7021
- ariaLabel: "Rotate viewport",
7022
- onClick: () => {
7023
- update({ value: viewportName, isRotated: !isRotated });
7024
- }
7025
- },
7026
- React66.createElement(TransferIcon, null)
7027
- ))) : null);
7028
- });
7074
+ isDefault ? null : name
7075
+ );
7076
+ };
7029
7077
 
7030
7078
  // src/viewport/manager.tsx
7031
- var manager_default7 = addons7.register(ADDON_ID2, (api) => {
7079
+ var manager_default7 = addons7.register(ADDON_ID2, () => {
7032
7080
  globalThis?.FEATURES?.viewport && addons7.add(TOOL_ID, {
7033
7081
  title: "viewport / media-queries",
7034
7082
  type: types7.TOOL,
7035
7083
  match: ({ viewMode, tabId }) => viewMode === "story" && !tabId,
7036
- render: () => React67.createElement(ViewportTool, { api })
7084
+ render: () => React67.createElement(ViewportTool, null)
7037
7085
  });
7038
7086
  });
7039
7087
 
@@ -7050,7 +7098,7 @@ var TAG_FILTERS = "tag-filters", STATIC_FILTER = "static-filter", tagFiltersMana
7050
7098
  let tags = item.tags ?? [];
7051
7099
  return (
7052
7100
  // we can filter out the primary story, but we still want to show autodocs
7053
- (tags.includes("dev") || item.type === "docs") && tags.filter((tag) => staticExcludeTags[tag]).length === 0
7101
+ (tags.includes(Tag.DEV) || item.type === "docs") && tags.filter((tag) => staticExcludeTags[tag]).length === 0
7054
7102
  );
7055
7103
  });
7056
7104
  }), common_manager_default = [
@@ -1,21 +1,21 @@
1
- import CJS_COMPAT_NODE_URL_3bfbtrdgjix from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_3bfbtrdgjix from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_3bfbtrdgjix from "node:module";
1
+ import CJS_COMPAT_NODE_URL_phceqgr585q from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_phceqgr585q from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_phceqgr585q from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_3bfbtrdgjix.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_3bfbtrdgjix.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_3bfbtrdgjix.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_phceqgr585q.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_phceqgr585q.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_phceqgr585q.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- glob
14
- } from "../../_node-chunks/chunk-3K6P75SS.js";
15
12
  import {
16
13
  slash
17
- } from "../../_node-chunks/chunk-LOXLI4XT.js";
18
- import "../../_node-chunks/chunk-5WQXPM6D.js";
14
+ } from "../../_node-chunks/chunk-B422K4XV.js";
15
+ import {
16
+ glob
17
+ } from "../../_node-chunks/chunk-BJOXVTWM.js";
18
+ import "../../_node-chunks/chunk-AXDM43NU.js";
19
19
 
20
20
  // src/core-server/utils/remove-mdx-entries.ts
21
21
  import { isAbsolute, join, relative } from "node:path";