@storybook/web-components 11.0.0-alpha.8 → 11.0.0-alpha.9
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/{chunk-7DGX2RHV.js → chunk-J5WDK7W3.js} +21 -14
- package/dist/_node-chunks/{chunk-A2ZEEPU6.js → chunk-RDLB2FIM.js} +6 -6
- package/dist/docgen/docgen-worker.js +8 -8
- package/dist/docgen/index.js +8 -8
- package/dist/index.d.ts +3 -3
- package/dist/preset.js +20 -18
- package/package.json +5 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_mslipd8609 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_mslipd8609 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_mslipd8609 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_mslipd8609.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_mslipd8609.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_mslipd8609.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,10 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_f6rwsm0jxpo.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
parseStoryFile,
|
|
14
14
|
resolveStoryComponent
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RDLB2FIM.js";
|
|
16
16
|
|
|
17
17
|
// src/docgen/docgen-worker.ts
|
|
18
|
-
import { createLazyDocgenMiddleware } from "storybook/internal/common";
|
|
18
|
+
import { createLazyDocgenMiddleware, loadTypeScriptCompilerApi } from "storybook/internal/common";
|
|
19
19
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
20
20
|
|
|
21
21
|
// src/docgen/component-docgen/build-docgen.ts
|
|
@@ -576,7 +576,11 @@ function namedEntry(item, category) {
|
|
|
576
576
|
let name = item.name || DEFAULT_SLOT_NAME;
|
|
577
577
|
return [
|
|
578
578
|
toArgKey(category, name),
|
|
579
|
-
memberArgType(name, [item], NAMED_ENTRY_CATEGORIES[category], {
|
|
579
|
+
memberArgType(name, [item], NAMED_ENTRY_CATEGORIES[category], {
|
|
580
|
+
type: { name: "string" },
|
|
581
|
+
// The element sets its own states through ElementInternals, so the row documents the `:state()` hook.
|
|
582
|
+
...category === "cssStates" ? { control: !1 } : {}
|
|
583
|
+
})
|
|
580
584
|
];
|
|
581
585
|
}
|
|
582
586
|
function cssPropertyEntry(property) {
|
|
@@ -1282,7 +1286,7 @@ var createDocgenProvider = ({
|
|
|
1282
1286
|
previewFilePath
|
|
1283
1287
|
}) => createLazyDocgenMiddleware({
|
|
1284
1288
|
createManager: async () => {
|
|
1285
|
-
let sources = await loadSourceManager(previewFilePath), [first, ...rest] = [
|
|
1289
|
+
let sources = await loadSourceManager(previewFilePath, manifestPaths.length > 0), [first, ...rest] = [
|
|
1286
1290
|
...manifestPaths.length > 0 ? [new CemManager(manifestPaths)] : [],
|
|
1287
1291
|
...sources ? [sources] : []
|
|
1288
1292
|
];
|
|
@@ -1290,12 +1294,15 @@ var createDocgenProvider = ({
|
|
|
1290
1294
|
},
|
|
1291
1295
|
extract: async (resolver, input) => buildDocgenPayload(input, { resolver })
|
|
1292
1296
|
});
|
|
1293
|
-
async function loadSourceManager(previewFilePath) {
|
|
1297
|
+
async function loadSourceManager(previewFilePath, hasManifest) {
|
|
1294
1298
|
try {
|
|
1295
|
-
let [typescript, generator] = await Promise.all([
|
|
1296
|
-
|
|
1299
|
+
let [typescript, generator] = await Promise.all([
|
|
1300
|
+
loadTypeScriptCompilerApi(() => import("typescript")),
|
|
1301
|
+
loadGenerator()
|
|
1302
|
+
]);
|
|
1303
|
+
return new SourceManager(typescript, generator, previewFilePath);
|
|
1297
1304
|
} catch (error) {
|
|
1298
|
-
logger5.warn(
|
|
1305
|
+
(hasManifest ? logger5.debug : logger5.warn)(
|
|
1299
1306
|
`Web components docgen cannot generate declarations from sources: ${errorMessage(error)}`
|
|
1300
1307
|
);
|
|
1301
1308
|
return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_mslipd8609 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_mslipd8609 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_mslipd8609 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_mslipd8609.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_mslipd8609.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_mslipd8609.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_mslipd8609 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_mslipd8609 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_mslipd8609 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_mslipd8609.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_mslipd8609.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_mslipd8609.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
|
createDocgenProvider
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
15
|
-
import "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-J5WDK7W3.js";
|
|
15
|
+
import "../_node-chunks/chunk-RDLB2FIM.js";
|
|
16
16
|
export {
|
|
17
17
|
createDocgenProvider
|
|
18
18
|
};
|
package/dist/docgen/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_mslipd8609 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_mslipd8609 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_mslipd8609 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_mslipd8609.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_mslipd8609.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_mslipd8609.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,8 +12,8 @@ var require = CJS_COMPAT_NODE_MODULE_f6rwsm0jxpo.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
buildDocgenPayload,
|
|
14
14
|
createDocgenProvider
|
|
15
|
-
} from "../_node-chunks/chunk-
|
|
16
|
-
import "../_node-chunks/chunk-
|
|
15
|
+
} from "../_node-chunks/chunk-J5WDK7W3.js";
|
|
16
|
+
import "../_node-chunks/chunk-RDLB2FIM.js";
|
|
17
17
|
export {
|
|
18
18
|
buildDocgenPayload,
|
|
19
19
|
createDocgenProvider
|
package/dist/index.d.ts
CHANGED
|
@@ -25,19 +25,19 @@ interface WebComponentsTypes extends WebComponentsRenderer {}
|
|
|
25
25
|
/**
|
|
26
26
|
* Metadata to configure the stories for a component.
|
|
27
27
|
*
|
|
28
|
-
* @see [
|
|
28
|
+
* @see [Meta](https://storybook.js.org/docs/writing-stories/csf#meta)
|
|
29
29
|
*/
|
|
30
30
|
type Meta<TArgs = Args$1> = ComponentAnnotations<WebComponentsRenderer, TArgs>;
|
|
31
31
|
/**
|
|
32
32
|
* Story function that represents a CSFv2 component example.
|
|
33
33
|
*
|
|
34
|
-
* @see [
|
|
34
|
+
* @see [Stories](https://storybook.js.org/docs/writing-stories/csf#stories)
|
|
35
35
|
*/
|
|
36
36
|
type StoryFn<TArgs = Args$1> = AnnotatedStoryFn<WebComponentsRenderer, TArgs>;
|
|
37
37
|
/**
|
|
38
38
|
* Story object that represents a CSFv3 component example.
|
|
39
39
|
*
|
|
40
|
-
* @see [
|
|
40
|
+
* @see [Stories](https://storybook.js.org/docs/writing-stories/csf#stories)
|
|
41
41
|
*/
|
|
42
42
|
type StoryObj<TArgs = Args$1> = StoryAnnotations<WebComponentsRenderer, TArgs>;
|
|
43
43
|
type Decorator<TArgs = StrictArgs$1> = DecoratorFunction<WebComponentsRenderer, TArgs>;
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_mslipd8609 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_mslipd8609 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_mslipd8609 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_mslipd8609.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_mslipd8609.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_mslipd8609.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,14 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_f6rwsm0jxpo.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
parseStoryFile,
|
|
14
14
|
resolveStoryComponent
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-RDLB2FIM.js";
|
|
16
16
|
|
|
17
17
|
// src/preset.ts
|
|
18
18
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19
|
-
|
|
20
|
-
// src/docgen/preset.ts
|
|
21
|
-
import { loadPreviewOrConfigFile } from "storybook/internal/common";
|
|
22
|
-
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { isTypeScriptReadyForDocgen } from "storybook/internal/common";
|
|
23
20
|
|
|
24
21
|
// src/docgen/component-docgen/config/resolve-manifest-paths.ts
|
|
25
22
|
import { findFilesUp } from "storybook/internal/common";
|
|
@@ -35,6 +32,10 @@ var asPathArray = (value) => typeof value == "string" ? [value] : Array.isArray(
|
|
|
35
32
|
);
|
|
36
33
|
}, resolveFrameworkManifestPaths = (configDir, frameworkOptions) => asPathArray(frameworkOptions.customElementsManifest).map((path) => resolve(configDir, path)), resolveManifestPaths = (configDir, frameworkOptions) => frameworkOptions.customElementsManifest === void 0 ? readPackageCustomElements(configDir) : resolveFrameworkManifestPaths(configDir, frameworkOptions);
|
|
37
34
|
|
|
35
|
+
// src/docgen/preset.ts
|
|
36
|
+
import { loadPreviewOrConfigFile } from "storybook/internal/common";
|
|
37
|
+
import { fileURLToPath } from "node:url";
|
|
38
|
+
|
|
38
39
|
// src/docgen/worker-specifier.ts
|
|
39
40
|
var DOCGEN_WORKER_SPECIFIER = "@storybook/web-components/internal/docgen-worker";
|
|
40
41
|
|
|
@@ -613,9 +614,9 @@ var printCssProperties = (properties) => {
|
|
|
613
614
|
|
|
614
615
|
// src/docgen/story-docs/template-holes.ts
|
|
615
616
|
import {
|
|
617
|
+
detachedTextOf,
|
|
616
618
|
oneLineTextOf as oneLineTextOf3,
|
|
617
619
|
reindent,
|
|
618
|
-
textOf,
|
|
619
620
|
unwrapExpression as unwrapExpression3,
|
|
620
621
|
walk
|
|
621
622
|
} from "storybook/internal/csf-tools";
|
|
@@ -778,11 +779,7 @@ var returnedTemplateExpression = (renderFunction, bindings) => {
|
|
|
778
779
|
};
|
|
779
780
|
|
|
780
781
|
// src/docgen/story-docs/template-holes.ts
|
|
781
|
-
var handlerText = (node) => {
|
|
782
|
-
let code = textOf(node), closingIndent = /^[ \t]*/.exec(code.slice(code.lastIndexOf(`
|
|
783
|
-
`) + 1))[0];
|
|
784
|
-
return reindent(code, closingIndent, " ");
|
|
785
|
-
}, TEMPLATE_TAG_SOURCES2 = ["lit", "lit-html", "lit-element"], IF_DEFINED_SOURCES = ["lit/directives/if-defined.js", "lit-html/directives/if-defined.js"], resolveHoleValue = (expression, context) => {
|
|
782
|
+
var handlerText = (node) => reindent(detachedTextOf(node), "", " "), TEMPLATE_TAG_SOURCES2 = ["lit", "lit-html", "lit-element"], IF_DEFINED_SOURCES = ["lit/directives/if-defined.js", "lit-html/directives/if-defined.js"], resolveHoleValue = (expression, context) => {
|
|
786
783
|
let expressionNode = unwrapExpression3(expression), alias = expressionNode.type === "Identifier" ? aliasValueForIdentifier(expressionNode, context.scope) : void 0;
|
|
787
784
|
if (alias)
|
|
788
785
|
return resolveAlias(alias, context, oneLineTextOf3(expression));
|
|
@@ -1386,7 +1383,12 @@ var warnedMissingDocgenService = !1, getDocgenPayload = async (componentId) => {
|
|
|
1386
1383
|
});
|
|
1387
1384
|
|
|
1388
1385
|
// src/preset.ts
|
|
1389
|
-
var isDocgenProviderEnabled =
|
|
1386
|
+
var isDocgenProviderEnabled = async (_existing, options) => {
|
|
1387
|
+
let frameworkOptions = await options.presets.apply(
|
|
1388
|
+
"frameworkOptions"
|
|
1389
|
+
) ?? {};
|
|
1390
|
+
return resolveManifestPaths(options.configDir, frameworkOptions).length > 0 || await isTypeScriptReadyForDocgen((specifier) => import.meta.resolve(specifier), options);
|
|
1391
|
+
}, previewAnnotations = async (input = [], options) => {
|
|
1390
1392
|
let docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
1391
1393
|
return [].concat(input).concat([
|
|
1392
1394
|
fileURLToPath3(import.meta.resolve("@storybook/web-components/entry-preview")),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/web-components",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.9",
|
|
4
4
|
"description": "Storybook Web Components renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -58,8 +58,7 @@
|
|
|
58
58
|
"@wc-toolkit/cem-generator-lit": "^0.1.16",
|
|
59
59
|
"custom-elements-manifest": "^2.1.0",
|
|
60
60
|
"tiny-invariant": "^1.3.1",
|
|
61
|
-
"ts-dedent": "^2.2.0"
|
|
62
|
-
"typescript": "^6.0.3"
|
|
61
|
+
"ts-dedent": "^2.2.0"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@types/cross-spawn": "^6.0.6",
|
|
@@ -70,11 +69,13 @@
|
|
|
70
69
|
"lit": "2.3.1",
|
|
71
70
|
"pathe": "^1.1.2",
|
|
72
71
|
"tmp": "^0.2.3",
|
|
72
|
+
"typescript": "^6.0.3",
|
|
73
73
|
"web-component-analyzer": "^1.1.6"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"lit": "^2.0.0 || ^3.0.0",
|
|
77
|
-
"storybook": "^11.0.0-alpha.
|
|
77
|
+
"storybook": "^11.0.0-alpha.9",
|
|
78
|
+
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
78
79
|
},
|
|
79
80
|
"publishConfig": {
|
|
80
81
|
"access": "public"
|