storybook 10.1.0-alpha.1 → 10.1.0-alpha.3
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/_browser-chunks/{chunk-I74EUU5O.js → chunk-B3S3ROIP.js} +2 -1
- package/dist/_node-chunks/{builder-manager-6UBDPV7P.js → builder-manager-GBWCUYRR.js} +12 -12
- package/dist/_node-chunks/camelcase-2N6MD2HZ.js +18 -0
- package/dist/_node-chunks/{chunk-QNUGJO6L.js → chunk-2JHIUWIN.js} +7 -7
- package/dist/_node-chunks/{chunk-TXHNWNH4.js → chunk-5KDXQR2J.js} +7 -7
- package/dist/_node-chunks/{chunk-WNOSTIYP.js → chunk-5X7FGASE.js} +7 -7
- package/dist/_node-chunks/{chunk-BYVQZ2HU.js → chunk-6U2QTN2E.js} +7 -7
- package/dist/_node-chunks/{chunk-X67VGZN4.js → chunk-APKZWRTX.js} +7 -7
- package/dist/_node-chunks/{chunk-3FPF5Y2F.js → chunk-AX2PCJZ2.js} +6 -6
- package/dist/_node-chunks/{chunk-7TNUMFKR.js → chunk-B63HGQAB.js} +9 -9
- package/dist/_node-chunks/{chunk-6GD23U64.js → chunk-BNO5FB6B.js} +8 -8
- package/dist/_node-chunks/{chunk-3JCSHYSU.js → chunk-C4UVY6FF.js} +7 -7
- package/dist/_node-chunks/{chunk-J7N7PD5Q.js → chunk-CKXP5RYA.js} +9 -9
- package/dist/_node-chunks/chunk-D3NGJQDZ.js +18 -0
- package/dist/_node-chunks/{chunk-5SEHHENC.js → chunk-FJWQKOXX.js} +10 -10
- package/dist/_node-chunks/{chunk-HORWITP7.js → chunk-GMO24NTJ.js} +7 -7
- package/dist/_node-chunks/{chunk-BCDHUXAJ.js → chunk-HH57J4TX.js} +8 -8
- package/dist/_node-chunks/{chunk-VYRFXLRO.js → chunk-JKWP2FKQ.js} +7 -7
- package/dist/_node-chunks/chunk-LPNJ7PJY.js +61 -0
- package/dist/_node-chunks/{chunk-ULWNTI6M.js → chunk-MDXYV4OF.js} +15 -15
- package/dist/_node-chunks/{chunk-II4AFH3V.js → chunk-MPUDYIDW.js} +7 -7
- package/dist/_node-chunks/{chunk-GD2FXWDF.js → chunk-N7XYNLCJ.js} +7 -7
- package/dist/_node-chunks/{chunk-SCTKVDWR.js → chunk-NCHBSJG3.js} +1467 -148
- package/dist/_node-chunks/{chunk-RVE4UTVQ.js → chunk-NTH76OZA.js} +12 -12
- package/dist/_node-chunks/{chunk-DAMVKHAC.js → chunk-NTX43F34.js} +7 -7
- package/dist/_node-chunks/{chunk-MF2PUEWG.js → chunk-NYXHMPY4.js} +7 -7
- package/dist/_node-chunks/{chunk-FEOC7OX2.js → chunk-RLMJDF6S.js} +8 -8
- package/dist/_node-chunks/{chunk-TUFWZUTO.js → chunk-S32G4TCP.js} +7 -7
- package/dist/_node-chunks/{chunk-XW7YMR7I.js → chunk-SQAKXWVV.js} +7 -7
- package/dist/_node-chunks/{chunk-XCEBYOA4.js → chunk-T7KB265F.js} +6 -6
- package/dist/_node-chunks/{chunk-LAU7VVPC.js → chunk-TDLKTACT.js} +7 -7
- package/dist/_node-chunks/{chunk-6OAXYS5T.js → chunk-TSKLBMF3.js} +8 -8
- package/dist/_node-chunks/{chunk-4GE6Q4MX.js → chunk-TZ7GUTJ4.js} +7 -7
- package/dist/_node-chunks/{chunk-CJHAP7SE.js → chunk-YFBIEJ33.js} +7 -7
- package/dist/_node-chunks/{chunk-FY7XZPLY.js → chunk-YJJWZPL7.js} +39 -24
- package/dist/_node-chunks/{chunk-2RIKHYCS.js → chunk-ZQY3BNST.js} +12 -12
- package/dist/_node-chunks/{dist-APCKHSY3.js → dist-SQENNWFY.js} +9 -9
- package/dist/_node-chunks/{globby-TSGXGDA2.js → globby-CVPDLQ5Z.js} +9 -9
- package/dist/_node-chunks/{lib-DZ5TVIU5.js → lib-4BTTMYE2.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-Z6BYQCPN.js → mdx-N42X6CFJ-ENVHI6CC.js} +8 -8
- package/dist/_node-chunks/{p-limit-MLJNGG2K.js → p-limit-I2XW6GST.js} +7 -7
- package/dist/_node-chunks/{plugin-J3JI3ZKJ.js → plugin-4NIE24IO.js} +10 -10
- package/dist/_node-chunks/{plugin-HJLCLGNT.js → plugin-O5PHZ367.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-3QHNTM5B.js → webpack-inject-mocker-runtime-plugin-SVBN7WFH.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-4Y3MWPJ6.js → webpack-mock-plugin-XBV3VXVD.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 +210 -3
- package/dist/common/index.js +28 -20
- package/dist/components/index.js +1 -1
- package/dist/core-server/index.js +766 -52
- package/dist/core-server/presets/common-manager.js +1 -1
- 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-tools/index.d.ts +8 -4
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +5 -4
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.js +14 -14
- package/dist/preview/runtime.js +2 -2
- package/dist/preview-api/index.d.ts +67 -68
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +2 -2
- package/dist/types/index.d.ts +47 -5
- package/package.json +2 -1
- package/dist/_node-chunks/camelcase-WKJOVNPM.js +0 -18
- package/dist/_node-chunks/chunk-HM6B7FE5.js +0 -18
- package/dist/_node-chunks/chunk-ZRFYQ46H.js +0 -61
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bqgqh4d46dd from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bqgqh4d46dd from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bqgqh4d46dd from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bqgqh4d46dd.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bqgqh4d46dd.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bqgqh4d46dd.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-NTH76OZA.js";
|
|
15
15
|
import {
|
|
16
16
|
require_pretty_hrtime
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-GMO24NTJ.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-RLMJDF6S.js";
|
|
22
|
+
import "../_node-chunks/chunk-NTX43F34.js";
|
|
23
23
|
import {
|
|
24
24
|
StatusTypeIdMismatchError,
|
|
25
25
|
StorybookError
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
26
|
+
} from "../_node-chunks/chunk-CKXP5RYA.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-ZQY3BNST.js";
|
|
35
|
+
import "../_node-chunks/chunk-N7XYNLCJ.js";
|
|
36
36
|
import {
|
|
37
37
|
telemetry
|
|
38
|
-
} from "../_node-chunks/chunk-
|
|
39
|
-
import "../_node-chunks/chunk-
|
|
38
|
+
} from "../_node-chunks/chunk-MDXYV4OF.js";
|
|
39
|
+
import "../_node-chunks/chunk-D3NGJQDZ.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-NCHBSJG3.js";
|
|
45
|
+
import "../_node-chunks/chunk-TZ7GUTJ4.js";
|
|
46
|
+
import "../_node-chunks/chunk-LPNJ7PJY.js";
|
|
47
|
+
import "../_node-chunks/chunk-HH57J4TX.js";
|
|
46
48
|
import {
|
|
47
49
|
optionalEnvToBoolean,
|
|
48
50
|
require_cross_spawn
|
|
49
|
-
} from "../_node-chunks/chunk-
|
|
51
|
+
} from "../_node-chunks/chunk-B63HGQAB.js";
|
|
50
52
|
import {
|
|
51
53
|
up2 as up
|
|
52
|
-
} from "../_node-chunks/chunk-
|
|
53
|
-
import "../_node-chunks/chunk-
|
|
54
|
+
} from "../_node-chunks/chunk-5KDXQR2J.js";
|
|
55
|
+
import "../_node-chunks/chunk-SQAKXWVV.js";
|
|
54
56
|
import {
|
|
55
57
|
invariant
|
|
56
|
-
} from "../_node-chunks/chunk-
|
|
58
|
+
} from "../_node-chunks/chunk-5X7FGASE.js";
|
|
57
59
|
import {
|
|
58
60
|
importModule,
|
|
59
61
|
resolvePackageDir
|
|
60
|
-
} from "../_node-chunks/chunk-
|
|
62
|
+
} from "../_node-chunks/chunk-TSKLBMF3.js";
|
|
61
63
|
import {
|
|
62
64
|
join,
|
|
63
65
|
relative,
|
|
64
66
|
resolve
|
|
65
|
-
} from "../_node-chunks/chunk-
|
|
67
|
+
} from "../_node-chunks/chunk-6U2QTN2E.js";
|
|
66
68
|
import {
|
|
67
69
|
require_prompts
|
|
68
|
-
} from "../_node-chunks/chunk-
|
|
69
|
-
import "../_node-chunks/chunk-
|
|
70
|
+
} from "../_node-chunks/chunk-NYXHMPY4.js";
|
|
71
|
+
import "../_node-chunks/chunk-JKWP2FKQ.js";
|
|
70
72
|
import {
|
|
71
73
|
slash
|
|
72
|
-
} from "../_node-chunks/chunk-
|
|
74
|
+
} from "../_node-chunks/chunk-MPUDYIDW.js";
|
|
73
75
|
import {
|
|
74
76
|
require_dist
|
|
75
|
-
} from "../_node-chunks/chunk-
|
|
77
|
+
} from "../_node-chunks/chunk-S32G4TCP.js";
|
|
76
78
|
import {
|
|
77
79
|
require_lib,
|
|
78
80
|
require_src
|
|
79
|
-
} from "../_node-chunks/chunk-
|
|
81
|
+
} from "../_node-chunks/chunk-TDLKTACT.js";
|
|
80
82
|
import {
|
|
81
83
|
require_picocolors
|
|
82
|
-
} from "../_node-chunks/chunk-
|
|
84
|
+
} from "../_node-chunks/chunk-2JHIUWIN.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-T7KB265F.js";
|
|
89
91
|
|
|
90
92
|
// ../node_modules/tsconfig-paths/lib/filesystem.js
|
|
91
93
|
var require_filesystem = __commonJS({
|
|
@@ -2630,8 +2632,8 @@ var require_graceful_fs = __commonJS({
|
|
|
2630
2632
|
}
|
|
2631
2633
|
__name(readFile5, "readFile");
|
|
2632
2634
|
var fs$writeFile = fs7.writeFile;
|
|
2633
|
-
fs7.writeFile =
|
|
2634
|
-
function
|
|
2635
|
+
fs7.writeFile = writeFile5;
|
|
2636
|
+
function writeFile5(path2, data, options, cb) {
|
|
2635
2637
|
if (typeof options === "function")
|
|
2636
2638
|
cb = options, options = null;
|
|
2637
2639
|
return go$writeFile(path2, data, options, cb);
|
|
@@ -2647,7 +2649,7 @@ var require_graceful_fs = __commonJS({
|
|
|
2647
2649
|
}
|
|
2648
2650
|
__name(go$writeFile, "go$writeFile");
|
|
2649
2651
|
}
|
|
2650
|
-
__name(
|
|
2652
|
+
__name(writeFile5, "writeFile");
|
|
2651
2653
|
var fs$appendFile = fs7.appendFile;
|
|
2652
2654
|
if (fs$appendFile)
|
|
2653
2655
|
fs7.appendFile = appendFile;
|
|
@@ -8473,7 +8475,7 @@ var require_cli_table3 = __commonJS({
|
|
|
8473
8475
|
import { getPreviewHeadTemplate, getPreviewBodyTemplate } from "storybook/internal/common";
|
|
8474
8476
|
|
|
8475
8477
|
// src/core-server/build-static.ts
|
|
8476
|
-
import { cp as cp2, mkdir } from "node:fs/promises";
|
|
8478
|
+
import { cp as cp2, mkdir, writeFile as writeFile3 } from "node:fs/promises";
|
|
8477
8479
|
import { rm } from "node:fs/promises";
|
|
8478
8480
|
import {
|
|
8479
8481
|
loadAllPresets,
|
|
@@ -8487,6 +8489,645 @@ 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
|
+
componentsWithError: analyses.filter((a) => a.hasComponentError).length,
|
|
8502
|
+
componentsWithWarnings: analyses.filter((a) => a.hasWarns).length,
|
|
8503
|
+
examples: analyses.reduce((sum, a) => sum + a.totalExamples, 0),
|
|
8504
|
+
exampleErrors: analyses.reduce((sum, a) => sum + a.exampleErrors, 0)
|
|
8505
|
+
};
|
|
8506
|
+
const allPill = `<a class="filter-pill all" data-k="all" href="#filter-all">All</a>`;
|
|
8507
|
+
const compErrorsPill = totals.componentsWithError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithError}/${totals.components} component ${plural(totals.componentsWithError, "error")}</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>`;
|
|
8508
|
+
const compWarningsPill = totals.componentsWithWarnings > 0 ? `<a class="filter-pill warn" data-k="warnings" href="#filter-warnings">${totals.componentsWithWarnings}/${totals.components} component ${plural(totals.componentsWithWarnings, "warning")}</a>` : "";
|
|
8509
|
+
const examplesPill = totals.exampleErrors > 0 ? `<a class="filter-pill err" data-k="example-errors" href="#filter-example-errors">${totals.exampleErrors}/${totals.examples} example errors</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.examples} examples 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-example-errors:target ~ header .filter-pill[data-k='example-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-example-errors {
|
|
8668
|
+
display: none;
|
|
8669
|
+
}
|
|
8670
|
+
|
|
8671
|
+
main {
|
|
8672
|
+
padding: 24px 0 40px;
|
|
8673
|
+
}
|
|
8674
|
+
|
|
8675
|
+
.grid {
|
|
8676
|
+
display: grid;
|
|
8677
|
+
grid-template-columns: 1fr;
|
|
8678
|
+
gap: 14px;
|
|
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-ex:checked + label.as-toggle {
|
|
8780
|
+
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8781
|
+
border-color: currentColor;
|
|
8782
|
+
}
|
|
8783
|
+
|
|
8784
|
+
/* Panels: hidden by default, shown when respective toggle checked */
|
|
8785
|
+
.panels {
|
|
8786
|
+
display: grid;
|
|
8787
|
+
gap: 10px;
|
|
8788
|
+
}
|
|
8789
|
+
|
|
8790
|
+
.panel {
|
|
8791
|
+
display: none;
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8794
|
+
.tg-err:checked ~ .panels .panel-err {
|
|
8795
|
+
display: grid;
|
|
8796
|
+
}
|
|
8797
|
+
|
|
8798
|
+
.tg-warn:checked ~ .panels .panel-warn {
|
|
8799
|
+
display: grid;
|
|
8800
|
+
gap: 8px;
|
|
8801
|
+
}
|
|
8802
|
+
|
|
8803
|
+
.tg-ex:checked ~ .panels .panel-ex {
|
|
8804
|
+
display: grid;
|
|
8805
|
+
}
|
|
8806
|
+
|
|
8807
|
+
/* Colored notes for component error + warnings */
|
|
8808
|
+
.note {
|
|
8809
|
+
padding: 12px;
|
|
8810
|
+
border: 1px solid var(--border);
|
|
8811
|
+
border-radius: 10px;
|
|
8812
|
+
}
|
|
8813
|
+
|
|
8814
|
+
.note.err {
|
|
8815
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8816
|
+
background: var(--err-bg);
|
|
8817
|
+
color: #ffd1d4;
|
|
8818
|
+
}
|
|
8819
|
+
|
|
8820
|
+
.note.warn {
|
|
8821
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8822
|
+
background: var(--warn-bg);
|
|
8823
|
+
color: #ffe9a6;
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8826
|
+
.note-title {
|
|
8827
|
+
font-weight: 600;
|
|
8828
|
+
margin-bottom: 6px;
|
|
8829
|
+
}
|
|
8830
|
+
|
|
8831
|
+
.note-body {
|
|
8832
|
+
white-space: normal;
|
|
8833
|
+
}
|
|
8834
|
+
|
|
8835
|
+
/* Example error cards */
|
|
8836
|
+
.ex {
|
|
8837
|
+
padding: 10px;
|
|
8838
|
+
border: 1px solid var(--border);
|
|
8839
|
+
border-radius: 10px;
|
|
8840
|
+
background: #0f131b;
|
|
8841
|
+
}
|
|
8842
|
+
|
|
8843
|
+
.ex.err {
|
|
8844
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8845
|
+
}
|
|
8846
|
+
|
|
8847
|
+
.row {
|
|
8848
|
+
display: flex;
|
|
8849
|
+
align-items: center;
|
|
8850
|
+
gap: 8px;
|
|
8851
|
+
flex-wrap: wrap;
|
|
8852
|
+
}
|
|
8853
|
+
|
|
8854
|
+
.status-dot {
|
|
8855
|
+
width: 8px;
|
|
8856
|
+
height: 8px;
|
|
8857
|
+
border-radius: 50%;
|
|
8858
|
+
display: inline-block;
|
|
8859
|
+
}
|
|
8860
|
+
|
|
8861
|
+
.dot-ok {
|
|
8862
|
+
background: var(--ok);
|
|
8863
|
+
}
|
|
8864
|
+
|
|
8865
|
+
.dot-err {
|
|
8866
|
+
background: var(--err);
|
|
8867
|
+
}
|
|
8868
|
+
|
|
8869
|
+
.ex-name {
|
|
8870
|
+
font-weight: 600;
|
|
8871
|
+
}
|
|
8872
|
+
|
|
8873
|
+
/* Error groups (visible in errors filter) */
|
|
8874
|
+
.error-groups {
|
|
8875
|
+
display: none;
|
|
8876
|
+
margin-bottom: 16px;
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8879
|
+
.group {
|
|
8880
|
+
border: 1px solid var(--border);
|
|
8881
|
+
background: var(--panel);
|
|
8882
|
+
border-radius: 14px;
|
|
8883
|
+
overflow: hidden;
|
|
8884
|
+
}
|
|
8885
|
+
|
|
8886
|
+
.group + .group {
|
|
8887
|
+
margin-top: 12px;
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8890
|
+
.group-header {
|
|
8891
|
+
display: flex;
|
|
8892
|
+
align-items: center;
|
|
8893
|
+
gap: 10px;
|
|
8894
|
+
padding: 12px 14px;
|
|
8895
|
+
cursor: pointer;
|
|
8896
|
+
border-bottom: 1px solid var(--border);
|
|
8897
|
+
}
|
|
8898
|
+
|
|
8899
|
+
.group-header:hover {
|
|
8900
|
+
background: #141722;
|
|
8901
|
+
}
|
|
8902
|
+
|
|
8903
|
+
.group-title {
|
|
8904
|
+
font-weight: 600;
|
|
8905
|
+
flex: 1;
|
|
8906
|
+
}
|
|
8907
|
+
|
|
8908
|
+
.group-count {
|
|
8909
|
+
font-size: 12px;
|
|
8910
|
+
color: var(--muted);
|
|
8911
|
+
}
|
|
8912
|
+
|
|
8913
|
+
.group-cards {
|
|
8914
|
+
display: none;
|
|
8915
|
+
padding: 12px;
|
|
8916
|
+
}
|
|
8917
|
+
|
|
8918
|
+
.group .card {
|
|
8919
|
+
margin: 12px 0;
|
|
8920
|
+
}
|
|
8921
|
+
|
|
8922
|
+
.group .card:first-child {
|
|
8923
|
+
margin-top: 0;
|
|
8924
|
+
}
|
|
8925
|
+
|
|
8926
|
+
.group .card:last-child {
|
|
8927
|
+
margin-bottom: 0;
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8930
|
+
/* caret rotation */
|
|
8931
|
+
.group-tg:checked + label .caret {
|
|
8932
|
+
transform: rotate(90deg);
|
|
8933
|
+
}
|
|
8934
|
+
|
|
8935
|
+
.caret {
|
|
8936
|
+
transition: transform 0.15s ease;
|
|
8937
|
+
}
|
|
8938
|
+
|
|
8939
|
+
/* toggle body */
|
|
8940
|
+
.group-tg:checked ~ .group-cards {
|
|
8941
|
+
display: block;
|
|
8942
|
+
}
|
|
8943
|
+
|
|
8944
|
+
/* CSS-only filtering of cards via top pills */
|
|
8945
|
+
#filter-errors:target ~ main .card:not(.has-error):not(.has-example-error) {
|
|
8946
|
+
display: none;
|
|
8947
|
+
}
|
|
8948
|
+
|
|
8949
|
+
#filter-warnings:target ~ main .card:not(.has-warn) {
|
|
8950
|
+
display: none;
|
|
8951
|
+
}
|
|
8952
|
+
|
|
8953
|
+
#filter-example-errors:target ~ main .card:not(.has-example-error) {
|
|
8954
|
+
display: none;
|
|
8955
|
+
}
|
|
8956
|
+
|
|
8957
|
+
#filter-all:target ~ main .card {
|
|
8958
|
+
display: block;
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8961
|
+
/* In errors view, hide standalone component-error cards in the regular grid (they will appear in groups) */
|
|
8962
|
+
#filter-errors:target ~ main .grid .card.has-error {
|
|
8963
|
+
display: none;
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
/* Show grouped section only in errors view */
|
|
8967
|
+
#filter-errors:target ~ main .error-groups {
|
|
8968
|
+
display: block;
|
|
8969
|
+
}
|
|
8970
|
+
|
|
8971
|
+
/* When a toggle is checked, show the corresponding panel */
|
|
8972
|
+
.card > .tg-err:checked ~ .panels .panel-err {
|
|
8973
|
+
display: grid;
|
|
8974
|
+
}
|
|
8975
|
+
|
|
8976
|
+
.card > .tg-warn:checked ~ .panels .panel-warn {
|
|
8977
|
+
display: grid;
|
|
8978
|
+
}
|
|
8979
|
+
|
|
8980
|
+
.card > .tg-ex:checked ~ .panels .panel-ex {
|
|
8981
|
+
display: grid;
|
|
8982
|
+
}
|
|
8983
|
+
|
|
8984
|
+
/* Optional: a subtle 1px ring on the active badge, using :has() if available */
|
|
8985
|
+
@supports selector(.card:has(.tg-err:checked)) {
|
|
8986
|
+
.card:has(.tg-err:checked) label[for$='-err'],
|
|
8987
|
+
.card:has(.tg-warn:checked) label[for$='-warn'],
|
|
8988
|
+
.card:has(.tg-ex:checked) label[for$='-ex'] {
|
|
8989
|
+
box-shadow: 0 0 0 1px currentColor;
|
|
8990
|
+
border-color: currentColor;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
</style>
|
|
8994
|
+
</head>
|
|
8995
|
+
<body>
|
|
8996
|
+
<!-- Hidden targets for the top-level filters -->
|
|
8997
|
+
<span id="filter-all"></span>
|
|
8998
|
+
<span id="filter-errors"></span>
|
|
8999
|
+
<span id="filter-warnings"></span>
|
|
9000
|
+
<span id="filter-example-errors"></span>
|
|
9001
|
+
<header>
|
|
9002
|
+
<div class="wrap">
|
|
9003
|
+
<h1>Components Manifest</h1>
|
|
9004
|
+
<div class="summary">${allPill}${compErrorsPill}${compWarningsPill}${examplesPill}</div>
|
|
9005
|
+
</div>
|
|
9006
|
+
</header>
|
|
9007
|
+
<main>
|
|
9008
|
+
<div class="wrap">
|
|
9009
|
+
<div class="grid" role="list">
|
|
9010
|
+
${grid || `<div class="card"><div class="head"><div class="hint">No components.</div></div></div>`}
|
|
9011
|
+
</div>
|
|
9012
|
+
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="Error groups">${errorGroupsHTML}</div>` : ""}
|
|
9013
|
+
</div>
|
|
9014
|
+
</main>
|
|
9015
|
+
</body>
|
|
9016
|
+
</html> `;
|
|
9017
|
+
}
|
|
9018
|
+
__name(renderManifestComponentsPage, "renderManifestComponentsPage");
|
|
9019
|
+
var esc = /* @__PURE__ */ __name((s) => String(s ?? "").replace(
|
|
9020
|
+
/[&<>"']/g,
|
|
9021
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]
|
|
9022
|
+
), "esc");
|
|
9023
|
+
var plural = /* @__PURE__ */ __name((n, one, many = `${one}s`) => n === 1 ? one : many, "plural");
|
|
9024
|
+
function analyzeComponent(c) {
|
|
9025
|
+
const hasComponentError = !!c.error;
|
|
9026
|
+
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
|
+
if (!c.import?.trim()) {
|
|
9033
|
+
warns.push(
|
|
9034
|
+
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
9035
|
+
);
|
|
9036
|
+
}
|
|
9037
|
+
const totalExamples = c.examples?.length ?? 0;
|
|
9038
|
+
const exampleErrors = (c.examples ?? []).filter((e) => !!e?.error).length;
|
|
9039
|
+
const exampleOk = totalExamples - exampleErrors;
|
|
9040
|
+
const hasAnyError = hasComponentError || exampleErrors > 0;
|
|
9041
|
+
return {
|
|
9042
|
+
hasComponentError,
|
|
9043
|
+
hasAnyError,
|
|
9044
|
+
hasWarns: warns.length > 0,
|
|
9045
|
+
warns,
|
|
9046
|
+
totalExamples,
|
|
9047
|
+
exampleErrors,
|
|
9048
|
+
exampleOk
|
|
9049
|
+
};
|
|
9050
|
+
}
|
|
9051
|
+
__name(analyzeComponent, "analyzeComponent");
|
|
9052
|
+
function note(title, bodyHTML, kind) {
|
|
9053
|
+
return `
|
|
9054
|
+
<div class="note ${kind}">
|
|
9055
|
+
<div class="note-title">${esc(title)}</div>
|
|
9056
|
+
<div class="note-body">${bodyHTML}</div>
|
|
9057
|
+
</div>`;
|
|
9058
|
+
}
|
|
9059
|
+
__name(note, "note");
|
|
9060
|
+
function renderComponentCard(key, c, id) {
|
|
9061
|
+
const a = analyzeComponent(c);
|
|
9062
|
+
const statusDot = a.hasAnyError ? "dot-err" : "dot-ok";
|
|
9063
|
+
const errorExamples = (c.examples ?? []).filter((ex) => !!ex?.error);
|
|
9064
|
+
const slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`;
|
|
9065
|
+
const componentErrorBadge = a.hasComponentError ? `<label for="${slug}-err" class="badge err as-toggle">component error</label>` : "";
|
|
9066
|
+
const warningsBadge = a.hasWarns ? `<label for="${slug}-warn" class="badge warn as-toggle">${a.warns.length} ${plural(a.warns.length, "warning")}</label>` : "";
|
|
9067
|
+
const examplesBadge = a.exampleErrors > 0 ? `<label for="${slug}-ex" class="badge err as-toggle">${a.exampleErrors}/${a.totalExamples} example errors</label>` : `<span class="badge ok">${a.totalExamples} examples ok</span>`;
|
|
9068
|
+
const tags = c.jsDocTags && typeof c.jsDocTags === "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
9069
|
+
([k, v]) => (Array.isArray(v) ? v : [v]).map(
|
|
9070
|
+
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
9071
|
+
)
|
|
9072
|
+
).join("") : "";
|
|
9073
|
+
esc(c.error?.message || "Unknown error");
|
|
9074
|
+
return `
|
|
9075
|
+
<article
|
|
9076
|
+
class="card
|
|
9077
|
+
${a.hasComponentError ? "has-error" : "no-error"}
|
|
9078
|
+
${a.hasWarns ? "has-warn" : "no-warn"}
|
|
9079
|
+
${a.exampleErrors ? "has-example-error" : "no-example-error"}"
|
|
9080
|
+
role="listitem"
|
|
9081
|
+
aria-label="${esc(c.name || key)}">
|
|
9082
|
+
<div class="head">
|
|
9083
|
+
<div class="title">
|
|
9084
|
+
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
9085
|
+
<div class="badges">
|
|
9086
|
+
${componentErrorBadge}
|
|
9087
|
+
${warningsBadge}
|
|
9088
|
+
${examplesBadge}
|
|
9089
|
+
</div>
|
|
9090
|
+
</div>
|
|
9091
|
+
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
9092
|
+
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
9093
|
+
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
9094
|
+
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
9095
|
+
</div>
|
|
9096
|
+
|
|
9097
|
+
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
9098
|
+
${a.hasComponentError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
9099
|
+
${a.hasWarns ? `<input id="${slug}-warn" class="tg tg-warn" type="checkbox" hidden />` : ""}
|
|
9100
|
+
${a.exampleErrors > 0 ? `<input id="${slug}-ex" class="tg tg-ex" type="checkbox" hidden />` : ""}
|
|
9101
|
+
|
|
9102
|
+
<div class="panels">
|
|
9103
|
+
${a.hasComponentError ? `
|
|
9104
|
+
<div class="panel panel-err">
|
|
9105
|
+
${note("Component error", `<pre><code>${esc(c.error?.message || "Unknown error")}</code></pre>`, "err")}
|
|
9106
|
+
</div>` : ""}
|
|
9107
|
+
${a.hasWarns ? `
|
|
9108
|
+
<div class="panel panel-warn">
|
|
9109
|
+
${a.warns.map((w) => note("Warning", esc(w), "warn")).join("")}
|
|
9110
|
+
</div>` : ""}
|
|
9111
|
+
${a.exampleErrors > 0 ? `
|
|
9112
|
+
<div class="panel panel-ex">
|
|
9113
|
+
${errorExamples.map(
|
|
9114
|
+
(ex, j) => `
|
|
9115
|
+
<div class="ex err">
|
|
9116
|
+
<div class="row">
|
|
9117
|
+
<span class="status-dot dot-err"></span>
|
|
9118
|
+
<span class="ex-name">${esc(ex?.name ?? `Example ${j + 1}`)}</span>
|
|
9119
|
+
<span class="badge err">example error</span>
|
|
9120
|
+
</div>
|
|
9121
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
9122
|
+
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
9123
|
+
</div>`
|
|
9124
|
+
).join("")}
|
|
9125
|
+
</div>` : ""}
|
|
9126
|
+
</div>
|
|
9127
|
+
</article>`;
|
|
9128
|
+
}
|
|
9129
|
+
__name(renderComponentCard, "renderComponentCard");
|
|
9130
|
+
|
|
8490
9131
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
8491
9132
|
import { existsSync } from "node:fs";
|
|
8492
9133
|
import { readFile } from "node:fs/promises";
|
|
@@ -8719,7 +9360,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8719
9360
|
}
|
|
8720
9361
|
const pathToSubIndex = {};
|
|
8721
9362
|
const fullGlob = slash(join2(specifier.directory, specifier.files));
|
|
8722
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
9363
|
+
const { globby } = await import("../_node-chunks/globby-CVPDLQ5Z.js");
|
|
8723
9364
|
const files = await globby(fullGlob, {
|
|
8724
9365
|
absolute: true,
|
|
8725
9366
|
cwd: workingDir,
|
|
@@ -8868,17 +9509,15 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8868
9509
|
* If no such file exists, assume that the import is from a package and return the raw
|
|
8869
9510
|
*/
|
|
8870
9511
|
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));
|
|
9512
|
+
const matchedPath = matchPath?.(rawComponentPath, void 0, void 0, supportedExtensions) ?? rawComponentPath;
|
|
9513
|
+
let resolved;
|
|
9514
|
+
try {
|
|
9515
|
+
resolved = resolveImport(matchedPath, { basedir: dirname(absolutePath) });
|
|
9516
|
+
} catch (_) {
|
|
9517
|
+
return matchedPath;
|
|
8880
9518
|
}
|
|
8881
|
-
|
|
9519
|
+
const relativePath = relative2(this.options.workingDir, resolved);
|
|
9520
|
+
return slash(normalizeStoryPath(relativePath));
|
|
8882
9521
|
}
|
|
8883
9522
|
async extractStories(specifier, absolutePath, projectTags = []) {
|
|
8884
9523
|
const relativePath = relative2(this.options.workingDir, absolutePath);
|
|
@@ -8977,7 +9616,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8977
9616
|
const normalizedPath = normalizeStoryPath(relativePath);
|
|
8978
9617
|
const importPath = slash(normalizedPath);
|
|
8979
9618
|
const content = await readFile(absolutePath, { encoding: "utf8" });
|
|
8980
|
-
const { analyze } = await import("../_node-chunks/dist-
|
|
9619
|
+
const { analyze } = await import("../_node-chunks/dist-SQENNWFY.js");
|
|
8981
9620
|
const result = await analyze(content);
|
|
8982
9621
|
if (result.isTemplate) {
|
|
8983
9622
|
return false;
|
|
@@ -9320,7 +9959,7 @@ __name(print, "print");
|
|
|
9320
9959
|
// src/core-server/utils/get-builders.ts
|
|
9321
9960
|
import { MissingBuilderError } from "storybook/internal/server-errors";
|
|
9322
9961
|
async function getManagerBuilder() {
|
|
9323
|
-
return await import("../_node-chunks/builder-manager-
|
|
9962
|
+
return await import("../_node-chunks/builder-manager-GBWCUYRR.js");
|
|
9324
9963
|
}
|
|
9325
9964
|
__name(getManagerBuilder, "getManagerBuilder");
|
|
9326
9965
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
@@ -9559,7 +10198,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
9559
10198
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
9560
10199
|
basename2(specifier.files)
|
|
9561
10200
|
);
|
|
9562
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
10201
|
+
const { globby } = await import("../_node-chunks/globby-CVPDLQ5Z.js");
|
|
9563
10202
|
const addedFiles = await globby(slash(dirGlob), commonGlobOptions2(dirGlob));
|
|
9564
10203
|
addedFiles.forEach((filePath) => {
|
|
9565
10204
|
const fileImportPath = toImportPath(filePath);
|
|
@@ -9866,6 +10505,31 @@ async function buildStaticStandalone(options) {
|
|
|
9866
10505
|
initializedStoryIndexGenerator
|
|
9867
10506
|
)
|
|
9868
10507
|
);
|
|
10508
|
+
if (features?.experimentalComponentsManifest) {
|
|
10509
|
+
const componentManifestGenerator = await presets.apply(
|
|
10510
|
+
"experimental_componentManifestGenerator"
|
|
10511
|
+
);
|
|
10512
|
+
const indexGenerator = await initializedStoryIndexGenerator;
|
|
10513
|
+
if (componentManifestGenerator && indexGenerator) {
|
|
10514
|
+
try {
|
|
10515
|
+
const manifests = await componentManifestGenerator(
|
|
10516
|
+
indexGenerator
|
|
10517
|
+
);
|
|
10518
|
+
await mkdir(join(options.outputDir, "manifests"), { recursive: true });
|
|
10519
|
+
await writeFile3(
|
|
10520
|
+
join(options.outputDir, "manifests", "components.json"),
|
|
10521
|
+
JSON.stringify(manifests)
|
|
10522
|
+
);
|
|
10523
|
+
await writeFile3(
|
|
10524
|
+
join(options.outputDir, "manifests", "components.html"),
|
|
10525
|
+
renderManifestComponentsPage(manifests)
|
|
10526
|
+
);
|
|
10527
|
+
} catch (e) {
|
|
10528
|
+
logger4.error("Failed to generate manifests/components.json");
|
|
10529
|
+
logger4.error(e instanceof Error ? e : String(e));
|
|
10530
|
+
}
|
|
10531
|
+
}
|
|
10532
|
+
}
|
|
9869
10533
|
}
|
|
9870
10534
|
if (!core2?.disableProjectJson) {
|
|
9871
10535
|
effects.push(
|
|
@@ -11734,6 +12398,56 @@ async function storybookDevServer(options) {
|
|
|
11734
12398
|
await previewBuilder?.bail().catch();
|
|
11735
12399
|
throw indexError;
|
|
11736
12400
|
}
|
|
12401
|
+
const features = await options.presets.apply("features");
|
|
12402
|
+
if (features?.experimentalComponentsManifest) {
|
|
12403
|
+
app.use("/manifests/components.json", async (req, res) => {
|
|
12404
|
+
try {
|
|
12405
|
+
const componentManifestGenerator = await options.presets.apply(
|
|
12406
|
+
"experimental_componentManifestGenerator"
|
|
12407
|
+
);
|
|
12408
|
+
const indexGenerator = await initializedStoryIndexGenerator;
|
|
12409
|
+
if (componentManifestGenerator && indexGenerator) {
|
|
12410
|
+
const manifest = await componentManifestGenerator(
|
|
12411
|
+
indexGenerator
|
|
12412
|
+
);
|
|
12413
|
+
res.setHeader("Content-Type", "application/json");
|
|
12414
|
+
res.end(JSON.stringify(manifest));
|
|
12415
|
+
return;
|
|
12416
|
+
}
|
|
12417
|
+
res.statusCode = 400;
|
|
12418
|
+
res.end("No component manifest generator configured.");
|
|
12419
|
+
return;
|
|
12420
|
+
} catch (e) {
|
|
12421
|
+
logger8.error(e instanceof Error ? e : String(e));
|
|
12422
|
+
res.statusCode = 500;
|
|
12423
|
+
res.end(e instanceof Error ? e.toString() : String(e));
|
|
12424
|
+
return;
|
|
12425
|
+
}
|
|
12426
|
+
});
|
|
12427
|
+
app.get("/manifests/components.html", async (req, res) => {
|
|
12428
|
+
try {
|
|
12429
|
+
const componentManifestGenerator = await options.presets.apply(
|
|
12430
|
+
"experimental_componentManifestGenerator"
|
|
12431
|
+
);
|
|
12432
|
+
const indexGenerator = await initializedStoryIndexGenerator;
|
|
12433
|
+
if (!componentManifestGenerator || !indexGenerator) {
|
|
12434
|
+
res.statusCode = 400;
|
|
12435
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12436
|
+
res.end(`<pre>No component manifest generator configured.</pre>`);
|
|
12437
|
+
return;
|
|
12438
|
+
}
|
|
12439
|
+
const manifest = await componentManifestGenerator(
|
|
12440
|
+
indexGenerator
|
|
12441
|
+
);
|
|
12442
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12443
|
+
res.end(renderManifestComponentsPage(manifest));
|
|
12444
|
+
} catch (e) {
|
|
12445
|
+
res.statusCode = 500;
|
|
12446
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12447
|
+
res.end(`<pre>${e instanceof Error ? e.toString() : String(e)}</pre>`);
|
|
12448
|
+
}
|
|
12449
|
+
});
|
|
12450
|
+
}
|
|
11737
12451
|
doTelemetry(app, core2, initializedStoryIndexGenerator, options);
|
|
11738
12452
|
async function cancelTelemetry() {
|
|
11739
12453
|
const payload = { eventType: "dev" };
|
|
@@ -12269,7 +12983,7 @@ async function buildDevStandalone(options) {
|
|
|
12269
12983
|
__name(buildDevStandalone, "buildDevStandalone");
|
|
12270
12984
|
|
|
12271
12985
|
// src/core-server/build-index.ts
|
|
12272
|
-
import { writeFile as
|
|
12986
|
+
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
12273
12987
|
import { normalizeStories as normalizeStories3 } from "storybook/internal/common";
|
|
12274
12988
|
import { logger as logger12 } from "storybook/internal/node-logger";
|
|
12275
12989
|
|
|
@@ -12358,7 +13072,7 @@ var buildIndex = /* @__PURE__ */ __name(async (options) => {
|
|
|
12358
13072
|
var buildIndexStandalone = /* @__PURE__ */ __name(async (options) => {
|
|
12359
13073
|
const index = await buildIndex(options);
|
|
12360
13074
|
logger12.info(`Writing index to ${options.outputFile}`);
|
|
12361
|
-
await
|
|
13075
|
+
await writeFile4(options.outputFile, JSON.stringify(index));
|
|
12362
13076
|
}, "buildIndexStandalone");
|
|
12363
13077
|
|
|
12364
13078
|
// src/core-server/standalone.ts
|