storybook 9.0.0-alpha.12 → 9.0.0-alpha.13

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 (78) hide show
  1. package/assets/docs/addon-backgrounds.gif +0 -0
  2. package/assets/docs/highlight.png +0 -0
  3. package/dist/backgrounds/index.cjs +148 -0
  4. package/dist/backgrounds/index.d.ts +91 -0
  5. package/dist/backgrounds/index.js +130 -0
  6. package/dist/backgrounds/preview.cjs +143 -0
  7. package/dist/backgrounds/preview.d.ts +54 -0
  8. package/dist/backgrounds/preview.js +127 -0
  9. package/dist/bin/index.cjs +63 -71
  10. package/dist/bin/index.js +53 -61
  11. package/dist/builder-manager/index.cjs +390 -380
  12. package/dist/builder-manager/index.js +489 -479
  13. package/dist/cli/bin/index.cjs +225 -225
  14. package/dist/cli/bin/index.js +234 -234
  15. package/dist/cli/index.cjs +0 -2
  16. package/dist/cli/index.js +0 -2
  17. package/dist/common/index.cjs +2399 -2378
  18. package/dist/common/index.d.ts +0 -8
  19. package/dist/common/index.js +2607 -2586
  20. package/dist/components/index.cjs +3394 -3372
  21. package/dist/components/index.js +3922 -3900
  22. package/dist/core-events/index.cjs +72 -84
  23. package/dist/core-events/index.d.ts +2 -77
  24. package/dist/core-events/index.js +61 -73
  25. package/dist/core-server/index.cjs +5258 -5168
  26. package/dist/core-server/index.js +6539 -6449
  27. package/dist/core-server/presets/common-manager.js +9815 -12
  28. package/dist/core-server/presets/common-preset.cjs +2809 -3005
  29. package/dist/core-server/presets/common-preset.js +2891 -3087
  30. package/dist/docs-tools/index.cjs +626 -600
  31. package/dist/docs-tools/index.js +613 -587
  32. package/dist/highlight/index.cjs +27 -0
  33. package/dist/highlight/index.d.ts +17 -0
  34. package/dist/highlight/index.js +7 -0
  35. package/dist/highlight/preview.cjs +81 -0
  36. package/dist/highlight/preview.d.ts +54 -0
  37. package/dist/highlight/preview.js +67 -0
  38. package/dist/instrumenter/index.cjs +70 -60
  39. package/dist/instrumenter/index.d.ts +8 -7
  40. package/dist/instrumenter/index.js +98 -88
  41. package/dist/manager/globals-module-info.cjs +12 -22
  42. package/dist/manager/globals-module-info.js +2 -12
  43. package/dist/manager/globals-runtime.js +24173 -23140
  44. package/dist/manager/runtime.js +3419 -3522
  45. package/dist/manager-api/index.cjs +1055 -1167
  46. package/dist/manager-api/index.d.ts +7 -21
  47. package/dist/manager-api/index.js +761 -877
  48. package/dist/measure/index.cjs +474 -0
  49. package/dist/measure/index.d.ts +66 -0
  50. package/dist/measure/index.js +462 -0
  51. package/dist/measure/preview.cjs +464 -0
  52. package/dist/measure/preview.d.ts +59 -0
  53. package/dist/measure/preview.js +448 -0
  54. package/dist/outline/index.cjs +528 -0
  55. package/dist/outline/index.d.ts +66 -0
  56. package/dist/outline/index.js +500 -0
  57. package/dist/outline/preview.cjs +518 -0
  58. package/dist/outline/preview.d.ts +59 -0
  59. package/dist/outline/preview.js +486 -0
  60. package/dist/preview/runtime.js +14441 -13330
  61. package/dist/preview-api/index.cjs +1067 -1071
  62. package/dist/preview-api/index.d.ts +61 -102
  63. package/dist/preview-api/index.js +1090 -1092
  64. package/dist/test/index.cjs +1547 -1546
  65. package/dist/test/index.js +2308 -2307
  66. package/dist/test/preview.cjs +1906 -1905
  67. package/dist/test/preview.d.ts +0 -6
  68. package/dist/test/preview.js +1439 -1438
  69. package/dist/test/spy.cjs +65 -64
  70. package/dist/test/spy.js +59 -58
  71. package/dist/types/index.cjs +10 -10
  72. package/dist/types/index.d.ts +206 -243
  73. package/package.json +121 -16
  74. package/dist/actions/manager.js +0 -1195
  75. package/dist/component-testing/manager.js +0 -3126
  76. package/dist/controls/manager.js +0 -5593
  77. package/dist/viewport/manager.js +0 -400
  78. /package/dist/{component-testing/manager.css → core-server/presets/common-manager.css} +0 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var H = Object.defineProperty;
