storybook 10.1.0-alpha.3 → 10.1.0-alpha.4
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.
- package/dist/_node-chunks/{builder-manager-GBWCUYRR.js → builder-manager-P652CU5Z.js} +12 -12
- package/dist/_node-chunks/camelcase-VADCJSEY.js +18 -0
- package/dist/_node-chunks/{chunk-5X7FGASE.js → chunk-3GTBPTCZ.js} +7 -7
- package/dist/_node-chunks/chunk-3OPGVNKX.js +18 -0
- package/dist/_node-chunks/{chunk-AX2PCJZ2.js → chunk-5A6EYMRK.js} +6 -6
- package/dist/_node-chunks/{chunk-GMO24NTJ.js → chunk-5E5YDTCQ.js} +7 -7
- package/dist/_node-chunks/{chunk-C4UVY6FF.js → chunk-5NGUGC3U.js} +7 -7
- package/dist/_node-chunks/{chunk-2JHIUWIN.js → chunk-6DHXOOK2.js} +7 -7
- package/dist/_node-chunks/{chunk-NYXHMPY4.js → chunk-6VWT3H7R.js} +7 -7
- package/dist/_node-chunks/{chunk-NCHBSJG3.js → chunk-7332Y23R.js} +21 -21
- package/dist/_node-chunks/{chunk-MPUDYIDW.js → chunk-7C52H6S6.js} +7 -7
- package/dist/_node-chunks/{chunk-BNO5FB6B.js → chunk-7NSBLADO.js} +8 -8
- package/dist/_node-chunks/{chunk-YJJWZPL7.js → chunk-BHHNQ5GJ.js} +36 -43
- package/dist/_node-chunks/{chunk-JKWP2FKQ.js → chunk-CAKHJEH6.js} +7 -7
- package/dist/_node-chunks/{chunk-TSKLBMF3.js → chunk-CPI4IKLK.js} +8 -8
- package/dist/_node-chunks/{chunk-TDLKTACT.js → chunk-FMLH3V5B.js} +7 -7
- package/dist/_node-chunks/{chunk-CKXP5RYA.js → chunk-FU2KCZJG.js} +9 -9
- package/dist/_node-chunks/{chunk-YFBIEJ33.js → chunk-GDOIF7E6.js} +7 -7
- package/dist/_node-chunks/{chunk-S32G4TCP.js → chunk-HPERTMWB.js} +7 -7
- package/dist/_node-chunks/{chunk-SQAKXWVV.js → chunk-ICT62CX5.js} +7 -7
- package/dist/_node-chunks/{chunk-NTX43F34.js → chunk-JS5I7ZY6.js} +7 -7
- package/dist/_node-chunks/{chunk-ZQY3BNST.js → chunk-K3K6H2BF.js} +12 -12
- package/dist/_node-chunks/{chunk-N7XYNLCJ.js → chunk-LPBJHVNR.js} +7 -7
- package/dist/_node-chunks/{chunk-MDXYV4OF.js → chunk-OXPHRY7P.js} +15 -15
- package/dist/_node-chunks/{chunk-5KDXQR2J.js → chunk-PCXGFAQ3.js} +7 -7
- package/dist/_node-chunks/{chunk-NTH76OZA.js → chunk-PW7ECOTU.js} +12 -12
- package/dist/_node-chunks/{chunk-RLMJDF6S.js → chunk-RFAREF3S.js} +8 -8
- package/dist/_node-chunks/{chunk-TZ7GUTJ4.js → chunk-T6VOUSIY.js} +7 -7
- package/dist/_node-chunks/{chunk-6U2QTN2E.js → chunk-TFBHPN6J.js} +7 -7
- package/dist/_node-chunks/{chunk-B63HGQAB.js → chunk-TXDBGO2X.js} +9 -9
- package/dist/_node-chunks/{chunk-T7KB265F.js → chunk-VAAX75EL.js} +6 -6
- package/dist/_node-chunks/chunk-VCC35ZLQ.js +61 -0
- package/dist/_node-chunks/{chunk-HH57J4TX.js → chunk-XCTASIYK.js} +8 -8
- package/dist/_node-chunks/{chunk-APKZWRTX.js → chunk-XPBE544K.js} +7 -7
- package/dist/_node-chunks/{chunk-FJWQKOXX.js → chunk-YXC7LAMZ.js} +10 -10
- package/dist/_node-chunks/{dist-SQENNWFY.js → dist-MCOAOC3B.js} +9 -9
- package/dist/_node-chunks/{globby-CVPDLQ5Z.js → globby-L3NPKIS7.js} +9 -9
- package/dist/_node-chunks/{lib-4BTTMYE2.js → lib-ITTSFFC5.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-ENVHI6CC.js → mdx-N42X6CFJ-YP4YCIZM.js} +8 -8
- package/dist/_node-chunks/{p-limit-I2XW6GST.js → p-limit-TTLWUU6D.js} +7 -7
- package/dist/_node-chunks/{plugin-O5PHZ367.js → plugin-C2OCVZYN.js} +10 -10
- package/dist/_node-chunks/{plugin-4NIE24IO.js → plugin-OC5KWEJQ.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-SVBN7WFH.js → webpack-inject-mocker-runtime-plugin-IRAPT6HV.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-XBV3VXVD.js → webpack-mock-plugin-CFITLD44.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +21 -21
- package/dist/common/index.js +20 -20
- package/dist/components/index.js +5744 -73
- package/dist/core-server/index.js +211 -90
- package/dist/core-server/presets/common-manager.js +14 -20
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +23 -23
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf/index.js +2 -2
- package/dist/csf-tools/index.d.ts +7 -0
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.js +14 -14
- package/dist/preview-api/index.d.ts +68 -67
- package/dist/preview-api/index.js +5 -5
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/_browser-chunks/chunk-B3S3ROIP.js +0 -5810
- package/dist/_node-chunks/camelcase-2N6MD2HZ.js +0 -18
- package/dist/_node-chunks/chunk-D3NGJQDZ.js +0 -18
- package/dist/_node-chunks/chunk-LPNJ7PJY.js +0 -61
- package/dist/_browser-chunks/{chunk-W4QKLQSC.js → chunk-RW5PKMWM.js} +5 -5
- package/dist/_browser-chunks/{syntaxhighlighter-DK2ODWXH.js → syntaxhighlighter-CAVLW7PM.js} +4 -4
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1ale42sn21 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1ale42sn21 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1ale42sn21 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1ale42sn21.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1ale42sn21.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1ale42sn21.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
detectPnp
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-PW7ECOTU.js";
|
|
15
15
|
import {
|
|
16
16
|
require_pretty_hrtime
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-5E5YDTCQ.js";
|
|
18
18
|
import {
|
|
19
19
|
boxen,
|
|
20
20
|
require_string_width
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
22
|
-
import "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-RFAREF3S.js";
|
|
22
|
+
import "../_node-chunks/chunk-JS5I7ZY6.js";
|
|
23
23
|
import {
|
|
24
24
|
StatusTypeIdMismatchError,
|
|
25
25
|
StorybookError
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
26
|
+
} from "../_node-chunks/chunk-FU2KCZJG.js";
|
|
27
27
|
import {
|
|
28
28
|
getErrorLevel,
|
|
29
29
|
mapStaticDir,
|
|
@@ -31,63 +31,63 @@ import {
|
|
|
31
31
|
sendTelemetryError,
|
|
32
32
|
useStatics,
|
|
33
33
|
withTelemetry
|
|
34
|
-
} from "../_node-chunks/chunk-
|
|
35
|
-
import "../_node-chunks/chunk-
|
|
34
|
+
} from "../_node-chunks/chunk-K3K6H2BF.js";
|
|
35
|
+
import "../_node-chunks/chunk-LPBJHVNR.js";
|
|
36
36
|
import {
|
|
37
37
|
telemetry
|
|
38
|
-
} from "../_node-chunks/chunk-
|
|
39
|
-
import "../_node-chunks/chunk-
|
|
38
|
+
} from "../_node-chunks/chunk-OXPHRY7P.js";
|
|
39
|
+
import "../_node-chunks/chunk-3OPGVNKX.js";
|
|
40
40
|
import {
|
|
41
41
|
resolveImport,
|
|
42
42
|
supportedExtensions,
|
|
43
43
|
userOrAutoTitleFromSpecifier
|
|
44
|
-
} from "../_node-chunks/chunk-
|
|
45
|
-
import "../_node-chunks/chunk-
|
|
46
|
-
import "../_node-chunks/chunk-
|
|
47
|
-
import "../_node-chunks/chunk-
|
|
44
|
+
} from "../_node-chunks/chunk-7332Y23R.js";
|
|
45
|
+
import "../_node-chunks/chunk-T6VOUSIY.js";
|
|
46
|
+
import "../_node-chunks/chunk-VCC35ZLQ.js";
|
|
47
|
+
import "../_node-chunks/chunk-XCTASIYK.js";
|
|
48
48
|
import {
|
|
49
49
|
optionalEnvToBoolean,
|
|
50
50
|
require_cross_spawn
|
|
51
|
-
} from "../_node-chunks/chunk-
|
|
51
|
+
} from "../_node-chunks/chunk-TXDBGO2X.js";
|
|
52
52
|
import {
|
|
53
53
|
up2 as up
|
|
54
|
-
} from "../_node-chunks/chunk-
|
|
55
|
-
import "../_node-chunks/chunk-
|
|
54
|
+
} from "../_node-chunks/chunk-PCXGFAQ3.js";
|
|
55
|
+
import "../_node-chunks/chunk-ICT62CX5.js";
|
|
56
56
|
import {
|
|
57
57
|
invariant
|
|
58
|
-
} from "../_node-chunks/chunk-
|
|
58
|
+
} from "../_node-chunks/chunk-3GTBPTCZ.js";
|
|
59
59
|
import {
|
|
60
60
|
importModule,
|
|
61
61
|
resolvePackageDir
|
|
62
|
-
} from "../_node-chunks/chunk-
|
|
62
|
+
} from "../_node-chunks/chunk-CPI4IKLK.js";
|
|
63
63
|
import {
|
|
64
64
|
join,
|
|
65
65
|
relative,
|
|
66
66
|
resolve
|
|
67
|
-
} from "../_node-chunks/chunk-
|
|
67
|
+
} from "../_node-chunks/chunk-TFBHPN6J.js";
|
|
68
68
|
import {
|
|
69
69
|
require_prompts
|
|
70
|
-
} from "../_node-chunks/chunk-
|
|
71
|
-
import "../_node-chunks/chunk-
|
|
70
|
+
} from "../_node-chunks/chunk-6VWT3H7R.js";
|
|
71
|
+
import "../_node-chunks/chunk-CAKHJEH6.js";
|
|
72
72
|
import {
|
|
73
73
|
slash
|
|
74
|
-
} from "../_node-chunks/chunk-
|
|
74
|
+
} from "../_node-chunks/chunk-7C52H6S6.js";
|
|
75
75
|
import {
|
|
76
76
|
require_dist
|
|
77
|
-
} from "../_node-chunks/chunk-
|
|
77
|
+
} from "../_node-chunks/chunk-HPERTMWB.js";
|
|
78
78
|
import {
|
|
79
79
|
require_lib,
|
|
80
80
|
require_src
|
|
81
|
-
} from "../_node-chunks/chunk-
|
|
81
|
+
} from "../_node-chunks/chunk-FMLH3V5B.js";
|
|
82
82
|
import {
|
|
83
83
|
require_picocolors
|
|
84
|
-
} from "../_node-chunks/chunk-
|
|
84
|
+
} from "../_node-chunks/chunk-6DHXOOK2.js";
|
|
85
85
|
import {
|
|
86
86
|
__commonJS,
|
|
87
87
|
__name,
|
|
88
88
|
__require,
|
|
89
89
|
__toESM
|
|
90
|
-
} from "../_node-chunks/chunk-
|
|
90
|
+
} from "../_node-chunks/chunk-VAAX75EL.js";
|
|
91
91
|
|
|
92
92
|
// ../node_modules/tsconfig-paths/lib/filesystem.js
|
|
93
93
|
var require_filesystem = __commonJS({
|
|
@@ -8498,15 +8498,15 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8498
8498
|
const analyses = entries.map(([, c]) => analyzeComponent(c));
|
|
8499
8499
|
const totals = {
|
|
8500
8500
|
components: entries.length,
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8501
|
+
componentsWithPropTypeError: analyses.filter((a) => a.hasPropTypeError).length,
|
|
8502
|
+
warnings: analyses.filter((a) => a.hasWarns).length,
|
|
8503
|
+
stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
|
|
8504
|
+
storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0)
|
|
8505
8505
|
};
|
|
8506
8506
|
const allPill = `<a class="filter-pill all" data-k="all" href="#filter-all">All</a>`;
|
|
8507
|
-
const compErrorsPill = totals.
|
|
8508
|
-
const compWarningsPill = totals.
|
|
8509
|
-
const
|
|
8507
|
+
const compErrorsPill = totals.componentsWithPropTypeError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithPropTypeError}/${totals.components} prop type ${plural(totals.componentsWithPropTypeError, "error")}</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>`;
|
|
8508
|
+
const compWarningsPill = totals.warnings > 0 ? `<a class="filter-pill warn" data-k="warnings" href="#filter-warnings">${totals.warnings}/${totals.components} ${plural(totals.warnings, "warning")}</a>` : "";
|
|
8509
|
+
const storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>`;
|
|
8510
8510
|
const grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`)).join("");
|
|
8511
8511
|
const errorGroups = Object.entries(
|
|
8512
8512
|
groupBy(
|
|
@@ -8655,7 +8655,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8655
8655
|
#filter-all:target ~ header .filter-pill[data-k='all'],
|
|
8656
8656
|
#filter-errors:target ~ header .filter-pill[data-k='errors'],
|
|
8657
8657
|
#filter-warnings:target ~ header .filter-pill[data-k='warnings'],
|
|
8658
|
-
#filter-
|
|
8658
|
+
#filter-story-errors:target ~ header .filter-pill[data-k='story-errors'] {
|
|
8659
8659
|
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8660
8660
|
border-color: currentColor;
|
|
8661
8661
|
}
|
|
@@ -8664,18 +8664,18 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8664
8664
|
#filter-all,
|
|
8665
8665
|
#filter-errors,
|
|
8666
8666
|
#filter-warnings,
|
|
8667
|
-
#filter-
|
|
8667
|
+
#filter-story-errors {
|
|
8668
8668
|
display: none;
|
|
8669
8669
|
}
|
|
8670
8670
|
|
|
8671
8671
|
main {
|
|
8672
|
-
padding:
|
|
8672
|
+
padding: 36px 0 40px;
|
|
8673
8673
|
}
|
|
8674
8674
|
|
|
8675
8675
|
.grid {
|
|
8676
8676
|
display: grid;
|
|
8677
8677
|
grid-template-columns: 1fr;
|
|
8678
|
-
gap:
|
|
8678
|
+
gap: 18px;
|
|
8679
8679
|
}
|
|
8680
8680
|
|
|
8681
8681
|
/* one card per row */
|
|
@@ -8776,7 +8776,8 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8776
8776
|
/* 1px ring on active toggle */
|
|
8777
8777
|
.tg-err:checked + label.as-toggle,
|
|
8778
8778
|
.tg-warn:checked + label.as-toggle,
|
|
8779
|
-
.tg-
|
|
8779
|
+
.tg-stories:checked + label.as-toggle,
|
|
8780
|
+
.tg-props:checked + label.as-toggle {
|
|
8780
8781
|
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8781
8782
|
border-color: currentColor;
|
|
8782
8783
|
}
|
|
@@ -8800,11 +8801,16 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8800
8801
|
gap: 8px;
|
|
8801
8802
|
}
|
|
8802
8803
|
|
|
8803
|
-
.tg-
|
|
8804
|
+
.tg-stories:checked ~ .panels .panel-stories {
|
|
8804
8805
|
display: grid;
|
|
8806
|
+
gap: 8px;
|
|
8805
8807
|
}
|
|
8806
8808
|
|
|
8807
|
-
|
|
8809
|
+
.tg-props:checked ~ .panels .panel-props {
|
|
8810
|
+
display: grid;
|
|
8811
|
+
}
|
|
8812
|
+
|
|
8813
|
+
/* Colored notes for prop type error + warnings */
|
|
8808
8814
|
.note {
|
|
8809
8815
|
padding: 12px;
|
|
8810
8816
|
border: 1px solid var(--border);
|
|
@@ -8823,6 +8829,12 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8823
8829
|
color: #ffe9a6;
|
|
8824
8830
|
}
|
|
8825
8831
|
|
|
8832
|
+
.note.ok {
|
|
8833
|
+
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
8834
|
+
background: var(--ok-bg);
|
|
8835
|
+
color: var(--fg);
|
|
8836
|
+
}
|
|
8837
|
+
|
|
8826
8838
|
.note-title {
|
|
8827
8839
|
font-weight: 600;
|
|
8828
8840
|
margin-bottom: 6px;
|
|
@@ -8832,7 +8844,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8832
8844
|
white-space: normal;
|
|
8833
8845
|
}
|
|
8834
8846
|
|
|
8835
|
-
/*
|
|
8847
|
+
/* Story error cards */
|
|
8836
8848
|
.ex {
|
|
8837
8849
|
padding: 10px;
|
|
8838
8850
|
border: 1px solid var(--border);
|
|
@@ -8942,7 +8954,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8942
8954
|
}
|
|
8943
8955
|
|
|
8944
8956
|
/* CSS-only filtering of cards via top pills */
|
|
8945
|
-
#filter-errors:target ~ main .card:not(.has-error):not(.has-
|
|
8957
|
+
#filter-errors:target ~ main .card:not(.has-error):not(.has-story-error) {
|
|
8946
8958
|
display: none;
|
|
8947
8959
|
}
|
|
8948
8960
|
|
|
@@ -8950,7 +8962,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8950
8962
|
display: none;
|
|
8951
8963
|
}
|
|
8952
8964
|
|
|
8953
|
-
#filter-
|
|
8965
|
+
#filter-story-errors:target ~ main .card:not(.has-story-error) {
|
|
8954
8966
|
display: none;
|
|
8955
8967
|
}
|
|
8956
8968
|
|
|
@@ -8977,7 +8989,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8977
8989
|
display: grid;
|
|
8978
8990
|
}
|
|
8979
8991
|
|
|
8980
|
-
.card > .tg-
|
|
8992
|
+
.card > .tg-stories:checked ~ .panels .panel-stories {
|
|
8981
8993
|
display: grid;
|
|
8982
8994
|
}
|
|
8983
8995
|
|
|
@@ -8985,7 +8997,8 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8985
8997
|
@supports selector(.card:has(.tg-err:checked)) {
|
|
8986
8998
|
.card:has(.tg-err:checked) label[for$='-err'],
|
|
8987
8999
|
.card:has(.tg-warn:checked) label[for$='-warn'],
|
|
8988
|
-
.card:has(.tg-
|
|
9000
|
+
.card:has(.tg-stories:checked) label[for$='-stories'],
|
|
9001
|
+
.card:has(.tg-props:checked) label[for$='-props'] {
|
|
8989
9002
|
box-shadow: 0 0 0 1px currentColor;
|
|
8990
9003
|
border-color: currentColor;
|
|
8991
9004
|
}
|
|
@@ -8997,11 +9010,11 @@ function renderManifestComponentsPage(manifest) {
|
|
|
8997
9010
|
<span id="filter-all"></span>
|
|
8998
9011
|
<span id="filter-errors"></span>
|
|
8999
9012
|
<span id="filter-warnings"></span>
|
|
9000
|
-
<span id="filter-
|
|
9013
|
+
<span id="filter-story-errors"></span>
|
|
9001
9014
|
<header>
|
|
9002
9015
|
<div class="wrap">
|
|
9003
9016
|
<h1>Components Manifest</h1>
|
|
9004
|
-
<div class="summary">${allPill}${compErrorsPill}${compWarningsPill}${
|
|
9017
|
+
<div class="summary">${allPill}${compErrorsPill}${compWarningsPill}${storiesPill}</div>
|
|
9005
9018
|
</div>
|
|
9006
9019
|
</header>
|
|
9007
9020
|
<main>
|
|
@@ -9009,7 +9022,7 @@ function renderManifestComponentsPage(manifest) {
|
|
|
9009
9022
|
<div class="grid" role="list">
|
|
9010
9023
|
${grid || `<div class="card"><div class="head"><div class="hint">No components.</div></div></div>`}
|
|
9011
9024
|
</div>
|
|
9012
|
-
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="
|
|
9025
|
+
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="Prop type error groups">${errorGroupsHTML}</div>` : ""}
|
|
9013
9026
|
</div>
|
|
9014
9027
|
</main>
|
|
9015
9028
|
</body>
|
|
@@ -9022,30 +9035,25 @@ var esc = /* @__PURE__ */ __name((s) => String(s ?? "").replace(
|
|
|
9022
9035
|
), "esc");
|
|
9023
9036
|
var plural = /* @__PURE__ */ __name((n, one, many = `${one}s`) => n === 1 ? one : many, "plural");
|
|
9024
9037
|
function analyzeComponent(c) {
|
|
9025
|
-
const
|
|
9038
|
+
const hasPropTypeError = !!c.error;
|
|
9026
9039
|
const warns = [];
|
|
9027
|
-
if (!c.description?.trim()) {
|
|
9028
|
-
warns.push(
|
|
9029
|
-
"No description found. Write a jsdoc comment such as /** Component description */ on your component or on your stories meta."
|
|
9030
|
-
);
|
|
9031
|
-
}
|
|
9032
9040
|
if (!c.import?.trim()) {
|
|
9033
9041
|
warns.push(
|
|
9034
9042
|
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
9035
9043
|
);
|
|
9036
9044
|
}
|
|
9037
|
-
const
|
|
9038
|
-
const
|
|
9039
|
-
const
|
|
9040
|
-
const hasAnyError =
|
|
9045
|
+
const totalStories = c.stories?.length ?? 0;
|
|
9046
|
+
const storyErrors = (c.stories ?? []).filter((e) => !!e?.error).length;
|
|
9047
|
+
const storyOk = totalStories - storyErrors;
|
|
9048
|
+
const hasAnyError = hasPropTypeError || storyErrors > 0;
|
|
9041
9049
|
return {
|
|
9042
|
-
|
|
9050
|
+
hasPropTypeError,
|
|
9043
9051
|
hasAnyError,
|
|
9044
9052
|
hasWarns: warns.length > 0,
|
|
9045
9053
|
warns,
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9054
|
+
totalStories,
|
|
9055
|
+
storyErrors,
|
|
9056
|
+
storyOk
|
|
9049
9057
|
};
|
|
9050
9058
|
}
|
|
9051
9059
|
__name(analyzeComponent, "analyzeComponent");
|
|
@@ -9060,11 +9068,28 @@ __name(note, "note");
|
|
|
9060
9068
|
function renderComponentCard(key, c, id) {
|
|
9061
9069
|
const a = analyzeComponent(c);
|
|
9062
9070
|
const statusDot = a.hasAnyError ? "dot-err" : "dot-ok";
|
|
9063
|
-
const
|
|
9071
|
+
const allStories = c.stories ?? [];
|
|
9072
|
+
const errorStories = allStories.filter((ex) => !!ex?.error);
|
|
9073
|
+
const okStories = allStories.filter((ex) => !ex?.error);
|
|
9064
9074
|
const slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`;
|
|
9065
|
-
const componentErrorBadge = a.
|
|
9075
|
+
const componentErrorBadge = a.hasPropTypeError ? `<label for="${slug}-err" class="badge err as-toggle">prop type error</label>` : "";
|
|
9066
9076
|
const warningsBadge = a.hasWarns ? `<label for="${slug}-warn" class="badge warn as-toggle">${a.warns.length} ${plural(a.warns.length, "warning")}</label>` : "";
|
|
9067
|
-
const
|
|
9077
|
+
const storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}</label>` : "";
|
|
9078
|
+
const hasDocgen = !a.hasPropTypeError && "reactDocgen" in c && c.reactDocgen;
|
|
9079
|
+
const parsedDocgen = hasDocgen ? parseReactDocgen(c.reactDocgen) : void 0;
|
|
9080
|
+
const propEntries = parsedDocgen ? Object.entries(parsedDocgen.props ?? {}) : [];
|
|
9081
|
+
const propTypesBadge = !a.hasPropTypeError && propEntries.length > 0 ? `<label for="${slug}-props" class="badge ok as-toggle">${propEntries.length} ${plural(propEntries.length, "prop type")}</label>` : "";
|
|
9082
|
+
const primaryBadge = componentErrorBadge || propTypesBadge;
|
|
9083
|
+
const propsCode = propEntries.length > 0 ? propEntries.sort(([aName], [bName]) => aName.localeCompare(bName)).map(([propName, info]) => {
|
|
9084
|
+
const description = (info?.description ?? "").trim();
|
|
9085
|
+
const t = (info?.type ?? "any").trim();
|
|
9086
|
+
const optional = info?.required ? "" : "?";
|
|
9087
|
+
const defaultVal = (info?.defaultValue ?? "").trim();
|
|
9088
|
+
const def = defaultVal ? ` = ${defaultVal}` : "";
|
|
9089
|
+
const doc = description ? `/** ${description} */
|
|
9090
|
+
` : "";
|
|
9091
|
+
return `${doc}${propName}${optional}: ${t}${def}`;
|
|
9092
|
+
}).join("\n\n") : "";
|
|
9068
9093
|
const tags = c.jsDocTags && typeof c.jsDocTags === "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
9069
9094
|
([k, v]) => (Array.isArray(v) ? v : [v]).map(
|
|
9070
9095
|
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
@@ -9074,18 +9099,18 @@ function renderComponentCard(key, c, id) {
|
|
|
9074
9099
|
return `
|
|
9075
9100
|
<article
|
|
9076
9101
|
class="card
|
|
9077
|
-
${a.
|
|
9102
|
+
${a.hasPropTypeError ? "has-error" : "no-error"}
|
|
9078
9103
|
${a.hasWarns ? "has-warn" : "no-warn"}
|
|
9079
|
-
${a.
|
|
9104
|
+
${a.storyErrors ? "has-story-error" : "no-story-error"}"
|
|
9080
9105
|
role="listitem"
|
|
9081
9106
|
aria-label="${esc(c.name || key)}">
|
|
9082
9107
|
<div class="head">
|
|
9083
9108
|
<div class="title">
|
|
9084
9109
|
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
9085
9110
|
<div class="badges">
|
|
9086
|
-
${
|
|
9111
|
+
${primaryBadge}
|
|
9087
9112
|
${warningsBadge}
|
|
9088
|
-
${
|
|
9113
|
+
${storiesBadge}
|
|
9089
9114
|
</div>
|
|
9090
9115
|
</div>
|
|
9091
9116
|
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
@@ -9095,38 +9120,134 @@ function renderComponentCard(key, c, id) {
|
|
|
9095
9120
|
</div>
|
|
9096
9121
|
|
|
9097
9122
|
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
9098
|
-
${a.
|
|
9123
|
+
${a.hasPropTypeError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
9099
9124
|
${a.hasWarns ? `<input id="${slug}-warn" class="tg tg-warn" type="checkbox" hidden />` : ""}
|
|
9100
|
-
${a.
|
|
9125
|
+
${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
|
|
9126
|
+
${!a.hasPropTypeError && propEntries.length > 0 ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
|
|
9101
9127
|
|
|
9102
9128
|
<div class="panels">
|
|
9103
|
-
${a.
|
|
9129
|
+
${a.hasPropTypeError ? `
|
|
9104
9130
|
<div class="panel panel-err">
|
|
9105
|
-
${note("
|
|
9131
|
+
${note("Prop type error", `<pre><code>${esc(c.error?.message || "Unknown error")}</code></pre>`, "err")}
|
|
9106
9132
|
</div>` : ""}
|
|
9107
9133
|
${a.hasWarns ? `
|
|
9108
9134
|
<div class="panel panel-warn">
|
|
9109
9135
|
${a.warns.map((w) => note("Warning", esc(w), "warn")).join("")}
|
|
9110
9136
|
</div>` : ""}
|
|
9111
|
-
${a.
|
|
9112
|
-
<div class="panel panel-
|
|
9113
|
-
|
|
9137
|
+
${!a.hasPropTypeError && propEntries.length > 0 ? `
|
|
9138
|
+
<div class="panel panel-props">
|
|
9139
|
+
<div class="note ok">
|
|
9140
|
+
<div class="row">
|
|
9141
|
+
<span class="ex-name">Prop types</span>
|
|
9142
|
+
<span class="badge ok">${propEntries.length} ${plural(propEntries.length, "prop type")}</span>
|
|
9143
|
+
</div>
|
|
9144
|
+
<pre><code>${esc(propsCode)}</code></pre>
|
|
9145
|
+
</div>
|
|
9146
|
+
</div>` : ""}
|
|
9147
|
+
${a.totalStories > 0 ? `
|
|
9148
|
+
<div class="panel panel-stories">
|
|
9149
|
+
${errorStories.map(
|
|
9114
9150
|
(ex, j) => `
|
|
9115
|
-
<div class="
|
|
9151
|
+
<div class="note err">
|
|
9116
9152
|
<div class="row">
|
|
9117
|
-
<span class="
|
|
9118
|
-
<span class="
|
|
9119
|
-
<span class="badge err">example error</span>
|
|
9153
|
+
<span class="ex-name">${esc(ex.name)}</span>
|
|
9154
|
+
<span class="badge err">story error</span>
|
|
9120
9155
|
</div>
|
|
9121
9156
|
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
9122
9157
|
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
9123
9158
|
</div>`
|
|
9159
|
+
).join("")}
|
|
9160
|
+
${okStories.map(
|
|
9161
|
+
(ex, k) => `
|
|
9162
|
+
<div class="note ok">
|
|
9163
|
+
<div class="row">
|
|
9164
|
+
<span class="ex-name">${esc(ex.name)}</span>
|
|
9165
|
+
<span class="badge ok">story ok</span>
|
|
9166
|
+
</div>
|
|
9167
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
9168
|
+
</div>`
|
|
9124
9169
|
).join("")}
|
|
9125
9170
|
</div>` : ""}
|
|
9126
9171
|
</div>
|
|
9127
9172
|
</article>`;
|
|
9128
9173
|
}
|
|
9129
9174
|
__name(renderComponentCard, "renderComponentCard");
|
|
9175
|
+
var parseReactDocgen = /* @__PURE__ */ __name((reactDocgen) => {
|
|
9176
|
+
const props = reactDocgen?.props ?? {};
|
|
9177
|
+
return {
|
|
9178
|
+
props: Object.fromEntries(
|
|
9179
|
+
Object.entries(props).map(([propName, prop]) => [
|
|
9180
|
+
propName,
|
|
9181
|
+
{
|
|
9182
|
+
description: prop.description,
|
|
9183
|
+
type: serializeTsType(prop.tsType ?? prop.type),
|
|
9184
|
+
defaultValue: prop.defaultValue?.value,
|
|
9185
|
+
required: prop.required
|
|
9186
|
+
}
|
|
9187
|
+
])
|
|
9188
|
+
)
|
|
9189
|
+
};
|
|
9190
|
+
}, "parseReactDocgen");
|
|
9191
|
+
function serializeTsType(tsType) {
|
|
9192
|
+
if (!tsType) {
|
|
9193
|
+
return void 0;
|
|
9194
|
+
}
|
|
9195
|
+
if ("raw" in tsType && typeof tsType.raw === "string" && tsType.raw.trim().length > 0) {
|
|
9196
|
+
return tsType.raw;
|
|
9197
|
+
}
|
|
9198
|
+
if (!tsType.name) {
|
|
9199
|
+
return void 0;
|
|
9200
|
+
}
|
|
9201
|
+
if ("elements" in tsType) {
|
|
9202
|
+
if (tsType.name === "union") {
|
|
9203
|
+
const parts = (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown");
|
|
9204
|
+
return parts.join(" | ");
|
|
9205
|
+
}
|
|
9206
|
+
if (tsType.name === "intersection") {
|
|
9207
|
+
const parts = (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown");
|
|
9208
|
+
return parts.join(" & ");
|
|
9209
|
+
}
|
|
9210
|
+
if (tsType.name === "Array") {
|
|
9211
|
+
const el = (tsType.elements ?? [])[0];
|
|
9212
|
+
const inner = serializeTsType(el) ?? "unknown";
|
|
9213
|
+
return `${inner}[]`;
|
|
9214
|
+
}
|
|
9215
|
+
if (tsType.name === "tuple") {
|
|
9216
|
+
const parts = (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown");
|
|
9217
|
+
return `[${parts.join(", ")}]`;
|
|
9218
|
+
}
|
|
9219
|
+
}
|
|
9220
|
+
if ("value" in tsType && tsType.name === "literal") {
|
|
9221
|
+
return tsType.value;
|
|
9222
|
+
}
|
|
9223
|
+
if ("signature" in tsType && tsType.name === "signature") {
|
|
9224
|
+
if (tsType.type === "function") {
|
|
9225
|
+
const args = (tsType.signature?.arguments ?? []).map((a) => {
|
|
9226
|
+
const argType = serializeTsType(a.type) ?? "any";
|
|
9227
|
+
return `${a.name}: ${argType}`;
|
|
9228
|
+
});
|
|
9229
|
+
const ret = serializeTsType(tsType.signature?.return) ?? "void";
|
|
9230
|
+
return `(${args.join(", ")}) => ${ret}`;
|
|
9231
|
+
}
|
|
9232
|
+
if (tsType.type === "object") {
|
|
9233
|
+
const props = (tsType.signature?.properties ?? []).map((p) => {
|
|
9234
|
+
const req = Boolean(p.value?.required);
|
|
9235
|
+
const propType = serializeTsType(p.value) ?? "any";
|
|
9236
|
+
return `${p.key}${req ? "" : "?"}: ${propType}`;
|
|
9237
|
+
});
|
|
9238
|
+
return `{ ${props.join("; ")} }`;
|
|
9239
|
+
}
|
|
9240
|
+
return "unknown";
|
|
9241
|
+
}
|
|
9242
|
+
if ("elements" in tsType) {
|
|
9243
|
+
const inner = (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown");
|
|
9244
|
+
if (inner.length > 0) {
|
|
9245
|
+
return `${tsType.name}<${inner.join(", ")}>`;
|
|
9246
|
+
}
|
|
9247
|
+
}
|
|
9248
|
+
return tsType.name;
|
|
9249
|
+
}
|
|
9250
|
+
__name(serializeTsType, "serializeTsType");
|
|
9130
9251
|
|
|
9131
9252
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
9132
9253
|
import { existsSync } from "node:fs";
|
|
@@ -9360,7 +9481,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
9360
9481
|
}
|
|
9361
9482
|
const pathToSubIndex = {};
|
|
9362
9483
|
const fullGlob = slash(join2(specifier.directory, specifier.files));
|
|
9363
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
9484
|
+
const { globby } = await import("../_node-chunks/globby-L3NPKIS7.js");
|
|
9364
9485
|
const files = await globby(fullGlob, {
|
|
9365
9486
|
absolute: true,
|
|
9366
9487
|
cwd: workingDir,
|
|
@@ -9616,7 +9737,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
9616
9737
|
const normalizedPath = normalizeStoryPath(relativePath);
|
|
9617
9738
|
const importPath = slash(normalizedPath);
|
|
9618
9739
|
const content = await readFile(absolutePath, { encoding: "utf8" });
|
|
9619
|
-
const { analyze } = await import("../_node-chunks/dist-
|
|
9740
|
+
const { analyze } = await import("../_node-chunks/dist-MCOAOC3B.js");
|
|
9620
9741
|
const result = await analyze(content);
|
|
9621
9742
|
if (result.isTemplate) {
|
|
9622
9743
|
return false;
|
|
@@ -9959,7 +10080,7 @@ __name(print, "print");
|
|
|
9959
10080
|
// src/core-server/utils/get-builders.ts
|
|
9960
10081
|
import { MissingBuilderError } from "storybook/internal/server-errors";
|
|
9961
10082
|
async function getManagerBuilder() {
|
|
9962
|
-
return await import("../_node-chunks/builder-manager-
|
|
10083
|
+
return await import("../_node-chunks/builder-manager-P652CU5Z.js");
|
|
9963
10084
|
}
|
|
9964
10085
|
__name(getManagerBuilder, "getManagerBuilder");
|
|
9965
10086
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
@@ -10198,7 +10319,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
10198
10319
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
10199
10320
|
basename2(specifier.files)
|
|
10200
10321
|
);
|
|
10201
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
10322
|
+
const { globby } = await import("../_node-chunks/globby-L3NPKIS7.js");
|
|
10202
10323
|
const addedFiles = await globby(slash(dirGlob), commonGlobOptions2(dirGlob));
|
|
10203
10324
|
addedFiles.forEach((filePath) => {
|
|
10204
10325
|
const fileImportPath = toImportPath(filePath);
|