storybook 10.1.0-alpha.9 → 10.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.
Files changed (198) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
  5. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  6. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  7. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  8. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  9. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  15. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  16. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  17. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  18. package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
  19. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  20. package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
  26. package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
  27. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  28. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  29. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  30. package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
  31. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  32. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  33. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
  39. package/dist/_node-chunks/{builder-manager-SM3UWERX.js → builder-manager-FTVC2JL7.js} +510 -1019
  40. package/dist/_node-chunks/camelcase-3SMT5WKC.js +37 -0
  41. package/dist/_node-chunks/chunk-2OVULPK3.js +54 -0
  42. package/dist/_node-chunks/chunk-3JJPSDXI.js +3043 -0
  43. package/dist/_node-chunks/chunk-54NMJ4II.js +1564 -0
  44. package/dist/_node-chunks/chunk-5V4A6MSI.js +943 -0
  45. package/dist/_node-chunks/chunk-6DEMT5VX.js +299 -0
  46. package/dist/_node-chunks/{chunk-HHSTA6QS.js → chunk-6L7FFBOW.js} +8 -10
  47. package/dist/_node-chunks/chunk-6ULDIDXV.js +46662 -0
  48. package/dist/_node-chunks/chunk-AREL5IXS.js +603 -0
  49. package/dist/_node-chunks/chunk-DWA53E73.js +23 -0
  50. package/dist/_node-chunks/chunk-FNYKBULZ.js +765 -0
  51. package/dist/_node-chunks/chunk-IUYZQKSX.js +70 -0
  52. package/dist/_node-chunks/{chunk-F6EFOEC7.js → chunk-K673CX4Q.js} +469 -983
  53. package/dist/_node-chunks/chunk-KJAFCNZ3.js +61 -0
  54. package/dist/_node-chunks/chunk-N3BJOOY5.js +78 -0
  55. package/dist/_node-chunks/{chunk-EBUEXRH5.js → chunk-O5FMCQHP.js} +116 -276
  56. package/dist/_node-chunks/chunk-RIKQZHV3.js +29 -0
  57. package/dist/_node-chunks/chunk-RURZIE3W.js +3780 -0
  58. package/dist/_node-chunks/chunk-RVII4SK6.js +919 -0
  59. package/dist/_node-chunks/chunk-S3PBHOVC.js +6024 -0
  60. package/dist/_node-chunks/chunk-SQSFX47N.js +61 -0
  61. package/dist/_node-chunks/{chunk-SGM3ZCCT.js → chunk-TURUTKVH.js} +292 -688
  62. package/dist/_node-chunks/chunk-VRICJPXY.js +72 -0
  63. package/dist/_node-chunks/chunk-WIWWMCEU.js +119 -0
  64. package/dist/_node-chunks/{chunk-ATDHMMIZ.js → chunk-XGNRK7QB.js} +15 -24
  65. package/dist/_node-chunks/chunk-Y2FOTPAE.js +4523 -0
  66. package/dist/_node-chunks/{chunk-GHIBZRKD.js → chunk-Y4UYN72K.js} +8133 -8887
  67. package/dist/_node-chunks/chunk-Z4BMBA5L.js +18 -0
  68. package/dist/_node-chunks/chunk-ZMCJS2GU.js +20 -0
  69. package/dist/_node-chunks/dist-TZLZ3T6L.js +121 -0
  70. package/dist/_node-chunks/globby-22GFCZQD.js +3452 -0
  71. package/dist/_node-chunks/lib-37NQ4ZIJ.js +366 -0
  72. package/dist/_node-chunks/mdx-N42X6CFJ-2TRB7OEH.js +14329 -0
  73. package/dist/_node-chunks/p-limit-UD7TYFDW.js +116 -0
  74. package/dist/actions/decorator.js +21 -42
  75. package/dist/actions/index.js +3 -3
  76. package/dist/babel/index.d.ts +671 -335
  77. package/dist/babel/index.js +10 -11
  78. package/dist/bin/core.js +602 -1549
  79. package/dist/bin/dispatcher.js +36 -36
  80. package/dist/bin/loader.js +24 -38
  81. package/dist/channels/index.js +98 -234
  82. package/dist/cli/index.d.ts +1479 -133
  83. package/dist/cli/index.js +30 -8540
  84. package/dist/client-logger/index.js +31 -61
  85. package/dist/common/index.d.ts +139 -62
  86. package/dist/common/index.js +66 -51
  87. package/dist/components/index.d.ts +575 -273
  88. package/dist/components/index.js +14863 -4313
  89. package/dist/core-events/index.js +2 -66
  90. package/dist/core-server/index.d.ts +3 -2
  91. package/dist/core-server/index.js +2911 -8519
  92. package/dist/core-server/presets/common-manager.css +2 -2
  93. package/dist/core-server/presets/common-manager.js +2521 -5233
  94. package/dist/core-server/presets/common-override-preset.js +31 -60
  95. package/dist/core-server/presets/common-preset.js +663 -962
  96. package/dist/csf/index.js +534 -1179
  97. package/dist/csf-tools/index.js +9 -9
  98. package/dist/docs-tools/index.js +6 -6
  99. package/dist/highlight/index.js +2 -2
  100. package/dist/instrumenter/index.js +199 -415
  101. package/dist/manager/globals-runtime.js +59044 -67141
  102. package/dist/manager/globals.js +2 -3
  103. package/dist/manager/manager-stores.d.ts +1 -0
  104. package/dist/manager/manager-stores.js +23 -0
  105. package/dist/manager/runtime.js +11569 -10953
  106. package/dist/manager-api/index.d.ts +1813 -2
  107. package/dist/manager-api/index.js +1348 -2401
  108. package/dist/manager-errors.d.ts +9 -0
  109. package/dist/manager-errors.js +3 -3
  110. package/dist/mocking-utils/index.d.ts +1126 -0
  111. package/dist/mocking-utils/index.js +1181 -0
  112. package/dist/node-logger/index.d.ts +192 -24
  113. package/dist/node-logger/index.js +23 -4471
  114. package/dist/preview/globals.js +2 -3
  115. package/dist/preview/runtime.js +10799 -22393
  116. package/dist/preview-api/index.d.ts +1 -1
  117. package/dist/preview-api/index.js +13 -13
  118. package/dist/preview-errors.d.ts +9 -0
  119. package/dist/preview-errors.js +4 -4
  120. package/dist/router/index.js +347 -899
  121. package/dist/server-errors.d.ts +34 -1
  122. package/dist/server-errors.js +17 -10
  123. package/dist/telemetry/index.d.ts +24 -3
  124. package/dist/telemetry/index.js +25 -24
  125. package/dist/test/index.js +6131 -11916
  126. package/dist/theming/create.d.ts +1 -0
  127. package/dist/theming/create.js +4 -4
  128. package/dist/theming/index.d.ts +3366 -2599
  129. package/dist/theming/index.js +501 -1091
  130. package/dist/types/index.d.ts +72 -8
  131. package/dist/types/index.js +27 -12
  132. package/dist/viewport/index.js +3 -3
  133. package/package.json +26 -17
  134. package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
  135. package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
  136. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  137. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  138. package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
  139. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  140. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  141. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  142. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  143. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  144. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  145. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  146. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  147. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  148. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  149. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  150. package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
  151. package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
  152. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  153. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  154. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  155. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  156. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  157. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  158. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  159. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  160. package/dist/_node-chunks/camelcase-H5QSGQLK.js +0 -18
  161. package/dist/_node-chunks/chunk-3THWHQOC.js +0 -61
  162. package/dist/_node-chunks/chunk-45YUOLTU.js +0 -69
  163. package/dist/_node-chunks/chunk-4QSNCPAU.js +0 -64656
  164. package/dist/_node-chunks/chunk-744PQSOU.js +0 -79
  165. package/dist/_node-chunks/chunk-74Z2U7QG.js +0 -1544
  166. package/dist/_node-chunks/chunk-7MB7TFPO.js +0 -1198
  167. package/dist/_node-chunks/chunk-A7GS4RFT.js +0 -697
  168. package/dist/_node-chunks/chunk-BIA3A5UM.js +0 -61
  169. package/dist/_node-chunks/chunk-C5G7CLWX.js +0 -1657
  170. package/dist/_node-chunks/chunk-DLFUKMYJ.js +0 -1531
  171. package/dist/_node-chunks/chunk-EMRGRXKT.js +0 -111
  172. package/dist/_node-chunks/chunk-EX46EHHY.js +0 -420
  173. package/dist/_node-chunks/chunk-F76QKNOJ.js +0 -304
  174. package/dist/_node-chunks/chunk-HDCRUTEF.js +0 -220
  175. package/dist/_node-chunks/chunk-HUYAOIPH.js +0 -90
  176. package/dist/_node-chunks/chunk-IBJZQZJC.js +0 -101
  177. package/dist/_node-chunks/chunk-KZN2RDDT.js +0 -6712
  178. package/dist/_node-chunks/chunk-LYUNFU3F.js +0 -4741
  179. package/dist/_node-chunks/chunk-N44SIS6K.js +0 -28
  180. package/dist/_node-chunks/chunk-NILZM6KR.js +0 -18
  181. package/dist/_node-chunks/chunk-PC4ZRP6W.js +0 -34
  182. package/dist/_node-chunks/chunk-TJNGOQUH.js +0 -4272
  183. package/dist/_node-chunks/chunk-UBSYLHIL.js +0 -1250
  184. package/dist/_node-chunks/chunk-UTCLXPOC.js +0 -1518
  185. package/dist/_node-chunks/chunk-WOXXODXP.js +0 -5029
  186. package/dist/_node-chunks/chunk-XC4MEUA6.js +0 -1586
  187. package/dist/_node-chunks/chunk-YRXXMKRR.js +0 -2256
  188. package/dist/_node-chunks/dist-SL73W244.js +0 -175
  189. package/dist/_node-chunks/globby-ZSHAUQZ5.js +0 -5222
  190. package/dist/_node-chunks/lib-U2VIPUTI.js +0 -518
  191. package/dist/_node-chunks/mdx-N42X6CFJ-ZLHD33JK.js +0 -22017
  192. package/dist/_node-chunks/p-limit-K5BS5MSV.js +0 -168
  193. package/dist/_node-chunks/plugin-5PD4YIUH.js +0 -129
  194. package/dist/_node-chunks/plugin-MONDT2WL.js +0 -159
  195. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-EUZJRG3W.js +0 -69102
  196. package/dist/_node-chunks/webpack-mock-plugin-T4LDXEHE.js +0 -124
  197. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
  198. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
