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,528 @@
1
+ "use strict";
2
+ var C = Object.create;
3
+ var e = Object.defineProperty;
4
+ var L = Object.getOwnPropertyDescriptor;
5
+ var R = Object.getOwnPropertyNames;
6
+ var H = Object.getPrototypeOf, K = Object.prototype.hasOwnProperty;
7
+ var p = (i, t) => e(i, "name", { value: t, configurable: !0 });
8
+ var T = (i, t) => () => (t || i((t = { exports: {} }).exports, t), t.exports), c = (i, t) => {
9
+ for (var n in t)
10
+ e(i, n, { get: t[n], enumerable: !0 });
11
+ }, E = (i, t, n, o) => {
12
+ if (t && typeof t == "object" || typeof t == "function")
13
+ for (let a of R(t))
14
+ !K.call(i, a) && a !== n && e(i, a, { get: () => t[a], enumerable: !(o = L(t, a)) || o.enumerable });
15
+ return i;
16
+ };
17
+ var Y = (i, t, n) => (n = i != null ? C(H(i)) : {}, E(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ t || !i || !i.__esModule ? e(n, "default", { value: i, enumerable: !0 }) : n,
23
+ i
24
+ )), q = (i) => E(e({}, "__esModule", { value: !0 }), i);
25
+
26
+ // ../node_modules/ts-dedent/dist/index.js
27
+ var k = T(($) => {
28
+ "use strict";
29
+ Object.defineProperty($, "__esModule", { value: !0 });
30
+ $.dedent = void 0;
31
+ function M(i) {
32
+ for (var t = [], n = 1; n < arguments.length; n++)
33
+ t[n - 1] = arguments[n];
34
+ var o = Array.from(typeof i == "string" ? [i] : i);
35
+ o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
36
+ var a = o.reduce(function(d, g) {
37
+ var r = g.match(/\n([\t ]+|(?!\s).)/g);
38
+ return r ? d.concat(r.map(function(y) {
39
+ var u, m;
40
+ return (m = (u = y.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && m !== void 0 ? m : 0;
41
+ })) : d;
42
+ }, []);
43
+ if (a.length) {
44
+ var f = new RegExp(`
45
+ [ ]{` + Math.min.apply(Math, a) + "}", "g");
46
+ o = o.map(function(d) {
47
+ return d.replace(f, `
48
+ `);
49
+ });
50
+ }
51
+ o[0] = o[0].replace(/^\r?\n/, "");
52
+ var l = o[0];
53
+ return t.forEach(function(d, g) {
54
+ var r = l.match(/(?:^|\n)( *)$/), y = r ? r[1] : "", u = d;
55
+ typeof d == "string" && d.includes(`
56
+ `) && (u = String(d).split(`
57
+ `).map(function(m, j) {
58
+ return j === 0 ? m : "" + y + m;
59
+ }).join(`
60
+ `)), l += u + o[g + 1];
61
+ }), l;
62
+ }
63
+ p(M, "dedent");
64
+ $.dedent = M;
65
+ $.default = M;
66
+ });
67
+
68
+ // src/outline/index.ts
69
+ var N = {};
70
+ c(N, {
71
+ default: () => G
72
+ });
73
+ module.exports = q(N);
74
+ var _ = require("storybook/preview-api");
75
+
76
+ // src/outline/preview.ts
77
+ var A = {};
78
+ c(A, {
79
+ decorators: () => D,
80
+ default: () => F,
81
+ initialGlobals: () => I
82
+ });
83
+ var P = require("storybook/preview-api");
84
+
85
+ // src/outline/constants.ts
86
+ var s = "outline";
87
+
88
+ // src/outline/withOutline.ts
89
+ var b = require("storybook/preview-api");
90
+
91
+ // src/outline/helpers.ts
92
+ var x = require("@storybook/global");
93
+ var h = /* @__PURE__ */ p((i) => {
94
+ (Array.isArray(i) ? i : [i]).forEach(B);
95
+ }, "clearStyles"), B = /* @__PURE__ */ p((i) => {
96
+ let t = typeof i == "string" ? i : i.join(""), n = x.global.document.getElementById(t);
97
+ n && n.parentElement && n.parentElement.removeChild(n);
98
+ }, "clearStyle"), S = /* @__PURE__ */ p((i, t) => {
99
+ let n = x.global.document.getElementById(i);
100
+ if (n)
101
+ n.innerHTML !== t && (n.innerHTML = t);
102
+ else {
103
+ let o = x.global.document.createElement("style");
104
+ o.setAttribute("id", i), o.innerHTML = t, x.global.document.head.appendChild(o);
105
+ }
106
+ }, "addOutlineStyles");
107
+
108
+ // src/outline/outlineCSS.ts
109
+ var w = Y(k(), 1);
110
+ function v(i) {
111
+ return w.dedent`
112
+ ${i} body {
113
+ outline: 1px solid #2980b9 !important;
114
+ }
115
+
116
+ ${i} article {
117
+ outline: 1px solid #3498db !important;
118
+ }
119
+
120
+ ${i} nav {
121
+ outline: 1px solid #0088c3 !important;
122
+ }
123
+
124
+ ${i} aside {
125
+ outline: 1px solid #33a0ce !important;
126
+ }
127
+
128
+ ${i} section {
129
+ outline: 1px solid #66b8da !important;
130
+ }
131
+
132
+ ${i} header {
133
+ outline: 1px solid #99cfe7 !important;
134
+ }
135
+
136
+ ${i} footer {
137
+ outline: 1px solid #cce7f3 !important;
138
+ }
139
+
140
+ ${i} h1 {
141
+ outline: 1px solid #162544 !important;
142
+ }
143
+
144
+ ${i} h2 {
145
+ outline: 1px solid #314e6e !important;
146
+ }
147
+
148
+ ${i} h3 {
149
+ outline: 1px solid #3e5e85 !important;
150
+ }
151
+
152
+ ${i} h4 {
153
+ outline: 1px solid #449baf !important;
154
+ }
155
+
156
+ ${i} h5 {
157
+ outline: 1px solid #c7d1cb !important;
158
+ }
159
+
160
+ ${i} h6 {
161
+ outline: 1px solid #4371d0 !important;
162
+ }
163
+
164
+ ${i} main {
165
+ outline: 1px solid #2f4f90 !important;
166
+ }
167
+
168
+ ${i} address {
169
+ outline: 1px solid #1a2c51 !important;
170
+ }
171
+
172
+ ${i} div {
173
+ outline: 1px solid #036cdb !important;
174
+ }
175
+
176
+ ${i} p {
177
+ outline: 1px solid #ac050b !important;
178
+ }
179
+
180
+ ${i} hr {
181
+ outline: 1px solid #ff063f !important;
182
+ }
183
+
184
+ ${i} pre {
185
+ outline: 1px solid #850440 !important;
186
+ }
187
+
188
+ ${i} blockquote {
189
+ outline: 1px solid #f1b8e7 !important;
190
+ }
191
+
192
+ ${i} ol {
193
+ outline: 1px solid #ff050c !important;
194
+ }
195
+
196
+ ${i} ul {
197
+ outline: 1px solid #d90416 !important;
198
+ }
199
+
200
+ ${i} li {
201
+ outline: 1px solid #d90416 !important;
202
+ }
203
+
204
+ ${i} dl {
205
+ outline: 1px solid #fd3427 !important;
206
+ }
207
+
208
+ ${i} dt {
209
+ outline: 1px solid #ff0043 !important;
210
+ }
211
+
212
+ ${i} dd {
213
+ outline: 1px solid #e80174 !important;
214
+ }
215
+
216
+ ${i} figure {
217
+ outline: 1px solid #ff00bb !important;
218
+ }
219
+
220
+ ${i} figcaption {
221
+ outline: 1px solid #bf0032 !important;
222
+ }
223
+
224
+ ${i} table {
225
+ outline: 1px solid #00cc99 !important;
226
+ }
227
+
228
+ ${i} caption {
229
+ outline: 1px solid #37ffc4 !important;
230
+ }
231
+
232
+ ${i} thead {
233
+ outline: 1px solid #98daca !important;
234
+ }
235
+
236
+ ${i} tbody {
237
+ outline: 1px solid #64a7a0 !important;
238
+ }
239
+
240
+ ${i} tfoot {
241
+ outline: 1px solid #22746b !important;
242
+ }
243
+
244
+ ${i} tr {
245
+ outline: 1px solid #86c0b2 !important;
246
+ }
247
+
248
+ ${i} th {
249
+ outline: 1px solid #a1e7d6 !important;
250
+ }
251
+
252
+ ${i} td {
253
+ outline: 1px solid #3f5a54 !important;
254
+ }
255
+
256
+ ${i} col {
257
+ outline: 1px solid #6c9a8f !important;
258
+ }
259
+
260
+ ${i} colgroup {
261
+ outline: 1px solid #6c9a9d !important;
262
+ }
263
+
264
+ ${i} button {
265
+ outline: 1px solid #da8301 !important;
266
+ }
267
+
268
+ ${i} datalist {
269
+ outline: 1px solid #c06000 !important;
270
+ }
271
+
272
+ ${i} fieldset {
273
+ outline: 1px solid #d95100 !important;
274
+ }
275
+
276
+ ${i} form {
277
+ outline: 1px solid #d23600 !important;
278
+ }
279
+
280
+ ${i} input {
281
+ outline: 1px solid #fca600 !important;
282
+ }
283
+
284
+ ${i} keygen {
285
+ outline: 1px solid #b31e00 !important;
286
+ }
287
+
288
+ ${i} label {
289
+ outline: 1px solid #ee8900 !important;
290
+ }
291
+
292
+ ${i} legend {
293
+ outline: 1px solid #de6d00 !important;
294
+ }
295
+
296
+ ${i} meter {
297
+ outline: 1px solid #e8630c !important;
298
+ }
299
+
300
+ ${i} optgroup {
301
+ outline: 1px solid #b33600 !important;
302
+ }
303
+
304
+ ${i} option {
305
+ outline: 1px solid #ff8a00 !important;
306
+ }
307
+
308
+ ${i} output {
309
+ outline: 1px solid #ff9619 !important;
310
+ }
311
+
312
+ ${i} progress {
313
+ outline: 1px solid #e57c00 !important;
314
+ }
315
+
316
+ ${i} select {
317
+ outline: 1px solid #e26e0f !important;
318
+ }
319
+
320
+ ${i} textarea {
321
+ outline: 1px solid #cc5400 !important;
322
+ }
323
+
324
+ ${i} details {
325
+ outline: 1px solid #33848f !important;
326
+ }
327
+
328
+ ${i} summary {
329
+ outline: 1px solid #60a1a6 !important;
330
+ }
331
+
332
+ ${i} command {
333
+ outline: 1px solid #438da1 !important;
334
+ }
335
+
336
+ ${i} menu {
337
+ outline: 1px solid #449da6 !important;
338
+ }
339
+
340
+ ${i} del {
341
+ outline: 1px solid #bf0000 !important;
342
+ }
343
+
344
+ ${i} ins {
345
+ outline: 1px solid #400000 !important;
346
+ }
347
+
348
+ ${i} img {
349
+ outline: 1px solid #22746b !important;
350
+ }
351
+
352
+ ${i} iframe {
353
+ outline: 1px solid #64a7a0 !important;
354
+ }
355
+
356
+ ${i} embed {
357
+ outline: 1px solid #98daca !important;
358
+ }
359
+
360
+ ${i} object {
361
+ outline: 1px solid #00cc99 !important;
362
+ }
363
+
364
+ ${i} param {
365
+ outline: 1px solid #37ffc4 !important;
366
+ }
367
+
368
+ ${i} video {
369
+ outline: 1px solid #6ee866 !important;
370
+ }
371
+
372
+ ${i} audio {
373
+ outline: 1px solid #027353 !important;
374
+ }
375
+
376
+ ${i} source {
377
+ outline: 1px solid #012426 !important;
378
+ }
379
+
380
+ ${i} canvas {
381
+ outline: 1px solid #a2f570 !important;
382
+ }
383
+
384
+ ${i} track {
385
+ outline: 1px solid #59a600 !important;
386
+ }
387
+
388
+ ${i} map {
389
+ outline: 1px solid #7be500 !important;
390
+ }
391
+
392
+ ${i} area {
393
+ outline: 1px solid #305900 !important;
394
+ }
395
+
396
+ ${i} a {
397
+ outline: 1px solid #ff62ab !important;
398
+ }
399
+
400
+ ${i} em {
401
+ outline: 1px solid #800b41 !important;
402
+ }
403
+
404
+ ${i} strong {
405
+ outline: 1px solid #ff1583 !important;
406
+ }
407
+
408
+ ${i} i {
409
+ outline: 1px solid #803156 !important;
410
+ }
411
+
412
+ ${i} b {
413
+ outline: 1px solid #cc1169 !important;
414
+ }
415
+
416
+ ${i} u {
417
+ outline: 1px solid #ff0430 !important;
418
+ }
419
+
420
+ ${i} s {
421
+ outline: 1px solid #f805e3 !important;
422
+ }
423
+
424
+ ${i} small {
425
+ outline: 1px solid #d107b2 !important;
426
+ }
427
+
428
+ ${i} abbr {
429
+ outline: 1px solid #4a0263 !important;
430
+ }
431
+
432
+ ${i} q {
433
+ outline: 1px solid #240018 !important;
434
+ }
435
+
436
+ ${i} cite {
437
+ outline: 1px solid #64003c !important;
438
+ }
439
+
440
+ ${i} dfn {
441
+ outline: 1px solid #b4005a !important;
442
+ }
443
+
444
+ ${i} sub {
445
+ outline: 1px solid #dba0c8 !important;
446
+ }
447
+
448
+ ${i} sup {
449
+ outline: 1px solid #cc0256 !important;
450
+ }
451
+
452
+ ${i} time {
453
+ outline: 1px solid #d6606d !important;
454
+ }
455
+
456
+ ${i} code {
457
+ outline: 1px solid #e04251 !important;
458
+ }
459
+
460
+ ${i} kbd {
461
+ outline: 1px solid #5e001f !important;
462
+ }
463
+
464
+ ${i} samp {
465
+ outline: 1px solid #9c0033 !important;
466
+ }
467
+
468
+ ${i} var {
469
+ outline: 1px solid #d90047 !important;
470
+ }
471
+
472
+ ${i} mark {
473
+ outline: 1px solid #ff0053 !important;
474
+ }
475
+
476
+ ${i} bdi {
477
+ outline: 1px solid #bf3668 !important;
478
+ }
479
+
480
+ ${i} bdo {
481
+ outline: 1px solid #6f1400 !important;
482
+ }
483
+
484
+ ${i} ruby {
485
+ outline: 1px solid #ff7b93 !important;
486
+ }
487
+
488
+ ${i} rt {
489
+ outline: 1px solid #ff2f54 !important;
490
+ }
491
+
492
+ ${i} rp {
493
+ outline: 1px solid #803e49 !important;
494
+ }
495
+
496
+ ${i} span {
497
+ outline: 1px solid #cc2643 !important;
498
+ }
499
+
500
+ ${i} br {
501
+ outline: 1px solid #db687d !important;
502
+ }
503
+
504
+ ${i} wbr {
505
+ outline: 1px solid #db175b !important;
506
+ }`;
507
+ }
508
+ p(v, "outlineCSS");
509
+
510
+ // src/outline/withOutline.ts
511
+ var O = /* @__PURE__ */ p((i, t) => {
512
+ let n = t.globals || {}, o = [!0, "true"].includes(n[s]), a = t.viewMode === "docs", f = (0, b.useMemo)(() => v(a ? '[data-story-block="tr\
513
+ ue"]' : ".sb-show-main"), [t]);
514
+ return (0, b.useEffect)(() => {
515
+ let l = a ? `addon-outline-docs-${t.id}` : "addon-outline";
516
+ return o ? S(l, f) : h(l), () => {
517
+ h(l);
518
+ };
519
+ }, [o, f, t]), i();
520
+ }, "withOutline");
521
+
522
+ // src/outline/preview.ts
523
+ var D = [O], I = {
524
+ [s]: !1
525
+ }, F = /* @__PURE__ */ p(() => (0, P.definePreview)({ decorators: D, initialGlobals: I }), "default");
526
+
527
+ // src/outline/index.ts
528
+ var G = /* @__PURE__ */ p(() => (0, _.definePreview)(A), "default");
@@ -0,0 +1,66 @@
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
+ interface OutlineParameters {
53
+ /**
54
+ * Outline configuration
55
+ *
56
+ * @see https://storybook.js.org/docs/essentials/measure-and-outline#parameters
57
+ */
58
+ outline: {
59
+ /** Remove the addon panel and disable the addon's behavior */
60
+ disable?: boolean;
61
+ };
62
+ }
63
+
64
+ declare const _default: () => ProjectAnnotations<Renderer>;
65
+
66
+ export { type OutlineParameters, _default as default };