@storybook/vue3 11.0.0-beta.1 → 11.0.0-beta.2
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-AMGFSPJB.js → chunk-A2HT2Y5M.js} +117 -11
- package/dist/_node-chunks/{chunk-I4ZYXPEH.js → chunk-CIJF3FGB.js} +6 -6
- package/dist/_node-chunks/chunk-KAK3PMTO.js +77 -0
- package/dist/_node-chunks/{chunk-GFNZQYCY.js → chunk-PVSYEICG.js} +8 -8
- package/dist/_node-chunks/{chunk-ZMD4HLGO.js → chunk-SHMQLVBP.js} +572 -120
- package/dist/_node-chunks/{component-meta-RANPVN4N.js → component-meta-QAI7SQD7.js} +7 -7
- package/dist/_node-chunks/{parsers-KQAJKRBM.js → parsers-4ZU4HLBA.js} +6 -6
- package/dist/_node-chunks/vue-docgen-api-CN5SXTKQ.js +17 -0
- package/dist/docgen/docgen-worker.js +9 -9
- package/dist/docgen/index.js +10 -10
- package/dist/entry-preview-docs.js +5 -3
- package/dist/index.js +1 -1
- package/dist/preset.js +11 -11
- package/package.json +2 -2
- package/dist/_node-chunks/chunk-Y735V2YT.js +0 -406
- package/dist/_node-chunks/vue-docgen-api-AHMNYNGX.js +0 -17
|
@@ -5,13 +5,118 @@ import {
|
|
|
5
5
|
// src/entry-preview-docs.ts
|
|
6
6
|
var entry_preview_docs_exports = {};
|
|
7
7
|
__export(entry_preview_docs_exports, {
|
|
8
|
-
decorators: () => decorators
|
|
8
|
+
decorators: () => decorators,
|
|
9
|
+
parameters: () => parameters
|
|
9
10
|
});
|
|
10
11
|
|
|
12
|
+
// src/docs/print-hole.ts
|
|
13
|
+
import { printValue, unknownHoleKind } from "storybook/internal/docs-tools";
|
|
14
|
+
import { isVNode } from "vue";
|
|
15
|
+
|
|
16
|
+
// src/snippet-values.ts
|
|
17
|
+
var attributeOrder = (a, b) => a.localeCompare(b), slotOrder = (a, b) => a === "default" ? -1 : b === "default" ? 1 : a.localeCompare(b);
|
|
18
|
+
function quoteAttributeValue(value) {
|
|
19
|
+
if (!value.includes("&")) {
|
|
20
|
+
if (!value.includes('"'))
|
|
21
|
+
return `"${value}"`;
|
|
22
|
+
if (!value.includes("'"))
|
|
23
|
+
return `'${value}'`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function printAttribute(name, value) {
|
|
27
|
+
switch (value.kind) {
|
|
28
|
+
case "boolean":
|
|
29
|
+
return value.value ? name : `:${name}="false"`;
|
|
30
|
+
case "string": {
|
|
31
|
+
let quoted = quoteAttributeValue(value.value);
|
|
32
|
+
return quoted === void 0 ? void 0 : `${name}=${quoted}`;
|
|
33
|
+
}
|
|
34
|
+
default:
|
|
35
|
+
return `:${name}="${value.code}"`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function escapeTextContent(text2) {
|
|
39
|
+
return text2.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("{{", "{{");
|
|
40
|
+
}
|
|
41
|
+
function interpolatedText(value) {
|
|
42
|
+
return value.kind === "code" ? void 0 : escapeTextContent(String(value.value));
|
|
43
|
+
}
|
|
44
|
+
function slotContent(value) {
|
|
45
|
+
if (value.kind === "code") {
|
|
46
|
+
let code2 = expressionCode(value.code, void 0);
|
|
47
|
+
return code2 === void 0 ? void 0 : `{{ ${code2} }}`;
|
|
48
|
+
}
|
|
49
|
+
let text2 = String(value.value);
|
|
50
|
+
return /^\s|\s$/.test(text2) ? void 0 : escapeTextContent(text2);
|
|
51
|
+
}
|
|
52
|
+
function expressionCode(code2, quote) {
|
|
53
|
+
return quote && code2.includes(quote) || code2.includes("}}") || code2.includes("&") ? void 0 : code2;
|
|
54
|
+
}
|
|
55
|
+
function operand(code2, readsOn) {
|
|
56
|
+
return code2.startsWith("-") || code2.startsWith("{") || readsOn && /^\d/.test(code2) ? `(${code2})` : code2;
|
|
57
|
+
}
|
|
58
|
+
function wrapSlotContent(name, content) {
|
|
59
|
+
return name === "default" ? content : `<template #${name}>
|
|
60
|
+
${indent(content)}
|
|
61
|
+
</template>`;
|
|
62
|
+
}
|
|
63
|
+
function indent(source, by = " ") {
|
|
64
|
+
return source.split(`
|
|
65
|
+
`).map((line) => line && `${by}${line}`).join(`
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/docs/print-hole.ts
|
|
70
|
+
var printHole = (hole, value) => {
|
|
71
|
+
let arg = hole.arg ?? "";
|
|
72
|
+
switch (hole.kind) {
|
|
73
|
+
case "attr":
|
|
74
|
+
return value === void 0 ? "" : attribute(hole.name ?? arg, arg, value);
|
|
75
|
+
case "props":
|
|
76
|
+
return Object.entries(value).filter(([name]) => !hole.except.includes(name)).sort(([a], [b]) => attributeOrder(a, b)).map(([name, item]) => attribute(name, name, item)).join(" ");
|
|
77
|
+
case "slots": {
|
|
78
|
+
let set = hole.slots.filter((name) => Object.hasOwn(value, name)).sort(slotOrder);
|
|
79
|
+
if (set.length === 0)
|
|
80
|
+
return hole.tag ? " />" : "";
|
|
81
|
+
let children = set.map((name) => wrapSlotContent(name, slot(name, value[name]))).map((child) => indent(child, hole.indent)).join(`
|
|
82
|
+
`);
|
|
83
|
+
return hole.tag ? `>
|
|
84
|
+
${children}
|
|
85
|
+
${hole.indent.slice(2)}</${hole.tag}>` : `
|
|
86
|
+
${children}`;
|
|
87
|
+
}
|
|
88
|
+
case "text":
|
|
89
|
+
return value === void 0 ? "" : hole.slot ? slot(arg, value) : text(arg, value);
|
|
90
|
+
case "value": {
|
|
91
|
+
let readsOn = hole.readsOn === !0;
|
|
92
|
+
if (hole.in === "attribute") {
|
|
93
|
+
let quote = hole.quote;
|
|
94
|
+
return operand(inAttribute(code(arg, value, quote === "'" ? '"' : "'"), quote), readsOn);
|
|
95
|
+
}
|
|
96
|
+
let printed = code(arg, value, "'");
|
|
97
|
+
return hole.in === "script" ? printed : operand(hole.in === "interpolation" ? inInterpolation(printed) : printed, readsOn);
|
|
98
|
+
}
|
|
99
|
+
default:
|
|
100
|
+
return unknownHoleKind(hole);
|
|
101
|
+
}
|
|
102
|
+
}, code = (name, value, quote) => printValue(value, name, { quote, opaque: isVNode });
|
|
103
|
+
function snippetValue(name, value) {
|
|
104
|
+
return typeof value == "boolean" ? { kind: "boolean", value } : typeof value == "string" ? { kind: "string", value } : typeof value == "number" && Number.isFinite(value) && value >= 0 && !Object.is(value, -0) ? { kind: "number", value, code: String(value) } : { kind: "code", code: code(name, value, "'") };
|
|
105
|
+
}
|
|
106
|
+
var inAttribute = (text2, quote) => text2.replaceAll("&", "&").replaceAll(quote, quote === '"' ? """ : "'"), inInterpolation = (text2) => text2.replaceAll("&", "&").replace(/}(?=})/g, "}\\");
|
|
107
|
+
function attribute(name, arg, value) {
|
|
108
|
+
let snippet = snippetValue(arg, value);
|
|
109
|
+
return snippet.kind === "code" ? `:${name}="${inAttribute(snippet.code, '"')}"` : printAttribute(name, snippet) ?? `${name}="${inAttribute(String(snippet.value), '"')}"`;
|
|
110
|
+
}
|
|
111
|
+
function text(name, value) {
|
|
112
|
+
return interpolatedText(snippetValue(name, value))?.replace(/\{$/, "{") ?? interpolation(name, value);
|
|
113
|
+
}
|
|
114
|
+
var slot = (name, value) => slotContent(snippetValue(name, value)) ?? interpolation(name, value), interpolation = (name, value) => `{{ ${inInterpolation(code(name, value, "'"))} }}`;
|
|
115
|
+
|
|
11
116
|
// src/docgen/story-docs/source-decorator/sourceDecorator.ts
|
|
12
117
|
import { SourceType } from "storybook/internal/docs-tools";
|
|
13
118
|
import { emitTransformCode, useEffect } from "storybook/preview-api";
|
|
14
|
-
import { isVNode } from "vue";
|
|
119
|
+
import { isVNode as isVNode2 } from "vue";
|
|
15
120
|
var TRACKING_SYMBOL = /* @__PURE__ */ Symbol("DEEP_ACCESS_SYMBOL"), isProxy = (obj) => !!(obj && typeof obj == "object" && TRACKING_SYMBOL in obj), sourceDecorator = (storyFn, ctx) => {
|
|
16
121
|
let story = storyFn();
|
|
17
122
|
return useEffect(() => {
|
|
@@ -137,18 +242,18 @@ ${template}`;
|
|
|
137
242
|
let arg = args[slotName];
|
|
138
243
|
if (!arg)
|
|
139
244
|
return;
|
|
140
|
-
let
|
|
141
|
-
if (!
|
|
245
|
+
let slotContent2 = generateSlotChildrenSourceCode([arg], ctx);
|
|
246
|
+
if (!slotContent2)
|
|
142
247
|
return;
|
|
143
248
|
let slotBindings = typeof arg == "function" ? getFunctionParamNames(arg) : [];
|
|
144
|
-
slotName === "default" && !slotBindings.length ? slotSourceCodes.push(
|
|
145
|
-
`<template ${slotBindingsToString(slotName, slotBindings)}>${
|
|
249
|
+
slotName === "default" && !slotBindings.length ? slotSourceCodes.push(slotContent2) : slotSourceCodes.push(
|
|
250
|
+
`<template ${slotBindingsToString(slotName, slotBindings)}>${slotContent2}</template>`
|
|
146
251
|
);
|
|
147
252
|
}), slotSourceCodes.join(`
|
|
148
253
|
`);
|
|
149
254
|
}, generateSlotChildrenSourceCode = (children, ctx) => {
|
|
150
255
|
let slotChildrenSourceCodes = [], generateSingleChildSourceCode = (child) => {
|
|
151
|
-
if (
|
|
256
|
+
if (isVNode2(child))
|
|
152
257
|
return generateVNodeSourceCode(child, ctx);
|
|
153
258
|
switch (typeof child) {
|
|
154
259
|
case "string":
|
|
@@ -156,14 +261,14 @@ ${template}`;
|
|
|
156
261
|
case "boolean":
|
|
157
262
|
return child.toString();
|
|
158
263
|
case "object":
|
|
159
|
-
return child === null ? "" : Array.isArray(child) ? child.map(generateSingleChildSourceCode).filter((
|
|
264
|
+
return child === null ? "" : Array.isArray(child) ? child.map(generateSingleChildSourceCode).filter((code2) => code2 !== "").join(`
|
|
160
265
|
`) : JSON.stringify(child);
|
|
161
266
|
case "function": {
|
|
162
267
|
let paramNames = getFunctionParamNames(child).filter(
|
|
163
268
|
(param) => !["{", "}"].includes(param)
|
|
164
|
-
),
|
|
269
|
+
), parameters2 = {}, proxied = {};
|
|
165
270
|
paramNames.forEach((param) => {
|
|
166
|
-
|
|
271
|
+
parameters2[param] = `{{ ${param} }}`, proxied[param] = new Proxy(
|
|
167
272
|
{
|
|
168
273
|
// we use the symbol to identify the proxy
|
|
169
274
|
[TRACKING_SYMBOL]: !0
|
|
@@ -235,9 +340,10 @@ ${template}`;
|
|
|
235
340
|
) ? JSON.stringify(obj) : JSON.stringify(obj, null, 2);
|
|
236
341
|
|
|
237
342
|
// src/entry-preview-docs.ts
|
|
238
|
-
var isDocgenServerEnabled = globalThis.FEATURES?.docgenServer, decorators = isDocgenServerEnabled ? [] : [sourceDecorator];
|
|
343
|
+
var isDocgenServerEnabled = globalThis.FEATURES?.docgenServer, decorators = isDocgenServerEnabled ? [] : [sourceDecorator], parameters = isDocgenServerEnabled ? { docs: { source: { printHole } } } : {};
|
|
239
344
|
|
|
240
345
|
export {
|
|
241
346
|
decorators,
|
|
347
|
+
parameters,
|
|
242
348
|
entry_preview_docs_exports
|
|
243
349
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_hh1gbq7a27h from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_hh1gbq7a27h from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_hh1gbq7a27h from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_hh1gbq7a27h.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_hh1gbq7a27h.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_hh1gbq7a27h.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_hh1gbq7a27h from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_hh1gbq7a27h from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_hh1gbq7a27h from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_hh1gbq7a27h.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_hh1gbq7a27h.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_hh1gbq7a27h.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/snippet-values.ts
|
|
14
|
+
var attributeOrder = (a, b) => a.localeCompare(b), slotOrder = (a, b) => a === "default" ? -1 : b === "default" ? 1 : a.localeCompare(b);
|
|
15
|
+
function quoteAttributeValue(value) {
|
|
16
|
+
if (!value.includes("&")) {
|
|
17
|
+
if (!value.includes('"'))
|
|
18
|
+
return `"${value}"`;
|
|
19
|
+
if (!value.includes("'"))
|
|
20
|
+
return `'${value}'`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function printAttribute(name, value) {
|
|
24
|
+
switch (value.kind) {
|
|
25
|
+
case "boolean":
|
|
26
|
+
return value.value ? name : `:${name}="false"`;
|
|
27
|
+
case "string": {
|
|
28
|
+
let quoted = quoteAttributeValue(value.value);
|
|
29
|
+
return quoted === void 0 ? void 0 : `${name}=${quoted}`;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return `:${name}="${value.code}"`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function escapeTextContent(text) {
|
|
36
|
+
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("{{", "{{");
|
|
37
|
+
}
|
|
38
|
+
function interpolatedText(value) {
|
|
39
|
+
return value.kind === "code" ? void 0 : escapeTextContent(String(value.value));
|
|
40
|
+
}
|
|
41
|
+
function slotContent(value) {
|
|
42
|
+
if (value.kind === "code") {
|
|
43
|
+
let code = expressionCode(value.code, void 0);
|
|
44
|
+
return code === void 0 ? void 0 : `{{ ${code} }}`;
|
|
45
|
+
}
|
|
46
|
+
let text = String(value.value);
|
|
47
|
+
return /^\s|\s$/.test(text) ? void 0 : escapeTextContent(text);
|
|
48
|
+
}
|
|
49
|
+
function expressionCode(code, quote) {
|
|
50
|
+
return quote && code.includes(quote) || code.includes("}}") || code.includes("&") ? void 0 : code;
|
|
51
|
+
}
|
|
52
|
+
function operand(code, readsOn) {
|
|
53
|
+
return code.startsWith("-") || code.startsWith("{") || readsOn && /^\d/.test(code) ? `(${code})` : code;
|
|
54
|
+
}
|
|
55
|
+
function wrapSlotContent(name, content) {
|
|
56
|
+
return name === "default" ? content : `<template #${name}>
|
|
57
|
+
${indent(content)}
|
|
58
|
+
</template>`;
|
|
59
|
+
}
|
|
60
|
+
function indent(source, by = " ") {
|
|
61
|
+
return source.split(`
|
|
62
|
+
`).map((line) => line && `${by}${line}`).join(`
|
|
63
|
+
`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
attributeOrder,
|
|
68
|
+
slotOrder,
|
|
69
|
+
printAttribute,
|
|
70
|
+
escapeTextContent,
|
|
71
|
+
interpolatedText,
|
|
72
|
+
slotContent,
|
|
73
|
+
expressionCode,
|
|
74
|
+
operand,
|
|
75
|
+
wrapSlotContent,
|
|
76
|
+
indent
|
|
77
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_hh1gbq7a27h from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_hh1gbq7a27h from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_hh1gbq7a27h from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_hh1gbq7a27h.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_hh1gbq7a27h.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_hh1gbq7a27h.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-KAK3PMTO.js";
|
|
15
15
|
import {
|
|
16
16
|
collectComponentMetaSources
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CIJF3FGB.js";
|
|
18
18
|
|
|
19
19
|
// src/docgen/component-docgen/arg-types/extractArgTypes.ts
|
|
20
20
|
import { convert, extractComponentProps, hasDocgen } from "storybook/internal/docs-tools";
|