storybook 9.0.0-alpha.20 → 9.0.0-alpha.21

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 (72) hide show
  1. package/assets/server/base-preview-head.html +1 -3
  2. package/dist/actions/decorator.js +34 -38
  3. package/dist/actions/index.cjs +1 -4
  4. package/dist/actions/index.js +1 -4
  5. package/dist/actions/preview.cjs +1 -4
  6. package/dist/actions/preview.js +1 -4
  7. package/dist/babel/index.cjs +822 -816
  8. package/dist/babel/index.js +822 -816
  9. package/dist/backgrounds/index.cjs +16 -16
  10. package/dist/backgrounds/index.js +14 -14
  11. package/dist/backgrounds/preview.cjs +34 -34
  12. package/dist/backgrounds/preview.js +29 -29
  13. package/dist/bin/index.cjs +67 -65
  14. package/dist/bin/index.js +61 -59
  15. package/dist/builder-manager/index.cjs +482 -472
  16. package/dist/builder-manager/index.js +283 -273
  17. package/dist/channels/index.js +941 -919
  18. package/dist/cli/bin/index.cjs +1 -1
  19. package/dist/cli/bin/index.js +1 -1
  20. package/dist/cli/index.cjs +61752 -7591
  21. package/dist/cli/index.d.ts +22 -14
  22. package/dist/cli/index.js +61775 -7614
  23. package/dist/common/index.cjs +16015 -8979
  24. package/dist/common/index.d.ts +30 -1
  25. package/dist/common/index.js +16105 -9063
  26. package/dist/components/index.cjs +3694 -3643
  27. package/dist/components/index.d.ts +5 -2
  28. package/dist/components/index.js +2352 -2294
  29. package/dist/core-server/index.cjs +3540 -3540
  30. package/dist/core-server/index.js +730 -730
  31. package/dist/core-server/presets/common-manager.js +2642 -2592
  32. package/dist/core-server/presets/common-preset.cjs +723 -715
  33. package/dist/core-server/presets/common-preset.js +10 -2
  34. package/dist/docs-tools/index.js +640 -632
  35. package/dist/highlight/index.cjs +16 -16
  36. package/dist/highlight/index.d.ts +45 -1
  37. package/dist/highlight/index.js +2 -2
  38. package/dist/highlight/preview.cjs +522 -68
  39. package/dist/highlight/preview.js +508 -56
  40. package/dist/instrumenter/index.js +1179 -1170
  41. package/dist/manager/globals-module-info.cjs +1 -0
  42. package/dist/manager/globals-module-info.js +1 -0
  43. package/dist/manager/globals-runtime.js +19385 -19190
  44. package/dist/manager/runtime.js +2084 -2079
  45. package/dist/manager-api/index.cjs +352 -352
  46. package/dist/manager-api/index.js +1694 -1663
  47. package/dist/manager-errors.js +41 -37
  48. package/dist/measure/index.cjs +99 -97
  49. package/dist/measure/index.js +95 -93
  50. package/dist/measure/preview.cjs +127 -125
  51. package/dist/measure/preview.js +125 -123
  52. package/dist/outline/index.cjs +41 -41
  53. package/dist/outline/index.js +12 -12
  54. package/dist/outline/preview.cjs +23 -23
  55. package/dist/outline/preview.js +7 -7
  56. package/dist/preview/runtime.js +13577 -12959
  57. package/dist/preview-api/index.cjs +0 -1
  58. package/dist/preview-api/index.d.ts +120 -385
  59. package/dist/preview-api/index.js +827 -812
  60. package/dist/preview-errors.cjs +65 -51
  61. package/dist/preview-errors.d.ts +6 -2
  62. package/dist/preview-errors.js +176 -142
  63. package/dist/server-errors.cjs +105 -72
  64. package/dist/server-errors.d.ts +9 -1
  65. package/dist/server-errors.js +87 -54
  66. package/dist/telemetry/index.cjs +374 -370
  67. package/dist/telemetry/index.js +460 -456
  68. package/dist/test/index.js +9831 -9743
  69. package/dist/test/preview.d.ts +0 -6
  70. package/dist/test/preview.js +3628 -3568
  71. package/dist/types/index.d.ts +72 -6
  72. package/package.json +1 -1
