@storybook/react 10.5.0-alpha.1 → 10.5.0-alpha.10

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DDIRQRCA.js";
4
4
  import {
5
5
  __export
6
- } from "./chunk-SL3VIQZ3.js";
6
+ } from "./chunk-UAWMPV5J.js";
7
7
 
8
8
  // src/entry-preview.tsx
9
9
  var entry_preview_exports = {};
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isMemo,
3
3
  reactElementToJsxString
4
- } from "./chunk-E4YOXNOQ.js";
4
+ } from "./chunk-B3FR4PBN.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __export,
8
8
  __toESM
9
- } from "./chunk-SL3VIQZ3.js";
9
+ } from "./chunk-UAWMPV5J.js";
10
10
 
11
11
  // ../../../node_modules/estraverse/estraverse.js
12
12
  var require_estraverse = __commonJS({
@@ -6324,14 +6324,9 @@ function parse(value) {
6324
6324
  };
6325
6325
  if (ast.body[0] != null) {
6326
6326
  let rootNode = ast.body[0];
6327
- switch (rootNode.type) {
6328
- case "ExpressionStatement": {
6329
- let expressionResult = parseExpression(rootNode.expression);
6330
- expressionResult != null && (parsingResult = expressionResult);
6331
- break;
6332
- }
6333
- default:
6334
- break;
6327
+ if (rootNode.type === "ExpressionStatement") {
6328
+ let expressionResult = parseExpression(rootNode.expression);
6329
+ expressionResult != null && (parsingResult = expressionResult);
6335
6330
  }
6336
6331
  }
6337
6332
  return parsingResult;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __toESM
4
- } from "./chunk-SL3VIQZ3.js";
4
+ } from "./chunk-UAWMPV5J.js";
5
5
 
6
6
  // ../../../node_modules/@base2/pretty-print-object/dist/index.js
7
7
  var require_dist = __commonJS({
@@ -104,8 +104,8 @@ var require_dist = __commonJS({
104
104
  var require_react_is_production_min = __commonJS({
105
105
  "../../../node_modules/react-element-to-jsx-string/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
106
106
  "use strict";
107
- var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u;
108
- u = Symbol.for("react.module.reference");
107
+ var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
108
+ u = /* @__PURE__ */ Symbol.for("react.module.reference");
109
109
  function v(a) {
110
110
  if (typeof a == "object" && a !== null) {
111
111
  var r = a.$$typeof;
@@ -203,8 +203,8 @@ var require_react_is_development = __commonJS({
203
203
  "use strict";
204
204
  process.env.NODE_ENV !== "production" && (function() {
205
205
  "use strict";
206
- var enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), REACT_MODULE_REFERENCE;
207
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
206
+ var enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen"), REACT_MODULE_REFERENCE;
207
+ REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
208
208
  function isValidElementType(type) {
209
209
  return !!(typeof type == "string" || typeof type == "function" || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing || typeof type == "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
210
210
  // types supported by any Flight configuration anywhere since
@@ -301,7 +301,7 @@ var require_react_is = __commonJS({
301
301
  });
302
302
 
303
303
  // src/docs/lib/componentTypes.ts
304
- var isMemo = (component) => component.$$typeof === Symbol.for("react.memo"), isForwardRef = (component) => component.$$typeof === Symbol.for("react.forward_ref");
304
+ var isMemo = (component) => component.$$typeof === /* @__PURE__ */ Symbol.for("react.memo"), isForwardRef = (component) => component.$$typeof === /* @__PURE__ */ Symbol.for("react.forward_ref");
305
305
 
306
306
  // ../../../node_modules/is-plain-object/dist/is-plain-object.mjs
307
307
  function isObject(o) {
@@ -538,7 +538,7 @@ var defaultFunctionValue = inlineFunction, formatFunction = (function(fn, option
538
538
  var usedValue = hasValue ? value : defaultValue, useBooleanShorthandSyntax = options.useBooleanShorthandSyntax, tabStop = options.tabStop, formattedPropValue = formatPropValue(usedValue, inline, lvl, options), attributeFormattedInline = " ", attributeFormattedMultiline = `
539
539
  `.concat(spacer(lvl + 1, tabStop)), isMultilineAttribute = formattedPropValue.includes(`
540
540
  `);
541
- return useBooleanShorthandSyntax && formattedPropValue === "{false}" && !hasDefaultValue ? (attributeFormattedInline = "", attributeFormattedMultiline = "") : useBooleanShorthandSyntax && formattedPropValue === "{true}" ? (attributeFormattedInline += "".concat(name), attributeFormattedMultiline += "".concat(name)) : (attributeFormattedInline += "".concat(name, "=").concat(formattedPropValue), attributeFormattedMultiline += "".concat(name, "=").concat(formattedPropValue)), {
541
+ return useBooleanShorthandSyntax && formattedPropValue === "{true}" ? (attributeFormattedInline += "".concat(name), attributeFormattedMultiline += "".concat(name)) : (attributeFormattedInline += "".concat(name, "=").concat(formattedPropValue), attributeFormattedMultiline += "".concat(name, "=").concat(formattedPropValue)), {
542
542
  attributeFormattedInline,
543
543
  attributeFormattedMultiline,
544
544
  isMultilineAttribute
@@ -5,10 +5,10 @@ import {
5
5
  isForwardRef,
6
6
  isMemo,
7
7
  reactElementToJsxString
8
- } from "./chunk-E4YOXNOQ.js";
8
+ } from "./chunk-B3FR4PBN.js";
9
9
  import {
10
10
  __export
11
- } from "./chunk-SL3VIQZ3.js";
11
+ } from "./chunk-UAWMPV5J.js";
12
12
 
13
13
  // src/entry-preview-docs.ts
14
14
  var entry_preview_docs_exports = {};
@@ -50,7 +50,29 @@ var renderJsx = (code, options) => {
50
50
  let displayNameDefaults;
51
51
  typeof options?.displayName == "string" ? displayNameDefaults = { showFunctions: !0, displayName: () => options.displayName } : displayNameDefaults = {
52
52
  // To get exotic component names resolving properly
53
- displayName: (el) => el.type.displayName ? el.type.displayName : getDocgenSection(el.type, "displayName") ? getDocgenSection(el.type, "displayName") : el.type.render?.displayName ? el.type.render.displayName : typeof el.type == "symbol" || el.type.$$typeof && typeof el.type.$$typeof == "symbol" ? getReactSymbolName(el.type) : el.type.name && el.type.name !== "_default" ? el.type.name : typeof el.type == "function" ? "No Display Name" : isForwardRef(el.type) ? el.type.render.name : isMemo(el.type) ? el.type.type.name : el.type
53
+ displayName: (el) => {
54
+ if (el.type.displayName)
55
+ return el.type.displayName;
56
+ if (getDocgenSection(el.type, "displayName"))
57
+ return getDocgenSection(el.type, "displayName");
58
+ if (el.type.render?.displayName)
59
+ return el.type.render.displayName;
60
+ if (typeof el.type == "symbol" || el.type.$$typeof && typeof el.type.$$typeof == "symbol")
61
+ return getReactSymbolName(el.type);
62
+ if (el.type.name && el.type.name !== "_default")
63
+ return el.type.name;
64
+ if (typeof el.type == "function") {
65
+ let parent = options?.parentComponent;
66
+ if (parent) {
67
+ for (let key of Object.keys(parent))
68
+ if (/^[A-Z]/.test(key) && parent[key] === el.type) {
69
+ let parentName = parent.displayName || parent.name || "";
70
+ return parentName ? `${parentName}.${key}` : key;
71
+ }
72
+ }
73
+ return "No Display Name";
74
+ } else return isForwardRef(el.type) ? el.type.render.name : isMemo(el.type) ? el.type.type.name : el.type;
75
+ }
54
76
  };
55
77
  let opts = {
56
78
  ...displayNameDefaults,
@@ -89,7 +111,8 @@ var renderJsx = (code, options) => {
89
111
  }, jsxDecorator = (storyFn, context) => {
90
112
  let jsx = useRef(void 0), story = storyFn(), skip = skipJsxRender(context), options = {
91
113
  ...defaultOpts,
92
- ...context?.parameters.jsx || {}
114
+ ...context?.parameters.jsx || {},
115
+ parentComponent: context?.component
93
116
  }, storyJsx = context.originalStoryFn(context.args, context);
94
117
  return useEffect(() => {
95
118
  if (skip)
@@ -106,7 +129,7 @@ var applyDecorators2 = (storyFn, decorators2) => {
106
129
  };
107
130
 
108
131
  // src/entry-preview-docs.ts
109
- var decorators = "FEATURES" in globalThis && globalThis?.FEATURES?.experimentalCodeExamples ? [] : [jsxDecorator], parameters = {
132
+ var useStaticServiceSnippets = "FEATURES" in globalThis && globalThis?.FEATURES?.experimentalDocgenServer, useCompileTimeSnippets = "FEATURES" in globalThis && globalThis?.FEATURES?.experimentalCodeExamples, decorators = useStaticServiceSnippets || useCompileTimeSnippets ? [] : [jsxDecorator], parameters = {
110
133
  docs: {
111
134
  story: { inline: !0 }
112
135
  }
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  entry_preview_exports
3
- } from "./chunk-L3JF7GGZ.js";
3
+ } from "./chunk-3HUEQMBJ.js";
4
4
  import {
5
5
  entry_preview_argtypes_exports
6
- } from "./chunk-77RIPXG7.js";
6
+ } from "./chunk-5GZAZJC7.js";
7
7
  import {
8
8
  entry_preview_docs_exports
9
- } from "./chunk-CMP5DLKH.js";
9
+ } from "./chunk-I4YGNZB3.js";
10
10
 
11
11
  // src/preview.tsx
12
12
  import { definePreview as definePreviewBase } from "storybook/internal/csf";
@@ -4,7 +4,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __commonJS = (cb, mod) => function() {
7
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ try {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ } catch (e) {
10
+ throw mod = 0, e;
11
+ }
8
12
  };
9
13
  var __export = (target, all) => {
10
14
  for (var name in all)