storybook 9.0.0-alpha.2 → 9.0.0-alpha.20

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 (159) hide show
  1. package/README.md +1 -1
  2. package/assets/docs/addon-backgrounds.gif +0 -0
  3. package/assets/docs/addon-controls-args-annotated.png +0 -0
  4. package/assets/docs/addon-controls-args-background-color.png +0 -0
  5. package/assets/docs/addon-controls-args-background-string.png +0 -0
  6. package/assets/docs/addon-controls-args-docs.png +0 -0
  7. package/assets/docs/addon-controls-args-logging.png +0 -0
  8. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  9. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  10. package/assets/docs/addon-controls-args-reflow.png +0 -0
  11. package/assets/docs/addon-controls-args-template.png +0 -0
  12. package/assets/docs/addon-controls-expanded.png +0 -0
  13. package/assets/docs/addon-controls-hero.gif +0 -0
  14. package/assets/docs/addon-controls-install.png +0 -0
  15. package/assets/docs/hero.gif +0 -0
  16. package/assets/docs/highlight.png +0 -0
  17. package/assets/docs/viewport.png +0 -0
  18. package/bin/index.cjs +2 -2
  19. package/dist/actions/decorator.d.ts +6 -0
  20. package/dist/actions/decorator.js +138 -0
  21. package/dist/actions/index.cjs +126 -0
  22. package/dist/actions/index.d.ts +102 -0
  23. package/dist/actions/index.js +111 -0
  24. package/dist/actions/preview.cjs +164 -0
  25. package/dist/actions/preview.d.ts +54 -0
  26. package/dist/actions/preview.js +155 -0
  27. package/dist/backgrounds/index.cjs +148 -0
  28. package/dist/backgrounds/index.d.ts +91 -0
  29. package/dist/backgrounds/index.js +130 -0
  30. package/dist/backgrounds/preview.cjs +143 -0
  31. package/dist/backgrounds/preview.d.ts +54 -0
  32. package/dist/backgrounds/preview.js +127 -0
  33. package/dist/bin/index.cjs +66 -89
  34. package/dist/bin/index.js +62 -85
  35. package/dist/builder-manager/index.cjs +523 -540
  36. package/dist/builder-manager/index.js +544 -561
  37. package/dist/channels/index.cjs +1026 -981
  38. package/dist/channels/index.js +1194 -1165
  39. package/dist/cli/bin/index.cjs +483 -483
  40. package/dist/cli/bin/index.js +495 -495
  41. package/dist/cli/index.cjs +2279 -2295
  42. package/dist/cli/index.d.ts +4 -8
  43. package/dist/cli/index.js +740 -756
  44. package/dist/client-logger/index.cjs +56 -88
  45. package/dist/client-logger/index.js +41 -47
  46. package/dist/common/index.cjs +2496 -2480
  47. package/dist/common/index.d.ts +5 -29
  48. package/dist/common/index.js +2679 -2663
  49. package/dist/component-testing/index.cjs +23 -0
  50. package/dist/component-testing/index.d.ts +3 -0
  51. package/dist/component-testing/index.js +5 -0
  52. package/dist/component-testing/preview.cjs +40 -0
  53. package/dist/component-testing/preview.d.ts +5 -0
  54. package/dist/component-testing/preview.js +25 -0
  55. package/dist/components/index.cjs +11709 -20418
  56. package/dist/components/index.d.ts +94 -346
  57. package/dist/components/index.js +5827 -19157
  58. package/dist/controls/decorator.d.ts +5 -0
  59. package/dist/controls/decorator.js +8 -0
  60. package/dist/controls/index.cjs +26 -0
  61. package/dist/controls/index.d.ts +39 -0
  62. package/dist/controls/index.js +6 -0
  63. package/dist/controls/preview.cjs +26 -0
  64. package/dist/controls/preview.d.ts +54 -0
  65. package/dist/controls/preview.js +9 -0
  66. package/dist/core-events/index.cjs +91 -106
  67. package/dist/core-events/index.d.ts +139 -104
  68. package/dist/core-events/index.js +79 -94
  69. package/dist/core-server/index.cjs +14413 -13924
  70. package/dist/core-server/index.d.ts +270 -3
  71. package/dist/core-server/index.js +14003 -13519
  72. package/dist/core-server/presets/common-manager.css +170 -0
  73. package/dist/core-server/presets/common-manager.js +12099 -17
  74. package/dist/core-server/presets/common-preset.cjs +2760 -2914
  75. package/dist/core-server/presets/common-preset.js +2852 -3007
  76. package/dist/csf/index.cjs +76 -120
  77. package/dist/csf/index.d.ts +2 -6
  78. package/dist/csf/index.js +69 -113
  79. package/dist/csf-tools/index.cjs +412 -403
  80. package/dist/csf-tools/index.d.ts +0 -4
  81. package/dist/csf-tools/index.js +410 -401
  82. package/dist/docs-tools/index.cjs +2569 -575
  83. package/dist/docs-tools/index.d.ts +2 -2
  84. package/dist/docs-tools/index.js +2557 -564
  85. package/dist/highlight/index.cjs +27 -0
  86. package/dist/highlight/index.d.ts +17 -0
  87. package/dist/highlight/index.js +7 -0
  88. package/dist/highlight/preview.cjs +81 -0
  89. package/dist/highlight/preview.d.ts +54 -0
  90. package/dist/highlight/preview.js +67 -0
  91. package/dist/instrumenter/index.cjs +2207 -2342
  92. package/dist/instrumenter/index.d.ts +8 -7
  93. package/dist/instrumenter/index.js +2438 -2620
  94. package/dist/manager/globals-module-info.cjs +290 -151
  95. package/dist/manager/globals-module-info.d.ts +1 -1
  96. package/dist/manager/globals-module-info.js +274 -135
  97. package/dist/manager/globals-runtime.js +60016 -28331
  98. package/dist/manager/globals.cjs +23 -19
  99. package/dist/manager/globals.d.ts +8 -5
  100. package/dist/manager/globals.js +10 -6
  101. package/dist/manager/runtime.js +4645 -3946
  102. package/dist/manager-api/index.cjs +4228 -3833
  103. package/dist/manager-api/index.d.ts +398 -102
  104. package/dist/manager-api/index.js +3676 -3291
  105. package/dist/manager-errors.d.ts +25 -1
  106. package/dist/manager-errors.js +42 -26
  107. package/dist/measure/index.cjs +474 -0
  108. package/dist/measure/index.d.ts +66 -0
  109. package/dist/measure/index.js +462 -0
  110. package/dist/measure/preview.cjs +464 -0
  111. package/dist/measure/preview.d.ts +59 -0
  112. package/dist/measure/preview.js +448 -0
  113. package/dist/outline/index.cjs +528 -0
  114. package/dist/outline/index.d.ts +66 -0
  115. package/dist/outline/index.js +500 -0
  116. package/dist/outline/preview.cjs +518 -0
  117. package/dist/outline/preview.d.ts +59 -0
  118. package/dist/outline/preview.js +486 -0
  119. package/dist/preview/globals.cjs +21 -17
  120. package/dist/preview/globals.d.ts +4 -1
  121. package/dist/preview/globals.js +6 -2
  122. package/dist/preview/runtime.js +45697 -6618
  123. package/dist/preview-api/index.cjs +1363 -1898
  124. package/dist/preview-api/index.d.ts +449 -498
  125. package/dist/preview-api/index.js +1622 -2095
  126. package/dist/preview-errors.cjs +99 -82
  127. package/dist/preview-errors.d.ts +25 -1
  128. package/dist/preview-errors.js +110 -94
  129. package/dist/router/index.cjs +847 -871
  130. package/dist/router/index.js +193 -199
  131. package/dist/server-errors.cjs +156 -125
  132. package/dist/server-errors.d.ts +28 -2
  133. package/dist/server-errors.js +150 -119
  134. package/dist/telemetry/index.cjs +1050 -1977
  135. package/dist/telemetry/index.d.ts +26 -5
  136. package/dist/telemetry/index.js +1085 -2008
  137. package/dist/test/index.cjs +35686 -0
  138. package/dist/test/index.d.ts +186 -0
  139. package/dist/test/index.js +33752 -0
  140. package/dist/test/preview.cjs +15870 -0
  141. package/dist/test/preview.d.ts +54 -0
  142. package/dist/test/preview.js +14441 -0
  143. package/dist/test/spy.cjs +258 -0
  144. package/dist/test/spy.d.ts +66 -0
  145. package/dist/test/spy.js +240 -0
  146. package/dist/theming/create.cjs +79 -2269
  147. package/dist/theming/create.js +67 -841
  148. package/dist/theming/index.cjs +1065 -3232
  149. package/dist/theming/index.js +951 -1719
  150. package/dist/types/index.cjs +11 -12
  151. package/dist/types/index.d.ts +612 -157
  152. package/dist/types/index.js +1 -2
  153. package/dist/viewport/index.cjs +310 -0
  154. package/dist/viewport/index.d.ts +320 -0
  155. package/dist/viewport/index.js +290 -0
  156. package/dist/viewport/preview.cjs +35 -0
  157. package/dist/viewport/preview.d.ts +68 -0
  158. package/dist/viewport/preview.js +19 -0
  159. package/package.json +359 -12