@@ -1,8 +1,7 @@
1
1
  <base target="_parent" />
2
2
 
3
3
  <style>
4
- /* While we aren't showing the main block yet, but still preparing, we want everything the user
5
- has rendered, which may or may not be in #storybook-root, to be display none */
4
+ /* While we aren't showing the main block yet, but still preparing, we want everything the user has rendered, which may or may not be in #storybook-root, to be display none */
6
5
  .sb-show-preparing-story:not(.sb-show-main) > :not(.sb-preparing-story) {
7
6
  display: none;
8
7
  }
@@ -437,7 +436,6 @@
437
436
 
438
437
  <script>
439
438
  /* globals window */
440
- /* eslint-disable no-underscore-dangle */
441
439
  try {
442
440
  if (window.top !== window) {
443
441
  window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.top.__REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -1,18 +1,17 @@
1
- var j = Object.defineProperty;
2
- var r = (e, o) => j(e, "name", { value: o, configurable: !0 });
1
+ var R = Object.defineProperty;
2
+ var r = (e, o) => R(e, "name", { value: o, configurable: !0 });
3
3
 
4
4
  // src/actions/decorator.ts
5
- import { global as F } from "@storybook/global";
6
- import { makeDecorator as M, useEffect as C } from "storybook/preview-api";
5
+ import { makeDecorator as T, useEffect as k } from "storybook/preview-api";
7
6
 
8
7
  // src/actions/constants.ts
9
- var h = "actions", y = "storybook/actions", L = `${y}/panel`, g = `${y}/action-event`, W = `${y}/action-clear`;
8
+ var h = "actions", y = "storybook/actions", B = `${y}/panel`, g = `${y}/action-event`, H = `${y}/action-clear`;
10
9
 
11
10
  // src/actions/runtime/action.ts
12
- import { ImplicitActionsDuringRendering as S } from "storybook/internal/preview-errors";
11
+ import { ImplicitActionsDuringRendering as D } from "storybook/internal/preview-errors";
13
12
  import { global as E } from "@storybook/global";
14
- import { addons as I } from "storybook/preview-api";
15
- import { v4 as P } from "uuid";
13
+ import { addons as j } from "storybook/preview-api";
14
+ import { v4 as S } from "uuid";
16
15
 
17
16
  // src/actions/runtime/configureActions.ts
18
17
  var a = {
@@ -25,9 +24,9 @@ var a = {
25
24
  var A = /* @__PURE__ */ r((e, o) => {
26
25
  let t = Object.getPrototypeOf(e);
27
26
  return !t || o(t) ? t : A(t, o);
28
- }, "findProto"), x = /* @__PURE__ */ r((e) => !!(typeof e == "object" && e && A(e, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
29
- typeof e.persist == "function"), "isReactSyntheticEvent"), k = /* @__PURE__ */ r((e) => {
30
- if (x(e)) {
27
+ }, "findProto"), I = /* @__PURE__ */ r((e) => !!(typeof e == "object" && e && A(e, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
28
+ typeof e.persist == "function"), "isReactSyntheticEvent"), P = /* @__PURE__ */ r((e) => {
29
+ if (I(e)) {
31
30
  let o = Object.create(
32
31
  e.constructor.prototype,
33
32
  Object.getOwnPropertyDescriptors(e)
@@ -40,7 +39,7 @@ typeof e.persist == "function"), "isReactSyntheticEvent"), k = /* @__PURE__ */ r
40
39
  }), o;
41
40
  }
42
41
  return e;
43
- }, "serializeArg"), T = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? P() : (
42
+ }, "serializeArg"), x = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? S() : (
44
43
  // pseudo random id, example response lo1e7zm4832bkr7yfl7
45
44
  Date.now().toString(36) + Math.random().toString(36).substring(2)
46
45
  ), "generateId");
@@ -50,34 +49,31 @@ function O(e, o = {}) {
50
49
  ...o
51
50
  }, n = /* @__PURE__ */ r(function(...i) {
52
51
  if (o.implicit) {
53
- let u = ("__STORYBOOK_PREVIEW__" in E ? (
54
- // eslint-disable-next-line no-underscore-dangle
55
- E.__STORYBOOK_PREVIEW__
56
- ) : void 0)?.storyRenders.find(
52
+ let d = ("__STORYBOOK_PREVIEW__" in E ? E.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
57
53
  (c) => c.phase === "playing" || c.phase === "rendering"
58
54
  );
59
- if (u) {
60
- let c = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, d = new S({
61
- phase: u.phase,
55
+ if (d) {
56
+ let c = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, u = new D({
57
+ phase: d.phase,
62
58
  name: e,
63
59
  deprecated: c
64
60
  });
65
61
  if (c)
66
- console.warn(d);
62
+ console.warn(u);
67
63
  else
68
- throw d;
64
+ throw u;
69
65
  }
70
66
  }
71
- let m = I.getChannel(), p = T(), l = 5, f = i.map(k), R = i.length > 1 ? f : f[0], D = {
67
+ let m = j.getChannel(), p = x(), l = 5, f = i.map(P), w = i.length > 1 ? f : f[0], _ = {
72
68
  id: p,
73
69
  count: 0,
74
- data: { name: e, args: R },
70
+ data: { name: e, args: w },
75
71
  options: {
76
72
  ...t,
77
73
  maxDepth: l + (t.depth || 3)
78
74
  }
79
75
  };
80
- m.emit(g, D);
76
+ m.emit(g, _);
81
77
  }, "actionHandler");
82
78
  return n.isAction = !0, n.implicit = o.implicit, n;
83
79
  }
@@ -101,38 +97,38 @@ var b = /* @__PURE__ */ r((...e) => {
101
97
  }, "actions");
102
98
 
103
99
  // src/actions/decorator.ts
104
- var { document: v, Element: w } = F, N = /^(\S+)\s*(.*)$/, V = w != null && !w.prototype.matches, Y = V ? "msMatchesSelector" : "matches", _ = /* @__PURE__ */ r(
100
+ var F = /^(\S+)\s*(.*)$/, M = Element != null && !Element.prototype.matches, C = M ? "msMatchesSelector" : "matches", v = /* @__PURE__ */ r(
105
101
  (e, o) => {
106
- if (e[Y](o))
102
+ if (e[C](o))
107
103
  return !0;
108
104
  let t = e.parentElement;
109
- return t ? _(t, o) : !1;
110
- }, "hasMatchInAncestry"), $ = /* @__PURE__ */ r((e, ...o) => {
105
+ return t ? v(t, o) : !1;
106
+ }, "hasMatchInAncestry"), N = /* @__PURE__ */ r((e, ...o) => {
111
107
  let t = e(...o);
112
108
  return Object.entries(t).map(([n, s]) => {
113
- let [i, m, p] = n.match(N) || [];
109
+ let [i, m, p] = n.match(F) || [];
114
110
  return {
115
111
  eventName: m,
116
112
  handler: /* @__PURE__ */ r((l) => {
117
- (!p || _(l.target, p)) && s(l);
113
+ (!p || v(l.target, p)) && s(l);
118
114
  }, "handler")
119
115
  };
120
116
  });
121
- }, "createHandlers"), B = /* @__PURE__ */ r((e, ...o) => {
122
- let t = v && v.getElementById("storybook-root");
123
- C(() => {
124
- if (t != null) {
125
- let n = $(e, ...o);
117
+ }, "createHandlers"), V = /* @__PURE__ */ r((e, ...o) => {
118
+ let t = typeof globalThis.document < "u" && globalThis.document.getElementById("storybook-root");
119
+ k(() => {
120
+ if (t) {
121
+ let n = N(e, ...o);
126
122
  return n.forEach(({ eventName: s, handler: i }) => t.addEventListener(s, i)), () => n.forEach(({ eventName: s, handler: i }) => t.removeEventListener(
127
123
  s, i));
128
124
  }
129
125
  }, [t, e, o]);
130
- }, "applyEventHandlers"), mt = M({
126
+ }, "applyEventHandlers"), ct = T({
131
127
  name: "withActions",
132
128
  parameterName: h,
133
129
  skipIfNoParametersOrOptions: !0,
134
- wrapper: /* @__PURE__ */ r((e, o, { parameters: t }) => (t?.handles && B(b, ...t.handles), e(o)), "wrapper")
130
+ wrapper: /* @__PURE__ */ r((e, o, { parameters: t }) => (t?.handles && V(b, ...t.handles), e(o)), "wrapper")
135
131
  });
136
132
  export {
137
- mt as withActions
133
+ ct as withActions
138
134
  };
@@ -75,10 +75,7 @@ function l(t, o = {}) {
75
75
  ...o
76
76
  }, e = /* @__PURE__ */ r(function(...c) {
77
77
  if (o.implicit) {
78
- let d = ("__STORYBOOK_PREVIEW__" in f.global ? (
79
- // eslint-disable-next-line no-underscore-dangle
80
- f.global.__STORYBOOK_PREVIEW__
81
- ) : void 0)?.storyRenders.find(
78
+ let d = ("__STORYBOOK_PREVIEW__" in f.global ? f.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
82
79
  (p) => p.phase === "playing" || p.phase === "rendering"
83
80
  );
84
81
  if (d) {
@@ -48,10 +48,7 @@ function g(o, n = {}) {
48
48
  ...n
49
49
  }, e = /* @__PURE__ */ r(function(...i) {
50
50
  if (n.implicit) {
51
- let y = ("__STORYBOOK_PREVIEW__" in u ? (
52
- // eslint-disable-next-line no-underscore-dangle
53
- u.__STORYBOOK_PREVIEW__
54
- ) : void 0)?.storyRenders.find(
51
+ let y = ("__STORYBOOK_PREVIEW__" in u ? u.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
55
52
  (s) => s.phase === "playing" || s.phase === "rendering"
56
53
  );
57
54
  if (y) {
@@ -71,10 +71,7 @@ function g(e, t = {}) {
71
71
  ...t
72
72
  }, r = /* @__PURE__ */ i(function(...s) {
73
73
  if (t.implicit) {
74
- let x = ("__STORYBOOK_PREVIEW__" in u.global ? (
75
- // eslint-disable-next-line no-underscore-dangle
76
- u.global.__STORYBOOK_PREVIEW__
77
- ) : void 0)?.storyRenders.find(
74
+ let x = ("__STORYBOOK_PREVIEW__" in u.global ? u.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
78
75
  (d) => d.phase === "playing" || d.phase === "rendering"
79
76
  );
80
77
  if (x) {
@@ -59,10 +59,7 @@ function g(t, e = {}) {
59
59
  ...e
60
60
  }, r = /* @__PURE__ */ n(function(...s) {
61
61
  if (e.implicit) {
62
- let u = ("__STORYBOOK_PREVIEW__" in R ? (
63
- // eslint-disable-next-line no-underscore-dangle
64
- R.__STORYBOOK_PREVIEW__
65
- ) : void 0)?.storyRenders.find(
62
+ let u = ("__STORYBOOK_PREVIEW__" in R ? R.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
66
63
  (d) => d.phase === "playing" || d.phase === "rendering"
67
64
  );
68
65
  if (u) {