storybook 9.0.0-alpha.1 → 9.0.0-alpha.11

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 (267) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/addon-controls-args-annotated.png +0 -0
  8. package/assets/docs/addon-controls-args-background-color.png +0 -0
  9. package/assets/docs/addon-controls-args-background-string.png +0 -0
  10. package/assets/docs/addon-controls-args-docs.png +0 -0
  11. package/assets/docs/addon-controls-args-logging.png +0 -0
  12. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  13. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  14. package/assets/docs/addon-controls-args-reflow.png +0 -0
  15. package/assets/docs/addon-controls-args-template.png +0 -0
  16. package/assets/docs/addon-controls-expanded.png +0 -0
  17. package/assets/docs/addon-controls-hero.gif +0 -0
  18. package/assets/docs/addon-controls-install.png +0 -0
  19. package/assets/docs/hero.gif +0 -0
  20. package/assets/docs/message-reference.png +0 -0
  21. package/assets/docs/viewport.png +0 -0
  22. package/assets/server/addon.tsconfig.json +6 -0
  23. package/assets/server/base-preview-body.html +119 -0
  24. package/assets/server/base-preview-head.html +451 -0
  25. package/assets/server/template.ejs +87 -0
  26. package/bin/index.cjs +1 -1
  27. package/dist/actions/decorator.d.ts +6 -0
  28. package/dist/actions/decorator.js +139 -0
  29. package/dist/actions/index.cjs +127 -0
  30. package/dist/actions/index.d.ts +105 -0
  31. package/dist/actions/index.js +112 -0
  32. package/dist/actions/manager.js +1196 -0
  33. package/dist/actions/preview.cjs +165 -0
  34. package/dist/actions/preview.d.ts +55 -0
  35. package/dist/actions/preview.js +156 -0
  36. package/dist/babel/index.cjs +54034 -0
  37. package/dist/babel/index.d.ts +7488 -0
  38. package/dist/babel/index.js +54044 -0
  39. package/dist/bin/index.cjs +118 -0
  40. package/dist/bin/index.js +112 -0
  41. package/dist/builder-manager/index.cjs +2140 -0
  42. package/dist/builder-manager/index.d.ts +19 -0
  43. package/dist/builder-manager/index.js +2162 -0
  44. package/dist/channels/index.cjs +1913 -0
  45. package/dist/channels/index.d.ts +108 -0
  46. package/dist/channels/index.js +1881 -0
  47. package/dist/cli/bin/index.cjs +2687 -0
  48. package/dist/cli/bin/index.d.ts +2 -0
  49. package/dist/cli/bin/index.js +2707 -0
  50. package/dist/cli/index.cjs +17327 -0
  51. package/dist/cli/index.d.ts +209 -0
  52. package/dist/cli/index.js +17349 -0
  53. package/dist/client-logger/index.cjs +80 -0
  54. package/dist/client-logger/index.d.ts +29 -0
  55. package/dist/client-logger/index.js +64 -0
  56. package/dist/common/index.cjs +20568 -0
  57. package/dist/common/index.d.ts +948 -0
  58. package/dist/common/index.js +20653 -0
  59. package/dist/component-testing/index.cjs +23 -0
  60. package/dist/component-testing/index.d.ts +3 -0
  61. package/dist/component-testing/index.js +5 -0
  62. package/dist/component-testing/manager.css +170 -0
  63. package/dist/component-testing/manager.js +3099 -0
  64. package/dist/component-testing/preview.cjs +40 -0
  65. package/dist/component-testing/preview.d.ts +5 -0
  66. package/dist/component-testing/preview.js +25 -0
  67. package/dist/components/index.cjs +27925 -0
  68. package/dist/components/index.d.ts +1423 -0
  69. package/dist/components/index.js +24674 -0
  70. package/dist/controls/decorator.d.ts +5 -0
  71. package/dist/controls/decorator.js +8 -0
  72. package/dist/controls/index.cjs +26 -0
  73. package/dist/controls/index.d.ts +39 -0
  74. package/dist/controls/index.js +6 -0
  75. package/dist/controls/manager.js +5545 -0
  76. package/dist/controls/preview.cjs +26 -0
  77. package/dist/controls/preview.d.ts +55 -0
  78. package/dist/controls/preview.js +9 -0
  79. package/dist/core-events/index.cjs +167 -0
  80. package/dist/core-events/index.d.ts +426 -0
  81. package/dist/core-events/index.js +149 -0
  82. package/dist/core-server/index.cjs +38183 -0
  83. package/dist/core-server/index.d.ts +720 -0
  84. package/dist/core-server/index.js +38272 -0
  85. package/dist/core-server/presets/common-manager.js +20 -0
  86. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  87. package/dist/core-server/presets/common-override-preset.js +4829 -0
  88. package/dist/core-server/presets/common-preset.cjs +10231 -0
  89. package/dist/core-server/presets/common-preset.js +10309 -0
  90. package/dist/csf/index.cjs +179 -0
  91. package/dist/csf/index.d.ts +750 -0
  92. package/dist/csf/index.js +172 -0
  93. package/dist/csf-tools/index.cjs +1422 -0
  94. package/dist/csf-tools/index.d.ts +250 -0
  95. package/dist/csf-tools/index.js +1439 -0
  96. package/dist/docs-tools/index.cjs +2891 -0
  97. package/dist/docs-tools/index.d.ts +162 -0
  98. package/dist/docs-tools/index.js +2876 -0
  99. package/dist/index.cjs +17 -1
  100. package/dist/index.d.ts +1 -1
  101. package/dist/index.js +2 -7
  102. package/dist/instrumenter/index.cjs +3492 -0
  103. package/dist/instrumenter/index.d.ts +104 -0
  104. package/dist/instrumenter/index.js +4964 -0
  105. package/dist/manager/globals-module-info.cjs +817 -0
  106. package/dist/manager/globals-module-info.d.ts +36 -0
  107. package/dist/manager/globals-module-info.js +804 -0
  108. package/dist/manager/globals-runtime.js +83389 -0
  109. package/dist/manager/globals.cjs +47 -0
  110. package/dist/manager/globals.d.ts +24 -0
  111. package/dist/manager/globals.js +34 -0
  112. package/dist/manager/runtime.js +12323 -0
  113. package/dist/manager-api/index.cjs +11074 -0
  114. package/dist/manager-api/index.d.ts +1512 -0
  115. package/dist/manager-api/index.js +4835 -0
  116. package/dist/manager-errors.d.ts +89 -0
  117. package/dist/manager-errors.js +99 -0
  118. package/dist/node-logger/index.cjs +1642 -0
  119. package/dist/node-logger/index.d.ts +117 -0
  120. package/dist/node-logger/index.js +1652 -0
  121. package/dist/preview/globals.cjs +38 -0
  122. package/dist/preview/globals.d.ts +15 -0
  123. package/dist/preview/globals.js +25 -0
  124. package/dist/preview/runtime.js +44921 -0
  125. package/dist/preview-api/index.cjs +5227 -0
  126. package/dist/preview-api/index.d.ts +1093 -0
  127. package/dist/preview-api/index.js +5295 -0
  128. package/dist/preview-errors.cjs +503 -0
  129. package/dist/preview-errors.d.ts +212 -0
  130. package/dist/preview-errors.js +449 -0
  131. package/dist/router/index.cjs +3296 -0
  132. package/dist/router/index.d.ts +385 -0
  133. package/dist/router/index.js +1843 -0
  134. package/dist/server-errors.cjs +727 -0
  135. package/dist/server-errors.d.ts +296 -0
  136. package/dist/server-errors.js +728 -0
  137. package/dist/telemetry/index.cjs +2756 -0
  138. package/dist/telemetry/index.d.ts +133 -0
  139. package/dist/telemetry/index.js +2797 -0
  140. package/dist/test/index.cjs +35685 -0
  141. package/dist/test/index.d.ts +186 -0
  142. package/dist/test/index.js +33751 -0
  143. package/dist/test/preview.cjs +15869 -0
  144. package/dist/test/preview.d.ts +54 -0
  145. package/dist/test/preview.js +14440 -0
  146. package/dist/test/spy.cjs +257 -0
  147. package/dist/test/spy.d.ts +66 -0
  148. package/dist/test/spy.js +239 -0
  149. package/dist/theming/create.cjs +232 -0
  150. package/dist/theming/create.d.ts +50 -0
  151. package/dist/theming/create.js +216 -0
  152. package/dist/theming/index.cjs +2665 -0
  153. package/dist/theming/index.d.ts +11939 -0
  154. package/dist/theming/index.js +2485 -0
  155. package/dist/types/index.cjs +27 -0
  156. package/dist/types/index.d.ts +2795 -0
  157. package/dist/types/index.js +7 -0
  158. package/dist/viewport/index.cjs +310 -0
  159. package/dist/viewport/index.d.ts +320 -0
  160. package/dist/viewport/index.js +290 -0
  161. package/dist/viewport/manager.js +400 -0
  162. package/dist/viewport/preview.cjs +35 -0
  163. package/dist/viewport/preview.d.ts +69 -0
  164. package/dist/viewport/preview.js +19 -0
  165. package/package.json +539 -209
  166. package/.eslintrc.cjs +0 -31
  167. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  168. package/core/babel/index.cjs +0 -1
  169. package/core/babel/index.d.ts +0 -2
  170. package/core/babel/index.js +0 -1
  171. package/core/builder-manager/index.cjs +0 -1
  172. package/core/builder-manager/index.d.ts +0 -2
  173. package/core/builder-manager/index.js +0 -1
  174. package/core/channels/index.cjs +0 -1
  175. package/core/channels/index.d.ts +0 -2
  176. package/core/channels/index.js +0 -1
  177. package/core/cli/bin/index.cjs +0 -1
  178. package/core/cli/bin/index.d.ts +0 -2
  179. package/core/cli/bin/index.js +0 -1
  180. package/core/cli/index.cjs +0 -1
  181. package/core/cli/index.d.ts +0 -2
  182. package/core/cli/index.js +0 -1
  183. package/core/client-logger/index.cjs +0 -1
  184. package/core/client-logger/index.d.ts +0 -2
  185. package/core/client-logger/index.js +0 -1
  186. package/core/common/index.cjs +0 -1
  187. package/core/common/index.d.ts +0 -2
  188. package/core/common/index.js +0 -1
  189. package/core/components/index.cjs +0 -1
  190. package/core/components/index.d.ts +0 -2
  191. package/core/components/index.js +0 -1
  192. package/core/core-events/index.cjs +0 -1
  193. package/core/core-events/index.d.ts +0 -2
  194. package/core/core-events/index.js +0 -1
  195. package/core/core-server/index.cjs +0 -1
  196. package/core/core-server/index.d.ts +0 -2
  197. package/core/core-server/index.js +0 -1
  198. package/core/core-server/presets/common-manager.js +0 -1
  199. package/core/core-server/presets/common-override-preset.cjs +0 -1
  200. package/core/core-server/presets/common-override-preset.js +0 -1
  201. package/core/core-server/presets/common-preset.cjs +0 -1
  202. package/core/core-server/presets/common-preset.js +0 -1
  203. package/core/csf/index.cjs +0 -1
  204. package/core/csf/index.d.ts +0 -2
  205. package/core/csf/index.js +0 -1
  206. package/core/csf-tools/index.cjs +0 -1
  207. package/core/csf-tools/index.d.ts +0 -2
  208. package/core/csf-tools/index.js +0 -1
  209. package/core/docs-tools/index.cjs +0 -1
  210. package/core/docs-tools/index.d.ts +0 -2
  211. package/core/docs-tools/index.js +0 -1
  212. package/core/index.cjs +0 -1
  213. package/core/index.d.ts +0 -2
  214. package/core/index.js +0 -1
  215. package/core/manager/globals-module-info.cjs +0 -1
  216. package/core/manager/globals-module-info.d.ts +0 -2
  217. package/core/manager/globals-module-info.js +0 -1
  218. package/core/manager/globals-runtime.js +0 -1
  219. package/core/manager/globals.cjs +0 -1
  220. package/core/manager/globals.d.ts +0 -2
  221. package/core/manager/globals.js +0 -1
  222. package/core/manager-api/index.cjs +0 -1
  223. package/core/manager-api/index.d.ts +0 -2
  224. package/core/manager-api/index.js +0 -1
  225. package/core/manager-errors.d.ts +0 -2
  226. package/core/manager-errors.js +0 -1
  227. package/core/node-logger/index.cjs +0 -1
  228. package/core/node-logger/index.d.ts +0 -2
  229. package/core/node-logger/index.js +0 -1
  230. package/core/preview/globals.cjs +0 -1
  231. package/core/preview/globals.d.ts +0 -2
  232. package/core/preview/globals.js +0 -1
  233. package/core/preview/runtime.js +0 -1
  234. package/core/preview-api/index.cjs +0 -1
  235. package/core/preview-api/index.d.ts +0 -2
  236. package/core/preview-api/index.js +0 -1
  237. package/core/preview-errors.cjs +0 -1
  238. package/core/preview-errors.d.ts +0 -2
  239. package/core/preview-errors.js +0 -1
  240. package/core/router/index.cjs +0 -1
  241. package/core/router/index.d.ts +0 -2
  242. package/core/router/index.js +0 -1
  243. package/core/server-errors.cjs +0 -1
  244. package/core/server-errors.d.ts +0 -2
  245. package/core/server-errors.js +0 -1
  246. package/core/telemetry/index.cjs +0 -1
  247. package/core/telemetry/index.d.ts +0 -2
  248. package/core/telemetry/index.js +0 -1
  249. package/core/theming/create.cjs +0 -1
  250. package/core/theming/create.d.ts +0 -2
  251. package/core/theming/create.js +0 -1
  252. package/core/theming/index.cjs +0 -1
  253. package/core/theming/index.d.ts +0 -2
  254. package/core/theming/index.js +0 -1
  255. package/core/types/index.cjs +0 -1
  256. package/core/types/index.d.ts +0 -2
  257. package/core/types/index.js +0 -1
  258. package/core.cjs +0 -0
  259. package/core.d.ts +0 -0
  260. package/core.js +0 -1
  261. package/dist/chunk-OWLSIX54.js +0 -8
  262. package/dist/core-path.cjs +0 -1
  263. package/dist/core-path.d.ts +0 -3
  264. package/dist/core-path.js +0 -9
  265. package/dist/proxy.cjs +0 -1
  266. package/dist/proxy.d.ts +0 -2
  267. package/dist/proxy.js +0 -9
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var a = Object.defineProperty;
3
+ var x = Object.getOwnPropertyDescriptor;
4
+ var R = Object.getOwnPropertyNames;
5
+ var j = Object.prototype.hasOwnProperty;
6
+ var i = (t, o) => a(t, "name", { value: o, configurable: !0 });
7
+ var I = (t, o) => {
8
+ for (var n in o)
9
+ a(t, n, { get: o[n], enumerable: !0 });
10
+ }, P = (t, o, n, e) => {
11
+ if (o && typeof o == "object" || typeof o == "function")
12
+ for (let r of R(o))
13
+ !j.call(t, r) && r !== n && a(t, r, { get: () => o[r], enumerable: !(e = x(o, r)) || e.enumerable });
14
+ return t;
15
+ };
16
+ var S = (t) => P(a({}, "__esModule", { value: !0 }), t);
17
+
18
+ // src/actions/index.ts
19
+ var K = {};
20
+ I(K, {
21
+ ADDON_ID: () => l,
22
+ CLEAR_ID: () => F,
23
+ CYCLIC_KEY: () => C,
24
+ EVENT_ID: () => f,
25
+ PANEL_ID: () => k,
26
+ PARAM_KEY: () => T,
27
+ action: () => y,
28
+ actions: () => B,
29
+ config: () => s,
30
+ configureActions: () => V
31
+ });
32
+ module.exports = S(K);
33
+
34
+ // src/actions/constants.ts
35
+ var T = "actions", l = "storybook/actions", k = `${l}/panel`, f = `${l}/action-event`, F = `${l}/action-clear`, C = "$___storybook.isCyclic";
36
+
37
+ // src/actions/runtime/action.ts
38
+ var A = require("storybook/internal/preview-errors"), m = require("@storybook/global"), O = require("storybook/preview-api"), h = require("uuid");
39
+
40
+ // src/actions/runtime/configureActions.ts
41
+ var s = {
42
+ depth: 10,
43
+ clearOnStoryChange: !0,
44
+ limit: 50
45
+ }, V = /* @__PURE__ */ i((t = {}) => {
46
+ Object.assign(s, t);
47
+ }, "configureActions");
48
+
49
+ // src/actions/runtime/action.ts
50
+ var b = /* @__PURE__ */ i((t, o) => {
51
+ let n = Object.getPrototypeOf(t);
52
+ return !n || o(n) ? n : b(n, o);
53
+ }, "findProto"), W = /* @__PURE__ */ i((t) => !!(typeof t == "object" && t && b(t, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
54
+ typeof t.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ i((t) => {
55
+ if (W(t)) {
56
+ let o = Object.create(
57
+ t.constructor.prototype,
58
+ Object.getOwnPropertyDescriptors(t)
59
+ );
60
+ o.persist();
61
+ let n = Object.getOwnPropertyDescriptor(o, "view"), e = n?.value;
62
+ return typeof e == "object" && e?.constructor.name === "Window" && Object.defineProperty(o, "view", {
63
+ ...n,
64
+ value: Object.create(e.constructor.prototype)
65
+ }), o;
66
+ }
67
+ return t;
68
+ }, "serializeArg"), $ = /* @__PURE__ */ i(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? (0, h.v4)() : (
69
+ // pseudo random id, example response lo1e7zm4832bkr7yfl7
70
+ Date.now().toString(36) + Math.random().toString(36).substring(2)
71
+ ), "generateId");
72
+ function y(t, o = {}) {
73
+ let n = {
74
+ ...s,
75
+ ...o
76
+ }, e = /* @__PURE__ */ i(function(...c) {
77
+ if (o.implicit) {
78
+ let d = ("__STORYBOOK_PREVIEW__" in m.global ? (
79
+ // eslint-disable-next-line no-underscore-dangle
80
+ m.global.__STORYBOOK_PREVIEW__
81
+ ) : void 0)?.storyRenders.find(
82
+ (p) => p.phase === "playing" || p.phase === "rendering"
83
+ );
84
+ if (d) {
85
+ let p = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, g = new A.ImplicitActionsDuringRendering({
86
+ phase: d.phase,
87
+ name: t,
88
+ deprecated: p
89
+ });
90
+ if (p)
91
+ console.warn(g);
92
+ else
93
+ throw g;
94
+ }
95
+ }
96
+ let w = O.addons.getChannel(), E = $(), v = 5, u = c.map(Y), _ = c.length > 1 ? u : u[0], D = {
97
+ id: E,
98
+ count: 0,
99
+ data: { name: t, args: _ },
100
+ options: {
101
+ ...n,
102
+ maxDepth: v + (n.depth || 3),
103
+ allowFunction: n.allowFunction || !1
104
+ }
105
+ };
106
+ w.emit(f, D);
107
+ }, "actionHandler");
108
+ return e.isAction = !0, e.implicit = o.implicit, e;
109
+ }
110
+ i(y, "action");
111
+
112
+ // src/actions/runtime/actions.ts
113
+ var B = /* @__PURE__ */ i((...t) => {
114
+ let o = s, n = t;
115
+ n.length === 1 && Array.isArray(n[0]) && ([n] = n), n.length !== 1 && typeof n[n.length - 1] != "string" && (o = {
116
+ ...s,
117
+ ...n.pop()
118
+ });
119
+ let e = n[0];
120
+ (n.length !== 1 || typeof e == "string") && (e = {}, n.forEach((c) => {
121
+ e[c] = c;
122
+ }));
123
+ let r = {};
124
+ return Object.keys(e).forEach((c) => {
125
+ r[c] = y(e[c], o);
126
+ }), r;
127
+ }, "actions");
@@ -0,0 +1,105 @@
1
+ declare const PARAM_KEY = "actions";
2
+ declare const ADDON_ID = "storybook/actions";
3
+ declare const PANEL_ID = "storybook/actions/panel";
4
+ declare const EVENT_ID = "storybook/actions/action-event";
5
+ declare const CLEAR_ID = "storybook/actions/action-clear";
6
+ declare const CYCLIC_KEY = "$___storybook.isCyclic";
7
+
8
+ interface Options$1 {
9
+ allowRegExp: boolean;
10
+ allowFunction: boolean;
11
+ allowSymbol: boolean;
12
+ allowDate: boolean;
13
+ allowUndefined: boolean;
14
+ allowClass: boolean;
15
+ allowError: boolean;
16
+ maxDepth: number;
17
+ space: number | undefined;
18
+ lazyEval: boolean;
19
+ }
20
+
21
+ interface Options {
22
+ depth: number;
23
+ clearOnStoryChange: boolean;
24
+ limit: number;
25
+ implicit: boolean;
26
+ id: string;
27
+ }
28
+ type ActionOptions = Partial<Options> & Partial<Options$1>;
29
+
30
+ interface ActionDisplay {
31
+ id: string;
32
+ data: {
33
+ name: string;
34
+ args: any[];
35
+ };
36
+ count: number;
37
+ options: ActionOptions;
38
+ }
39
+
40
+ type HandlerFunction = (...args: any[]) => void;
41
+
42
+ type ActionsMap<T extends string = string> = Record<T, HandlerFunction>;
43
+
44
+ interface ActionsFunction {
45
+ <T extends string>(handlerMap: Record<T, string>, options?: ActionOptions): ActionsMap<T>;
46
+ <T extends string>(...handlers: T[]): ActionsMap<T>;
47
+ <T extends string>(handler1: T, options?: ActionOptions): ActionsMap<T>;
48
+ <T extends string>(handler1: T, handler2: T, options?: ActionOptions): ActionsMap<T>;
49
+ <T extends string>(handler1: T, handler2: T, handler3: T, options?: ActionOptions): ActionsMap<T>;
50
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, options?: ActionOptions): ActionsMap<T>;
51
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, options?: ActionOptions): ActionsMap<T>;
52
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, options?: ActionOptions): ActionsMap<T>;
53
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, options?: ActionOptions): ActionsMap<T>;
54
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, options?: ActionOptions): ActionsMap<T>;
55
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, handler9: T, options?: ActionOptions): ActionsMap<T>;
56
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, handler9: T, handler10: T, options?: ActionOptions): ActionsMap<T>;
57
+ }
58
+
59
+ type DecoratorFunction = (args: any[]) => any[];
60
+
61
+ declare function action(name: string, options?: ActionOptions): HandlerFunction;
62
+
63
+ declare const actions: ActionsFunction;
64
+
65
+ declare const config: ActionOptions;
66
+ declare const configureActions: (options?: ActionOptions) => void;
67
+
68
+ interface ActionsParameters {
69
+ /**
70
+ * Actions configuration
71
+ *
72
+ * @see https://storybook.js.org/docs/essentials/actions#parameters
73
+ */
74
+ actions: {
75
+ /**
76
+ * Create actions for each arg that matches the regex. (**NOT recommended, see below**)
77
+ *
78
+ * This is quite useful when your component has dozens (or hundreds) of methods and you do not
79
+ * want to manually apply the fn utility for each of those methods. However, this is not the
80
+ * recommended way of writing actions. That's because automatically inferred args are not
81
+ * available as spies in your play function. If you use argTypesRegex and your stories have play
82
+ * functions, you will need to also define args with the fn utility to test them in your play
83
+ * function.
84
+ *
85
+ * @example `argTypesRegex: '^on.*'`
86
+ */
87
+ argTypesRegex?: string;
88
+ /** Remove the addon panel and disable the addon's behavior */
89
+ disable?: boolean;
90
+ /**
91
+ * Binds a standard HTML event handler to the outermost HTML element rendered by your component
92
+ * and triggers an action when the event is called for a given selector. The format is
93
+ * `<eventname> <selector>`. The selector is optional; it defaults to all elements.
94
+ *
95
+ * **To enable this feature, you must use the `withActions` decorator.**
96
+ *
97
+ * @example `handles: ['mouseover', 'click .btn']`
98
+ *
99
+ * @see https://storybook.js.org/docs/essentials/actions#action-event-handlers
100
+ */
101
+ handles?: string[];
102
+ };
103
+ }
104
+
105
+ export { ADDON_ID, type ActionDisplay, type ActionOptions, type ActionsFunction, type ActionsMap, type ActionsParameters, CLEAR_ID, CYCLIC_KEY, type DecoratorFunction, EVENT_ID, type HandlerFunction, PANEL_ID, PARAM_KEY, action, actions, config, configureActions };
@@ -0,0 +1,112 @@
1
+ var E = Object.defineProperty;
2
+ var i = (o, n) => E(o, "name", { value: n, configurable: !0 });
3
+
4
+ // src/actions/constants.ts
5
+ var S = "actions", a = "storybook/actions", T = `${a}/panel`, y = `${a}/action-event`, k = `${a}/action-clear`, F = "$___storybook.isCyclic";
6
+
7
+ // src/actions/runtime/action.ts
8
+ import { ImplicitActionsDuringRendering as v } from "storybook/internal/preview-errors";
9
+ import { global as u } from "@storybook/global";
10
+ import { addons as _ } from "storybook/preview-api";
11
+ import { v4 as D } from "uuid";
12
+
13
+ // src/actions/runtime/configureActions.ts
14
+ var c = {
15
+ depth: 10,
16
+ clearOnStoryChange: !0,
17
+ limit: 50
18
+ }, V = /* @__PURE__ */ i((o = {}) => {
19
+ Object.assign(c, o);
20
+ }, "configureActions");
21
+
22
+ // src/actions/runtime/action.ts
23
+ var d = /* @__PURE__ */ i((o, n) => {
24
+ let t = Object.getPrototypeOf(o);
25
+ return !t || n(t) ? t : d(t, n);
26
+ }, "findProto"), x = /* @__PURE__ */ i((o) => !!(typeof o == "object" && o && d(o, (n) => /^Synthetic(?:Base)?Event$/.test(n.constructor.name)) &&
27
+ typeof o.persist == "function"), "isReactSyntheticEvent"), R = /* @__PURE__ */ i((o) => {
28
+ if (x(o)) {
29
+ let n = Object.create(
30
+ o.constructor.prototype,
31
+ Object.getOwnPropertyDescriptors(o)
32
+ );
33
+ n.persist();
34
+ let t = Object.getOwnPropertyDescriptor(n, "view"), e = t?.value;
35
+ return typeof e == "object" && e?.constructor.name === "Window" && Object.defineProperty(n, "view", {
36
+ ...t,
37
+ value: Object.create(e.constructor.prototype)
38
+ }), n;
39
+ }
40
+ return o;
41
+ }, "serializeArg"), j = /* @__PURE__ */ i(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? D() : (
42
+ // pseudo random id, example response lo1e7zm4832bkr7yfl7
43
+ Date.now().toString(36) + Math.random().toString(36).substring(2)
44
+ ), "generateId");
45
+ function g(o, n = {}) {
46
+ let t = {
47
+ ...c,
48
+ ...n
49
+ }, e = /* @__PURE__ */ i(function(...r) {
50
+ if (n.implicit) {
51
+ let f = ("__STORYBOOK_PREVIEW__" in u ? (
52
+ // eslint-disable-next-line no-underscore-dangle
53
+ u.__STORYBOOK_PREVIEW__
54
+ ) : void 0)?.storyRenders.find(
55
+ (s) => s.phase === "playing" || s.phase === "rendering"
56
+ );
57
+ if (f) {
58
+ let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, m = new v({
59
+ phase: f.phase,
60
+ name: o,
61
+ deprecated: s
62
+ });
63
+ if (s)
64
+ console.warn(m);
65
+ else
66
+ throw m;
67
+ }
68
+ }
69
+ let A = _.getChannel(), O = j(), h = 5, l = r.map(R), b = r.length > 1 ? l : l[0], w = {
70
+ id: O,
71
+ count: 0,
72
+ data: { name: o, args: b },
73
+ options: {
74
+ ...t,
75
+ maxDepth: h + (t.depth || 3),
76
+ allowFunction: t.allowFunction || !1
77
+ }
78
+ };
79
+ A.emit(y, w);
80
+ }, "actionHandler");
81
+ return e.isAction = !0, e.implicit = n.implicit, e;
82
+ }
83
+ i(g, "action");
84
+
85
+ // src/actions/runtime/actions.ts
86
+ var G = /* @__PURE__ */ i((...o) => {
87
+ let n = c, t = o;
88
+ t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (n = {
89
+ ...c,
90
+ ...t.pop()
91
+ });
92
+ let e = t[0];
93
+ (t.length !== 1 || typeof e == "string") && (e = {}, t.forEach((r) => {
94
+ e[r] = r;
95
+ }));
96
+ let p = {};
97
+ return Object.keys(e).forEach((r) => {
98
+ p[r] = g(e[r], n);
99
+ }), p;
100
+ }, "actions");
101
+ export {
102
+ a as ADDON_ID,
103
+ k as CLEAR_ID,
104
+ F as CYCLIC_KEY,
105
+ y as EVENT_ID,
106
+ T as PANEL_ID,
107
+ S as PARAM_KEY,
108
+ g as action,
109
+ G as actions,
110
+ c as config,
111
+ V as configureActions
112
+ };