@@ -1,42 +1,42 @@
1
1
  "use strict";
2
- var _ = Object.create;
3
- var u = Object.defineProperty;
4
- var $ = Object.getOwnPropertyDescriptor;
5
- var j = Object.getOwnPropertyNames;
2
+ var v = Object.create;
3
+ var d = Object.defineProperty;
4
+ var j = Object.getOwnPropertyDescriptor;
5
+ var _ = Object.getOwnPropertyNames;
6
6
  var C = Object.getPrototypeOf, E = Object.prototype.hasOwnProperty;
7
- var s = (e, r) => u(e, "name", { value: r, configurable: !0 });
8
- var z = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports), M = (e, r) => {
7
+ var a = (e, r) => d(e, "name", { value: r, configurable: !0 });
8
+ var P = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports), z = (e, r) => {
9
9
  for (var t in r)
10
- u(e, t, { get: r[t], enumerable: !0 });
11
- }, T = (e, r, t, n) => {
10
+ d(e, t, { get: r[t], enumerable: !0 });
11
+ }, x = (e, r, t, n) => {
12
12
  if (r && typeof r == "object" || typeof r == "function")
13
- for (let a of j(r))
14
- !E.call(e, a) && a !== t && u(e, a, { get: () => r[a], enumerable: !(n = $(r, a)) || n.enumerable });
13
+ for (let s of _(r))
14
+ !E.call(e, s) && s !== t && d(e, s, { get: () => r[s], enumerable: !(n = j(r, s)) || n.enumerable });
15
15
  return e;
16
16
  };
