@storybook/vue3 10.6.0-alpha.2 → 10.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,12 +69,16 @@ var ARG_TYPE_SECTIONS = ["props", "events", "slots", "exposed", "expose"], extra
|
|
|
69
69
|
return;
|
|
70
70
|
let tableType = { summary: docgenInfo.type.replace(" | undefined", "") };
|
|
71
71
|
if (section === "props") {
|
|
72
|
-
let propInfo = docgenInfo, defaultValue = propInfo.default ? { summary: propInfo.default } : void 0;
|
|
72
|
+
let propInfo = docgenInfo, defaultValue = propInfo.default ? { summary: propInfo.default } : void 0, type = convertVueComponentMetaProp(propInfo), enumLabels = getEnumMemberLabels(propInfo.schema);
|
|
73
73
|
return {
|
|
74
74
|
name: propInfo.name,
|
|
75
75
|
description: formatDescriptionWithTags(propInfo.description, propInfo.tags),
|
|
76
76
|
defaultValue,
|
|
77
|
-
type
|
|
77
|
+
type,
|
|
78
|
+
// A TS enum member is selected by its runtime value, so the qualified name it is written
|
|
79
|
+
// as can only be a label. "control.type" is left to inferControls, which picks radio or
|
|
80
|
+
// select by option count just like it does for a plain literal union.
|
|
81
|
+
...enumLabels && type.name === "enum" ? { options: type.value, control: { labels: enumLabels } } : {},
|
|
78
82
|
table: {
|
|
79
83
|
type: tableType,
|
|
80
84
|
defaultValue,
|
|
@@ -95,7 +99,7 @@ var ARG_TYPE_SECTIONS = ["props", "events", "slots", "exposed", "expose"], extra
|
|
|
95
99
|
switch (schema.kind) {
|
|
96
100
|
case "enum": {
|
|
97
101
|
let definedSchemas = schema.schema?.filter((item) => item !== "undefined") ?? [];
|
|
98
|
-
return isBooleanSchema(definedSchemas) ? { name: "boolean", required } :
|
|
102
|
+
return isBooleanSchema(definedSchemas) ? { name: "boolean", required } : isSelectableUnionSchema(definedSchemas) ? { name: "enum", value: definedSchemas.map(selectableValue), required } : isEnumSchema(definedSchemas) ? fallbackSbType : definedSchemas.length === 1 ? convertVueComponentMetaProp({
|
|
99
103
|
schema: definedSchemas[0],
|
|
100
104
|
type: propInfo.type,
|
|
101
105
|
required
|
|
@@ -140,9 +144,12 @@ var ARG_TYPE_SECTIONS = ["props", "events", "slots", "exposed", "expose"], extra
|
|
|
140
144
|
default:
|
|
141
145
|
return fallbackSbType;
|
|
142
146
|
}
|
|
143
|
-
}, formatDescriptionWithTags = (description, tags) => !tags?.length || !description ? description ?? "" : `${tags.map((tag) => `@${tag.name}: ${tag.text}`).join("<br>")}<br><br>${description}`,
|
|
144
|
-
(
|
|
145
|
-
|
|
147
|
+
}, formatDescriptionWithTags = (description, tags) => !tags?.length || !description ? description ?? "" : `${tags.map((tag) => `@${tag.name}: ${tag.text}`).join("<br>")}<br><br>${description}`, isLiteralSchema = (schema) => typeof schema == "object" && schema.kind === "literal", isQuotedLiteral = (schema) => typeof schema == "string" && schema.startsWith('"') && schema.endsWith('"'), isSelectableUnionSchema = (schemas) => schemas.every((schema) => isQuotedLiteral(schema) || isLiteralSchema(schema)), selectableValue = (schema) => isLiteralSchema(schema) ? JSON.parse(schema.value) : schema.replace(/"/g, ""), getEnumMemberLabels = (schema) => {
|
|
148
|
+
if (typeof schema != "object" || schema.kind !== "enum")
|
|
149
|
+
return;
|
|
150
|
+
let members = (schema.schema ?? []).filter(isLiteralSchema);
|
|
151
|
+
return members.length ? Object.fromEntries(members.map((member) => [selectableValue(member), member.type])) : void 0;
|
|
152
|
+
}, isEnumSchema = (schemas) => schemas.every((schema) => typeof schema == "string" && schema.includes(".")), isBooleanSchema = (schemas) => schemas.length === 2 && schemas.includes("true") && schemas.includes("false");
|
|
146
153
|
|
|
147
154
|
// src/render.ts
|
|
148
155
|
import { createApp, h, isReactive, isVNode, reactive } from "vue";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gx8u2w437qe from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gx8u2w437qe from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gx8u2w437qe from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gx8u2w437qe.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gx8u2w437qe.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gx8u2w437qe.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/entry-preview.js
CHANGED
package/dist/index.js
CHANGED
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gx8u2w437qe from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gx8u2w437qe from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gx8u2w437qe from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gx8u2w437qe.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gx8u2w437qe.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gx8u2w437qe.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -18,7 +18,7 @@ var previewAnnotations = async (input = [], options) => {
|
|
|
18
18
|
docsEnabled ? [fileURLToPath(import.meta.resolve("@storybook/vue3/entry-preview-docs"))] : []
|
|
19
19
|
);
|
|
20
20
|
}, experimental_importParsers = async (input = []) => {
|
|
21
|
-
let { vueImportParser } = await import("./_node-chunks/parsers-
|
|
21
|
+
let { vueImportParser } = await import("./_node-chunks/parsers-OMLY3BJL.js");
|
|
22
22
|
return [...input, vueImportParser];
|
|
23
23
|
};
|
|
24
24
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/vue3",
|
|
3
|
-
"version": "10.6.0-alpha.
|
|
3
|
+
"version": "10.6.0-alpha.4",
|
|
4
4
|
"description": "Storybook Vue 3 renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"vue-tsc": "latest"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"storybook": "^10.6.0-alpha.
|
|
64
|
+
"storybook": "^10.6.0-alpha.4",
|
|
65
65
|
"vue": "^3.0.0"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|