@@ -1,7 +1,3 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
1
  // ../node_modules/@babel/runtime/helpers/esm/extends.js
6
2
  function _extends() {
7
3
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
@@ -12,7 +8,6 @@ function _extends() {
12
8
  return n;
13
9
  }, _extends.apply(null, arguments);
14
10
  }
15
- __name(_extends, "_extends");
16
11
 
17
12
  export {
18
13
  _extends
@@ -0,0 +1,93 @@
1
+ import {
2
+ EVENT_ID
3
+ } from "./chunk-6XWLIJQL.js";
4
+
5
+ // src/actions/runtime/configureActions.ts
6
+ var config = {
7
+ depth: 10,
8
+ clearOnStoryChange: !0,
9
+ limit: 50
10
+ }, configureActions = (options = {}) => {
11
+ Object.assign(config, options);
12
+ };
13
+
14
+ // src/actions/runtime/action.ts
15
+ import { ImplicitActionsDuringRendering } from "storybook/internal/preview-errors";
16
+ import { global } from "@storybook/global";
17
+ import { addons } from "storybook/preview-api";
18
+ var findProto = (obj, callback) => {
19
+ let proto = Object.getPrototypeOf(obj);
20
+ return !proto || callback(proto) ? proto : findProto(proto, callback);
21
+ }, isReactSyntheticEvent = (e) => !!(typeof e == "object" && e && findProto(e, (proto) => /^Synthetic(?:Base)?Event$/.test(proto.constructor.name)) && typeof e.persist == "function"), serializeArg = (a) => {
22
+ if (isReactSyntheticEvent(a)) {
23
+ let e = Object.create(
24
+ a.constructor.prototype,
25
+ Object.getOwnPropertyDescriptors(a)
26
+ );
27
+ e.persist();
28
+ let viewDescriptor = Object.getOwnPropertyDescriptor(e, "view"), view = viewDescriptor?.value;
29
+ return typeof view == "object" && view?.constructor.name === "Window" && Object.defineProperty(e, "view", {
30
+ ...viewDescriptor,
31
+ value: Object.create(view.constructor.prototype)
32
+ }), e;
33
+ }
34
+ return a;
35
+ };
36
+ function action(name, options = {}) {
37
+ let actionOptions = {
38
+ ...config,
39
+ ...options
40
+ }, handler = function(...args) {
41
+ if (options.implicit) {
42
+ let storyRenderer = ("__STORYBOOK_PREVIEW__" in global ? global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
43
+ (render) => render.phase === "playing" || render.phase === "rendering"
44
+ );
45
+ if (storyRenderer) {
46
+ let deprecated = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, error = new ImplicitActionsDuringRendering({
47
+ phase: storyRenderer.phase,
48
+ name,
49
+ deprecated
50
+ });
51
+ if (deprecated)
52
+ console.warn(error);
53
+ else
54
+ throw error;
55
+ }
56
+ }
57
+ let channel = addons.getChannel(), id = Date.now().toString(36) + Math.random().toString(36).substring(2), minDepth = 5, serializedArgs = args.map(serializeArg), normalizedArgs = args.length > 1 ? serializedArgs : serializedArgs[0], actionDisplayToEmit = {
58
+ id,
59
+ count: 0,
60
+ data: { name, args: normalizedArgs },
61
+ options: {
62
+ ...actionOptions,
63
+ maxDepth: minDepth + (actionOptions.depth || 3)
64
+ }
65
+ };
66
+ channel.emit(EVENT_ID, actionDisplayToEmit);
67
+ };
68
+ return handler.isAction = !0, handler.implicit = options.implicit, handler;
69
+ }
70
+
71
+ // src/actions/runtime/actions.ts
72
+ var actions = (...args) => {
73
+ let options = config, names = args;
74
+ names.length === 1 && Array.isArray(names[0]) && ([names] = names), names.length !== 1 && typeof names[names.length - 1] != "string" && (options = {
75
+ ...config,
76
+ ...names.pop()
77
+ });
78
+ let namesObject = names[0];
79
+ (names.length !== 1 || typeof namesObject == "string") && (namesObject = {}, names.forEach((name) => {
80
+ namesObject[name] = name;
81
+ }));
82
+ let actionsObject = {};
83
+ return Object.keys(namesObject).forEach((name) => {
84
+ actionsObject[name] = action(namesObject[name], options);
85
+ }), actionsObject;
86
+ };
87
+
88
+ export {
89
+ config,
90
+ configureActions,
91
+ action,
92
+ actions
93
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ __commonJS
3
+ } from "./chunk-A242L54C.js";
4
+
5
+ // ../node_modules/picocolors/picocolors.browser.js
6
+ var require_picocolors_browser = __commonJS({
7
+ "../node_modules/picocolors/picocolors.browser.js"(exports, module) {
8
+ var x = String, create = function() {
9
+ return { isColorSupported: !1, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x, blackBright: x, redBright: x, greenBright: x, yellowBright: x, blueBright: x, magentaBright: x, cyanBright: x, whiteBright: x, bgBlackBright: x, bgRedBright: x, bgGreenBright: x, bgYellowBright: x, bgBlueBright: x, bgMagentaBright: x, bgCyanBright: x, bgWhiteBright: x };
10
+ };
11
+ module.exports = create();
12
+ module.exports.createColors = create;
13
+ }
14
+ });
15
+
16
+ export {
17
+ require_picocolors_browser
18
+ };
@@ -1,23 +1,18 @@
1
1
  // src/backgrounds/constants.ts
2
- var ADDON_ID = "storybook/background";
3
- var PARAM_KEY = "backgrounds";
2
+ var ADDON_ID = "storybook/background", PARAM_KEY = "backgrounds";
4
3
  var EVENTS = {
5
4
  UPDATE: `${ADDON_ID}/update`
6
5
  };
7
6
 
8
7
  // src/measure/constants.ts
9
- var ADDON_ID2 = "storybook/measure-addon";
10
- var TOOL_ID = `${ADDON_ID2}/tool`;
11
- var PARAM_KEY2 = "measureEnabled";
12
- var EVENTS2 = {
8
+ var ADDON_ID2 = "storybook/measure-addon", TOOL_ID = `${ADDON_ID2}/tool`, PARAM_KEY2 = "measureEnabled", EVENTS2 = {
13
9
  RESULT: `${ADDON_ID2}/result`,
14
10
  REQUEST: `${ADDON_ID2}/request`,
15
11
  CLEAR: `${ADDON_ID2}/clear`
16
12
  };
17
13
 
18
14
  // src/outline/constants.ts
19
- var ADDON_ID3 = "storybook/outline";
20
- var PARAM_KEY3 = "outline";
15
+ var ADDON_ID3 = "storybook/outline", PARAM_KEY3 = "outline";
21
16
 
22
17
  // src/backgrounds/defaults.ts
23
18
  var DEFAULT_BACKGROUNDS = {
@@ -0,0 +1,66 @@
1
+ // src/storybook-error.ts
2
+ function parseErrorCode({
3
+ code,
4
+ category
5
+ }) {
6
+ let paddedCode = String(code).padStart(4, "0");
7
+ return `SB_${category}_${paddedCode}`;
8
+ }
9
+ function appendErrorRef(url) {
10
+ if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url))
11
+ return url;
12
+ try {
13
+ let urlObj = new URL(url);
14
+ return urlObj.searchParams.set("ref", "error"), urlObj.toString();
15
+ } catch {
16
+ return url;
17
+ }
18
+ }
19
+ var StorybookError = class _StorybookError extends Error {
20
+ constructor(props) {
21
+ super(_StorybookError.getFullMessage(props));
22
+ /**
23
+ * Data associated with the error. Used to provide additional information in the error message or
24
+ * to be passed to telemetry.
25
+ */
26
+ this.data = {};
27
+ /** Flag used to easily determine if the error originates from Storybook. */
28
+ this.fromStorybook = !0;
29
+ /**
30
+ * Flag used to determine if the error is handled by us and should therefore not be shown to the
31
+ * user.
32
+ */
33
+ this.isHandledError = !1;
34
+ this.category = props.category, this.documentation = props.documentation ?? !1, this.code = props.code, this.isHandledError = props.isHandledError ?? !1, this.name = props.name;
35
+ }
36
+ get fullErrorCode() {
37
+ return parseErrorCode({ code: this.code, category: this.category });
38
+ }
39
+ /** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
40
+ get name() {
41
+ let errorName = this._name || this.constructor.name;
42
+ return `${this.fullErrorCode} (${errorName})`;
43
+ }
44
+ set name(name) {
45
+ this._name = name;
46
+ }
47
+ /** Generates the error message along with additional documentation link (if applicable). */
48
+ static getFullMessage({
49
+ documentation,
50
+ code,
51
+ category,
52
+ message
53
+ }) {
54
+ let page;
55
+ return documentation === !0 ? page = `https://storybook.js.org/error/${parseErrorCode({ code, category })}?ref=error` : typeof documentation == "string" ? page = appendErrorRef(documentation) : Array.isArray(documentation) && (page = `
56
+ ${documentation.map((doc) => ` - ${appendErrorRef(doc)}`).join(`
57
+ `)}`), `${message}${page != null ? `
58
+
59
+ More info: ${page}
60
+ ` : ""}`;
61
+ }
62
+ };
63
+
64
+ export {
65
+ StorybookError
66
+ };
@@ -0,0 +1,64 @@
1
+ // ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
2
+ function isPlainObject(value) {
3
+ if (!value || typeof value != "object")
4
+ return !1;
5
+ let proto = Object.getPrototypeOf(value);
6
+ return proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null ? Object.prototype.toString.call(value) === "[object Object]" : !1;
7
+ }
8
+
9
+ // ../node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
10
+ function isPrimitive(value) {
11
+ return value == null || typeof value != "object" && typeof value != "function";
12
+ }
13
+
14
+ // ../node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
15
+ function isTypedArray(x) {
16
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
17
+ }
18
+
19
+ // ../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
20
+ function getSymbols(object) {
21
+ return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
22
+ }
23
+
24
+ // ../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
25
+ function getTag(value) {
26
+ return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
27
+ }
28
+
29
+ // ../node_modules/es-toolkit/dist/compat/_internal/tags.mjs
30
+ var regexpTag = "[object RegExp]", stringTag = "[object String]", numberTag = "[object Number]", booleanTag = "[object Boolean]", argumentsTag = "[object Arguments]", symbolTag = "[object Symbol]", dateTag = "[object Date]", mapTag = "[object Map]", setTag = "[object Set]", arrayTag = "[object Array]", functionTag = "[object Function]", arrayBufferTag = "[object ArrayBuffer]", objectTag = "[object Object]", errorTag = "[object Error]", dataViewTag = "[object DataView]", uint8ArrayTag = "[object Uint8Array]", uint8ClampedArrayTag = "[object Uint8ClampedArray]", uint16ArrayTag = "[object Uint16Array]", uint32ArrayTag = "[object Uint32Array]", bigUint64ArrayTag = "[object BigUint64Array]", int8ArrayTag = "[object Int8Array]", int16ArrayTag = "[object Int16Array]", int32ArrayTag = "[object Int32Array]", bigInt64ArrayTag = "[object BigInt64Array]", float32ArrayTag = "[object Float32Array]", float64ArrayTag = "[object Float64Array]";
31
+
32
+ export {
33
+ isPrimitive,
34
+ isTypedArray,
35
+ getSymbols,
36
+ getTag,
37
+ regexpTag,
38
+ stringTag,
39
+ numberTag,
40
+ booleanTag,
41
+ argumentsTag,
42
+ symbolTag,
43
+ dateTag,
44
+ mapTag,
45
+ setTag,
46
+ arrayTag,
47
+ functionTag,
48
+ arrayBufferTag,
49
+ objectTag,
50
+ errorTag,
51
+ dataViewTag,
52
+ uint8ArrayTag,
53
+ uint8ClampedArrayTag,
54
+ uint16ArrayTag,
55
+ uint32ArrayTag,
56
+ bigUint64ArrayTag,
57
+ int8ArrayTag,
58
+ int16ArrayTag,
59
+ int32ArrayTag,
60
+ bigInt64ArrayTag,
61
+ float32ArrayTag,
62
+ float64ArrayTag,
63
+ isPlainObject
64
+ };
@@ -0,0 +1,47 @@
1
+ import {
2
+ StorybookError
3
+ } from "./chunk-FQ7SLVLR.js";
4
+
5
+ // src/manager-errors.ts
6
+ var Category = /* @__PURE__ */ ((Category2) => (Category2.MANAGER_UNCAUGHT = "MANAGER_UNCAUGHT", Category2.MANAGER_UI = "MANAGER_UI", Category2.MANAGER_API = "MANAGER_API", Category2.MANAGER_CLIENT_LOGGER = "MANAGER_CLIENT-LOGGER", Category2.MANAGER_CHANNELS = "MANAGER_CHANNELS", Category2.MANAGER_CORE_EVENTS = "MANAGER_CORE-EVENTS", Category2.MANAGER_ROUTER = "MANAGER_ROUTER", Category2.MANAGER_THEMING = "MANAGER_THEMING", Category2))(Category || {}), ProviderDoesNotExtendBaseProviderError = class extends StorybookError {
7
+ constructor() {
8
+ super({
9
+ name: "ProviderDoesNotExtendBaseProviderError",
10
+ category: "MANAGER_UI" /* MANAGER_UI */,
11
+ code: 1,
12
+ message: "The Provider passed into Storybook's UI is not extended from the base Provider. Please check your Provider implementation."
13
+ });
14
+ }
15
+ }, UncaughtManagerError = class extends StorybookError {
16
+ constructor(data) {
17
+ super({
18
+ name: "UncaughtManagerError",
19
+ category: "MANAGER_UNCAUGHT" /* MANAGER_UNCAUGHT */,
20
+ code: 1,
21
+ message: data.error.message
22
+ });
23
+ this.data = data;
24
+ this.stack = data.error.stack;
25
+ }
26
+ }, StatusTypeIdMismatchError = class extends StorybookError {
27
+ constructor(data) {
28
+ super({
29
+ name: "StatusTypeIdMismatchError",
30
+ category: "MANAGER_API" /* MANAGER_API */,
31
+ code: 1,
32
+ message: `Status has typeId "${data.status.typeId}" but was added to store with typeId "${data.typeId}". Full status: ${JSON.stringify(
33
+ data.status,
34
+ null,
35
+ 2
36
+ )}`
37
+ });
38
+ this.data = data;
39
+ }
40
+ };
41
+
42
+ export {
43
+ Category,
44
+ ProviderDoesNotExtendBaseProviderError,
45
+ UncaughtManagerError,
46
+ StatusTypeIdMismatchError
47
+ };
@@ -1,63 +1,55 @@
1
1
  import {
2
2
  _objectWithoutPropertiesLoose
3
- } from "./chunk-VAMFPZY3.js";
4
- import {
5
- __name
6
- } from "./chunk-MM7DTO55.js";
3
+ } from "./chunk-45UGUKRX.js";
7
4
 