17
- var N = (e, r, t) => (t = e != null ? _(C(e)) : {}, T(
17
+ var I = (e, r, t) => (t = e != null ? v(C(e)) : {}, x(
18
18
  // If the importer is in node compatibility mode or this is not an ESM
19
19
  // file that has been converted to a CommonJS file using a Babel-
20
20
  // compatible transform (i.e. "__esModule" has not been set), then set
21
21
  // "default" to the CommonJS "module.exports" for node compatibility.
22
- r || !e || !e.__esModule ? u(t, "default", { value: e, enumerable: !0 }) : t,
22
+ r || !e || !e.__esModule ? d(t, "default", { value: e, enumerable: !0 }) : t,
23
23
  e
24
- )), I = (e) => T(u({}, "__esModule", { value: !0 }), e);
24
+ )), M = (e) => x(d({}, "__esModule", { value: !0 }), e);
25
25
 
26
26
  // ../node_modules/@ngard/tiny-isequal/index.js
27
- var w = z((y) => {
28
- Object.defineProperty(y, "__esModule", { value: !0 }), y.isEqual = /* @__PURE__ */ function() {
27
+ var w = P((g) => {
28
+ Object.defineProperty(g, "__esModule", { value: !0 }), g.isEqual = /* @__PURE__ */ function() {
29
29
  var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(n) {
30
30
  return Object.keys(n).concat(Object.getOwnPropertySymbols(n));
31
31
  } : Object.keys;
32
- return function(n, a) {
33
- return (/* @__PURE__ */ s(function d(o, i, p) {
34
- var c, f, l, A = e.call(o), O = e.call(i);
32
+ return function(n, s) {
33
+ return (/* @__PURE__ */ a(function l(o, i, p) {
34
+ var c, f, u, A = e.call(o), $ = e.call(i);
35
35
  if (o === i) return !0;
36
36
  if (o == null || i == null) return !1;
37
37
  if (p.indexOf(o) > -1 && p.indexOf(i) > -1) return !0;
38
- if (p.push(o, i), A != O || (c = t(o), f = t(i), c.length != f.length || c.some(function(R) {
39
- return !d(o[R], i[R], p);
38
+ if (p.push(o, i), A != $ || (c = t(o), f = t(i), c.length != f.length || c.some(function(m) {
39
+ return !l(o[m], i[m], p);
40
40
  }))) return !1;
41
41
  switch (A.slice(8, -1)) {
42
42
  case "Symbol":
@@ -53,8 +53,8 @@ var w = z((y) => {
53
53
  case "Map":
54
54
  c = o.entries(), f = i.entries();
55
55
  do
56
- if (!d((l = c.next()).value, f.next().value, p)) return !1;
57
- while (!l.done);
56
+ if (!l((u = c.next()).value, f.next().value, p)) return !1;
57
+ while (!u.done);
58
58
  return !0;
59
59
  case "ArrayBuffer":
60
60
  o = new Uint8Array(o), i = new Uint8Array(i);
@@ -72,152 +72,108 @@ var w = z((y) => {
72
72
  case "Arguments":
73
73
  case "Array":
74
74
  if (o.length != i.length) return !1;
75
- for (l = 0; l < o.length; l++) if ((l in o || l in i) && (l in o != l in i || !d(o[l], i[l], p))) return !1;
75
+ for (u = 0; u < o.length; u++) if ((u in o || u in i) && (u in o != u in i || !l(o[u], i[u], p))) return !1;
76
76
  return !0;
77
77
  case "Object":
78
- return d(r(o), r(i), p);
78
+ return l(r(o), r(i), p);
79
79
  default:
80
80
  return !1;
81
81
  }
82
- }, "n"))(n, a, []);
82
+ }, "n"))(n, s, []);
83
83
  };
84
84
  }();
85
85
  });
86
86
 
87
87
  // src/csf/index.ts
88
- var H = {};
89
- M(H, {
90
- __definePreview: () => D,
91
- combineTags: () => W,
92
- includeConditionalArg: () => h,
93
- isExportStory: () => Z,
94
- isMeta: () => k,
95
- isPreview: () => B,
96
- isStory: () => G,
97
- parseKind: () => L,
98
- sanitize: () => P,
99
- storyNameFromExport: () => V,
100
- toId: () => J
88
+ var V = {};
89
+ z(V, {
90
+ combineTags: () => J,
91
+ includeConditionalArg: () => T,
92
+ isExportStory: () => F,
93
+ isMeta: () => D,
94
+ isPreview: () => U,
95
+ isStory: () => B,
96
+ parseKind: () => G,
97
+ sanitize: () => O,
98
+ storyNameFromExport: () => q,
99
+ toId: () => k
101
100
  });
102
- module.exports = I(H);
101
+ module.exports = M(V);
103
102
 
104
103
  // src/csf/toStartCaseStr.ts
105
- function x(e) {
106
- return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, a) => `${t} ${n}${a}`).replace(
104
+ function S(e) {
105
+ return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, s) => `${t} ${n}${s}`).replace(
107
106
  /([a-z])([A-Z])/g, (r, t, n) => `${t} ${n}`).replace(/([a-z])([0-9])/gi, (r, t, n) => `${t} ${n}`).replace(/([0-9])([a-z])/gi, (r, t, n) => `${t}\
108
107
  ${n}`).replace(/(\s|^)(\w)/g, (r, t, n) => `${t}${n.toUpperCase()}`).replace(/ +/g, " ").trim();
109
108
  }
110
- s(x, "toStartCaseStr");
109
+ a(S, "toStartCaseStr");
111
110
 
112
111
  // src/csf/includeConditionalArg.ts
113
- var m = N(w(), 1);
114
- var S = /* @__PURE__ */ s((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), U = /* @__PURE__ */ s((e, r) => {
115
- let { exists: t, eq: n, neq: a, truthy: d } = e;
116
- if (S([t, n, a, d]) > 1)
117
- throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: a })}`);
112
+ var y = I(w(), 1);
113
+ var R = /* @__PURE__ */ a((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), N = /* @__PURE__ */ a((e, r) => {
114
+ let { exists: t, eq: n, neq: s, truthy: l } = e;
115
+ if (R([t, n, s, l]) > 1)
116
+ throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: s })}`);
118
117
  if (typeof n < "u")
119
- return (0, m.isEqual)(r, n);
120
- if (typeof a < "u")
121
- return !(0, m.isEqual)(r, a);
118
+ return (0, y.isEqual)(r, n);
119
+ if (typeof s < "u")
120
+ return !(0, y.isEqual)(r, s);
122
121
  if (typeof t < "u") {
123
122
  let i = typeof r < "u";
124
123
  return t ? i : !i;
125
124
  }
126
- return (typeof d > "u" ? !0 : d) ? !!r : !r;
127
- }, "testValue"), h = /* @__PURE__ */ s((e, r, t) => {
125
+ return (typeof l > "u" ? !0 : l) ? !!r : !r;
126
+ }, "testValue"), T = /* @__PURE__ */ a((e, r, t) => {
128
127
  if (!e.if)
129
128
  return !0;
130
- let { arg: n, global: a } = e.if;
131
- if (S([n, a]) !== 1)
132
- throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: a })}`);
133
- let d = n ? r[n] : t[a];
134
- return U(e.if, d);
129
+ let { arg: n, global: s } = e.if;
130
+ if (R([n, s]) !== 1)
131
+ throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: s })}`);
132
+ let l = n ? r[n] : t[s];
133
+ return N(e.if, l);
135
134
  }, "includeConditionalArg");
136
135
 
137
136
  // src/csf/csf-factories.ts
138
- var g = require("storybook/internal/preview-api");
139
- function D(e) {
140
- let r, t = {
141
- _tag: "Preview",
142
- input: e,
143
- get composed() {
144
- if (r)
145
- return r;
146
- let { addons: n, ...a } = e;
147
- return r = (0, g.normalizeProjectAnnotations)((0, g.composeConfigs)([...n ?? [], a])), r;
148
- },
149
- meta(n) {
150
- return q(n, this);
151
- }
152
- };
153
- return globalThis.globalProjectAnnotations = t.composed, t;
154
- }
155
- s(D, "__definePreview");
156
- function B(e) {
137
+ function U(e) {
157
138
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
158
139
  }
159
- s(B, "isPreview");
160
- function k(e) {
140
+ a(U, "isPreview");
141
+ function D(e) {
161
142
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
162
143
  }
163
- s(k, "isMeta");
164
- function q(e, r) {
165
- return {
166
- _tag: "Meta",
167
- input: e,
168
- preview: r,
169
- get composed() {
170
- throw new Error("Not implemented");
171
- },
172
- story(t) {
173
- return F(t, this);
174
- }
175
- };
176
- }
177
- s(q, "defineMeta");
178
- function F(e, r) {
179
- return {
180
- _tag: "Story",
181
- input: e,
182
- meta: r,
183
- get composed() {
184
- throw new Error("Not implemented");
185
- }
186
- };
187
- }
188
- s(F, "defineStory");
189
- function G(e) {
144
+ a(D, "isMeta");
145
+ function B(e) {
190
146
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
191
147
  }
192
- s(G, "isStory");
148
+ a(B, "isStory");
193
149
 
194
150
  // src/csf/index.ts
195
- var P = /* @__PURE__ */ s((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
196
- "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), b = /* @__PURE__ */ s((e, r) => {
197
- let t = P(e);
151
+ var O = /* @__PURE__ */ a((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
152
+ "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), b = /* @__PURE__ */ a((e, r) => {
153
+ let t = O(e);
198
154
  if (t === "")
199
155
  throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);
200
156
  return t;
201
- }, "sanitizeSafe"), J = /* @__PURE__ */ s((e, r) => `${b(e, "kind")}${r ? `--${b(r, "name")}` : ""}`, "toId"), V = /* @__PURE__ */ s((e) => x(
157
+ }, "sanitizeSafe"), k = /* @__PURE__ */ a((e, r) => `${b(e, "kind")}${r ? `--${b(r, "name")}` : ""}`, "toId"), q = /* @__PURE__ */ a((e) => S(
202
158
  e), "storyNameFromExport");
203
- function v(e, r) {
159
+ function h(e, r) {
204
160
  return Array.isArray(r) ? r.includes(e) : e.match(r);
205
161
  }
206
- s(v, "matches");
207
- function Z(e, { includeStories: r, excludeStories: t }) {
162
+ a(h, "matches");
163
+ function F(e, { includeStories: r, excludeStories: t }) {
208
164
  return (
209
165
  // https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
210
- e !== "__esModule" && (!r || v(e, r)) && (!t || !v(e, t))
166
+ e !== "__esModule" && (!r || h(e, r)) && (!t || !h(e, t))
211
167
  );
212
168
  }
213
- s(Z, "isExportStory");
214
- var L = /* @__PURE__ */ s((e, { rootSeparator: r, groupSeparator: t }) => {
215
- let [n, a] = e.split(r, 2), d = (a || e).split(t).filter((o) => !!o);
169
+ a(F, "isExportStory");
170
+ var G = /* @__PURE__ */ a((e, { rootSeparator: r, groupSeparator: t }) => {
171
+ let [n, s] = e.split(r, 2), l = (s || e).split(t).filter((o) => !!o);
216
172
  return {
217
- root: a ? n : null,
218
- groups: d
173
+ root: s ? n : null,
174
+ groups: l
219
175
  };
220
- }, "parseKind"), W = /* @__PURE__ */ s((...e) => {
176
+ }, "parseKind"), J = /* @__PURE__ */ a((...e) => {
221
177
  let r = e.reduce((t, n) => (n.startsWith("!") ? t.delete(n.slice(1)) : t.add(n), t), /* @__PURE__ */ new Set());
222
178
  return Array.from(r);
223
179
  }, "combineTags");
@@ -484,7 +484,7 @@ interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> exte
484
484
  abortSignal: AbortSignal;
485
485
  canvasElement: TRenderer['canvasElement'];
486
486
  hooks: unknown;
487
- originalStoryFn: StoryFn<TRenderer>;
487
+ originalStoryFn: ArgsStoryFn<TRenderer>;
488
488
  viewMode: ViewMode;
489
489
  step: StepFunction<TRenderer, TArgs>;
490
490
  context: this;
@@ -589,8 +589,6 @@ interface ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args
589
589
  * reverse order of initialization.
590
590
  */
591
591
  beforeAll?: BeforeAll;
592
- /** @deprecated Project `globals` renamed to `initiaGlobals` */
593
- globals?: Globals;
594
592
  initialGlobals?: Globals;
595
593
  globalTypes?: GlobalTypes;
596
594
  applyDecorators?: DecoratorApplicator<TRenderer, Args>;
@@ -701,8 +699,6 @@ interface Preview<TRenderer extends Renderer$1 = Renderer$1> {
701
699
  composed: NormalizedProjectAnnotations<TRenderer>;
702
700
  meta(input: ComponentAnnotations$1<TRenderer>): Meta<TRenderer>;
703
701
  }
704
- /** Do not use, use the definePreview exported from the framework instead. */
705
- declare function __definePreview<TRenderer extends Renderer$1>(input: Preview<TRenderer>['input']): Preview<TRenderer>;
706
702
  declare function isPreview(input: unknown): input is Preview<Renderer$1>;
707
703
  interface Meta<TRenderer extends Renderer$1, TArgs extends Args$1 = Args$1> {
708
704
  readonly _tag: 'Meta';
@@ -749,4 +745,4 @@ declare const parseKind: (kind: string, { rootSeparator, groupSeparator }: Separ
749
745
  /** Combine a set of project / meta / story tags, removing duplicates and handling negations. */
750
746
  declare const combineTags: (...tags: string[]) => string[];
751
747
 
752
- export { type AfterEach, type AnnotatedStoryFn, type AnyFramework, type ArgTypes, type ArgTypesEnhancer, type Args, type ArgsEnhancer, type ArgsFromMeta, type ArgsStoryFn, type BaseAnnotations, type BeforeAll, type BeforeEach, type Canvas, type CleanupCallback, type ComponentAnnotations, type ComponentId, type ComponentTitle, type Conditional, type DecoratorApplicator, type DecoratorFunction, type GlobalTypes, type Globals, type IncludeExcludeOptions, type InputType, type LegacyAnnotatedStoryFn, type LegacyStoryAnnotationsOrFn, type LegacyStoryFn, type LoaderFunction, type Meta, type Parameters, type PartialStoryFn, type PlayFunction, type PlayFunctionContext, type Preview, type ProjectAnnotations, type Renderer, type SBArrayType, type SBEnumType, type SBIntersectionType, type SBObjectType, type SBOtherType, type SBScalarType, type SBType, type SBUnionType, type SeparatorOptions, type StepFunction, type StepLabel, type StepRunner, type Story, type StoryAnnotations, type StoryAnnotationsOrFn, type StoryContext, type StoryContextForEnhancers, type StoryContextForLoaders, type StoryContextUpdate, type StoryFn, type StoryId, type StoryIdentifier, type StoryKind, type StoryName, type StrictArgTypes, type StrictArgs, type StrictGlobalTypes, type StrictInputType, type StrictParameters, type Tag, type ViewMode, __definePreview, combineTags, includeConditionalArg, isExportStory, isMeta, isPreview, isStory, parseKind, sanitize, storyNameFromExport, toId };
748
+ export { type AfterEach, type AnnotatedStoryFn, type AnyFramework, type ArgTypes, type ArgTypesEnhancer, type Args, type ArgsEnhancer, type ArgsFromMeta, type ArgsStoryFn, type BaseAnnotations, type BeforeAll, type BeforeEach, type Canvas, type CleanupCallback, type ComponentAnnotations, type ComponentId, type ComponentTitle, type Conditional, type DecoratorApplicator, type DecoratorFunction, type GlobalTypes, type Globals, type IncludeExcludeOptions, type InputType, type LegacyAnnotatedStoryFn, type LegacyStoryAnnotationsOrFn, type LegacyStoryFn, type LoaderFunction, type Meta, type Parameters, type PartialStoryFn, type PlayFunction, type PlayFunctionContext, type Preview, type ProjectAnnotations, type Renderer, type SBArrayType, type SBEnumType, type SBIntersectionType, type SBObjectType, type SBOtherType, type SBScalarType, type SBType, type SBUnionType, type SeparatorOptions, type StepFunction, type StepLabel, type StepRunner, type Story, type StoryAnnotations, type StoryAnnotationsOrFn, type StoryContext, type StoryContextForEnhancers, type StoryContextForLoaders, type StoryContextUpdate, type StoryFn, type StoryId, type StoryIdentifier, type StoryKind, type StoryName, type StrictArgTypes, type StrictArgs, type StrictGlobalTypes, type StrictInputType, type StrictParameters, type Tag, type ViewMode, combineTags, includeConditionalArg, isExportStory, isMeta, isPreview, isStory, parseKind, sanitize, storyNameFromExport, toId };
package/dist/csf/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var b = Object.create;
1
+ var h = Object.create;
2
2
  var f = Object.defineProperty;
3
- var v = Object.getOwnPropertyDescriptor;
4
- var P = Object.getOwnPropertyNames;
5
- var O = Object.getPrototypeOf, _ = Object.prototype.hasOwnProperty;
6
- var s = (e, r) => f(e, "name", { value: r, configurable: !0 });
7
- var $ = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports);
8
- var j = (e, r, t, n) => {
3
+ var O = Object.getOwnPropertyDescriptor;
4
+ var $ = Object.getOwnPropertyNames;
5
+ var v = Object.getPrototypeOf, j = Object.prototype.hasOwnProperty;
6
+ var a = (e, r) => f(e, "name", { value: r, configurable: !0 });
7
+ var _ = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports);
8
+ var C = (e, r, t, n) => {
9
9
  if (r && typeof r == "object" || typeof r == "function")
10
- for (let a of P(r))
11
- !_.call(e, a) && a !== t && f(e, a, { get: () => r[a], enumerable: !(n = v(r, a)) || n.enumerable });
10
+ for (let s of $(r))
11
+ !j.call(e, s) && s !== t && f(e, s, { get: () => r[s], enumerable: !(n = O(r, s)) || n.enumerable });
12
12
  return e;
13
13
  };
14
- var C = (e, r, t) => (t = e != null ? b(O(e)) : {}, j(
14
+ var E = (e, r, t) => (t = e != null ? h(v(e)) : {}, C(
15
15
  // If the importer is in node compatibility mode or this is not an ESM
16
16
  // file that has been converted to a CommonJS file using a Babel-
17
17
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -21,21 +21,21 @@ var C = (e, r, t) => (t = e != null ? b(O(e)) : {}, j(
21
21
  ));
22
22
 
23
23
  // ../node_modules/@ngard/tiny-isequal/index.js
24
- var T = $((g) => {
24
+ var S = _((g) => {
25
25
  Object.defineProperty(g, "__esModule", { value: !0 }), g.isEqual = /* @__PURE__ */ function() {
26
26
  var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(n) {
27
27
  return Object.keys(n).concat(Object.getOwnPropertySymbols(n));
28
28
  } : Object.keys;
29
- return function(n, a) {
30
- return (/* @__PURE__ */ s(function d(o, i, p) {
31
- var c, u, l, m = e.call(o), h = e.call(i);
29
+ return function(n, s) {
30
+ return (/* @__PURE__ */ a(function l(o, i, p) {
31
+ var c, d, u, A = e.call(o), b = e.call(i);
32
32
  if (o === i) return !0;
33
33
  if (o == null || i == null) return !1;
34
34
  if (p.indexOf(o) > -1 && p.indexOf(i) > -1) return !0;
35
- if (p.push(o, i), m != h || (c = t(o), u = t(i), c.length != u.length || c.some(function(A) {
36
- return !d(o[A], i[A], p);
35
+ if (p.push(o, i), A != b || (c = t(o), d = t(i), c.length != d.length || c.some(function(m) {
36
+ return !l(o[m], i[m], p);
37
37
  }))) return !1;
38
- switch (m.slice(8, -1)) {
38
+ switch (A.slice(8, -1)) {
39
39
  case "Symbol":
40
40
  return o.valueOf() == i.valueOf();
41
41
  case "Date":
@@ -48,10 +48,10 @@ var T = $((g) => {
48
48
  return "" + o == "" + i;
49
49
  case "Set":
50
50
  case "Map":
51
- c = o.entries(), u = i.entries();
51
+ c = o.entries(), d = i.entries();
52
52
  do
53
- if (!d((l = c.next()).value, u.next().value, p)) return !1;
54
- while (!l.done);
53
+ if (!l((u = c.next()).value, d.next().value, p)) return !1;
54
+ while (!u.done);
55
55
  return !0;
56
56
  case "ArrayBuffer":
57
57
  o = new Uint8Array(o), i = new Uint8Array(i);
@@ -69,148 +69,104 @@ var T = $((g) => {
69
69
  case "Arguments":
70
70
  case "Array":
71
71
  if (o.length != i.length) return !1;
72
- for (l = 0; l < o.length; l++) if ((l in o || l in i) && (l in o != l in i || !d(o[l], i[l], p))) return !1;
72
+ for (u = 0; u < o.length; u++) if ((u in o || u in i) && (u in o != u in i || !l(o[u], i[u], p))) return !1;
73
73
  return !0;
74
74
  case "Object":
75
- return d(r(o), r(i), p);
75
+ return l(r(o), r(i), p);
76
76
  default:
77
77
  return !1;
78
78
  }
79
- }, "n"))(n, a, []);
79
+ }, "n"))(n, s, []);
80
80
  };
81
81
  }();
82
82
  });
83
83
 
84
84
  // src/csf/toStartCaseStr.ts
85
- function R(e) {
86
- return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, a) => `${t} ${n}${a}`).replace(
85
+ function x(e) {
86
+ return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, s) => `${t} ${n}${s}`).replace(
87
87
  /([a-z])([A-Z])/g, (r, t, n) => `${t} ${n}`).replace(/([a-z])([0-9])/gi, (r, t, n) => `${t} ${n}`).replace(/([0-9])([a-z])/gi, (r, t, n) => `${t}\
88
88
  ${n}`).replace(/(\s|^)(\w)/g, (r, t, n) => `${t}${n.toUpperCase()}`).replace(/ +/g, " ").trim();
89
89
  }
90
- s(R, "toStartCaseStr");
90
+ a(x, "toStartCaseStr");
91
91
 
92
92
  // src/csf/includeConditionalArg.ts
93
- var y = C(T(), 1);
94
- var x = /* @__PURE__ */ s((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), E = /* @__PURE__ */ s((e, r) => {
95
- let { exists: t, eq: n, neq: a, truthy: d } = e;
96
- if (x([t, n, a, d]) > 1)
97
- throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: a })}`);
93
+ var y = E(S(), 1);
94
+ var w = /* @__PURE__ */ a((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), P = /* @__PURE__ */ a((e, r) => {
95
+ let { exists: t, eq: n, neq: s, truthy: l } = e;
96
+ if (w([t, n, s, l]) > 1)
97
+ throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: s })}`);
98
98
  if (typeof n < "u")
99
99
  return (0, y.isEqual)(r, n);
100
- if (typeof a < "u")
101
- return !(0, y.isEqual)(r, a);
100
+ if (typeof s < "u")
101
+ return !(0, y.isEqual)(r, s);
102
102
  if (typeof t < "u") {
103
103
  let i = typeof r < "u";
104
104
  return t ? i : !i;
105
105
  }
106
- return (typeof d > "u" ? !0 : d) ? !!r : !r;
107
- }, "testValue"), z = /* @__PURE__ */ s((e, r, t) => {
106
+ return (typeof l > "u" ? !0 : l) ? !!r : !r;
107
+ }, "testValue"), z = /* @__PURE__ */ a((e, r, t) => {
108
108
  if (!e.if)
109
109
  return !0;
110
- let { arg: n, global: a } = e.if;
111
- if (x([n, a]) !== 1)
112
- throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: a })}`);
113
- let d = n ? r[n] : t[a];
114
- return E(e.if, d);
110
+ let { arg: n, global: s } = e.if;
111
+ if (w([n, s]) !== 1)
112
+ throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: s })}`);
113
+ let l = n ? r[n] : t[s];
114
+ return P(e.if, l);
115
115
  }, "includeConditionalArg");
116
116
 
117
117
  // src/csf/csf-factories.ts
118
- import { composeConfigs as M, normalizeProjectAnnotations as N } from "storybook/internal/preview-api";
119
- function L(e) {
120
- let r, t = {
121
- _tag: "Preview",
122
- input: e,
123
- get composed() {
124
- if (r)
125
- return r;
126
- let { addons: n, ...a } = e;
127
- return r = N(M([...n ?? [], a])), r;
128
- },
129
- meta(n) {
130
- return I(n, this);
131
- }
132
- };
133
- return globalThis.globalProjectAnnotations = t.composed, t;
134
- }
135
- s(L, "__definePreview");
136
- function W(e) {
118
+ function F(e) {
137
119
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
138
120
  }
139
- s(W, "isPreview");
140
- function H(e) {
121
+ a(F, "isPreview");
122
+ function G(e) {
141
123
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
142
124
  }
143
- s(H, "isMeta");
144
- function I(e, r) {
145
- return {
146
- _tag: "Meta",
147
- input: e,
148
- preview: r,
149
- get composed() {
150
- throw new Error("Not implemented");
151
- },
152
- story(t) {
153
- return U(t, this);
154
- }
155
- };
156
- }
157
- s(I, "defineMeta");
158
- function U(e, r) {
159
- return {
160
- _tag: "Story",
161
- input: e,
162
- meta: r,
163
- get composed() {
164
- throw new Error("Not implemented");
165
- }
166
- };
167
- }
168
- s(U, "defineStory");
169
- function K(e) {
125
+ a(G, "isMeta");
126
+ function J(e) {
170
127
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
171
128
  }
172
- s(K, "isStory");
129
+ a(J, "isStory");
173
130
 
174
131
  // src/csf/index.ts
175
- var D = /* @__PURE__ */ s((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
176
- "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), w = /* @__PURE__ */ s((e, r) => {
177
- let t = D(e);
132
+ var I = /* @__PURE__ */ a((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
133
+ "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), R = /* @__PURE__ */ a((e, r) => {
134
+ let t = I(e);
178
135
  if (t === "")
179
136
  throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);
180
137
  return t;
181
- }, "sanitizeSafe"), ee = /* @__PURE__ */ s((e, r) => `${w(e, "kind")}${r ? `--${w(r, "name")}` : ""}`, "toId"), re = /* @__PURE__ */ s((e) => R(
138
+ }, "sanitizeSafe"), W = /* @__PURE__ */ a((e, r) => `${R(e, "kind")}${r ? `--${R(r, "name")}` : ""}`, "toId"), H = /* @__PURE__ */ a((e) => x(
182
139
  e), "storyNameFromExport");
183
- function S(e, r) {
140
+ function T(e, r) {
184
141
  return Array.isArray(r) ? r.includes(e) : e.match(r);
185
142
  }
186
- s(S, "matches");
187
- function te(e, { includeStories: r, excludeStories: t }) {
143
+ a(T, "matches");
144
+ function K(e, { includeStories: r, excludeStories: t }) {
188
145
  return (
189
146
  // https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
190
- e !== "__esModule" && (!r || S(e, r)) && (!t || !S(e, t))
147
+ e !== "__esModule" && (!r || T(e, r)) && (!t || !T(e, t))
191
148
  );
192
149
  }
193
- s(te, "isExportStory");
194
- var ne = /* @__PURE__ */ s((e, { rootSeparator: r, groupSeparator: t }) => {
195
- let [n, a] = e.split(r, 2), d = (a || e).split(t).filter((o) => !!o);
150
+ a(K, "isExportStory");
151
+ var Q = /* @__PURE__ */ a((e, { rootSeparator: r, groupSeparator: t }) => {
152
+ let [n, s] = e.split(r, 2), l = (s || e).split(t).filter((o) => !!o);
196
153
  return {
197
- root: a ? n : null,
198
- groups: d
154
+ root: s ? n : null,
155
+ groups: l
199
156
  };
200
- }, "parseKind"), oe = /* @__PURE__ */ s((...e) => {
157
+ }, "parseKind"), X = /* @__PURE__ */ a((...e) => {
201
158
  let r = e.reduce((t, n) => (n.startsWith("!") ? t.delete(n.slice(1)) : t.add(n), t), /* @__PURE__ */ new Set());
202
159
  return Array.from(r);
203
160
  }, "combineTags");
204
161
  export {
205
- L as __definePreview,
206
- oe as combineTags,
162
+ X as combineTags,
207
163
  z as includeConditionalArg,
208
- te as isExportStory,
209
- H as isMeta,
210
- W as isPreview,
211
- K as isStory,
212
- ne as parseKind,
213
- D as sanitize,
214
- re as storyNameFromExport,
215
- ee as toId
164
+ K as isExportStory,
165
+ G as isMeta,
166
+ F as isPreview,
167
+ J as isStory,
168
+ Q as parseKind,
169
+ I as sanitize,
170
+ H as storyNameFromExport,
171
+ W as toId
216
172
  };