storybook 10.1.0-alpha.2 → 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-XRIDLU42.js → builder-manager-P652CU5Z.js} +12 -12
- package/dist/_node-chunks/camelcase-VADCJSEY.js +18 -0
- package/dist/_node-chunks/{chunk-D43KJFPO.js → chunk-3GTBPTCZ.js} +7 -7
- package/dist/_node-chunks/chunk-3OPGVNKX.js +18 -0
- package/dist/_node-chunks/{chunk-QFET4WIW.js → chunk-5A6EYMRK.js} +6 -6
- package/dist/_node-chunks/{chunk-ZN2EDLIJ.js → chunk-5E5YDTCQ.js} +7 -7
- package/dist/_node-chunks/{chunk-FWBIPR34.js → chunk-5NGUGC3U.js} +7 -7
- package/dist/_node-chunks/{chunk-2L3QAN3W.js → chunk-6DHXOOK2.js} +7 -7
- package/dist/_node-chunks/{chunk-BB3ZKTWJ.js → chunk-6VWT3H7R.js} +7 -7
- package/dist/_node-chunks/{chunk-GWSFLQQQ.js → chunk-7332Y23R.js} +1466 -148
- package/dist/_node-chunks/{chunk-EKPHXLN6.js → chunk-7C52H6S6.js} +7 -7
- package/dist/_node-chunks/{chunk-BAE27Z3H.js → chunk-7NSBLADO.js} +8 -8
- package/dist/_node-chunks/{chunk-VEZ6C62C.js → chunk-BHHNQ5GJ.js} +36 -43
- package/dist/_node-chunks/{chunk-Q5JSLT56.js → chunk-CAKHJEH6.js} +7 -7
- package/dist/_node-chunks/{chunk-ZI3WVJBS.js → chunk-CPI4IKLK.js} +8 -8
- package/dist/_node-chunks/{chunk-QS5MMNF7.js → chunk-FMLH3V5B.js} +7 -7
- package/dist/_node-chunks/{chunk-HFHQNHRU.js → chunk-FU2KCZJG.js} +9 -9
- package/dist/_node-chunks/{chunk-RIPSSVT6.js → chunk-GDOIF7E6.js} +7 -7
- package/dist/_node-chunks/{chunk-IK3K67LJ.js → chunk-HPERTMWB.js} +7 -7
- package/dist/_node-chunks/{chunk-OM4TBMP7.js → chunk-ICT62CX5.js} +7 -7
- package/dist/_node-chunks/{chunk-5RN3IJGF.js → chunk-JS5I7ZY6.js} +7 -7
- package/dist/_node-chunks/{chunk-ZTHTAFLY.js → chunk-K3K6H2BF.js} +12 -12
- package/dist/_node-chunks/{chunk-RQKELEE4.js → chunk-LPBJHVNR.js} +7 -7
- package/dist/_node-chunks/{chunk-FI6CLUVL.js → chunk-OXPHRY7P.js} +15 -15
- package/dist/_node-chunks/{chunk-3AR5SJTX.js → chunk-PCXGFAQ3.js} +7 -7
- package/dist/_node-chunks/{chunk-6TX2TV3E.js → chunk-PW7ECOTU.js} +12 -12
- package/dist/_node-chunks/{chunk-BYQZFXRF.js → chunk-RFAREF3S.js} +8 -8
- package/dist/_node-chunks/{chunk-XVXUF5GE.js → chunk-T6VOUSIY.js} +7 -7
- package/dist/_node-chunks/{chunk-LJPS53G5.js → chunk-TFBHPN6J.js} +7 -7
- package/dist/_node-chunks/{chunk-S6RYOO4I.js → chunk-TXDBGO2X.js} +9 -9
- package/dist/_node-chunks/{chunk-RUJOX3JR.js → chunk-VAAX75EL.js} +6 -6
- package/dist/_node-chunks/chunk-VCC35ZLQ.js +61 -0
- package/dist/_node-chunks/{chunk-L5J4RBU5.js → chunk-XCTASIYK.js} +8 -8
- package/dist/_node-chunks/{chunk-WHOPLOGE.js → chunk-XPBE544K.js} +7 -7
- package/dist/_node-chunks/{chunk-6WXUZSNC.js → chunk-YXC7LAMZ.js} +10 -10
- package/dist/_node-chunks/{dist-Q25SOSXX.js → dist-MCOAOC3B.js} +9 -9
- package/dist/_node-chunks/{globby-I54LIY47.js → globby-L3NPKIS7.js} +9 -9
- package/dist/_node-chunks/{lib-KQD2WJWJ.js → lib-ITTSFFC5.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-CT3A7SBK.js → mdx-N42X6CFJ-YP4YCIZM.js} +8 -8
- package/dist/_node-chunks/{p-limit-2NBKFARM.js → p-limit-TTLWUU6D.js} +7 -7
- package/dist/_node-chunks/{plugin-RF5FICSG.js → plugin-C2OCVZYN.js} +10 -10
- package/dist/_node-chunks/{plugin-2CCCBGGB.js → plugin-OC5KWEJQ.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-RY56E77L.js → webpack-inject-mocker-runtime-plugin-IRAPT6HV.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-6VDFRSC4.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.d.ts +190 -2
- package/dist/common/index.js +26 -20
- package/dist/components/index.js +5744 -73
- package/dist/core-server/index.js +833 -46
- 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.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 +4 -2
- package/package.json +2 -1
- package/dist/_browser-chunks/chunk-B3S3ROIP.js +0 -5810
- package/dist/_node-chunks/camelcase-3IIGGJ6N.js +0 -18
- package/dist/_node-chunks/chunk-N3ZE2FCS.js +0 -61
- package/dist/_node-chunks/chunk-U6VJQXTG.js +0 -18
- 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,61 +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
|
+
resolveImport,
|
|
42
|
+
supportedExtensions,
|
|
41
43
|
userOrAutoTitleFromSpecifier
|
|
42
|
-
} from "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
45
|
-
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";
|
|
46
48
|
import {
|
|
47
49
|
optionalEnvToBoolean,
|
|
48
50
|
require_cross_spawn
|
|
49
|
-
} from "../_node-chunks/chunk-
|
|
51
|
+
} from "../_node-chunks/chunk-TXDBGO2X.js";
|
|
50
52
|
import {
|
|
51
53
|
up2 as up
|
|
52
|
-
} from "../_node-chunks/chunk-
|
|
53
|
-
import "../_node-chunks/chunk-
|
|
54
|
+
} from "../_node-chunks/chunk-PCXGFAQ3.js";
|
|
55
|
+
import "../_node-chunks/chunk-ICT62CX5.js";
|
|
54
56
|
import {
|
|
55
57
|
invariant
|
|
56
|
-
} from "../_node-chunks/chunk-
|
|
58
|
+
} from "../_node-chunks/chunk-3GTBPTCZ.js";
|
|
57
59
|
import {
|
|
58
60
|
importModule,
|
|
59
61
|
resolvePackageDir
|
|
60
|
-
} from "../_node-chunks/chunk-
|
|
62
|
+
} from "../_node-chunks/chunk-CPI4IKLK.js";
|
|
61
63
|
import {
|
|
62
64
|
join,
|
|
63
65
|
relative,
|
|
64
66
|
resolve
|
|
65
|
-
} from "../_node-chunks/chunk-
|
|
67
|
+
} from "../_node-chunks/chunk-TFBHPN6J.js";
|
|
66
68
|
import {
|
|
67
69
|
require_prompts
|
|
68
|
-
} from "../_node-chunks/chunk-
|
|
69
|
-
import "../_node-chunks/chunk-
|
|
70
|
+
} from "../_node-chunks/chunk-6VWT3H7R.js";
|
|
71
|
+
import "../_node-chunks/chunk-CAKHJEH6.js";
|
|
70
72
|
import {
|
|
71
73
|
slash
|
|
72
|
-
} from "../_node-chunks/chunk-
|
|
74
|
+
} from "../_node-chunks/chunk-7C52H6S6.js";
|
|
73
75
|
import {
|
|
74
76
|
require_dist
|
|
75
|
-
} from "../_node-chunks/chunk-
|
|
77
|
+
} from "../_node-chunks/chunk-HPERTMWB.js";
|
|
76
78
|
import {
|
|
77
79
|
require_lib,
|
|
78
80
|
require_src
|
|
79
|
-
} from "../_node-chunks/chunk-
|
|
81
|
+
} from "../_node-chunks/chunk-FMLH3V5B.js";
|
|
80
82
|
import {
|
|
81
83
|
require_picocolors
|
|
82
|
-
} from "../_node-chunks/chunk-
|
|
84
|
+
} from "../_node-chunks/chunk-6DHXOOK2.js";
|
|
83
85
|
import {
|
|
84
86
|
__commonJS,
|
|
85
87
|
__name,
|
|
86
88
|
__require,
|
|
87
89
|
__toESM
|
|
88
|
-
} from "../_node-chunks/chunk-
|
|
90
|
+
} from "../_node-chunks/chunk-VAAX75EL.js";
|
|
89
91
|
|
|
90
92
|
// ../node_modules/tsconfig-paths/lib/filesystem.js
|
|
91
93
|
var require_filesystem = __commonJS({
|
|
@@ -8487,6 +8489,766 @@ import { getPrecedingUpgrade, telemetry as telemetry2 } from "storybook/internal
|
|
|
8487
8489
|
import { global as global2 } from "@storybook/global";
|
|
8488
8490
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
8489
8491
|
|
|
8492
|
+
// src/core-server/manifest.ts
|
|
8493
|
+
import { groupBy } from "storybook/internal/common";
|
|
8494
|
+
function renderManifestComponentsPage(manifest) {
|
|
8495
|
+
const entries = Object.entries(manifest?.components ?? {}).sort(
|
|
8496
|
+
(a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
|
|
8497
|
+
);
|
|
8498
|
+
const analyses = entries.map(([, c]) => analyzeComponent(c));
|
|
8499
|
+
const totals = {
|
|
8500
|
+
components: entries.length,
|
|
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
|
+
};
|
|
8506
|
+
const allPill = `<a class="filter-pill all" data-k="all" href="#filter-all">All</a>`;
|
|
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
|
+
const grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`)).join("");
|
|
8511
|
+
const errorGroups = Object.entries(
|
|
8512
|
+
groupBy(
|
|
8513
|
+
entries.map(([, it]) => it).filter((it) => it.error),
|
|
8514
|
+
(manifest2) => manifest2.error?.name ?? "Error"
|
|
8515
|
+
)
|
|
8516
|
+
);
|
|
8517
|
+
const errorGroupsHTML = errorGroups.map(([error, grouped]) => {
|
|
8518
|
+
const id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
8519
|
+
const headerText = `${esc(error)}`;
|
|
8520
|
+
const cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
|
|
8521
|
+
return `
|
|
8522
|
+
<section class="group">
|
|
8523
|
+
<input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
|
|
8524
|
+
<label for="${id}-toggle" class="group-header">
|
|
8525
|
+
<span class="caret">\u25B8</span>
|
|
8526
|
+
<span class="group-title">${headerText}</span>
|
|
8527
|
+
<span class="group-count">${grouped.length}</span>
|
|
8528
|
+
</label>
|
|
8529
|
+
<div class="group-cards">${cards}</div>
|
|
8530
|
+
</section>
|
|
8531
|
+
`;
|
|
8532
|
+
}).join("");
|
|
8533
|
+
return `<!doctype html>
|
|
8534
|
+
<html lang="en">
|
|
8535
|
+
<head>
|
|
8536
|
+
<meta charset="utf-8" />
|
|
8537
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8538
|
+
<title>Components Manifest</title>
|
|
8539
|
+
<style>
|
|
8540
|
+
:root {
|
|
8541
|
+
--bg: #0b0c10;
|
|
8542
|
+
--panel: #121318;
|
|
8543
|
+
--muted: #9aa0a6;
|
|
8544
|
+
--fg: #e8eaed;
|
|
8545
|
+
--ok: #22c55e;
|
|
8546
|
+
--warn: #b08900;
|
|
8547
|
+
--err: #c62828;
|
|
8548
|
+
--ok-bg: #0c1a13;
|
|
8549
|
+
--warn-bg: #1a1608;
|
|
8550
|
+
--err-bg: #1a0e0e;
|
|
8551
|
+
--chip: #1f2330;
|
|
8552
|
+
--border: #2b2f3a;
|
|
8553
|
+
--link: #8ab4f8;
|
|
8554
|
+
--active-ring: 1px; /* 1px active ring for pills and toggles */
|
|
8555
|
+
}
|
|
8556
|
+
|
|
8557
|
+
* {
|
|
8558
|
+
box-sizing: border-box;
|
|
8559
|
+
}
|
|
8560
|
+
|
|
8561
|
+
html,
|
|
8562
|
+
body {
|
|
8563
|
+
margin: 0;
|
|
8564
|
+
background: var(--bg);
|
|
8565
|
+
color: var(--fg);
|
|
8566
|
+
font: 14px/1.5 system-ui,
|
|
8567
|
+
-apple-system,
|
|
8568
|
+
Segoe UI,
|
|
8569
|
+
Roboto,
|
|
8570
|
+
Ubuntu,
|
|
8571
|
+
Cantarell,
|
|
8572
|
+
'Helvetica Neue',
|
|
8573
|
+
Arial,
|
|
8574
|
+
'Noto Sans';
|
|
8575
|
+
}
|
|
8576
|
+
|
|
8577
|
+
.wrap {
|
|
8578
|
+
max-width: 1100px;
|
|
8579
|
+
margin: 0 auto;
|
|
8580
|
+
padding: 16px 20px;
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
header {
|
|
8584
|
+
position: sticky;
|
|
8585
|
+
top: 0;
|
|
8586
|
+
backdrop-filter: blur(6px);
|
|
8587
|
+
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
|
8588
|
+
border-bottom: 1px solid var(--border);
|
|
8589
|
+
z-index: 10;
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
h1 {
|
|
8593
|
+
font-size: 20px;
|
|
8594
|
+
margin: 0 0 6px;
|
|
8595
|
+
}
|
|
8596
|
+
|
|
8597
|
+
.summary {
|
|
8598
|
+
display: flex;
|
|
8599
|
+
gap: 12px;
|
|
8600
|
+
flex-wrap: wrap;
|
|
8601
|
+
align-items: center;
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
/* Top filter pills */
|
|
8605
|
+
.filter-pill {
|
|
8606
|
+
display: inline-flex;
|
|
8607
|
+
align-items: center;
|
|
8608
|
+
gap: 6px;
|
|
8609
|
+
padding: 6px 12px;
|
|
8610
|
+
border: 1px solid var(--border);
|
|
8611
|
+
border-radius: 999px;
|
|
8612
|
+
background: var(--panel);
|
|
8613
|
+
text-decoration: none;
|
|
8614
|
+
cursor: pointer;
|
|
8615
|
+
user-select: none;
|
|
8616
|
+
color: var(--fg);
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
.filter-pill.ok {
|
|
8620
|
+
color: #b9f6ca;
|
|
8621
|
+
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
8622
|
+
background: color-mix(in srgb, var(--ok) 18%, #000);
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
.filter-pill.warn {
|
|
8626
|
+
color: #ffd666;
|
|
8627
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8628
|
+
background: var(--warn-bg);
|
|
8629
|
+
}
|
|
8630
|
+
|
|
8631
|
+
.filter-pill.err {
|
|
8632
|
+
color: #ff9aa0;
|
|
8633
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8634
|
+
background: var(--err-bg);
|
|
8635
|
+
}
|
|
8636
|
+
|
|
8637
|
+
.filter-pill.all {
|
|
8638
|
+
color: #d7dbe0;
|
|
8639
|
+
border-color: var(--border);
|
|
8640
|
+
background: var(--panel);
|
|
8641
|
+
}
|
|
8642
|
+
|
|
8643
|
+
.filter-pill[aria-disabled='true'] {
|
|
8644
|
+
cursor: default;
|
|
8645
|
+
text-decoration: none;
|
|
8646
|
+
}
|
|
8647
|
+
|
|
8648
|
+
.filter-pill:focus,
|
|
8649
|
+
.filter-pill:active {
|
|
8650
|
+
outline: none;
|
|
8651
|
+
box-shadow: none;
|
|
8652
|
+
}
|
|
8653
|
+
|
|
8654
|
+
/* Selected top pill ring via :target */
|
|
8655
|
+
#filter-all:target ~ header .filter-pill[data-k='all'],
|
|
8656
|
+
#filter-errors:target ~ header .filter-pill[data-k='errors'],
|
|
8657
|
+
#filter-warnings:target ~ header .filter-pill[data-k='warnings'],
|
|
8658
|
+
#filter-story-errors:target ~ header .filter-pill[data-k='story-errors'] {
|
|
8659
|
+
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8660
|
+
border-color: currentColor;
|
|
8661
|
+
}
|
|
8662
|
+
|
|
8663
|
+
/* Hidden targets for filtering */
|
|
8664
|
+
#filter-all,
|
|
8665
|
+
#filter-errors,
|
|
8666
|
+
#filter-warnings,
|
|
8667
|
+
#filter-story-errors {
|
|
8668
|
+
display: none;
|
|
8669
|
+
}
|
|
8670
|
+
|
|
8671
|
+
main {
|
|
8672
|
+
padding: 36px 0 40px;
|
|
8673
|
+
}
|
|
8674
|
+
|
|
8675
|
+
.grid {
|
|
8676
|
+
display: grid;
|
|
8677
|
+
grid-template-columns: 1fr;
|
|
8678
|
+
gap: 18px;
|
|
8679
|
+
}
|
|
8680
|
+
|
|
8681
|
+
/* one card per row */
|
|
8682
|
+
|
|
8683
|
+
.card {
|
|
8684
|
+
border: 1px solid var(--border);
|
|
8685
|
+
background: var(--panel);
|
|
8686
|
+
border-radius: 14px;
|
|
8687
|
+
padding: 14px;
|
|
8688
|
+
display: flex;
|
|
8689
|
+
flex-direction: column;
|
|
8690
|
+
gap: 10px;
|
|
8691
|
+
}
|
|
8692
|
+
|
|
8693
|
+
.head {
|
|
8694
|
+
display: flex;
|
|
8695
|
+
flex-direction: column;
|
|
8696
|
+
gap: 8px;
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8699
|
+
.title {
|
|
8700
|
+
display: flex;
|
|
8701
|
+
align-items: center;
|
|
8702
|
+
justify-content: space-between;
|
|
8703
|
+
gap: 10px;
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8706
|
+
.title h2 {
|
|
8707
|
+
font-size: 16px;
|
|
8708
|
+
margin: 0;
|
|
8709
|
+
overflow: hidden;
|
|
8710
|
+
text-overflow: ellipsis;
|
|
8711
|
+
white-space: nowrap;
|
|
8712
|
+
}
|
|
8713
|
+
|
|
8714
|
+
.meta {
|
|
8715
|
+
font-size: 12px;
|
|
8716
|
+
color: var(--muted);
|
|
8717
|
+
overflow: hidden;
|
|
8718
|
+
text-overflow: ellipsis;
|
|
8719
|
+
white-space: nowrap;
|
|
8720
|
+
}
|
|
8721
|
+
|
|
8722
|
+
.kv {
|
|
8723
|
+
display: flex;
|
|
8724
|
+
flex-wrap: wrap;
|
|
8725
|
+
gap: 6px;
|
|
8726
|
+
}
|
|
8727
|
+
|
|
8728
|
+
.chip {
|
|
8729
|
+
font-size: 12px;
|
|
8730
|
+
padding: 4px 8px;
|
|
8731
|
+
border-radius: 999px;
|
|
8732
|
+
background: var(--chip);
|
|
8733
|
+
border: 1px solid var(--border);
|
|
8734
|
+
}
|
|
8735
|
+
|
|
8736
|
+
.hint {
|
|
8737
|
+
color: var(--muted);
|
|
8738
|
+
font-size: 12px;
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8741
|
+
.badges {
|
|
8742
|
+
display: flex;
|
|
8743
|
+
gap: 8px;
|
|
8744
|
+
flex-wrap: wrap;
|
|
8745
|
+
}
|
|
8746
|
+
|
|
8747
|
+
/* Per-card badges: labels become toggles when clickable */
|
|
8748
|
+
.badge {
|
|
8749
|
+
font-size: 12px;
|
|
8750
|
+
padding: 3px 8px;
|
|
8751
|
+
border-radius: 999px;
|
|
8752
|
+
border: 1px solid var(--border);
|
|
8753
|
+
background: var(--chip);
|
|
8754
|
+
color: #d7dbe0;
|
|
8755
|
+
}
|
|
8756
|
+
|
|
8757
|
+
.badge.ok {
|
|
8758
|
+
color: #b9f6ca;
|
|
8759
|
+
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
8760
|
+
}
|
|
8761
|
+
|
|
8762
|
+
.badge.warn {
|
|
8763
|
+
color: #ffd666;
|
|
8764
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8765
|
+
}
|
|
8766
|
+
|
|
8767
|
+
.badge.err {
|
|
8768
|
+
color: #ff9aa0;
|
|
8769
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
.as-toggle {
|
|
8773
|
+
cursor: pointer;
|
|
8774
|
+
}
|
|
8775
|
+
|
|
8776
|
+
/* 1px ring on active toggle */
|
|
8777
|
+
.tg-err:checked + label.as-toggle,
|
|
8778
|
+
.tg-warn:checked + label.as-toggle,
|
|
8779
|
+
.tg-stories:checked + label.as-toggle,
|
|
8780
|
+
.tg-props:checked + label.as-toggle {
|
|
8781
|
+
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8782
|
+
border-color: currentColor;
|
|
8783
|
+
}
|
|
8784
|
+
|
|
8785
|
+
/* Panels: hidden by default, shown when respective toggle checked */
|
|
8786
|
+
.panels {
|
|
8787
|
+
display: grid;
|
|
8788
|
+
gap: 10px;
|
|
8789
|
+
}
|
|
8790
|
+
|
|
8791
|
+
.panel {
|
|
8792
|
+
display: none;
|
|
8793
|
+
}
|
|
8794
|
+
|
|
8795
|
+
.tg-err:checked ~ .panels .panel-err {
|
|
8796
|
+
display: grid;
|
|
8797
|
+
}
|
|
8798
|
+
|
|
8799
|
+
.tg-warn:checked ~ .panels .panel-warn {
|
|
8800
|
+
display: grid;
|
|
8801
|
+
gap: 8px;
|
|
8802
|
+
}
|
|
8803
|
+
|
|
8804
|
+
.tg-stories:checked ~ .panels .panel-stories {
|
|
8805
|
+
display: grid;
|
|
8806
|
+
gap: 8px;
|
|
8807
|
+
}
|
|
8808
|
+
|
|
8809
|
+
.tg-props:checked ~ .panels .panel-props {
|
|
8810
|
+
display: grid;
|
|
8811
|
+
}
|
|
8812
|
+
|
|
8813
|
+
/* Colored notes for prop type error + warnings */
|
|
8814
|
+
.note {
|
|
8815
|
+
padding: 12px;
|
|
8816
|
+
border: 1px solid var(--border);
|
|
8817
|
+
border-radius: 10px;
|
|
8818
|
+
}
|
|
8819
|
+
|
|
8820
|
+
.note.err {
|
|
8821
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8822
|
+
background: var(--err-bg);
|
|
8823
|
+
color: #ffd1d4;
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8826
|
+
.note.warn {
|
|
8827
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8828
|
+
background: var(--warn-bg);
|
|
8829
|
+
color: #ffe9a6;
|
|
8830
|
+
}
|
|
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
|
+
|
|
8838
|
+
.note-title {
|
|
8839
|
+
font-weight: 600;
|
|
8840
|
+
margin-bottom: 6px;
|
|
8841
|
+
}
|
|
8842
|
+
|
|
8843
|
+
.note-body {
|
|
8844
|
+
white-space: normal;
|
|
8845
|
+
}
|
|
8846
|
+
|
|
8847
|
+
/* Story error cards */
|
|
8848
|
+
.ex {
|
|
8849
|
+
padding: 10px;
|
|
8850
|
+
border: 1px solid var(--border);
|
|
8851
|
+
border-radius: 10px;
|
|
8852
|
+
background: #0f131b;
|
|
8853
|
+
}
|
|
8854
|
+
|
|
8855
|
+
.ex.err {
|
|
8856
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8857
|
+
}
|
|
8858
|
+
|
|
8859
|
+
.row {
|
|
8860
|
+
display: flex;
|
|
8861
|
+
align-items: center;
|
|
8862
|
+
gap: 8px;
|
|
8863
|
+
flex-wrap: wrap;
|
|
8864
|
+
}
|
|
8865
|
+
|
|
8866
|
+
.status-dot {
|
|
8867
|
+
width: 8px;
|
|
8868
|
+
height: 8px;
|
|
8869
|
+
border-radius: 50%;
|
|
8870
|
+
display: inline-block;
|
|
8871
|
+
}
|
|
8872
|
+
|
|
8873
|
+
.dot-ok {
|
|
8874
|
+
background: var(--ok);
|
|
8875
|
+
}
|
|
8876
|
+
|
|
8877
|
+
.dot-err {
|
|
8878
|
+
background: var(--err);
|
|
8879
|
+
}
|
|
8880
|
+
|
|
8881
|
+
.ex-name {
|
|
8882
|
+
font-weight: 600;
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
/* Error groups (visible in errors filter) */
|
|
8886
|
+
.error-groups {
|
|
8887
|
+
display: none;
|
|
8888
|
+
margin-bottom: 16px;
|
|
8889
|
+
}
|
|
8890
|
+
|
|
8891
|
+
.group {
|
|
8892
|
+
border: 1px solid var(--border);
|
|
8893
|
+
background: var(--panel);
|
|
8894
|
+
border-radius: 14px;
|
|
8895
|
+
overflow: hidden;
|
|
8896
|
+
}
|
|
8897
|
+
|
|
8898
|
+
.group + .group {
|
|
8899
|
+
margin-top: 12px;
|
|
8900
|
+
}
|
|
8901
|
+
|
|
8902
|
+
.group-header {
|
|
8903
|
+
display: flex;
|
|
8904
|
+
align-items: center;
|
|
8905
|
+
gap: 10px;
|
|
8906
|
+
padding: 12px 14px;
|
|
8907
|
+
cursor: pointer;
|
|
8908
|
+
border-bottom: 1px solid var(--border);
|
|
8909
|
+
}
|
|
8910
|
+
|
|
8911
|
+
.group-header:hover {
|
|
8912
|
+
background: #141722;
|
|
8913
|
+
}
|
|
8914
|
+
|
|
8915
|
+
.group-title {
|
|
8916
|
+
font-weight: 600;
|
|
8917
|
+
flex: 1;
|
|
8918
|
+
}
|
|
8919
|
+
|
|
8920
|
+
.group-count {
|
|
8921
|
+
font-size: 12px;
|
|
8922
|
+
color: var(--muted);
|
|
8923
|
+
}
|
|
8924
|
+
|
|
8925
|
+
.group-cards {
|
|
8926
|
+
display: none;
|
|
8927
|
+
padding: 12px;
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8930
|
+
.group .card {
|
|
8931
|
+
margin: 12px 0;
|
|
8932
|
+
}
|
|
8933
|
+
|
|
8934
|
+
.group .card:first-child {
|
|
8935
|
+
margin-top: 0;
|
|
8936
|
+
}
|
|
8937
|
+
|
|
8938
|
+
.group .card:last-child {
|
|
8939
|
+
margin-bottom: 0;
|
|
8940
|
+
}
|
|
8941
|
+
|
|
8942
|
+
/* caret rotation */
|
|
8943
|
+
.group-tg:checked + label .caret {
|
|
8944
|
+
transform: rotate(90deg);
|
|
8945
|
+
}
|
|
8946
|
+
|
|
8947
|
+
.caret {
|
|
8948
|
+
transition: transform 0.15s ease;
|
|
8949
|
+
}
|
|
8950
|
+
|
|
8951
|
+
/* toggle body */
|
|
8952
|
+
.group-tg:checked ~ .group-cards {
|
|
8953
|
+
display: block;
|
|
8954
|
+
}
|
|
8955
|
+
|
|
8956
|
+
/* CSS-only filtering of cards via top pills */
|
|
8957
|
+
#filter-errors:target ~ main .card:not(.has-error):not(.has-story-error) {
|
|
8958
|
+
display: none;
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8961
|
+
#filter-warnings:target ~ main .card:not(.has-warn) {
|
|
8962
|
+
display: none;
|
|
8963
|
+
}
|
|
8964
|
+
|
|
8965
|
+
#filter-story-errors:target ~ main .card:not(.has-story-error) {
|
|
8966
|
+
display: none;
|
|
8967
|
+
}
|
|
8968
|
+
|
|
8969
|
+
#filter-all:target ~ main .card {
|
|
8970
|
+
display: block;
|
|
8971
|
+
}
|
|
8972
|
+
|
|
8973
|
+
/* In errors view, hide standalone component-error cards in the regular grid (they will appear in groups) */
|
|
8974
|
+
#filter-errors:target ~ main .grid .card.has-error {
|
|
8975
|
+
display: none;
|
|
8976
|
+
}
|
|
8977
|
+
|
|
8978
|
+
/* Show grouped section only in errors view */
|
|
8979
|
+
#filter-errors:target ~ main .error-groups {
|
|
8980
|
+
display: block;
|
|
8981
|
+
}
|
|
8982
|
+
|
|
8983
|
+
/* When a toggle is checked, show the corresponding panel */
|
|
8984
|
+
.card > .tg-err:checked ~ .panels .panel-err {
|
|
8985
|
+
display: grid;
|
|
8986
|
+
}
|
|
8987
|
+
|
|
8988
|
+
.card > .tg-warn:checked ~ .panels .panel-warn {
|
|
8989
|
+
display: grid;
|
|
8990
|
+
}
|
|
8991
|
+
|
|
8992
|
+
.card > .tg-stories:checked ~ .panels .panel-stories {
|
|
8993
|
+
display: grid;
|
|
8994
|
+
}
|
|
8995
|
+
|
|
8996
|
+
/* Optional: a subtle 1px ring on the active badge, using :has() if available */
|
|
8997
|
+
@supports selector(.card:has(.tg-err:checked)) {
|
|
8998
|
+
.card:has(.tg-err:checked) label[for$='-err'],
|
|
8999
|
+
.card:has(.tg-warn:checked) label[for$='-warn'],
|
|
9000
|
+
.card:has(.tg-stories:checked) label[for$='-stories'],
|
|
9001
|
+
.card:has(.tg-props:checked) label[for$='-props'] {
|
|
9002
|
+
box-shadow: 0 0 0 1px currentColor;
|
|
9003
|
+
border-color: currentColor;
|
|
9004
|
+
}
|
|
9005
|
+
}
|
|
9006
|
+
</style>
|
|
9007
|
+
</head>
|
|
9008
|
+
<body>
|
|
9009
|
+
<!-- Hidden targets for the top-level filters -->
|
|
9010
|
+
<span id="filter-all"></span>
|
|
9011
|
+
<span id="filter-errors"></span>
|
|
9012
|
+
<span id="filter-warnings"></span>
|
|
9013
|
+
<span id="filter-story-errors"></span>
|
|
9014
|
+
<header>
|
|
9015
|
+
<div class="wrap">
|
|
9016
|
+
<h1>Components Manifest</h1>
|
|
9017
|
+
<div class="summary">${allPill}${compErrorsPill}${compWarningsPill}${storiesPill}</div>
|
|
9018
|
+
</div>
|
|
9019
|
+
</header>
|
|
9020
|
+
<main>
|
|
9021
|
+
<div class="wrap">
|
|
9022
|
+
<div class="grid" role="list">
|
|
9023
|
+
${grid || `<div class="card"><div class="head"><div class="hint">No components.</div></div></div>`}
|
|
9024
|
+
</div>
|
|
9025
|
+
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="Prop type error groups">${errorGroupsHTML}</div>` : ""}
|
|
9026
|
+
</div>
|
|
9027
|
+
</main>
|
|
9028
|
+
</body>
|
|
9029
|
+
</html> `;
|
|
9030
|
+
}
|
|
9031
|
+
__name(renderManifestComponentsPage, "renderManifestComponentsPage");
|
|
9032
|
+
var esc = /* @__PURE__ */ __name((s) => String(s ?? "").replace(
|
|
9033
|
+
/[&<>"']/g,
|
|
9034
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]
|
|
9035
|
+
), "esc");
|
|
9036
|
+
var plural = /* @__PURE__ */ __name((n, one, many = `${one}s`) => n === 1 ? one : many, "plural");
|
|
9037
|
+
function analyzeComponent(c) {
|
|
9038
|
+
const hasPropTypeError = !!c.error;
|
|
9039
|
+
const warns = [];
|
|
9040
|
+
if (!c.import?.trim()) {
|
|
9041
|
+
warns.push(
|
|
9042
|
+
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
9043
|
+
);
|
|
9044
|
+
}
|
|
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;
|
|
9049
|
+
return {
|
|
9050
|
+
hasPropTypeError,
|
|
9051
|
+
hasAnyError,
|
|
9052
|
+
hasWarns: warns.length > 0,
|
|
9053
|
+
warns,
|
|
9054
|
+
totalStories,
|
|
9055
|
+
storyErrors,
|
|
9056
|
+
storyOk
|
|
9057
|
+
};
|
|
9058
|
+
}
|
|
9059
|
+
__name(analyzeComponent, "analyzeComponent");
|
|
9060
|
+
function note(title, bodyHTML, kind) {
|
|
9061
|
+
return `
|
|
9062
|
+
<div class="note ${kind}">
|
|
9063
|
+
<div class="note-title">${esc(title)}</div>
|
|
9064
|
+
<div class="note-body">${bodyHTML}</div>
|
|
9065
|
+
</div>`;
|
|
9066
|
+
}
|
|
9067
|
+
__name(note, "note");
|
|
9068
|
+
function renderComponentCard(key, c, id) {
|
|
9069
|
+
const a = analyzeComponent(c);
|
|
9070
|
+
const statusDot = a.hasAnyError ? "dot-err" : "dot-ok";
|
|
9071
|
+
const allStories = c.stories ?? [];
|
|
9072
|
+
const errorStories = allStories.filter((ex) => !!ex?.error);
|
|
9073
|
+
const okStories = allStories.filter((ex) => !ex?.error);
|
|
9074
|
+
const slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`;
|
|
9075
|
+
const componentErrorBadge = a.hasPropTypeError ? `<label for="${slug}-err" class="badge err as-toggle">prop type error</label>` : "";
|
|
9076
|
+
const warningsBadge = a.hasWarns ? `<label for="${slug}-warn" class="badge warn as-toggle">${a.warns.length} ${plural(a.warns.length, "warning")}</label>` : "";
|
|
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") : "";
|
|
9093
|
+
const tags = c.jsDocTags && typeof c.jsDocTags === "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
9094
|
+
([k, v]) => (Array.isArray(v) ? v : [v]).map(
|
|
9095
|
+
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
9096
|
+
)
|
|
9097
|
+
).join("") : "";
|
|
9098
|
+
esc(c.error?.message || "Unknown error");
|
|
9099
|
+
return `
|
|
9100
|
+
<article
|
|
9101
|
+
class="card
|
|
9102
|
+
${a.hasPropTypeError ? "has-error" : "no-error"}
|
|
9103
|
+
${a.hasWarns ? "has-warn" : "no-warn"}
|
|
9104
|
+
${a.storyErrors ? "has-story-error" : "no-story-error"}"
|
|
9105
|
+
role="listitem"
|
|
9106
|
+
aria-label="${esc(c.name || key)}">
|
|
9107
|
+
<div class="head">
|
|
9108
|
+
<div class="title">
|
|
9109
|
+
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
9110
|
+
<div class="badges">
|
|
9111
|
+
${primaryBadge}
|
|
9112
|
+
${warningsBadge}
|
|
9113
|
+
${storiesBadge}
|
|
9114
|
+
</div>
|
|
9115
|
+
</div>
|
|
9116
|
+
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
9117
|
+
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
9118
|
+
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
9119
|
+
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
9120
|
+
</div>
|
|
9121
|
+
|
|
9122
|
+
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
9123
|
+
${a.hasPropTypeError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
9124
|
+
${a.hasWarns ? `<input id="${slug}-warn" class="tg tg-warn" type="checkbox" hidden />` : ""}
|
|
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 />` : ""}
|
|
9127
|
+
|
|
9128
|
+
<div class="panels">
|
|
9129
|
+
${a.hasPropTypeError ? `
|
|
9130
|
+
<div class="panel panel-err">
|
|
9131
|
+
${note("Prop type error", `<pre><code>${esc(c.error?.message || "Unknown error")}</code></pre>`, "err")}
|
|
9132
|
+
</div>` : ""}
|
|
9133
|
+
${a.hasWarns ? `
|
|
9134
|
+
<div class="panel panel-warn">
|
|
9135
|
+
${a.warns.map((w) => note("Warning", esc(w), "warn")).join("")}
|
|
9136
|
+
</div>` : ""}
|
|
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(
|
|
9150
|
+
(ex, j) => `
|
|
9151
|
+
<div class="note err">
|
|
9152
|
+
<div class="row">
|
|
9153
|
+
<span class="ex-name">${esc(ex.name)}</span>
|
|
9154
|
+
<span class="badge err">story error</span>
|
|
9155
|
+
</div>
|
|
9156
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
9157
|
+
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
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>`
|
|
9169
|
+
).join("")}
|
|
9170
|
+
</div>` : ""}
|
|
9171
|
+
</div>
|
|
9172
|
+
</article>`;
|
|
9173
|
+
}
|
|
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");
|
|
9251
|
+
|
|
8490
9252
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
8491
9253
|
import { existsSync } from "node:fs";
|
|
8492
9254
|
import { readFile } from "node:fs/promises";
|
|
@@ -8719,7 +9481,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8719
9481
|
}
|
|
8720
9482
|
const pathToSubIndex = {};
|
|
8721
9483
|
const fullGlob = slash(join2(specifier.directory, specifier.files));
|
|
8722
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
9484
|
+
const { globby } = await import("../_node-chunks/globby-L3NPKIS7.js");
|
|
8723
9485
|
const files = await globby(fullGlob, {
|
|
8724
9486
|
absolute: true,
|
|
8725
9487
|
cwd: workingDir,
|
|
@@ -8868,17 +9630,15 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8868
9630
|
* If no such file exists, assume that the import is from a package and return the raw
|
|
8869
9631
|
*/
|
|
8870
9632
|
resolveComponentPath(rawComponentPath, absolutePath, matchPath) {
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
if (existing) {
|
|
8878
|
-
const relativePath = relative2(this.options.workingDir, existing);
|
|
8879
|
-
return slash(normalizeStoryPath(relativePath));
|
|
9633
|
+
const matchedPath = matchPath?.(rawComponentPath, void 0, void 0, supportedExtensions) ?? rawComponentPath;
|
|
9634
|
+
let resolved;
|
|
9635
|
+
try {
|
|
9636
|
+
resolved = resolveImport(matchedPath, { basedir: dirname(absolutePath) });
|
|
9637
|
+
} catch (_) {
|
|
9638
|
+
return matchedPath;
|
|
8880
9639
|
}
|
|
8881
|
-
|
|
9640
|
+
const relativePath = relative2(this.options.workingDir, resolved);
|
|
9641
|
+
return slash(normalizeStoryPath(relativePath));
|
|
8882
9642
|
}
|
|
8883
9643
|
async extractStories(specifier, absolutePath, projectTags = []) {
|
|
8884
9644
|
const relativePath = relative2(this.options.workingDir, absolutePath);
|
|
@@ -8977,7 +9737,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8977
9737
|
const normalizedPath = normalizeStoryPath(relativePath);
|
|
8978
9738
|
const importPath = slash(normalizedPath);
|
|
8979
9739
|
const content = await readFile(absolutePath, { encoding: "utf8" });
|
|
8980
|
-
const { analyze } = await import("../_node-chunks/dist-
|
|
9740
|
+
const { analyze } = await import("../_node-chunks/dist-MCOAOC3B.js");
|
|
8981
9741
|
const result = await analyze(content);
|
|
8982
9742
|
if (result.isTemplate) {
|
|
8983
9743
|
return false;
|
|
@@ -9320,7 +10080,7 @@ __name(print, "print");
|
|
|
9320
10080
|
// src/core-server/utils/get-builders.ts
|
|
9321
10081
|
import { MissingBuilderError } from "storybook/internal/server-errors";
|
|
9322
10082
|
async function getManagerBuilder() {
|
|
9323
|
-
return await import("../_node-chunks/builder-manager-
|
|
10083
|
+
return await import("../_node-chunks/builder-manager-P652CU5Z.js");
|
|
9324
10084
|
}
|
|
9325
10085
|
__name(getManagerBuilder, "getManagerBuilder");
|
|
9326
10086
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
@@ -9559,7 +10319,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
9559
10319
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
9560
10320
|
basename2(specifier.files)
|
|
9561
10321
|
);
|
|
9562
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
10322
|
+
const { globby } = await import("../_node-chunks/globby-L3NPKIS7.js");
|
|
9563
10323
|
const addedFiles = await globby(slash(dirGlob), commonGlobOptions2(dirGlob));
|
|
9564
10324
|
addedFiles.forEach((filePath) => {
|
|
9565
10325
|
const fileImportPath = toImportPath(filePath);
|
|
@@ -9881,6 +10641,10 @@ async function buildStaticStandalone(options) {
|
|
|
9881
10641
|
join(options.outputDir, "manifests", "components.json"),
|
|
9882
10642
|
JSON.stringify(manifests)
|
|
9883
10643
|
);
|
|
10644
|
+
await writeFile3(
|
|
10645
|
+
join(options.outputDir, "manifests", "components.html"),
|
|
10646
|
+
renderManifestComponentsPage(manifests)
|
|
10647
|
+
);
|
|
9884
10648
|
} catch (e) {
|
|
9885
10649
|
logger4.error("Failed to generate manifests/components.json");
|
|
9886
10650
|
logger4.error(e instanceof Error ? e : String(e));
|
|
@@ -11781,6 +12545,29 @@ async function storybookDevServer(options) {
|
|
|
11781
12545
|
return;
|
|
11782
12546
|
}
|
|
11783
12547
|
});
|
|
12548
|
+
app.get("/manifests/components.html", async (req, res) => {
|
|
12549
|
+
try {
|
|
12550
|
+
const componentManifestGenerator = await options.presets.apply(
|
|
12551
|
+
"experimental_componentManifestGenerator"
|
|
12552
|
+
);
|
|
12553
|
+
const indexGenerator = await initializedStoryIndexGenerator;
|
|
12554
|
+
if (!componentManifestGenerator || !indexGenerator) {
|
|
12555
|
+
res.statusCode = 400;
|
|
12556
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12557
|
+
res.end(`<pre>No component manifest generator configured.</pre>`);
|
|
12558
|
+
return;
|
|
12559
|
+
}
|
|
12560
|
+
const manifest = await componentManifestGenerator(
|
|
12561
|
+
indexGenerator
|
|
12562
|
+
);
|
|
12563
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12564
|
+
res.end(renderManifestComponentsPage(manifest));
|
|
12565
|
+
} catch (e) {
|
|
12566
|
+
res.statusCode = 500;
|
|
12567
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12568
|
+
res.end(`<pre>${e instanceof Error ? e.toString() : String(e)}</pre>`);
|
|
12569
|
+
}
|
|
12570
|
+
});
|
|
11784
12571
|
}
|
|
11785
12572
|
doTelemetry(app, core2, initializedStoryIndexGenerator, options);
|
|
11786
12573
|
async function cancelTelemetry() {
|