3
+ var T = Object.getOwnPropertyDescriptor;
4
+ var _ = Object.getOwnPropertyNames;
5
+ var i = Object.prototype.hasOwnProperty;
6
+ var x = (o, t) => {
7
+ for (var r in t)
8
+ H(o, r, { get: t[r], enumerable: !0 });
9
+ }, E = (o, t, r, s) => {
10
+ if (t && typeof t == "object" || typeof t == "function")
11
+ for (let e of _(t))
12
+ !i.call(o, e) && e !== r && H(o, e, { get: () => t[e], enumerable: !(s = T(t, e)) || s.enumerable });
13
+ return o;
14
+ };
15
+ var c = (o) => E(H({}, "__esModule", { value: !0 }), o);
16
+
17
+ // src/highlight/index.ts
18
+ var h = {};
19
+ x(h, {
20
+ HIGHLIGHT: () => p,
21
+ RESET_HIGHLIGHT: () => G,
22
+ SCROLL_INTO_VIEW: () => L
23
+ });
24
+ module.exports = c(h);
25
+
26
+ // src/highlight/constants.ts
27
+ var I = "storybook/highlight", p = `${I}/add`, G = `${I}/reset`, L = `${I}/scroll-into-view`;
@@ -0,0 +1,17 @@
1
+ declare const HIGHLIGHT = "storybook/highlight/add";
2
+ declare const RESET_HIGHLIGHT = "storybook/highlight/reset";
3
+ declare const SCROLL_INTO_VIEW = "storybook/highlight/scroll-into-view";
4
+
5
+ interface HighlightParameters {
6
+ /**
7
+ * Highlight configuration
8
+ *
9
+ * @see https://storybook.js.org/docs/essentials/highlight#parameters
10
+ */
11
+ highlight: {
12
+ /** Remove the addon panel and disable the addon's behavior */
13
+ disable?: boolean;
14
+ };
15
+ }
16
+
17
+ export { HIGHLIGHT, type HighlightParameters, RESET_HIGHLIGHT, SCROLL_INTO_VIEW };
@@ -0,0 +1,7 @@
1
+ // src/highlight/constants.ts
2
+ var t = "storybook/highlight", o = `${t}/add`, e = `${t}/reset`, r = `${t}/scroll-into-view`;
3
+ export {
4
+ o as HIGHLIGHT,
5
+ e as RESET_HIGHLIGHT,
6
+ r as SCROLL_INTO_VIEW
7
+ };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var g = Object.defineProperty;
3
+ var E = Object.getOwnPropertyDescriptor;
4
+ var S = Object.getOwnPropertyNames;
5
+ var O = Object.prototype.hasOwnProperty;
6
+ var $ = (n, e) => g(n, "name", { value: e, configurable: !0 });
7
+ var T = (n, e) => {
8
+ for (var t in e)
9
+ g(n, t, { get: e[t], enumerable: !0 });
10
+ }, b = (n, e, t, o) => {
11
+ if (e && typeof e == "object" || typeof e == "function")
12
+ for (let r of S(e))
13
+ !O.call(n, r) && r !== t && g(n, r, { get: () => e[r], enumerable: !(o = E(e, r)) || o.enumerable });
14
+ return n;
15
+ };
16
+ var x = (n) => b(g({}, "__esModule", { value: !0 }), n);
17
+
18
+ // src/highlight/preview.ts
19
+ var _ = {};
20
+ T(_, {
21
+ default: () => L
22
+ });
23
+ module.exports = x(_);
24
+ var I = require("storybook/internal/core-events"), p = require("@storybook/global"), m = require("storybook/preview-api");
25
+
26
+ // src/highlight/constants.ts
27
+ var c = "storybook/highlight", u = `${c}/add`, f = `${c}/reset`, H = `${c}/scroll-into-view`;
28
+
29
+ // src/highlight/preview.ts
30
+ var { document: h } = p.global, G = /* @__PURE__ */ $((n, {
31
+ color: e = "#FF4785",
32
+ style: t = "solid",
33
+ width: o = "1px",
34
+ offset: r = "2px",
35
+ fadeOut: a = 0,
36
+ pulseOut: i = 0
37
+ }) => {
38
+ let s = Math.random().toString(36).substring(2, 15), l = "";
39
+ return i ? l = `@keyframes ${s} {
40
+ 0% { outline: ${o} ${t} ${e}; }
41
+ 20% { outline: ${o} ${t} ${e}00; }
42
+ 40% { outline: ${o} ${t} ${e}; }
43
+ 60% { outline: ${o} ${t} ${e}00; }
44
+ 80% { outline: ${o} ${t} ${e}; }
45
+ 100% { outline: ${o} ${t} ${e}00; }
46
+ }
47
+ ` : a && (l = `@keyframes ${s} {
48
+ 0% { outline: ${o} ${t} ${e}; }
49
+ 100% { outline: ${o} ${t} ${e}00; }
50
+ }
51
+ `), `${l}${n.join(", ")} {
52
+ outline: ${o} ${t} ${e};
53
+ outline-offset: ${r};
54
+ ${i || a ? `animation: ${s} ${i || a}ms linear forwards;` : ""}
55
+ }`;
56
+ }, "highlightStyle");
57
+ m.addons && m.addons.ready && m.addons.ready().then(() => {
58
+ let n = m.addons.getChannel(), e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ $((i) => {
59
+ let s = Math.random().toString(36).substring(2, 15);
60
+ e.add(s);
61
+ let l = h.createElement("style");
62
+ l.innerHTML = G(Array.from(new Set(i.elements)), i), l.setAttribute("id", s), h.head.appendChild(l);
63
+ let d = i.pulseOut || i.fadeOut;
64
+ d && setTimeout(() => o(s), d + 500);
65
+ }, "highlight"), o = /* @__PURE__ */ $((i) => {
66
+ let s = h.getElementById(i);
67
+ s?.parentNode?.removeChild(s), e.delete(i);
68
+ }, "removeHighlight"), r = /* @__PURE__ */ $(() => {
69
+ e.forEach(o);
70
+ }, "resetHighlight"), a = /* @__PURE__ */ $((i, s) => {
71
+ h.querySelector(i)?.scrollIntoView({ behavior: "smooth", block: "center", ...s }), t({
72
+ elements: [i],
73
+ color: "#1EA7FD",
74
+ width: "2px",
75
+ offset: "2px",
76
+ pulseOut: 3e3
77
+ });
78
+ }, "scrollIntoView");
79
+ n.on(I.STORY_CHANGED, r), n.on(H, a), n.on(f, r), n.on(u, t);
80
+ });
81
+ var L = /* @__PURE__ */ $(() => (0, m.definePreview)({}), "default");
@@ -0,0 +1,54 @@
1
+ import { Renderer as Renderer$1, ProjectAnnotations as ProjectAnnotations$1, StoryIdentifier, StoryContext, PartialStoryFn, LegacyStoryFn } from 'storybook/internal/csf';
2
+ import { NormalizedProjectAnnotations, ProjectAnnotations as ProjectAnnotations$2, ComposedStoryFn } from 'storybook/internal/types';
3
+
4
+ declare global {
5
+ interface SymbolConstructor {
6
+ readonly observable: symbol;
7
+ }
8
+ }
9
+
10
+ interface Renderer extends Renderer$1 {
11
+ }
12
+
13
+ type MaybePromise<T> = Promise<T> | T;
14
+ type TeardownRenderToCanvas = () => MaybePromise<void>;
15
+ type RenderToCanvas<TRenderer extends Renderer> = (context: RenderContext<TRenderer>, element: TRenderer['canvasElement']) => MaybePromise<void | TeardownRenderToCanvas>;
16
+ interface ProjectAnnotations<TRenderer extends Renderer> extends ProjectAnnotations$1<TRenderer> {
17
+ addons?: ProjectAnnotations<TRenderer>[];
18
+ testingLibraryRender?: (...args: never[]) => {
19
+ unmount: () => void;
20
+ };
21
+ renderToCanvas?: RenderToCanvas<TRenderer>;
22
+ }
23
+ declare type RenderContext<TRenderer extends Renderer = Renderer> = StoryIdentifier & {
24
+ showMain: () => void;
25
+ showError: (error: {
26
+ title: string;
27
+ description: string;
28
+ }) => void;
29
+ showException: (err: Error) => void;
30
+ forceRemount: boolean;
31
+ storyContext: StoryContext<TRenderer>;
32
+ storyFn: PartialStoryFn<TRenderer>;
33
+ unboundStoryFn: LegacyStoryFn<TRenderer>;
34
+ };
35
+
36
+ declare global {
37
+ var globalProjectAnnotations: NormalizedProjectAnnotations<any>;
38
+ var defaultProjectAnnotations: ProjectAnnotations$2<any>;
39
+ }
40
+ type WrappedStoryRef = {
41
+ __pw_type: 'jsx' | 'importRef';
42
+ };
43
+ type UnwrappedJSXStoryRef = {
44
+ __pw_type: 'jsx';
45
+ type: UnwrappedImportStoryRef;
46
+ };
47
+ type UnwrappedImportStoryRef = ComposedStoryFn;
48
+ declare global {
49
+ function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise<UnwrappedJSXStoryRef | UnwrappedImportStoryRef>;
50
+ }
51
+
52
+ declare const _default: () => ProjectAnnotations<Renderer>;
53
+
54
+ export { _default as default };
@@ -0,0 +1,67 @@
1
+ var H = Object.defineProperty;
2
+ var l = (s, e) => H(s, "name", { value: e, configurable: !0 });
3
+
4
+ // src/highlight/preview.ts
5
+ import { STORY_CHANGED as I } from "storybook/internal/core-events";
6
+ import { global as p } from "@storybook/global";
7
+ import { addons as a, definePreview as E } from "storybook/preview-api";
8
+
9
+ // src/highlight/constants.ts
10
+ var h = "storybook/highlight", d = `${h}/add`, u = `${h}/reset`, f = `${h}/scroll-into-view`;
11
+
12
+ // src/highlight/preview.ts
13
+ var { document: g } = p, S = /* @__PURE__ */ l((s, {
14
+ color: e = "#FF4785",
15
+ style: n = "solid",
16
+ width: o = "1px",
17
+ offset: m = "2px",
18
+ fadeOut: $ = 0,
19
+ pulseOut: t = 0
20
+ }) => {
21
+ let i = Math.random().toString(36).substring(2, 15), r = "";
22
+ return t ? r = `@keyframes ${i} {
23
+ 0% { outline: ${o} ${n} ${e}; }
24
+ 20% { outline: ${o} ${n} ${e}00; }
25
+ 40% { outline: ${o} ${n} ${e}; }
26
+ 60% { outline: ${o} ${n} ${e}00; }
27
+ 80% { outline: ${o} ${n} ${e}; }
28
+ 100% { outline: ${o} ${n} ${e}00; }
29
+ }
30
+ ` : $ && (r = `@keyframes ${i} {
31
+ 0% { outline: ${o} ${n} ${e}; }
32
+ 100% { outline: ${o} ${n} ${e}00; }
33
+ }
34
+ `), `${r}${s.join(", ")} {
35
+ outline: ${o} ${n} ${e};
36
+ outline-offset: ${m};
37
+ ${t || $ ? `animation: ${i} ${t || $}ms linear forwards;` : ""}
38
+ }`;
39
+ }, "highlightStyle");
40
+ a && a.ready && a.ready().then(() => {
41
+ let s = a.getChannel(), e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ l((t) => {
42
+ let i = Math.random().toString(36).substring(2, 15);
43
+ e.add(i);
44
+ let r = g.createElement("style");
45
+ r.innerHTML = S(Array.from(new Set(t.elements)), t), r.setAttribute("id", i), g.head.appendChild(r);
46
+ let c = t.pulseOut || t.fadeOut;
47
+ c && setTimeout(() => o(i), c + 500);
48
+ }, "highlight"), o = /* @__PURE__ */ l((t) => {
49
+ let i = g.getElementById(t);
50
+ i?.parentNode?.removeChild(i), e.delete(t);
51
+ }, "removeHighlight"), m = /* @__PURE__ */ l(() => {
52
+ e.forEach(o);
53
+ }, "resetHighlight"), $ = /* @__PURE__ */ l((t, i) => {
54
+ g.querySelector(t)?.scrollIntoView({ behavior: "smooth", block: "center", ...i }), n({
55
+ elements: [t],
56
+ color: "#1EA7FD",
57
+ width: "2px",
58
+ offset: "2px",
59
+ pulseOut: 3e3
60
+ });
61
+ }, "scrollIntoView");
62
+ s.on(I, m), s.on(f, $), s.on(u, m), s.on(d, n);
63
+ });
64
+ var _ = /* @__PURE__ */ l(() => E({}), "default");
65
+ export {
66
+ _ as default
67
+ };
@@ -24,13 +24,13 @@ var Er = (t, e, n) => (n = t != null ? gr(dr(t)) : {}, Le(
24
24
  )), _r = (t) => Le(Tt({}, "__esModule", { value: !0 }), t);
