@storybook/vue3 11.0.0-alpha.3 → 11.0.0-alpha.5
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-T4D6SHGG.js → chunk-AMGFSPJB.js} +1 -1
- package/dist/_browser-chunks/{chunk-SKDBAXQY.js → chunk-FBNGCEV4.js} +4 -2
- package/dist/_node-chunks/{chunk-MENGUCG3.js → chunk-3G3C2G4H.js} +7 -7
- package/dist/_node-chunks/{chunk-NF33ZESG.js → chunk-57IUDZDV.js} +6 -6
- package/dist/_node-chunks/{chunk-M36PSKU2.js → chunk-D222OWAC.js} +16 -9
- package/dist/_node-chunks/{chunk-FP5P5ADF.js → chunk-Z5PDHWYA.js} +452 -41
- package/dist/_node-chunks/{component-meta-47426U4F.js → component-meta-J7KAZZBZ.js} +7 -7
- package/dist/_node-chunks/{parsers-I6IXRULN.js → parsers-FP3M6J4A.js} +6 -6
- package/dist/_node-chunks/vue-docgen-api-BYHRPF6I.js +17 -0
- package/dist/docgen/docgen-worker.js +9 -9
- package/dist/docgen/index.js +10 -10
- package/dist/entry-preview-docs.js +1 -1
- package/dist/entry-preview.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/preset.d.ts +4 -3
- package/dist/preset.js +22 -17
- package/package.json +2 -2
- package/dist/_node-chunks/vue-docgen-api-6HY6ZXMW.js +0 -17
|
@@ -235,7 +235,7 @@ ${template}`;
|
|
|
235
235
|
) ? JSON.stringify(obj) : JSON.stringify(obj, null, 2);
|
|
236
236
|
|
|
237
237
|
// src/entry-preview-docs.ts
|
|
238
|
-
var isDocgenServerEnabled = globalThis.FEATURES?.
|
|
238
|
+
var isDocgenServerEnabled = globalThis.FEATURES?.docgenServer, decorators = isDocgenServerEnabled ? [] : [sourceDecorator];
|
|
239
239
|
|
|
240
240
|
export {
|
|
241
241
|
decorators,
|
|
@@ -147,7 +147,7 @@ var ARG_TYPE_SECTIONS = ["props", "events", "slots", "exposed", "expose"], extra
|
|
|
147
147
|
}, isEnumSchema = (schemas) => schemas.every((schema) => typeof schema == "string" && schema.includes(".")), isBooleanSchema = (schemas) => schemas.length === 2 && schemas.includes("true") && schemas.includes("false");
|
|
148
148
|
|
|
149
149
|
// src/render.ts
|
|
150
|
-
import { createApp, h, isReactive, isVNode, reactive } from "vue";
|
|
150
|
+
import { camelize, createApp, h, isReactive, isVNode, reactive } from "vue";
|
|
151
151
|
var render = (props, context) => {
|
|
152
152
|
let { id, component: Component } = context;
|
|
153
153
|
if (!Component)
|
|
@@ -191,7 +191,9 @@ async function renderToCanvas({ storyFn, forceRemount, showMain, showException,
|
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
function getSlots(props, context) {
|
|
194
|
-
let { argTypes } = context,
|
|
194
|
+
let { argTypes, component } = context, runtimeProps = component?.props, declaredProps = globalThis.FEATURES?.docgenServer ? new Set(
|
|
195
|
+
(Array.isArray(runtimeProps) ? runtimeProps : Object.keys(runtimeProps ?? {})).map(camelize)
|
|
196
|
+
) : void 0, isSlot = (key) => argTypes[key]?.table?.category === "slots" || declaredProps !== void 0 && !declaredProps.has(key) && !/^on[A-Z]/.test(key), slots = Object.entries(props).filter(([key]) => isSlot(key)).map(([key, value]) => [key, typeof value == "function" ? value : () => value]);
|
|
195
197
|
return Object.fromEntries(slots);
|
|
196
198
|
}
|
|
197
199
|
function getArgs(element, storyContext) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.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
|
indent
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-57IUDZDV.js";
|
|
15
15
|
|
|
16
16
|
// src/docgen/component-docgen/arg-types/extractArgTypes.ts
|
|
17
17
|
import { convert, extractComponentProps, hasDocgen } from "storybook/internal/docs-tools";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -80,14 +80,18 @@ async function collectComponentMetaSources(checker, id, typescript) {
|
|
|
80
80
|
displayName: name === "default" ? getFilenameWithoutExtension(id) : name,
|
|
81
81
|
typeParams,
|
|
82
82
|
...meta,
|
|
83
|
+
props: meta.props.filter(isDocumented),
|
|
84
|
+
events: meta.events.filter(isDocumented),
|
|
85
|
+
slots: meta.slots.filter(isDocumented),
|
|
83
86
|
description: jsDocInfo?.description,
|
|
84
87
|
jsDocTags: jsDocInfo?.jsDocTags,
|
|
85
|
-
exposed,
|
|
88
|
+
exposed: exposed.filter(isDocumented),
|
|
86
89
|
sourceFiles: id
|
|
87
90
|
})
|
|
88
91
|
);
|
|
89
92
|
}), metaSources;
|
|
90
93
|
}
|
|
94
|
+
var isDocumented = (member) => !member.tags?.some((tag) => tag.name === "ignore");
|
|
91
95
|
async function extractVueSfcTypeParams(id) {
|
|
92
96
|
if (id.endsWith(".vue"))
|
|
93
97
|
try {
|
|
@@ -152,8 +156,11 @@ function hasRuntimeEmitsDeclaration(source) {
|
|
|
152
156
|
function mergeEventDescriptions(meta, events) {
|
|
153
157
|
if (!(!meta.events.length || !events?.length))
|
|
154
158
|
for (let event of meta.events) {
|
|
155
|
-
let
|
|
156
|
-
description && (event.description = description)
|
|
159
|
+
let parsed = events.find((i) => i.name === event.name);
|
|
160
|
+
parsed?.description && (event.description = parsed.description), !event.tags.length && parsed?.tags?.length && (event.tags = parsed.tags.map((tag) => ({
|
|
161
|
+
name: tag.title,
|
|
162
|
+
text: "content" in tag && typeof tag.content == "string" ? tag.content : void 0
|
|
163
|
+
})));
|
|
157
164
|
}
|
|
158
165
|
}
|
|
159
166
|
function restoreMissingRuntimeEvents(meta, events) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -31,12 +31,12 @@ import {
|
|
|
31
31
|
renderPropLikeArg,
|
|
32
32
|
renderSlotContent,
|
|
33
33
|
wrapSlotContent
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-57IUDZDV.js";
|
|
35
35
|
|
|
36
36
|
// src/docgen/story-docs/build-story-docs.ts
|
|
37
37
|
import { readFile } from "node:fs/promises";
|
|
38
38
|
import { isAbsolute, join } from "node:path";
|
|
39
|
-
import { types as
|
|
39
|
+
import { types as t7 } from "storybook/internal/babel";
|
|
40
40
|
import {
|
|
41
41
|
STORY_FILE_TEST_REGEXP,
|
|
42
42
|
getComponentIdFromEntry,
|
|
@@ -51,19 +51,18 @@ import {
|
|
|
51
51
|
createStoryReferenceResolver,
|
|
52
52
|
extractStoryJSDocInfo,
|
|
53
53
|
jsDocTagsForPath,
|
|
54
|
-
keyOf as
|
|
54
|
+
keyOf as keyOf5,
|
|
55
55
|
loadCsf,
|
|
56
|
-
metaObjectPath,
|
|
56
|
+
metaObjectPath as metaObjectPath2,
|
|
57
57
|
noSnippetWarning,
|
|
58
|
-
normalizeStoryDeclaration,
|
|
58
|
+
normalizeStoryDeclaration as normalizeStoryDeclaration2,
|
|
59
59
|
propertyValue as propertyValue2,
|
|
60
60
|
resolveComponentImport,
|
|
61
|
-
resolveRenderFunction,
|
|
62
61
|
resolveReturnedObjectExpression,
|
|
63
62
|
returnedExpression as returnedExpression3,
|
|
64
63
|
returnedExpressionPath,
|
|
65
64
|
unresolvedWarning,
|
|
66
|
-
unwrapExpression as
|
|
65
|
+
unwrapExpression as unwrapExpression7
|
|
67
66
|
} from "storybook/internal/csf-tools";
|
|
68
67
|
|
|
69
68
|
// src/docgen/story-docs/classify-args/classify-args.ts
|
|
@@ -1175,6 +1174,434 @@ function setupProperty(renderObject) {
|
|
|
1175
1174
|
return renderObject.properties.find((property) => !t3.isObjectMethod(property) && !t3.isObjectProperty(property) ? !1 : keyOf3(property) === SETUP_PROPERTY);
|
|
1176
1175
|
}
|
|
1177
1176
|
|
|
1177
|
+
// ../../core/src/csf-tools/story-shape/utils.ts
|
|
1178
|
+
import { types as t4 } from "storybook/internal/babel";
|
|
1179
|
+
var unwrapExpression6 = (node) => t4.isTSAsExpression(node) || t4.isTSSatisfiesExpression(node) || t4.isTSNonNullExpression(node) || t4.isTSTypeAssertion(node) || t4.isParenthesizedExpression(node) ? unwrapExpression6(node.expression) : node, isCanonicalCsf2BindCall = (node) => t4.isCallExpression(node) && t4.isMemberExpression(node.callee) && !node.callee.computed && t4.isIdentifier(node.callee.object) && t4.isIdentifier(node.callee.property, { name: "bind" }) && (node.arguments.length === 0 || node.arguments.length === 1 && t4.isObjectExpression(node.arguments[0]) && node.arguments[0].properties.length === 0), withoutTypeCalls = (object) => t4.isCallExpression(object) && object.arguments.length === 0 && t4.isMemberExpression(object.callee) && !object.callee.computed && t4.isIdentifier(object.callee.property, { name: "type" }) ? withoutTypeCalls(object.callee.object) : object, isCsfFactoryCall = (node) => t4.isCallExpression(node) && t4.isMemberExpression(node.callee) && !node.callee.computed && t4.isIdentifier(withoutTypeCalls(node.callee.object)) && t4.isIdentifier(node.callee.property) && (node.callee.property.name === "story" || node.callee.property.name === "extend"), csfFactoryReceiver = (node) => withoutTypeCalls(node.callee.object);
|
|
1180
|
+
var keyOf4 = (p) => t4.isStringLiteral(p.key) ? p.key.value : !p.computed && t4.isIdentifier(p.key) ? p.key.name : null;
|
|
1181
|
+
function resolveIdentifierInit(storyPath, identifier) {
|
|
1182
|
+
let programPath = storyPath.findParent((p) => p.isProgram());
|
|
1183
|
+
if (!programPath)
|
|
1184
|
+
return null;
|
|
1185
|
+
for (let stmt of programPath.get("body")) {
|
|
1186
|
+
if (stmt.isFunctionDeclaration() && stmt.node.id?.name === identifier.node.name)
|
|
1187
|
+
return stmt;
|
|
1188
|
+
if (stmt.isExportNamedDeclaration()) {
|
|
1189
|
+
let decl = stmt.get("declaration");
|
|
1190
|
+
if (decl.isFunctionDeclaration() && decl.node.id?.name === identifier.node.name)
|
|
1191
|
+
return decl;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
let match = programPath.get("body").flatMap((stmt) => {
|
|
1195
|
+
if (stmt.isVariableDeclaration())
|
|
1196
|
+
return stmt.get("declarations");
|
|
1197
|
+
if (stmt.isExportNamedDeclaration()) {
|
|
1198
|
+
let decl = stmt.get("declaration");
|
|
1199
|
+
if (decl && decl.isVariableDeclaration())
|
|
1200
|
+
return decl.get("declarations");
|
|
1201
|
+
}
|
|
1202
|
+
return [];
|
|
1203
|
+
}).find((d) => {
|
|
1204
|
+
let id = d.get("id");
|
|
1205
|
+
return id.isIdentifier() && id.node.name === identifier.node.name;
|
|
1206
|
+
});
|
|
1207
|
+
if (!match)
|
|
1208
|
+
return null;
|
|
1209
|
+
let init = match.get("init");
|
|
1210
|
+
return init && init.isExpression() ? init : null;
|
|
1211
|
+
}
|
|
1212
|
+
function pathForNode(program, target) {
|
|
1213
|
+
if (!target)
|
|
1214
|
+
return;
|
|
1215
|
+
let found;
|
|
1216
|
+
return program.traverse({
|
|
1217
|
+
enter(p) {
|
|
1218
|
+
p.node && p.node === target && (found = p, p.stop());
|
|
1219
|
+
}
|
|
1220
|
+
}), found;
|
|
1221
|
+
}
|
|
1222
|
+
function metaObjectPath(csf) {
|
|
1223
|
+
let metaPath = pathForNode(csf._file.path, csf._metaNode);
|
|
1224
|
+
return metaPath?.isObjectExpression() ? metaPath : void 0;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// ../../core/src/csf-tools/story-shape/normalize-story.ts
|
|
1228
|
+
function normalizeStoryDeclaration(storyDeclaration) {
|
|
1229
|
+
let storyPath = declarationExpression(storyDeclaration), normalizedPath = bindInitializer(storyDeclaration, storyPath) ?? factoryArgumentExpression(storyPath), unwrappedPath = unwrapTypeExpression(normalizedPath);
|
|
1230
|
+
return classifyStoryPath(unwrappedPath);
|
|
1231
|
+
}
|
|
1232
|
+
function declarationExpression(storyDeclaration) {
|
|
1233
|
+
if (storyDeclaration.isFunctionDeclaration())
|
|
1234
|
+
return storyDeclaration;
|
|
1235
|
+
if (storyDeclaration.isVariableDeclarator()) {
|
|
1236
|
+
let init = storyDeclaration.get("init");
|
|
1237
|
+
if (!init.isExpression())
|
|
1238
|
+
throw storyDeclaration.buildCodeFrameError("Expected story initializer to be an expression");
|
|
1239
|
+
return init;
|
|
1240
|
+
}
|
|
1241
|
+
throw storyDeclaration.buildCodeFrameError(
|
|
1242
|
+
"Expected story to be a function or variable declaration"
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
function bindInitializer(storyDeclaration, storyPath) {
|
|
1246
|
+
if (!storyPath.isCallExpression() || !isCanonicalCsf2BindCall(storyPath.node))
|
|
1247
|
+
return null;
|
|
1248
|
+
let callee = storyPath.get("callee");
|
|
1249
|
+
if (!callee.isMemberExpression())
|
|
1250
|
+
return null;
|
|
1251
|
+
let obj = callee.get("object");
|
|
1252
|
+
return obj.isIdentifier() ? resolveIdentifierInit(storyDeclaration, obj) : null;
|
|
1253
|
+
}
|
|
1254
|
+
function factoryArgumentExpression(storyPath) {
|
|
1255
|
+
if (!storyPath.isCallExpression() || !isCsfFactoryCall(storyPath.node))
|
|
1256
|
+
return storyPath;
|
|
1257
|
+
let args = storyPath.get("arguments");
|
|
1258
|
+
if (args.length === 0)
|
|
1259
|
+
return storyPath;
|
|
1260
|
+
if (args.length !== 1 || !args[0].isExpression())
|
|
1261
|
+
throw storyPath.buildCodeFrameError("Could not evaluate story expression");
|
|
1262
|
+
return args[0];
|
|
1263
|
+
}
|
|
1264
|
+
function unwrapTypeExpression(storyPath) {
|
|
1265
|
+
return storyPath.isTSSatisfiesExpression() || storyPath.isTSAsExpression() ? storyPath.get("expression") : storyPath;
|
|
1266
|
+
}
|
|
1267
|
+
function classifyStoryPath(storyPath) {
|
|
1268
|
+
if (storyPath.isObjectExpression())
|
|
1269
|
+
return { type: "config", path: storyPath };
|
|
1270
|
+
if (storyPath.isArrowFunctionExpression() || storyPath.isFunctionExpression() || storyPath.isFunctionDeclaration())
|
|
1271
|
+
return { type: "fn", path: storyPath };
|
|
1272
|
+
if (storyPath.isCallExpression() && isCsfFactoryCall(storyPath.node) && storyPath.node.arguments.length === 0)
|
|
1273
|
+
return { type: "emptyConfig", path: storyPath };
|
|
1274
|
+
throw storyPath.buildCodeFrameError(
|
|
1275
|
+
"Expected story to be csf factory, function or an object expression"
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// ../../core/src/csf-tools/story-shape/resolve-members.ts
|
|
1280
|
+
import { generate, types as t6 } from "storybook/internal/babel";
|
|
1281
|
+
|
|
1282
|
+
// ../../core/src/csf-tools/story-shape/imports.ts
|
|
1283
|
+
import { types as t5 } from "storybook/internal/babel";
|
|
1284
|
+
var isTypeSpecifier = (s) => t5.isImportSpecifier(s) && s.importKind === "type", importedName = (im) => t5.isIdentifier(im) ? im.name : im.value;
|
|
1285
|
+
|
|
1286
|
+
// ../../core/src/csf-tools/story-shape/resolve-members.ts
|
|
1287
|
+
var sourceOf = (node) => generate(node, { concise: !0, comments: !1 }).code, complete = (properties = {}) => ({
|
|
1288
|
+
properties,
|
|
1289
|
+
shadowed: [],
|
|
1290
|
+
unresolved: []
|
|
1291
|
+
}), resolveObjectMembers = (object, ctx) => membersOf(object, ctx, /* @__PURE__ */ new Set());
|
|
1292
|
+
var membersOf = (object, ctx, visited) => {
|
|
1293
|
+
let properties = {}, unresolved = [], shadowed = /* @__PURE__ */ new Set(), shadowKnownMembers = (source) => {
|
|
1294
|
+
unresolved.push(source);
|
|
1295
|
+
for (let key of Object.keys(properties))
|
|
1296
|
+
shadowed.add(key);
|
|
1297
|
+
};
|
|
1298
|
+
for (let property of object.properties) {
|
|
1299
|
+
if (t6.isSpreadElement(property)) {
|
|
1300
|
+
let spread = spreadMembers(ctx, property, visited);
|
|
1301
|
+
if (spread === void 0 || spread.unresolved.length > 0) {
|
|
1302
|
+
shadowKnownMembers(sourceOf(property));
|
|
1303
|
+
continue;
|
|
1304
|
+
}
|
|
1305
|
+
for (let [key2, value] of Object.entries(spread.properties))
|
|
1306
|
+
properties[key2] = value, shadowed.delete(key2);
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1309
|
+
let key = keyOf4(property);
|
|
1310
|
+
if (key === null) {
|
|
1311
|
+
shadowKnownMembers(sourceOf(property));
|
|
1312
|
+
continue;
|
|
1313
|
+
}
|
|
1314
|
+
if (t6.isObjectMethod(property) && (property.kind !== "method" || property.generator)) {
|
|
1315
|
+
delete properties[key], shadowed.delete(key), unresolved.push(sourceOf(property));
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
properties[key] = t6.isObjectMethod(property) ? property : property.value, shadowed.delete(key);
|
|
1319
|
+
}
|
|
1320
|
+
return { properties, shadowed: [...shadowed], unresolved };
|
|
1321
|
+
}, spreadMembers = (ctx, spread, visited) => {
|
|
1322
|
+
let argument = unwrapExpression6(spread.argument);
|
|
1323
|
+
return t6.isObjectExpression(argument) ? membersOf(argument, ctx, visited) : resolveReference(ctx, argument, spread.start ?? void 0, visited);
|
|
1324
|
+
}, memberChain = (node) => {
|
|
1325
|
+
let path = [], current = unwrapExpression6(node);
|
|
1326
|
+
for (; t6.isMemberExpression(current); ) {
|
|
1327
|
+
let key = t6.isIdentifier(current.property) && !current.computed ? current.property.name : t6.isStringLiteral(current.property) ? current.property.value : void 0;
|
|
1328
|
+
if (key === void 0)
|
|
1329
|
+
return;
|
|
1330
|
+
path.unshift(key), current = unwrapExpression6(current.object);
|
|
1331
|
+
}
|
|
1332
|
+
return t6.isIdentifier(current) ? { root: current.name, path } : void 0;
|
|
1333
|
+
}, resolveReference = (ctx, expression, position, visited) => {
|
|
1334
|
+
let chain = memberChain(expression);
|
|
1335
|
+
if (!chain)
|
|
1336
|
+
return;
|
|
1337
|
+
let key = `ref:${ctx.filePath}#${chain.root}.${chain.path.join(".")}`;
|
|
1338
|
+
if (!visited.has(key)) {
|
|
1339
|
+
visited.add(key);
|
|
1340
|
+
try {
|
|
1341
|
+
return unguardedResolveReference(ctx, chain, position, visited);
|
|
1342
|
+
} finally {
|
|
1343
|
+
visited.delete(key);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
}, unguardedResolveReference = (ctx, chain, position, visited) => {
|
|
1347
|
+
let located = locate(ctx, chain, position, visited);
|
|
1348
|
+
if (!located)
|
|
1349
|
+
return;
|
|
1350
|
+
let members = located.members, scope = located.ctx;
|
|
1351
|
+
for (let [index, key] of located.path.entries()) {
|
|
1352
|
+
if (members.unresolved.length > 0)
|
|
1353
|
+
return;
|
|
1354
|
+
let value = members.properties[key];
|
|
1355
|
+
if (value === void 0)
|
|
1356
|
+
return index === located.path.length - 1 ? complete() : void 0;
|
|
1357
|
+
let unwrapped = unwrapExpression6(value);
|
|
1358
|
+
if (!t6.isObjectExpression(unwrapped))
|
|
1359
|
+
return;
|
|
1360
|
+
members = membersOf(unwrapped, scope, visited);
|
|
1361
|
+
}
|
|
1362
|
+
return located.external ? externalized(members, scope) : members;
|
|
1363
|
+
}, locate = (ctx, chain, position, visited) => {
|
|
1364
|
+
let binding = bindingMembers(ctx, chain.root, position, visited);
|
|
1365
|
+
if (!binding)
|
|
1366
|
+
return;
|
|
1367
|
+
if (binding.kind === "namespace") {
|
|
1368
|
+
let [exportName, ...path] = chain.path;
|
|
1369
|
+
if (exportName === void 0)
|
|
1370
|
+
return;
|
|
1371
|
+
let exported = bindingMembers(binding.ctx, exportName, void 0, visited);
|
|
1372
|
+
if (exported === void 0 || exported.kind === "namespace")
|
|
1373
|
+
return;
|
|
1374
|
+
let located2 = withAccessor(exported, path);
|
|
1375
|
+
return located2 === void 0 ? void 0 : { ...located2, external: !0 };
|
|
1376
|
+
}
|
|
1377
|
+
let located = withAccessor(binding, chain.path);
|
|
1378
|
+
return located === void 0 ? void 0 : { ...located, external: binding.external };
|
|
1379
|
+
}, withAccessor = (binding, path) => binding.accessor === void 0 ? { members: binding.members, ctx: binding.ctx, path } : path[0] === binding.accessor ? { members: binding.members, ctx: binding.ctx, path: path.slice(1) } : void 0, externalized = (members, ctx) => {
|
|
1380
|
+
if (!ctx.externalize)
|
|
1381
|
+
return members;
|
|
1382
|
+
let properties = {};
|
|
1383
|
+
for (let [key, node] of Object.entries(members.properties)) {
|
|
1384
|
+
let value = ctx.externalize(node);
|
|
1385
|
+
if (value === void 0)
|
|
1386
|
+
return;
|
|
1387
|
+
properties[key] = value;
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
properties,
|
|
1391
|
+
shadowed: members.shadowed,
|
|
1392
|
+
unresolved: members.unresolved
|
|
1393
|
+
};
|
|
1394
|
+
}, bindingMembers = (ctx, name, position, visited) => {
|
|
1395
|
+
let key = `${ctx.filePath}#${name}`;
|
|
1396
|
+
if (!visited.has(key)) {
|
|
1397
|
+
visited.add(key);
|
|
1398
|
+
try {
|
|
1399
|
+
return unguardedBindingMembers(ctx, name, position, visited);
|
|
1400
|
+
} finally {
|
|
1401
|
+
visited.delete(key);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}, unguardedBindingMembers = (ctx, name, position, visited) => {
|
|
1405
|
+
let binding = ctx.program.scope.getBinding(name);
|
|
1406
|
+
if (!binding)
|
|
1407
|
+
return;
|
|
1408
|
+
if (binding.kind === "module")
|
|
1409
|
+
return importedBinding(ctx, binding.path, visited);
|
|
1410
|
+
if (!binding.constant)
|
|
1411
|
+
return;
|
|
1412
|
+
let declared = declaredBindingMembers(ctx, binding.path.node, position, visited);
|
|
1413
|
+
if (declared === void 0)
|
|
1414
|
+
return;
|
|
1415
|
+
let assigned = assignedMembers(ctx, name, position);
|
|
1416
|
+
return {
|
|
1417
|
+
kind: "members",
|
|
1418
|
+
ctx,
|
|
1419
|
+
external: !1,
|
|
1420
|
+
...declared.accessor ? { accessor: declared.accessor } : {},
|
|
1421
|
+
members: {
|
|
1422
|
+
properties: { ...declared.members.properties, ...assigned.properties },
|
|
1423
|
+
shadowed: declared.members.shadowed.filter((key) => !(key in assigned.properties)),
|
|
1424
|
+
unresolved: [...declared.members.unresolved, ...assigned.unresolved]
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
}, declaredBindingMembers = (ctx, node, position, visited) => {
|
|
1428
|
+
if (t6.isFunctionDeclaration(node))
|
|
1429
|
+
return { members: complete() };
|
|
1430
|
+
if (t6.isVariableDeclarator(node) && !(position !== void 0 && (node.start ?? Number.POSITIVE_INFINITY) > position))
|
|
1431
|
+
return node.init ? declaredMembers(ctx, node.init, position, visited) : { members: complete() };
|
|
1432
|
+
}, declaredMembers = (ctx, init, position, visited) => {
|
|
1433
|
+
let unwrapped = unwrapExpression6(init);
|
|
1434
|
+
if (t6.isObjectExpression(unwrapped))
|
|
1435
|
+
return { members: membersOf(unwrapped, ctx, visited) };
|
|
1436
|
+
let factory = factoryCall(unwrapped);
|
|
1437
|
+
if (factory === void 0 && (t6.isFunction(unwrapped) || isCanonicalCsf2BindCall(unwrapped)))
|
|
1438
|
+
return { members: complete() };
|
|
1439
|
+
if (factory === void 0)
|
|
1440
|
+
return {
|
|
1441
|
+
members: { properties: {}, shadowed: [], unresolved: [sourceOf(unwrapped)] }
|
|
1442
|
+
};
|
|
1443
|
+
let config = factory.config ? membersOf(factory.config, ctx, visited) : complete();
|
|
1444
|
+
if (factory.method === "story")
|
|
1445
|
+
return { members: config, accessor: "input" };
|
|
1446
|
+
let parent = bindingMembers(ctx, factory.parent, position, visited);
|
|
1447
|
+
return parent === void 0 || parent.kind === "namespace" || parent.accessor !== "input" || parent.external ? void 0 : {
|
|
1448
|
+
members: {
|
|
1449
|
+
properties: mergedAnnotations(parent.members, config).properties,
|
|
1450
|
+
shadowed: [
|
|
1451
|
+
...parent.members.shadowed.filter((key) => !(key in config.properties)),
|
|
1452
|
+
...config.shadowed
|
|
1453
|
+
],
|
|
1454
|
+
unresolved: [...parent.members.unresolved, ...config.unresolved]
|
|
1455
|
+
},
|
|
1456
|
+
accessor: "input"
|
|
1457
|
+
};
|
|
1458
|
+
}, MERGED_ANNOTATIONS = ["args", "argTypes", "parameters", "globals"], mergedAnnotations = (parent, child) => {
|
|
1459
|
+
let properties = { ...parent.properties, ...child.properties };
|
|
1460
|
+
for (let key of MERGED_ANNOTATIONS) {
|
|
1461
|
+
let from = parent.properties[key], over = child.properties[key];
|
|
1462
|
+
from === void 0 || over === void 0 || !t6.isExpression(from) || !t6.isExpression(over) || (properties[key] = t6.objectExpression([t6.spreadElement(from), t6.spreadElement(over)]));
|
|
1463
|
+
}
|
|
1464
|
+
return { properties };
|
|
1465
|
+
}, factoryCall = (node) => {
|
|
1466
|
+
if (!isCsfFactoryCall(node))
|
|
1467
|
+
return;
|
|
1468
|
+
let method = node.callee.property.name;
|
|
1469
|
+
if (method !== "story" && method !== "extend")
|
|
1470
|
+
return;
|
|
1471
|
+
let [argument] = node.arguments, config = argument && unwrapExpression6(argument);
|
|
1472
|
+
if (!(argument !== void 0 && (config === void 0 || !t6.isObjectExpression(config))))
|
|
1473
|
+
return {
|
|
1474
|
+
method,
|
|
1475
|
+
parent: csfFactoryReceiver(node).name,
|
|
1476
|
+
...config && t6.isObjectExpression(config) ? { config } : {}
|
|
1477
|
+
};
|
|
1478
|
+
}, assignedMembers = (ctx, name, position) => {
|
|
1479
|
+
let properties = {}, unresolved = [];
|
|
1480
|
+
for (let statement of ctx.program.node.body) {
|
|
1481
|
+
if (!t6.isExpressionStatement(statement) || !t6.isAssignmentExpression(statement.expression))
|
|
1482
|
+
continue;
|
|
1483
|
+
let assignment = statement.expression, target = assignment.left, depth = 0, outermost;
|
|
1484
|
+
for (; t6.isMemberExpression(target); )
|
|
1485
|
+
depth += 1, outermost = t6.isIdentifier(target.property) && !target.computed ? target.property.name : t6.isStringLiteral(target.property) ? target.property.value : void 0, target = target.object;
|
|
1486
|
+
if (!(depth === 0 || !t6.isIdentifier(target) || target.name !== name) && !(position !== void 0 && (assignment.start ?? 0) > position)) {
|
|
1487
|
+
if (depth > 1 || outermost === void 0 || assignment.operator !== "=") {
|
|
1488
|
+
unresolved.push(sourceOf(assignment));
|
|
1489
|
+
continue;
|
|
1490
|
+
}
|
|
1491
|
+
properties[outermost] = assignment.right;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
return { properties, unresolved };
|
|
1495
|
+
}, importedBinding = (ctx, specifierPath, visited) => {
|
|
1496
|
+
let specifier = specifierPath.node, declaration = specifierPath.parent;
|
|
1497
|
+
if (!t6.isImportDeclaration(declaration) || declaration.importKind === "type" || !(t6.isImportSpecifier(specifier) || t6.isImportDefaultSpecifier(specifier) || t6.isImportNamespaceSpecifier(specifier)) || isTypeSpecifier(specifier))
|
|
1498
|
+
return;
|
|
1499
|
+
let target = resolveTargetModule(ctx, declaration.source.value);
|
|
1500
|
+
if (!target)
|
|
1501
|
+
return;
|
|
1502
|
+
if (t6.isImportNamespaceSpecifier(specifier))
|
|
1503
|
+
return { kind: "namespace", ctx: target };
|
|
1504
|
+
let exportName = t6.isImportDefaultSpecifier(specifier) ? "default" : importedName(specifier.imported);
|
|
1505
|
+
return exportedBinding(target, exportName, visited);
|
|
1506
|
+
}, resolveTargetModule = (ctx, specifier) => {
|
|
1507
|
+
let target = ctx.resolveModule?.(ctx.filePath, specifier);
|
|
1508
|
+
return target ? { ...ctx, ...target } : void 0;
|
|
1509
|
+
}, exportedBinding = (ctx, exportName, visited) => {
|
|
1510
|
+
let asExternal = (bound) => bound === void 0 || bound.kind === "namespace" ? bound : { ...bound, external: !0 };
|
|
1511
|
+
for (let statement of ctx.program.node.body) {
|
|
1512
|
+
if (t6.isExportDefaultDeclaration(statement) && exportName === "default") {
|
|
1513
|
+
let declaration = unwrapExpression6(statement.declaration);
|
|
1514
|
+
return t6.isIdentifier(declaration) ? asExternal(bindingMembers(ctx, declaration.name, void 0, visited)) : t6.isObjectExpression(declaration) ? {
|
|
1515
|
+
kind: "members",
|
|
1516
|
+
ctx,
|
|
1517
|
+
external: !0,
|
|
1518
|
+
members: membersOf(declaration, ctx, visited)
|
|
1519
|
+
} : void 0;
|
|
1520
|
+
}
|
|
1521
|
+
if (!t6.isExportNamedDeclaration(statement) || statement.exportKind === "type")
|
|
1522
|
+
continue;
|
|
1523
|
+
let specifier = statement.specifiers.find(
|
|
1524
|
+
(candidate) => t6.isExportSpecifier(candidate) && candidate.exportKind !== "type" && importedName(candidate.exported) === exportName
|
|
1525
|
+
);
|
|
1526
|
+
if (!specifier)
|
|
1527
|
+
continue;
|
|
1528
|
+
if (!statement.source)
|
|
1529
|
+
return asExternal(bindingMembers(ctx, specifier.local.name, void 0, visited));
|
|
1530
|
+
let target = resolveTargetModule(ctx, statement.source.value);
|
|
1531
|
+
return target ? exportedBinding(target, specifier.local.name, visited) : void 0;
|
|
1532
|
+
}
|
|
1533
|
+
return exportName === "default" ? void 0 : asExternal(bindingMembers(ctx, exportName, void 0, visited));
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
// ../../core/src/csf-tools/story-shape/render.ts
|
|
1537
|
+
var isRenderFunction = (path) => path.isArrowFunctionExpression() || path.isFunctionExpression() || path.isFunctionDeclaration();
|
|
1538
|
+
function resolveEffectiveRender(csf, exportName, references) {
|
|
1539
|
+
let declaration = csf._storyDeclarationPath[exportName], normalized = normalizeStoryDeclarationForRender(declaration);
|
|
1540
|
+
if (normalized.type === "fn")
|
|
1541
|
+
return { kind: "resolved", path: normalized.path };
|
|
1542
|
+
let storyRender = readRender(
|
|
1543
|
+
normalized.type === "config" ? normalized.path : void 0,
|
|
1544
|
+
declaration,
|
|
1545
|
+
references
|
|
1546
|
+
);
|
|
1547
|
+
if (storyRender.kind === "invalid")
|
|
1548
|
+
return { kind: "unresolved" };
|
|
1549
|
+
if (storyRender.kind !== "missing")
|
|
1550
|
+
return storyRender;
|
|
1551
|
+
let metaRender = readRender(metaObjectPath(csf), declaration, references);
|
|
1552
|
+
return metaRender.kind === "invalid" ? { kind: "unresolved" } : metaRender;
|
|
1553
|
+
}
|
|
1554
|
+
var normalizeStoryDeclarationForRender = normalizeStoryDeclaration, readRender = (config, storyDeclaration, references) => {
|
|
1555
|
+
let properties = config?.get("properties") ?? [], renderIndex = -1;
|
|
1556
|
+
for (let index = properties.length - 1; index >= 0; index -= 1) {
|
|
1557
|
+
let property = properties[index];
|
|
1558
|
+
if ((property.isObjectProperty() || property.isObjectMethod()) && keyOf4(property.node) === "render") {
|
|
1559
|
+
renderIndex = index;
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
let throughSpreads = () => config && references ? renderFromMembers(
|
|
1564
|
+
resolveObjectMembers(config.node, references),
|
|
1565
|
+
references,
|
|
1566
|
+
storyDeclaration
|
|
1567
|
+
) : { kind: "unresolved" };
|
|
1568
|
+
if (renderIndex === -1)
|
|
1569
|
+
return properties.some((property) => property.isSpreadElement()) ? throughSpreads() : { kind: "missing" };
|
|
1570
|
+
let resolved = readRenderProperty(properties[renderIndex], storyDeclaration);
|
|
1571
|
+
if (properties.some((property, index) => index > renderIndex && property.isSpreadElement())) {
|
|
1572
|
+
let read = throughSpreads();
|
|
1573
|
+
return read.kind !== "unresolved" ? read : resolved.kind === "resolved" ? { kind: "unresolved", shadowedRender: resolved.path } : { kind: "unresolved" };
|
|
1574
|
+
}
|
|
1575
|
+
return resolved;
|
|
1576
|
+
};
|
|
1577
|
+
function renderFromMembers(members, references, storyDeclaration) {
|
|
1578
|
+
if (members.unresolved.length > 0)
|
|
1579
|
+
return { kind: "unresolved" };
|
|
1580
|
+
let node = members.properties.render;
|
|
1581
|
+
if (node === void 0)
|
|
1582
|
+
return { kind: "missing" };
|
|
1583
|
+
let path = pathForNode(references.program, node);
|
|
1584
|
+
if (!path)
|
|
1585
|
+
return { kind: "unresolved" };
|
|
1586
|
+
if (path.isObjectMethod())
|
|
1587
|
+
return path.node.kind === "method" && !path.node.generator ? { kind: "resolved", path } : { kind: "unresolved" };
|
|
1588
|
+
if (path.isIdentifier()) {
|
|
1589
|
+
let resolved = resolveIdentifierInit(storyDeclaration, path);
|
|
1590
|
+
return resolved && isRenderFunction(resolved) ? { kind: "resolved", path: resolved } : { kind: "unresolved" };
|
|
1591
|
+
}
|
|
1592
|
+
return isRenderFunction(path) ? { kind: "resolved", path } : { kind: "unresolved" };
|
|
1593
|
+
}
|
|
1594
|
+
function readRenderProperty(renderProperty, storyDeclaration) {
|
|
1595
|
+
if (renderProperty.isObjectMethod())
|
|
1596
|
+
return renderProperty.node.kind === "method" && !renderProperty.node.generator ? { kind: "resolved", path: renderProperty } : { kind: "unresolved" };
|
|
1597
|
+
let renderPath = renderProperty.get("value");
|
|
1598
|
+
if (renderPath.isIdentifier()) {
|
|
1599
|
+
let resolved = resolveIdentifierInit(storyDeclaration, renderPath);
|
|
1600
|
+
return resolved && isRenderFunction(resolved) ? { kind: "resolved", path: resolved } : { kind: "unresolved" };
|
|
1601
|
+
}
|
|
1602
|
+
return isRenderFunction(renderPath) ? { kind: "resolved", path: renderPath } : { kind: "invalid", path: renderPath };
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1178
1605
|
// src/docgen/story-docs/build-story-docs.ts
|
|
1179
1606
|
var openStoryReferences = createStoryReferenceResolver({ extensions: [".vue"] }), RENDER_UNRESOLVED_WARNING = "No static snippet: the `render` function could not be resolved statically.", SLOT_UNRESOLVED_WARNING = "No static snippet: a slot function could not be resolved statically.", IMPORT_UNRESOLVED_WARNING = "No static snippet: the component's import could not be resolved statically.", TEMPLATE_UNRESOLVED_WARNING = "No static snippet: the story template could not be resolved statically.", UNRENDERED_WARNINGS = {
|
|
1180
1607
|
h: RENDER_UNRESOLVED_WARNING,
|
|
@@ -1197,7 +1624,7 @@ async function buildStoryDocsPayload(input, context = {}) {
|
|
|
1197
1624
|
} catch {
|
|
1198
1625
|
return;
|
|
1199
1626
|
}
|
|
1200
|
-
let metaPath =
|
|
1627
|
+
let metaPath = metaObjectPath2(csf), id = getComponentIdFromEntry(input.entry), docgenPayload;
|
|
1201
1628
|
try {
|
|
1202
1629
|
docgenPayload = await (context.readDocgen ?? readStoredDocgen)(id);
|
|
1203
1630
|
} catch {
|
|
@@ -1229,7 +1656,7 @@ function fallbackTitle(title) {
|
|
|
1229
1656
|
}
|
|
1230
1657
|
function resolveMetaComponentIdentifier(metaPath) {
|
|
1231
1658
|
let value = propertyValue2(metaPath?.node, "component");
|
|
1232
|
-
return
|
|
1659
|
+
return t7.isIdentifier(value) ? value.name : void 0;
|
|
1233
1660
|
}
|
|
1234
1661
|
function createImportStatement(componentName, importBindings, metaPath, docgenPayload) {
|
|
1235
1662
|
if (!componentName)
|
|
@@ -1269,18 +1696,13 @@ function enrichStoryDoc(csf, storyExport, storyDoc, options) {
|
|
|
1269
1696
|
return plain;
|
|
1270
1697
|
let { componentName, componentImportStatement, docgenArgInfo } = options.snippet, normalized;
|
|
1271
1698
|
try {
|
|
1272
|
-
normalized =
|
|
1699
|
+
normalized = normalizeStoryDeclaration2(csf._storyDeclarationPath[storyExport]);
|
|
1273
1700
|
} catch {
|
|
1274
1701
|
return plain;
|
|
1275
1702
|
}
|
|
1276
1703
|
if (normalized.type === "fn")
|
|
1277
1704
|
return plain;
|
|
1278
|
-
let
|
|
1279
|
-
storyConfigPath,
|
|
1280
|
-
options.metaPath,
|
|
1281
|
-
csf._storyDeclarationPath[storyExport],
|
|
1282
|
-
options.resolver.ctx
|
|
1283
|
-
), renderer = effectiveRender.kind === "resolved" ? staticRendererForRenderFunction(effectiveRender.path, options) : effectiveRender.kind === "missing" ? { kind: "sfc" } : void 0;
|
|
1705
|
+
let effectiveRender = resolveEffectiveRender(csf, storyExport, options.resolver.ctx), renderer = effectiveRender.kind === "resolved" ? staticRendererForRenderFunction(effectiveRender.path, options) : effectiveRender.kind === "missing" ? { kind: "sfc" } : void 0;
|
|
1284
1706
|
if (!renderer)
|
|
1285
1707
|
return withWarning(RENDER_UNRESOLVED_WARNING);
|
|
1286
1708
|
if (renderer.kind === "bail")
|
|
@@ -1381,35 +1803,24 @@ function renderStaticStorySnippet(renderer, classified, componentName, docgenArg
|
|
|
1381
1803
|
}
|
|
1382
1804
|
function setupReturnedRenderExpression(renderObject) {
|
|
1383
1805
|
if (!renderObject.properties.every((property) => {
|
|
1384
|
-
if (
|
|
1806
|
+
if (t7.isSpreadElement(property))
|
|
1385
1807
|
return !1;
|
|
1386
|
-
let key =
|
|
1808
|
+
let key = keyOf5(property);
|
|
1387
1809
|
return key === "setup" || key === "components" || key === "inheritAttrs";
|
|
1388
1810
|
}))
|
|
1389
1811
|
return;
|
|
1390
1812
|
let setup = renderObject.properties.find(
|
|
1391
|
-
(property) => !
|
|
1392
|
-
), setupFn =
|
|
1393
|
-
if (!setupFn || !
|
|
1813
|
+
(property) => !t7.isSpreadElement(property) && keyOf5(property) === "setup"
|
|
1814
|
+
), setupFn = t7.isObjectMethod(setup) ? setup : t7.isObjectProperty(setup) ? unwrapExpression7(setup.value) : void 0;
|
|
1815
|
+
if (!setupFn || !t7.isFunction(setupFn))
|
|
1394
1816
|
return;
|
|
1395
|
-
let renderClosure = returnedExpression3(setupFn), closure = renderClosure &&
|
|
1396
|
-
if (!(!closure || !
|
|
1817
|
+
let renderClosure = returnedExpression3(setupFn), closure = renderClosure && unwrapExpression7(renderClosure);
|
|
1818
|
+
if (!(!closure || !t7.isFunction(closure) || closure.params.length > 0))
|
|
1397
1819
|
return returnedExpression3(closure);
|
|
1398
1820
|
}
|
|
1399
1821
|
function argsParameterName(renderFunction) {
|
|
1400
1822
|
let [parameter] = renderFunction.params;
|
|
1401
|
-
return
|
|
1402
|
-
}
|
|
1403
|
-
function resolveEffectiveRender(storyConfigPath, metaPath, storyDeclaration, references) {
|
|
1404
|
-
let storyRender = resolveRenderFromObjectPath(storyConfigPath, storyDeclaration, references);
|
|
1405
|
-
return storyRender.kind !== "missing" ? storyRender : resolveRenderFromObjectPath(metaPath, storyDeclaration, references);
|
|
1406
|
-
}
|
|
1407
|
-
function resolveRenderFromObjectPath(path, storyDeclaration, references) {
|
|
1408
|
-
try {
|
|
1409
|
-
return resolveRenderFunction(path, storyDeclaration, references);
|
|
1410
|
-
} catch {
|
|
1411
|
-
return { kind: "unresolved" };
|
|
1412
|
-
}
|
|
1823
|
+
return t7.isIdentifier(parameter) ? parameter.name : void 0;
|
|
1413
1824
|
}
|
|
1414
1825
|
|
|
1415
1826
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
applyVueDocgenApiTempFixes,
|
|
15
15
|
collectComponentMetaSources,
|
|
16
16
|
createVueComponentMetaChecker
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D222OWAC.js";
|
|
18
18
|
export {
|
|
19
19
|
CHECKER_OPTIONS,
|
|
20
20
|
applyVueDocgenApiTempFixes,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/docgen/vue-docgen-api.ts
|
|
14
|
+
import { parse } from "vue-docgen-api";
|
|
15
|
+
export {
|
|
16
|
+
parse
|
|
17
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
buildApiDescription,
|
|
14
14
|
createNamedTypeDetailResolver,
|
|
15
15
|
extractArgTypes
|
|
16
|
-
} from "../_node-chunks/chunk-
|
|
17
|
-
import "../_node-chunks/chunk-
|
|
16
|
+
} from "../_node-chunks/chunk-3G3C2G4H.js";
|
|
17
|
+
import "../_node-chunks/chunk-57IUDZDV.js";
|
|
18
18
|
import {
|
|
19
19
|
CHECKER_OPTIONS,
|
|
20
20
|
collectComponentMetaSources
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-D222OWAC.js";
|
|
22
22
|
|
|
23
23
|
// src/docgen/docgen-worker.ts
|
|
24
24
|
import { createLazyDocgenMiddleware } from "storybook/internal/common";
|
package/dist/docgen/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.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
|
buildStoryDocsPayload
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-Z5PDHWYA.js";
|
|
15
15
|
import {
|
|
16
16
|
buildApiDescription,
|
|
17
17
|
createNamedTypeDetailResolver,
|
|
18
18
|
extractArgTypes
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
20
|
-
import "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-3G3C2G4H.js";
|
|
20
|
+
import "../_node-chunks/chunk-57IUDZDV.js";
|
|
21
21
|
import {
|
|
22
22
|
CHECKER_OPTIONS,
|
|
23
23
|
applyVueDocgenApiTempFixes,
|
|
24
24
|
collectComponentMetaSources
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-D222OWAC.js";
|
|
26
26
|
|
|
27
27
|
// src/docgen/story-docs/source-decorator/sourceDecorator.ts
|
|
28
28
|
import { SourceType } from "storybook/internal/docs-tools";
|
package/dist/entry-preview.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { _ as VueTypes, a as Loader, c as Preview, d as StoryObj, f as StrictArg
|
|
|
2
2
|
import { Args as Args$1, ArgsStoryFn, ComposedStoryFn, DecoratorFunction, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, ProjectAnnotations, Store_CSFExports, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext as StoryContext$1 } from "storybook/internal/types";
|
|
3
3
|
import { App } from "vue";
|
|
4
4
|
import { Simplify } from "type-fest";
|
|
5
|
-
import { AddonTypes, InferTypes, Meta as Meta$1, MetaInput, MetaTypes, Preview as Preview$1,
|
|
5
|
+
import { AddonTypes, InferTypes, Meta as Meta$1, MetaInput, MetaTypes, Preview as Preview$1, PreviewAddonEntry, Story, StoryArgs, TypedMetaArgKeys, WithRenderArgs } from "storybook/internal/csf";
|
|
6
6
|
|
|
7
7
|
//#region code/renderers/vue3/.dts-emit/code/renderers/vue3/src/render.d.ts
|
|
8
8
|
declare const setup: <AppHostElement = any>(fn: (app: App<AppHostElement>, storyContext?: StoryContext$1<VueRenderer>) => unknown) => void;
|
|
@@ -112,7 +112,7 @@ declare function composeStories<TModule extends Store_CSFExports<VueRenderer, an
|
|
|
112
112
|
* });
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
|
-
declare function __definePreview<Addons extends
|
|
115
|
+
declare function __definePreview<Addons extends PreviewAddonEntry[]>(input: {
|
|
116
116
|
addons: Addons;
|
|
117
117
|
} & ProjectAnnotations<VueTypes & InferTypes<Addons>>): VuePreview<VueTypes & InferTypes<Addons>>;
|
|
118
118
|
type InferComponentArgs<C> = [keyof ComponentPropsAndSlots<C>] extends [never] ? Args : ComponentPropsAndSlots<C>;
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
entry_preview_exports,
|
|
3
3
|
renderToCanvas,
|
|
4
4
|
setup
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-FBNGCEV4.js";
|
|
6
6
|
import {
|
|
7
7
|
entry_preview_docs_exports
|
|
8
|
-
} from "./_browser-chunks/chunk-
|
|
8
|
+
} from "./_browser-chunks/chunk-AMGFSPJB.js";
|
|
9
9
|
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
10
10
|
|
|
11
11
|
// src/globals.ts
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as createVueComponentMetaChecker, i as collectComponentMetaSources } from "./chunk-Dka2iJUy.js";
|
|
2
|
-
import { DocgenProviderDescriptor, IndexEntry,
|
|
2
|
+
import { DocgenProviderDescriptor, IndexEntry, PresetProperty, PresetPropertyFn, StoryDocsProviderPreset, StorybookConfigRaw } from "storybook/internal/types";
|
|
3
3
|
import { parse } from "vue-docgen-api";
|
|
4
4
|
import { ImportParser } from "storybook/internal/core-server";
|
|
5
5
|
|
|
6
6
|
//#region code/renderers/vue3/.dts-emit/code/renderers/vue3/src/docgen/preset.d.ts
|
|
7
7
|
/** Contributes the Vue docgen worker descriptor. */
|
|
8
|
-
declare const experimental_docgenProvider: (existing
|
|
8
|
+
declare const experimental_docgenProvider: (existing?: DocgenProviderDescriptor[]) => Promise<DocgenProviderDescriptor[]>;
|
|
9
9
|
/** Declares the Vue component manifest engine. */
|
|
10
10
|
declare const experimental_manifests: PresetPropertyFn<'experimental_manifests', StorybookConfigRaw, {
|
|
11
11
|
manifestEntries: IndexEntry[];
|
|
@@ -34,8 +34,9 @@ interface VueDocgenEngine {
|
|
|
34
34
|
declare const experimental_vueDocgenEngine: () => Promise<VueDocgenEngine>;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region code/renderers/vue3/.dts-emit/code/renderers/vue3/src/preset.d.ts
|
|
37
|
+
declare const isDocgenProviderEnabled: () => boolean;
|
|
37
38
|
declare const features: PresetProperty<'features'>;
|
|
38
39
|
declare const previewAnnotations: PresetProperty<'previewAnnotations'>;
|
|
39
40
|
declare const experimental_importParsers: (input?: ImportParser[]) => Promise<ImportParser[]>;
|
|
40
41
|
//#endregion
|
|
41
|
-
export { DOCGEN_WORKER_SPECIFIER, experimental_docgenProvider, experimental_importParsers, experimental_manifests, experimental_storyDocsProvider, experimental_vueDocgenEngine, features, previewAnnotations };
|
|
42
|
+
export { DOCGEN_WORKER_SPECIFIER, experimental_docgenProvider, experimental_importParsers, experimental_manifests, experimental_storyDocsProvider, experimental_vueDocgenEngine, features, isDocgenProviderEnabled, previewAnnotations };
|
package/dist/preset.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yivn7rnheud from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yivn7rnheud from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yivn7rnheud from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yivn7rnheud.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yivn7rnheud.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yivn7rnheud.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
|
buildStoryDocsPayload
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
15
|
-
import "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-Z5PDHWYA.js";
|
|
15
|
+
import "./_node-chunks/chunk-57IUDZDV.js";
|
|
16
16
|
|
|
17
17
|
// src/preset.ts
|
|
18
18
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -24,12 +24,10 @@ import { fileURLToPath } from "node:url";
|
|
|
24
24
|
var DOCGEN_WORKER_SPECIFIER = "@storybook/vue3/internal/docgen-worker";
|
|
25
25
|
|
|
26
26
|
// src/docgen/preset.ts
|
|
27
|
-
var VUE_COMPONENT_META = "vue-component-meta", experimental_docgenProvider = async (existing = []
|
|
27
|
+
var VUE_COMPONENT_META = "vue-component-meta", experimental_docgenProvider = async (existing = []) => [
|
|
28
28
|
...existing,
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
], experimental_manifests = async (existingManifests = {}, options) => (await options.presets.apply("features", {}))?.experimentalDocgenServer !== !0 ? existingManifests : {
|
|
29
|
+
{ moduleSpecifier: fileURLToPath(import.meta.resolve(DOCGEN_WORKER_SPECIFIER)) }
|
|
30
|
+
], experimental_manifests = async (existingManifests = {}, options) => (await options.presets.apply("features", {}))?.docgenServer !== !0 ? existingManifests : {
|
|
33
31
|
...existingManifests,
|
|
34
32
|
components: {
|
|
35
33
|
v: 0,
|
|
@@ -62,12 +60,18 @@ var experimental_storyDocsProvider = async (nextStoryDocs, options) => {
|
|
|
62
60
|
|
|
63
61
|
// src/docgen/engine.ts
|
|
64
62
|
var experimental_vueDocgenEngine = async () => ({
|
|
65
|
-
componentMeta: () => import("./_node-chunks/component-meta-
|
|
66
|
-
vueDocgenApi: () => import("./_node-chunks/vue-docgen-api-
|
|
63
|
+
componentMeta: () => import("./_node-chunks/component-meta-J7KAZZBZ.js"),
|
|
64
|
+
vueDocgenApi: () => import("./_node-chunks/vue-docgen-api-BYHRPF6I.js")
|
|
67
65
|
});
|
|
68
66
|
|
|
69
67
|
// src/preset.ts
|
|
70
|
-
var
|
|
68
|
+
var isDocgenProviderEnabled = () => {
|
|
69
|
+
try {
|
|
70
|
+
return import.meta.resolve("typescript"), !0;
|
|
71
|
+
} catch {
|
|
72
|
+
return !1;
|
|
73
|
+
}
|
|
74
|
+
}, features = async (existing) => ({
|
|
71
75
|
...existing,
|
|
72
76
|
componentsManifest: !0
|
|
73
77
|
}), previewAnnotations = async (input = [], options) => {
|
|
@@ -76,7 +80,7 @@ var features = async (existing) => ({
|
|
|
76
80
|
docsEnabled ? [fileURLToPath3(import.meta.resolve("@storybook/vue3/entry-preview-docs"))] : []
|
|
77
81
|
);
|
|
78
82
|
}, experimental_importParsers = async (input = []) => {
|
|
79
|
-
let { vueImportParser } = await import("./_node-chunks/parsers-
|
|
83
|
+
let { vueImportParser } = await import("./_node-chunks/parsers-FP3M6J4A.js");
|
|
80
84
|
return [...input, vueImportParser];
|
|
81
85
|
};
|
|
82
86
|
export {
|
|
@@ -87,5 +91,6 @@ export {
|
|
|
87
91
|
experimental_storyDocsProvider,
|
|
88
92
|
experimental_vueDocgenEngine,
|
|
89
93
|
features,
|
|
94
|
+
isDocgenProviderEnabled,
|
|
90
95
|
previewAnnotations
|
|
91
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/vue3",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.5",
|
|
4
4
|
"description": "Storybook Vue 3 renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"vue-tsc": "latest"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"storybook": "^11.0.0-alpha.
|
|
74
|
+
"storybook": "^11.0.0-alpha.5",
|
|
75
75
|
"typescript": "^5.9.0 || ^6.0.0",
|
|
76
76
|
"vue": "^3.0.0"
|
|
77
77
|
},
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_6n1f9p7n6ba from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_6n1f9p7n6ba from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_6n1f9p7n6ba from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_6n1f9p7n6ba.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_6n1f9p7n6ba.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_6n1f9p7n6ba.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
// src/docgen/vue-docgen-api.ts
|
|
14
|
-
import { parse } from "vue-docgen-api";
|
|
15
|
-
export {
|
|
16
|
-
parse
|
|
17
|
-
};
|