8
5
  // ../node_modules/@babel/runtime/helpers/esm/typeof.js
9
6
  function _typeof(o) {
10
7
  "@babel/helpers - typeof";
11
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
8
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
12
9
  return typeof o2;
13
10
  } : function(o2) {
14
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
11
+ return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
15
12
  }, _typeof(o);
16
13
  }
17
- __name(_typeof, "_typeof");
18
14
 
19
15
  // ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
20
16
  function toPrimitive(t, r) {
21
- if ("object" != _typeof(t) || !t) return t;
17
+ if (_typeof(t) != "object" || !t) return t;
22
18
  var e = t[Symbol.toPrimitive];
23
- if (void 0 !== e) {
19
+ if (e !== void 0) {
24
20
  var i = e.call(t, r || "default");
25
- if ("object" != _typeof(i)) return i;
21
+ if (_typeof(i) != "object") return i;
26
22
  throw new TypeError("@@toPrimitive must return a primitive value.");
27
23
  }
28
- return ("string" === r ? String : Number)(t);
24
+ return (r === "string" ? String : Number)(t);
29
25
  }
30
- __name(toPrimitive, "toPrimitive");
31
26
 
32
27
  // ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
33
28
  function toPropertyKey(t) {
34
29
  var i = toPrimitive(t, "string");
35
- return "symbol" == _typeof(i) ? i : i + "";
30
+ return _typeof(i) == "symbol" ? i : i + "";
36
31
  }
37
- __name(toPropertyKey, "toPropertyKey");
38
32
 
39
33
  // ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
40
34
  function _defineProperty(e, r, t) {
41
35
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
36
  value: t,
43
- enumerable: true,
44
- configurable: true,
45
- writable: true
37
+ enumerable: !0,
38
+ configurable: !0,
39
+ writable: !0
46
40
  }) : e[r] = t, e;