25
25
 
26
26
  // src/instrumenter/index.ts
27
- var ui = {};
28
- Sr(ui, {
27
+ var li = {};
28
+ Sr(li, {
29
29
  CallStates: () => cr,
30
- EVENTS: () => ot,
30
+ EVENTS: () => tt,
31
31
  instrument: () => mr
32
32
  });
33
- module.exports = _r(ui);
33
+ module.exports = _r(li);
34
34
 
35
35
  // src/instrumenter/instrumenter.ts
36
36
  var fr = require("storybook/internal/client-logger"), yt = require("storybook/internal/core-events"), W = require("@storybook/global");
@@ -120,7 +120,7 @@ c(Fe, "p");
120
120
  // ../node_modules/tinyrainbow/dist/node.js
121
121
  var De = require("tty");
122
122
  var Or = process.env.FORCE_TTY !== void 0 || (0, De.isatty)(1);
123
- var et = Fe(Or);
123
+ var nt = Fe(Or);
124
124
 
125
125
  // ../node_modules/@vitest/pretty-format/dist/index.js
126
126
  function Ze(t, e) {
@@ -782,7 +782,7 @@ o"), S = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), g = !1, u
782
782
  }
783
783
  }
784
784
  c(E, "typeOf");
785
- var $ = i, C = s, R = t, J = l, tt = n, L = S, z = f, X = e, V = o, M = r, F = m, D = p, Z = !1, B = !1;
785
+ var $ = i, C = s, R = t, J = l, et = n, L = S, z = f, X = e, V = o, M = r, F = m, D = p, Z = !1, B = !1;
786
786
  function K(T) {
787
787
  return Z || (Z = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")), !1;
788
788
  }
@@ -838,7 +838,7 @@ o"), S = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), g = !1, u
838
838
  function pr(T) {
839
839
  return E(T) === p;
840
840
  }
841
- c(pr, "isSuspenseList"), A.ContextConsumer = $, A.ContextProvider = C, A.Element = R, A.ForwardRef = J, A.Fragment = tt, A.Lazy = L, A.Memo =
841
+ c(pr, "isSuspenseList"), A.ContextConsumer = $, A.ContextProvider = C, A.Element = R, A.ForwardRef = J, A.Fragment = et, A.Lazy = L, A.Memo =
842
842
  z, A.Portal = X, A.Profiler = V, A.StrictMode = M, A.Suspense = F, A.SuspenseList = D, A.isAsyncMode = K, A.isConcurrentMode = st, A.isContextConsumer =
843
843
  G, A.isContextProvider = H, A.isElement = ct, A.isForwardRef = Q, A.isFragment = q, A.isLazy = it, A.isMemo = dt, A.isPortal = at, A.isProfiler =
844
844
  Ct, A.isStrictMode = Rt, A.isSuspense = Nt, A.isSuspenseList = pr, A.isValidElementType = d, A.typeOf = E;
@@ -1164,7 +1164,7 @@ var ce = {
1164
1164
  prop: "yellow",
1165
1165
  tag: "cyan",
1166
1166
  value: "green"
1167
- }, gn = Object.keys(ce), nt = {
1167
+ }, gn = Object.keys(ce), rt = {
1168
1168
  callToJSON: !0,
1169
1169
  compareKeys: void 0,
1170
1170
  escapeRegex: !1,
@@ -1181,7 +1181,7 @@ var ce = {
1181
1181
  };
1182
1182
  function ko(t) {
1183
1183
  for (let e of Object.keys(t))
1184
- if (!Object.prototype.hasOwnProperty.call(nt, e))
1184
+ if (!Object.prototype.hasOwnProperty.call(rt, e))
1185
1185
  throw new Error(`pretty-format: Unknown option "${e}".`);
1186
1186
  if (t.min && t.indent !== void 0 && t.indent !== 0)
1187
1187
  throw new Error(
@@ -1191,7 +1191,7 @@ function ko(t) {
1191
1191
  c(ko, "validateOptions");
1192
1192
  function zo() {
1193
1193
  return gn.reduce((t, e) => {
1194
- let n = ce[e], r = n && et[n];
1194
+ let n = ce[e], r = n && nt[n];
1195
1195
  if (r && typeof r.close == "string" && typeof r.open == "string")
1196
1196
  t[e] = r;
1197
1197
  else
@@ -1207,29 +1207,29 @@ function Yo() {
1207
1207
  }
1208
1208
  c(Yo, "getColorsEmpty");
1209
1209
  function hn(t) {
1210
- return t?.printFunctionName ?? nt.printFunctionName;
1210
+ return t?.printFunctionName ?? rt.printFunctionName;
1211
1211
  }
1212
1212
  c(hn, "getPrintFunctionName");
1213
1213
  function yn(t) {
1214
- return t?.escapeRegex ?? nt.escapeRegex;
1214
+ return t?.escapeRegex ?? rt.escapeRegex;
1215
1215
  }
1216
1216
  c(yn, "getEscapeRegex");
1217
1217
  function dn(t) {
1218
- return t?.escapeString ?? nt.escapeString;
1218
+ return t?.escapeString ?? rt.escapeString;
1219
1219
  }
1220
1220
  c(dn, "getEscapeString");
1221
1221
  function Xe(t) {
1222
1222
  return {
1223
- callToJSON: t?.callToJSON ?? nt.callToJSON,
1223
+ callToJSON: t?.callToJSON ?? rt.callToJSON,
1224
1224
  colors: t?.highlight ? zo() : Yo(),
1225
- compareKeys: typeof t?.compareKeys == "function" || t?.compareKeys === null ? t.compareKeys : nt.compareKeys,
1225
+ compareKeys: typeof t?.compareKeys == "function" || t?.compareKeys === null ? t.compareKeys : rt.compareKeys,
1226
1226
  escapeRegex: yn(t),
1227
1227
  escapeString: dn(t),
1228
- indent: t?.min ? "" : Uo(t?.indent ?? nt.indent),
1229
- maxDepth: t?.maxDepth ?? nt.maxDepth,
1230
- maxWidth: t?.maxWidth ?? nt.maxWidth,
1231
- min: t?.min ?? nt.min,
1232
- plugins: t?.plugins ?? nt.plugins,
1228
+ indent: t?.min ? "" : Uo(t?.indent ?? rt.indent),
1229
+ maxDepth: t?.maxDepth ?? rt.maxDepth,
1230
+ maxWidth: t?.maxWidth ?? rt.maxWidth,
1231
+ min: t?.min ?? rt.min,
1232
+ plugins: t?.plugins ?? rt.plugins,
1233
1233
  printBasicPrototype: t?.printBasicPrototype ?? !0,
1234
1234
  printFunctionName: hn(t),
1235
1235
  spacingInner: t?.min ? " " : `
@@ -1409,7 +1409,7 @@ c(ue, "inspectArray");
1409
1409
  // ../node_modules/loupe/lib/typedarray.js
1410
1410
  var Go = /* @__PURE__ */ c((t) => typeof Buffer == "function" && t instanceof Buffer ? "Buffer" : t[Symbol.toStringTag] ? t[Symbol.toStringTag] :
1411
1411
  t.constructor.name, "getArrayName");
1412
- function rt(t, e) {
1412
+ function ot(t, e) {
1413
1413
  let n = Go(t);
1414
1414
  e.truncate -= n.length + 4;
1415
1415
  let r = Object.keys(t).slice(t.length);
@@ -1427,7 +1427,7 @@ function rt(t, e) {
1427
1427
  let s = "";
1428
1428
  return r.length && (s = j(r.map((i) => [i, t[i]]), e, lt)), `${n}[ ${o}${s ? `, ${s}` : ""} ]`;
1429
1429
  }
1430
- c(rt, "inspectTypedArray");
1430
+ c(ot, "inspectTypedArray");
1431
1431
 
1432
1432
  // ../node_modules/loupe/lib/date.js
1433
1433
  function le(t, e) {
@@ -1648,15 +1648,15 @@ var Tn = /* @__PURE__ */ new WeakMap(), On = {}, $n = {
1648
1648
  WeakSet: /* @__PURE__ */ c((t, e) => e.stylize("WeakSet{\u2026}", "special"), "WeakSet"),
1649
1649
  WeakMap: /* @__PURE__ */ c((t, e) => e.stylize("WeakMap{\u2026}", "special"), "WeakMap"),
1650
1650
  Arguments: he,
1651
- Int8Array: rt,
1652
- Uint8Array: rt,
1653
- Uint8ClampedArray: rt,
1654
- Int16Array: rt,
1655
- Uint16Array: rt,
1656
- Int32Array: rt,
1657
- Uint32Array: rt,
1658
- Float32Array: rt,
1659
- Float64Array: rt,
1651
+ Int8Array: ot,
1652
+ Uint8Array: ot,
1653
+ Uint8ClampedArray: ot,
1654
+ Int16Array: ot,
1655
+ Uint16Array: ot,
1656
+ Int32Array: ot,
1657
+ Uint32Array: ot,
1658
+ Float32Array: ot,
1659
+ Float64Array: ot,
1660
1660
  Generator: /* @__PURE__ */ c(() => "", "Generator"),
1661
1661
  DataView: /* @__PURE__ */ c(() => "", "DataView"),
1662
1662
  ArrayBuffer: /* @__PURE__ */ c(() => "", "ArrayBuffer"),
@@ -2121,9 +2121,9 @@ function Ts() {
2121
2121
  }
2122
2122
  return !1;
2123
2123
  }, "extendOverlappablePathsR"), l = /* @__PURE__ */ c((y, g, u, h, b, _, O, d, E) => {
2124
- let $ = h - g, C = b - u, R = u - g, J = b - h, tt = J - R, L = R, z = R;
2125
- if (O[0] = g - 1, d[0] = u, tt % 2 === 0) {
2126
- let X = (y || tt) / 2, V = (R + J) / 2;
2124
+ let $ = h - g, C = b - u, R = u - g, J = b - h, et = J - R, L = R, z = R;
2125
+ if (O[0] = g - 1, d[0] = u, et % 2 === 0) {
2126
+ let X = (y || et) / 2, V = (R + J) / 2;
2127
2127
  for (let M = 1; M <= V; M += 1)
2128
2128
  if (L = o(M, u, b, $, _, O, L), M < X)
2129
2129
  z = s(M, g, h, C, _, d, z);
@@ -2146,7 +2146,7 @@ function Ts() {
2146
2146
  )
2147
2147
  return;
2148
2148
  } else {
2149
- let X = ((y || tt) + 1) / 2, V = (R + J + 1) / 2, M = 1;
2149
+ let X = ((y || et) + 1) / 2, V = (R + J + 1) / 2, M = 1;
2150
2150
  for (L = o(M, u, b, $, _, O, L), M += 1; M <= V; M += 1)
2151
2151
  if (z = s(
2152
2152
  M - 1,
@@ -2208,7 +2208,7 @@ function Ts() {
2208
2208
  );
2209
2209
  let {
2210
2210
  nChangePreceding: J,
2211
- aEndPreceding: tt,
2211
+ aEndPreceding: et,
2212
2212
  bEndPreceding: L,
2213
2213
  nCommonPreceding: z,
2214
2214
  aCommonPreceding: X,
@@ -2220,10 +2220,10 @@ function Ts() {
2220
2220
  aStartFollowing: B,
2221
2221
  bStartFollowing: K
2222
2222
  } = $;
2223
- g < tt && h < L && m(
2223
+ g < et && h < L && m(
2224
2224
  J,
2225
2225
  g,
2226
- tt,
2226
+ et,
2227
2227
  h,
2228
2228
  L,
2229
2229
  _,
@@ -2461,14 +2461,14 @@ var _e = /* @__PURE__ */ c((t) => t, "noColor"), Qn = 5, Rs = 0;
2461
2461
  function Ns() {
2462
2462
  return {
2463
2463
  aAnnotation: "Expected",
2464
- aColor: et.green,
2464
+ aColor: nt.green,
2465
2465
  aIndicator: "-",
2466
2466
  bAnnotation: "Received",
2467
- bColor: et.red,
2467
+ bColor: nt.red,
2468
2468
  bIndicator: "+",
2469
- changeColor: et.inverse,
2469
+ changeColor: nt.inverse,
2470
2470
  changeLineTrailingSpaceColor: _e,
2471
- commonColor: et.dim,
2471
+ commonColor: nt.dim,
2472
2472
  commonIndicator: " ",
2473
2473
  commonLineTrailingSpaceColor: _e,
2474
2474
  compareKeys: void 0,
@@ -2477,7 +2477,7 @@ function Ns() {
2477
2477
  expand: !0,
2478
2478
  includeChangeCounts: !1,
2479
2479
  omitAnnotationLines: !1,
2480
- patchColor: et.yellow,
2480
+ patchColor: nt.yellow,
2481
2481
  printBasicPrototype: !1,
2482
2482
  truncateThreshold: Rs,
2483
2483
  truncateAnnotation: "... Diff result is truncated",
@@ -3016,16 +3016,16 @@ function sr(t) {
3016
3016
  }
3017
3017
  c(sr, "replaceTrailingSpaces");
3018
3018
  function Xs(t) {
3019
- return et.red(sr(gt(t)));
3019
+ return nt.red(sr(gt(t)));
3020
3020
  }
3021
3021
  c(Xs, "printReceived");
3022
3022
  function Zs(t) {
3023
- return et.green(sr(gt(t)));
3023
+ return nt.green(sr(gt(t)));
3024
3024
  }
3025
3025
  c(Zs, "printExpected");
3026
3026
  function Vn(t, e, n) {
3027
3027
  return t.reduce(
3028
- (r, o) => r + (o[0] === x ? o[1] : o[0] === e ? n ? et.inverse(o[1]) : o[1] : ""),
3028
+ (r, o) => r + (o[0] === x ? o[1] : o[0] === e ? n ? nt.inverse(o[1]) : o[1] : ""),
3029
3029
  ""
3030
3030
  );
3031
3031
  }
@@ -3123,11 +3123,8 @@ Inner error message: ${r?.message}`
3123
3123
  }
3124
3124
  c(Ne, "processError");
3125
3125
 
3126
- // src/instrumenter/types.ts
3127
- var cr = /* @__PURE__ */ ((o) => (o.DONE = "done", o.ERROR = "error", o.ACTIVE = "active", o.WAITING = "waiting", o))(cr || {});
3128
-
3129
- // src/instrumenter/instrumenter.ts
3130
- var ot = {
3126
+ // src/instrumenter/EVENTS.ts
3127
+ var tt = {
3131
3128
  CALL: "storybook/instrumenter/call",
3132
3129
  SYNC: "storybook/instrumenter/sync",
3133
3130
  START: "storybook/instrumenter/start",
@@ -3135,7 +3132,13 @@ var ot = {
3135
3132
  GOTO: "storybook/instrumenter/goto",
3136
3133
  NEXT: "storybook/instrumenter/next",
3137
3134
  END: "storybook/instrumenter/end"
3138
- }, ur = {
3135
+ };
3136
+
3137
+ // src/instrumenter/types.ts
3138
+ var cr = /* @__PURE__ */ ((o) => (o.DONE = "done", o.ERROR = "error", o.ACTIVE = "active", o.WAITING = "waiting", o))(cr || {});
3139
+
3140
+ // src/instrumenter/instrumenter.ts
3141
+ var ur = {
3139
3142
  start: !1,
3140
3143
  back: !1,
3141
3144
  goto: !1,
@@ -3251,8 +3254,8 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3251
3254
  this.channel = l.getChannel(), this.channel.on(yt.FORCE_REMOUNT, e), this.channel.on(yt.STORY_RENDER_PHASE_CHANGED, a), this.channel.
3252
3255
  on(yt.SET_CURRENT_STORY, () => {
3253
3256
  this.initialized ? this.cleanup() : this.initialized = !0;
3254
- }), this.channel.on(ot.START, n(this.channel)), this.channel.on(ot.BACK, r(this.channel)), this.channel.on(ot.GOTO, o(this.channel)),
3255
- this.channel.on(ot.NEXT, s(this.channel)), this.channel.on(ot.END, i);
3257
+ }), this.channel.on(tt.START, n(this.channel)), this.channel.on(tt.BACK, r(this.channel)), this.channel.on(tt.GOTO, o(this.channel)),
3258
+ this.channel.on(tt.NEXT, s(this.channel)), this.channel.on(tt.END, i);
3256
3259
  });
3257
3260
  });
3258
3261
  }
@@ -3276,7 +3279,7 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3276
3279
  {}
3277
3280
  );
3278
3281
  let e = { controlStates: ur, logItems: [] };
3279
- this.channel?.emit(ot.SYNC, e), W.global.window?.parent && (W.global.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__ =
3282
+ this.channel?.emit(tt.SYNC, e), W.global.window?.parent && (W.global.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__ =
3280
3283
  this.state);
3281
3284
  }
3282
3285
  getLog(e) {
@@ -3406,8 +3409,8 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3406
3409
  try {
3407
3410
  if (i === "played" && !r.retain)
3408
3411
  throw ri;
3409
- let S = (o.getArgs ? o.getArgs(r, this.getState(r.storyId)) : r.args).map((g) => typeof g != "function" || Object.keys(g).length ? g :
3410
- (...u) => {
3412
+ let S = (o.getArgs ? o.getArgs(r, this.getState(r.storyId)) : r.args).map((g) => typeof g != "function" || ui(g) || Object.keys(g).length ?
3413
+ g : (...u) => {
3411
3414
  let { cursor: h, ancestors: b } = this.getState(r.storyId);
3412
3415
  this.setState(r.storyId, { cursor: 0, ancestors: [...b, r.id] });
3413
3416
  let _ = /* @__PURE__ */ c(() => this.setState(r.storyId, { cursor: h, ancestors: b }), "restore"), O = !1;
@@ -3433,7 +3436,7 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3433
3436
  }
3434
3437
  // Sends the call info to the manager and synchronizes the log.
3435
3438
  update(e) {
3436
- this.channel?.emit(ot.CALL, e), this.setState(e.storyId, ({ calls: n }) => {
3439
+ this.channel?.emit(tt.CALL, e), this.setState(e.storyId, ({ calls: n }) => {
3437
3440
  let r = n.concat(e).reduce((o, s) => Object.assign(o, { [s.id]: s }), {});
3438
3441
  return {
3439
3442
  // Calls are sorted to ensure parent calls always come before calls in their callback.
@@ -3451,7 +3454,7 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3451
3454
  status === "waiting")?.callId, a = s.some((f) => f.status === "active");
3452
3455
  if (r || a || s.length === 0) {
3453
3456
  let f = { controlStates: ur, logItems: s };
3454
- this.channel?.emit(ot.SYNC, f);
3457
+ this.channel?.emit(tt.SYNC, f);
3455
3458
  return;
3456
3459
  }
3457
3460
  let l = s.some(
@@ -3463,7 +3466,7 @@ prototype.toString.call(t) === "[object Module]", "isModule"), si = /* @__PURE__
3463
3466
  next: o,
3464
3467
  end: o
3465
3468
  }, logItems: s, pausedAt: i };
3466
- this.channel?.emit(ot.SYNC, p);
3469
+ this.channel?.emit(tt.SYNC, p);
3467
3470
  }, "synchronize");
3468
3471
  this.setState(e, ({ syncTimeout: r }) => (clearTimeout(r), { syncTimeout: setTimeout(n, 0) }));
3469
3472
  }
@@ -3490,3 +3493,10 @@ function ci(t, e) {
3490
3493
  }
3491
3494
  }
3492
3495
  c(ci, "getPropertyDescriptor");
3496
+ function ui(t) {
3497
+ if (typeof t != "function")
3498
+ return !1;
3499
+ let e = Object.getOwnPropertyDescriptor(t, "prototype");
3500
+ return e ? !e.writable : !1;
3501
+ }
3502
+ c(ui, "isClass");
@@ -84,6 +84,14 @@ interface Options {
84
84
  getKeys?: (originalObject: Record<string, unknown>, depth: number) => string[];
85
85
  }
86
86
 
87
+ /**
88
+ * Instruments an object or module by traversing its properties, patching any functions (methods) to
89
+ * enable debugging. Patched functions will emit a `call` event when invoked. When intercept = true,
90
+ * patched functions will return a Promise when the debugger stops before this function. As such,
91
+ * "interceptable" functions will have to be `await`-ed.
92
+ */
93
+ declare function instrument<TObj extends Record<string, any>>(obj: TObj, options?: Options): TObj;
94
+
87
95
  declare const EVENTS: {
88
96
  CALL: string;
89
97
  SYNC: string;
@@ -93,12 +101,5 @@ declare const EVENTS: {
93
101
  NEXT: string;
94
102
  END: string;
95
103
  };
96
- /**
97
- * Instruments an object or module by traversing its properties, patching any functions (methods) to
98
- * enable debugging. Patched functions will emit a `call` event when invoked. When intercept = true,
99
- * patched functions will return a Promise when the debugger stops before this function. As such,
100
- * "interceptable" functions will have to be `await`-ed.
101
- */
102
- declare function instrument<TObj extends Record<string, any>>(obj: TObj, options?: Options): TObj;
103
104
 
104
105
  export { type Call, type CallRef, CallStates, type ControlStates, EVENTS, type ElementRef, type LogItem, type Options, type State, type SyncPayload, instrument };