47
41
  }
48
- __name(_defineProperty, "_defineProperty");
49
42
 
50
43
  // ../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
51
44
  function _objectWithoutProperties(e, t) {
52
- if (null == e) return {};
45
+ if (e == null) return {};
53
46
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
54
47
  if (Object.getOwnPropertySymbols) {
55
48
  var n = Object.getOwnPropertySymbols(e);
56
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
49
+ for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) === -1 && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
57
50
  }
58
51
  return i;
59
52
  }
60
- __name(_objectWithoutProperties, "_objectWithoutProperties");
61
53
 
62
54
  export {
63
55
  _objectWithoutProperties,
@@ -0,0 +1,71 @@
1
+ // src/preview-api/modules/preview-web/render/animation-utils.ts
2
+ function isTestEnvironment() {
3
+ try {
4
+ return (
5
+ // @ts-expect-error This property exists in Vitest browser mode
6
+ !!globalThis.__vitest_browser__ || !!globalThis.window?.navigator?.userAgent?.match(/StorybookTestRunner/)
7
+ );
8
+ } catch {
9
+ return !1;
10
+ }
11
+ }
12
+ function pauseAnimations(atEnd = !0) {
13
+ if (!("document" in globalThis && "createElement" in globalThis.document))
14
+ return () => {
15
+ };
16
+ let disableStyle = document.createElement("style");
17
+ disableStyle.textContent = `*, *:before, *:after {
18
+ animation: none !important;
19
+ }`, document.head.appendChild(disableStyle);
20
+ let pauseStyle = document.createElement("style");
21
+ return pauseStyle.textContent = `*, *:before, *:after {
22
+ animation-delay: 0s !important;
23
+ animation-direction: ${atEnd ? "reverse" : "normal"} !important;
24
+ animation-play-state: paused !important;
25
+ transition: none !important;
26
+ }`, document.head.appendChild(pauseStyle), document.body.clientHeight, document.head.removeChild(disableStyle), () => {
27
+ pauseStyle.parentNode?.removeChild(pauseStyle);
28
+ };
29
+ }
30
+ async function waitForAnimations(signal) {
31
+ if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
32
+ return;
33
+ let timedOut = !1;
34
+ await Promise.race([
35
+ // After 50ms, retrieve any running animations and wait for them to finish
36
+ // If new animations are created while waiting, we'll wait for them too
37
+ new Promise((resolve) => {
38
+ setTimeout(() => {
39
+ let animationRoots = [globalThis.document, ...getShadowRoots(globalThis.document)], checkAnimationsFinished = async () => {
40
+ if (timedOut || signal?.aborted)
41
+ return;
42
+ let runningAnimations = animationRoots.flatMap((el) => el?.getAnimations?.() || []).filter((a) => a.playState === "running" && !isInfiniteAnimation(a));
43
+ runningAnimations.length > 0 && (await Promise.all(runningAnimations.map((a) => a.finished)), await checkAnimationsFinished());
44
+ };
45
+ checkAnimationsFinished().then(resolve);
46
+ }, 100);
47
+ }),
48
+ // If animations don't finish within the timeout, continue without waiting
49
+ new Promise(
50
+ (resolve) => setTimeout(() => {
51
+ timedOut = !0, resolve(void 0);
52
+ }, 5e3)
53
+ )
54
+ ]);
55
+ }
56
+ function getShadowRoots(doc) {
57
+ return [doc, ...doc.querySelectorAll("*")].reduce((acc, el) => ("shadowRoot" in el && el.shadowRoot && acc.push(el.shadowRoot, ...getShadowRoots(el.shadowRoot)), acc), []);
58
+ }
59
+ function isInfiniteAnimation(anim) {
60
+ if (anim instanceof CSSAnimation && anim.effect instanceof KeyframeEffect && anim.effect.target) {
61
+ let style = getComputedStyle(anim.effect.target, anim.effect.pseudoElement), index = style.animationName?.split(", ").indexOf(anim.animationName);
62
+ return style.animationIterationCount.split(", ")[index] === "infinite";
63
+ }
64
+ return !1;
65
+ }
66
+
67
+ export {
68
+ isTestEnvironment,
69
+ pauseAnimations,
70
+ waitForAnimations
71
+ };
@@ -0,0 +1,37 @@
1
+ // ../node_modules/ts-dedent/esm/index.js
2
+ function dedent(templ) {
3
+ for (var values = [], _i = 1; _i < arguments.length; _i++)
4
+ values[_i - 1] = arguments[_i];
5
+ var strings = Array.from(typeof templ == "string" ? [templ] : templ);
6
+ strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
7
+ var indentLengths = strings.reduce(function(arr, str) {
8
+ var matches = str.match(/\n([\t ]+|(?!\s).)/g);
9
+ return matches ? arr.concat(matches.map(function(match) {
10
+ var _a, _b;
11
+ return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
12
+ })) : arr;
13
+ }, []);
14
+ if (indentLengths.length) {
15
+ var pattern_1 = new RegExp(`
16
+ [ ]{` + Math.min.apply(Math, indentLengths) + "}", "g");
17
+ strings = strings.map(function(str) {
18
+ return str.replace(pattern_1, `
19
+ `);
20
+ });
21
+ }
22
+ strings[0] = strings[0].replace(/^\r?\n/, "");
23
+ var string = strings[0];
24
+ return values.forEach(function(value, i) {
25
+ var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
26
+ typeof value == "string" && value.includes(`
27
+ `) && (indentedValue = String(value).split(`
28
+ `).map(function(str, i2) {
29
+ return i2 === 0 ? str : "" + endentation + str;
30
+ }).join(`
31
+ `)), string += indentedValue + strings[i + 1];
32
+ }), string;
33
+ }
34
+
35
+ export {
36
+ dedent
37
+ };
@@ -0,0 +1,11 @@
1
+ // src/highlight/constants.ts
2
+ var ADDON_ID = "storybook/highlight", HIGHLIGHT = `${ADDON_ID}/add`, REMOVE_HIGHLIGHT = `${ADDON_ID}/remove`, RESET_HIGHLIGHT = `${ADDON_ID}/reset`, SCROLL_INTO_VIEW = `${ADDON_ID}/scroll-into-view`, MAX_Z_INDEX = 2147483647, MIN_TOUCH_AREA_SIZE = 28;
3
+
4
+ export {
5
+ HIGHLIGHT,
6
+ REMOVE_HIGHLIGHT,
7
+ RESET_HIGHLIGHT,
8
+ SCROLL_INTO_VIEW,
9
+ MAX_Z_INDEX,
10
+ MIN_TOUCH_AREA_SIZE
11
+ };