@storybook/vue3
Advanced tools
Comparing version
import { | ||
a as c | ||
} from "./_browser-chunks/chunk-A47P2DCZ.js"; | ||
__name | ||
} from "./_browser-chunks/chunk-JFJ5UJ7Q.js"; | ||
// src/docs/sourceDecorator.ts | ||
import { SourceType as $ } from "storybook/internal/docs-tools"; | ||
import { emitTransformCode as _, useEffect as N } from "storybook/preview-api"; | ||
import { isVNode as j } from "vue"; | ||
var p = Symbol("DEEP_ACCESS_SYMBOL"), A = /* @__PURE__ */ c((e) => !!(e && typeof e == "object" && p in e), "isProxy"), S = /* @__PURE__ */ c((e, n) => { | ||
let a = e(); | ||
return N(() => { | ||
let o = P(n); | ||
k(n) || _(o, n); | ||
}), a; | ||
}, "sourceDecorator"), P = /* @__PURE__ */ c((e) => { | ||
let n = { | ||
import { SourceType } from "storybook/internal/docs-tools"; | ||
import { emitTransformCode, useEffect } from "storybook/preview-api"; | ||
import { isVNode } from "vue"; | ||
var TRACKING_SYMBOL = Symbol("DEEP_ACCESS_SYMBOL"); | ||
var isProxy = /* @__PURE__ */ __name((obj) => !!(obj && typeof obj === "object" && TRACKING_SYMBOL in obj), "isProxy"); | ||
var sourceDecorator = /* @__PURE__ */ __name((storyFn, ctx) => { | ||
const story = storyFn(); | ||
useEffect(() => { | ||
const sourceCode = generateSourceCode(ctx); | ||
if (shouldSkipSourceCodeGeneration(ctx)) { | ||
return; | ||
} | ||
emitTransformCode(sourceCode, ctx); | ||
}); | ||
return story; | ||
}, "sourceDecorator"); | ||
var generateSourceCode = /* @__PURE__ */ __name((ctx) => { | ||
const sourceCodeContext = { | ||
imports: {}, | ||
scriptVariables: {} | ||
}, { displayName: a, slotNames: o, eventNames: r } = x(e.component), s = C(e.args, o, r, n), t = b(e.args, o, n), i = a || e.title.split("/").at(-1), u = t ? `<${i} ${s}> ${t} </${i}>` : `<${i} ${s} />`, l = Object.entries(n.scriptVariables).map(([g, d]) => `const ${g} = ${d};`).join(` | ||
`), f = Object.entries(n.imports).map(([g, d]) => `import { ${Array.from(d.values()).sort().join(", ")} } from "${g}";`).join(` | ||
`), m = `<template> | ||
${u} | ||
}; | ||
const { displayName, slotNames, eventNames } = parseDocgenInfo(ctx.component); | ||
const props = generatePropsSourceCode(ctx.args, slotNames, eventNames, sourceCodeContext); | ||
const slotSourceCode = generateSlotSourceCode(ctx.args, slotNames, sourceCodeContext); | ||
const componentName = displayName || ctx.title.split("/").at(-1); | ||
const templateCode = slotSourceCode ? `<${componentName} ${props}> ${slotSourceCode} </${componentName}>` : `<${componentName} ${props} />`; | ||
const variablesCode = Object.entries(sourceCodeContext.scriptVariables).map(([name, value]) => `const ${name} = ${value};`).join("\n\n"); | ||
const importsCode = Object.entries(sourceCodeContext.imports).map(([packageName, imports]) => { | ||
return `import { ${Array.from(imports.values()).sort().join(", ")} } from "${packageName}";`; | ||
}).join("\n"); | ||
const template = `<template> | ||
${templateCode} | ||
</template>`; | ||
return !f && !l ? m : `<script lang="ts" setup> | ||
${f ? `${f} | ||
if (!importsCode && !variablesCode) { | ||
return template; | ||
} | ||
return `<script lang="ts" setup> | ||
${importsCode ? `${importsCode} | ||
${l}` : l} | ||
${variablesCode}` : variablesCode} | ||
<\/script> | ||
${m}`; | ||
}, "generateSourceCode"), k = /* @__PURE__ */ c((e) => { | ||
let n = e?.parameters.docs?.source; | ||
return n?.type === $.DYNAMIC ? !1 : !e?.parameters.__isArgsStory || n?.code || n?.type === $.CODE; | ||
}, "shouldSkipSourceCodeGeneration"), x = /* @__PURE__ */ c((e) => { | ||
if (!e || !("__docgenInfo" in e) || !e.__docgenInfo || typeof e.__docgenInfo != "object") | ||
${template}`; | ||
}, "generateSourceCode"); | ||
var shouldSkipSourceCodeGeneration = /* @__PURE__ */ __name((context) => { | ||
const sourceParams = context?.parameters.docs?.source; | ||
if (sourceParams?.type === SourceType.DYNAMIC) { | ||
return false; | ||
} | ||
const isArgsStory = context?.parameters.__isArgsStory; | ||
return !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE; | ||
}, "shouldSkipSourceCodeGeneration"); | ||
var parseDocgenInfo = /* @__PURE__ */ __name((component) => { | ||
if (!component || !("__docgenInfo" in component) || !component.__docgenInfo || typeof component.__docgenInfo !== "object") { | ||
return { | ||
displayName: e?.__name, | ||
displayName: component?.__name, | ||
eventNames: [], | ||
slotNames: [] | ||
}; | ||
let n = e.__docgenInfo, a = "displayName" in n && typeof n.displayName == "string" ? n.displayName : void 0, o = /* @__PURE__ */ c((r) => !(r in n) || !Array.isArray(n[r]) ? [] : n[r].map((t) => t && typeof t == "object" && "name" in t ? t.name : void 0).filter((t) => typeof t == "string"), "parseNames"); | ||
} | ||
const docgenInfo = component.__docgenInfo; | ||
const displayName = "displayName" in docgenInfo && typeof docgenInfo.displayName === "string" ? docgenInfo.displayName : void 0; | ||
const parseNames = /* @__PURE__ */ __name((key) => { | ||
if (!(key in docgenInfo) || !Array.isArray(docgenInfo[key])) { | ||
return []; | ||
} | ||
const values = docgenInfo[key]; | ||
return values.map((i) => i && typeof i === "object" && "name" in i ? i.name : void 0).filter((i) => typeof i === "string"); | ||
}, "parseNames"); | ||
return { | ||
displayName: a || e.__name, | ||
slotNames: o("slots").sort((r, s) => r === "default" ? -1 : s === "default" ? 1 : r.localeCompare(s)), | ||
eventNames: o("events") | ||
displayName: displayName || component.__name, | ||
slotNames: parseNames("slots").sort((a, b) => { | ||
if (a === "default") { | ||
return -1; | ||
} | ||
if (b === "default") { | ||
return 1; | ||
} | ||
return a.localeCompare(b); | ||
}), | ||
eventNames: parseNames("events") | ||
}; | ||
}, "parseDocgenInfo"), C = /* @__PURE__ */ c((e, n, a, o) => { | ||
let r = []; | ||
Object.entries(e).forEach(([t, i]) => { | ||
if (!n.includes(t) && i != null) | ||
switch (A(i) && (i = i.toString()), typeof i) { | ||
case "string": | ||
if (i === "") | ||
return; | ||
r.push({ | ||
name: t, | ||
value: i.includes('"') ? `'${i}'` : `"${i}"`, | ||
templateFn: /* @__PURE__ */ c((u, l) => `${u}=${l}`, "templateFn") | ||
}); | ||
break; | ||
case "number": | ||
r.push({ | ||
name: t, | ||
value: i.toString(), | ||
templateFn: /* @__PURE__ */ c((u, l) => `:${u}="${l}"`, "templateFn") | ||
}); | ||
break; | ||
case "bigint": | ||
r.push({ | ||
name: t, | ||
value: `BigInt(${i.toString()})`, | ||
templateFn: /* @__PURE__ */ c((u, l) => `:${u}="${l}"`, "templateFn") | ||
}); | ||
break; | ||
case "boolean": | ||
r.push({ | ||
name: t, | ||
value: i ? "true" : "false", | ||
templateFn: /* @__PURE__ */ c((u, l) => l === "true" ? u : `:${u}="false"`, "templateFn") | ||
}); | ||
break; | ||
case "symbol": | ||
r.push({ | ||
name: t, | ||
value: `Symbol(${i.description ? `'${i.description}'` : ""})`, | ||
templateFn: /* @__PURE__ */ c((u, l) => `:${u}="${l}"`, "templateFn") | ||
}); | ||
break; | ||
case "object": { | ||
r.push({ | ||
name: t, | ||
value: I(i ?? {}), | ||
// to follow Vue best practices, complex values like object and arrays are | ||
// usually placed inside the <script setup> block instead of inlining them in the <template> | ||
templateFn: void 0 | ||
}); | ||
break; | ||
}, "parseDocgenInfo"); | ||
var generatePropsSourceCode = /* @__PURE__ */ __name((args, slotNames, eventNames, ctx) => { | ||
const properties = []; | ||
Object.entries(args).forEach(([propName, value]) => { | ||
if (slotNames.includes(propName)) { | ||
return; | ||
} | ||
if (value == void 0) { | ||
return; | ||
} | ||
if (isProxy(value)) { | ||
value = value.toString(); | ||
} | ||
switch (typeof value) { | ||
case "string": | ||
if (value === "") { | ||
return; | ||
} | ||
case "function": | ||
break; | ||
properties.push({ | ||
name: propName, | ||
value: value.includes('"') ? `'${value}'` : `"${value}"`, | ||
templateFn: /* @__PURE__ */ __name((name, propValue) => `${name}=${propValue}`, "templateFn") | ||
}); | ||
break; | ||
case "number": | ||
properties.push({ | ||
name: propName, | ||
value: value.toString(), | ||
templateFn: /* @__PURE__ */ __name((name, propValue) => `:${name}="${propValue}"`, "templateFn") | ||
}); | ||
break; | ||
case "bigint": | ||
properties.push({ | ||
name: propName, | ||
value: `BigInt(${value.toString()})`, | ||
templateFn: /* @__PURE__ */ __name((name, propValue) => `:${name}="${propValue}"`, "templateFn") | ||
}); | ||
break; | ||
case "boolean": | ||
properties.push({ | ||
name: propName, | ||
value: value ? "true" : "false", | ||
templateFn: /* @__PURE__ */ __name((name, propValue) => propValue === "true" ? name : `:${name}="false"`, "templateFn") | ||
}); | ||
break; | ||
case "symbol": | ||
properties.push({ | ||
name: propName, | ||
value: `Symbol(${value.description ? `'${value.description}'` : ""})`, | ||
templateFn: /* @__PURE__ */ __name((name, propValue) => `:${name}="${propValue}"`, "templateFn") | ||
}); | ||
break; | ||
case "object": { | ||
properties.push({ | ||
name: propName, | ||
value: formatObject(value ?? {}), | ||
// to follow Vue best practices, complex values like object and arrays are | ||
// usually placed inside the <script setup> block instead of inlining them in the <template> | ||
templateFn: void 0 | ||
}); | ||
break; | ||
} | ||
}), r.sort((t, i) => t.name.localeCompare(i.name)); | ||
let s = []; | ||
return r.forEach((t) => { | ||
let i = a.includes(`update:${t.name}`); | ||
if (!i && t.templateFn) { | ||
s.push(t.templateFn(t.name, t.value)); | ||
case "function": | ||
break; | ||
} | ||
}); | ||
properties.sort((a, b) => a.name.localeCompare(b.name)); | ||
const props = []; | ||
properties.forEach((prop) => { | ||
const isVModel = eventNames.includes(`update:${prop.name}`); | ||
if (!isVModel && prop.templateFn) { | ||
props.push(prop.templateFn(prop.name, prop.value)); | ||
return; | ||
} | ||
let u = t.name; | ||
if (u in o.scriptVariables) { | ||
let l = 1; | ||
do | ||
u = `${t.name}${l}`, l++; | ||
while (u in o.scriptVariables); | ||
let variableName = prop.name; | ||
if (variableName in ctx.scriptVariables) { | ||
let index = 1; | ||
do { | ||
variableName = `${prop.name}${index}`; | ||
index++; | ||
} while (variableName in ctx.scriptVariables); | ||
} | ||
if (!i) { | ||
o.scriptVariables[u] = t.value, s.push(`:${t.name}="${u}"`); | ||
if (!isVModel) { | ||
ctx.scriptVariables[variableName] = prop.value; | ||
props.push(`:${prop.name}="${variableName}"`); | ||
return; | ||
} | ||
o.scriptVariables[u] = `ref(${t.value})`, o.imports.vue || (o.imports.vue = /* @__PURE__ */ new Set()), o.imports.vue.add("ref"), t.name === "modelValue" ? s.push(`v-model="${u}"`) : s.push(`v-model:${t.name}="${u}"`); | ||
}), s.join(" "); | ||
}, "generatePropsSourceCode"), b = /* @__PURE__ */ c((e, n, a) => { | ||
let o = []; | ||
return n.forEach((r) => { | ||
let s = e[r]; | ||
if (!s) | ||
ctx.scriptVariables[variableName] = `ref(${prop.value})`; | ||
if (!ctx.imports.vue) { | ||
ctx.imports.vue = /* @__PURE__ */ new Set(); | ||
} | ||
ctx.imports.vue.add("ref"); | ||
if (prop.name === "modelValue") { | ||
props.push(`v-model="${variableName}"`); | ||
} else { | ||
props.push(`v-model:${prop.name}="${variableName}"`); | ||
} | ||
}); | ||
return props.join(" "); | ||
}, "generatePropsSourceCode"); | ||
var generateSlotSourceCode = /* @__PURE__ */ __name((args, slotNames, ctx) => { | ||
const slotSourceCodes = []; | ||
slotNames.forEach((slotName) => { | ||
const arg = args[slotName]; | ||
if (!arg) { | ||
return; | ||
let t = y([s], a); | ||
if (!t) | ||
} | ||
const slotContent = generateSlotChildrenSourceCode([arg], ctx); | ||
if (!slotContent) { | ||
return; | ||
let i = typeof s == "function" ? h(s) : []; | ||
r === "default" && !i.length ? o.push(t) : o.push( | ||
`<template ${V(r, i)}>${t}</template>` | ||
); | ||
}), o.join(` | ||
`); | ||
}, "generateSlotSourceCode"), y = /* @__PURE__ */ c((e, n) => { | ||
let a = [], o = /* @__PURE__ */ c((r) => { | ||
if (j(r)) | ||
return O(r, n); | ||
switch (typeof r) { | ||
} | ||
const slotBindings = typeof arg === "function" ? getFunctionParamNames(arg) : []; | ||
if (slotName === "default" && !slotBindings.length) { | ||
slotSourceCodes.push(slotContent); | ||
} else { | ||
slotSourceCodes.push( | ||
`<template ${slotBindingsToString(slotName, slotBindings)}>${slotContent}</template>` | ||
); | ||
} | ||
}); | ||
return slotSourceCodes.join("\n\n"); | ||
}, "generateSlotSourceCode"); | ||
var generateSlotChildrenSourceCode = /* @__PURE__ */ __name((children, ctx) => { | ||
const slotChildrenSourceCodes = []; | ||
const generateSingleChildSourceCode = /* @__PURE__ */ __name((child) => { | ||
if (isVNode(child)) { | ||
return generateVNodeSourceCode(child, ctx); | ||
} | ||
switch (typeof child) { | ||
case "string": | ||
case "number": | ||
case "boolean": | ||
return r.toString(); | ||
return child.toString(); | ||
case "object": | ||
return r === null ? "" : Array.isArray(r) ? r.map(o).filter((s) => s !== "").join(` | ||
`) : JSON.stringify(r); | ||
if (child === null) { | ||
return ""; | ||
} | ||
if (Array.isArray(child)) { | ||
return child.map(generateSingleChildSourceCode).filter((code) => code !== "").join("\n"); | ||
} | ||
return JSON.stringify(child); | ||
case "function": { | ||
let s = h(r).filter( | ||
(f) => !["{", "}"].includes(f) | ||
), t = {}, i = {}; | ||
s.forEach((f) => { | ||
t[f] = `{{ ${f} }}`, i[f] = new Proxy( | ||
const paramNames = getFunctionParamNames(child).filter( | ||
(param) => !["{", "}"].includes(param) | ||
); | ||
const parameters = {}; | ||
const proxied = {}; | ||
paramNames.forEach((param) => { | ||
parameters[param] = `{{ ${param} }}`; | ||
proxied[param] = new Proxy( | ||
{ | ||
// we use the symbol to identify the proxy | ||
[p]: !0 | ||
[TRACKING_SYMBOL]: true | ||
}, | ||
{ | ||
// getter is called when any prop of the parameter is read | ||
get: /* @__PURE__ */ c((m, g) => g === p ? m[p] : [Symbol.toPrimitive, Symbol.toStringTag, "toString"].includes(g) ? () => `{{ ${f} }}` : g === "v-bind" ? `${f}` : `{{ ${f}.${g.toString()} }}`, "get"), | ||
get: /* @__PURE__ */ __name((t, key) => { | ||
if (key === TRACKING_SYMBOL) { | ||
return t[TRACKING_SYMBOL]; | ||
} | ||
if ([Symbol.toPrimitive, Symbol.toStringTag, "toString"].includes(key)) { | ||
return () => `{{ ${param} }}`; | ||
} | ||
if (key === "v-bind") { | ||
return `${param}`; | ||
} | ||
return `{{ ${param}.${key.toString()} }}`; | ||
}, "get"), | ||
// ownKeys is called, among other uses, when an object is destructured | ||
// in this case we assume the parameter is supposed to be bound using "v-bind" | ||
// Therefore we only return one special key "v-bind" and the getter will be called afterwards with it | ||
ownKeys: /* @__PURE__ */ c(() => ["v-bind"], "ownKeys"), | ||
ownKeys: /* @__PURE__ */ __name(() => { | ||
return [`v-bind`]; | ||
}, "ownKeys"), | ||
/** Called when destructured */ | ||
getOwnPropertyDescriptor: /* @__PURE__ */ c(() => ({ | ||
configurable: !0, | ||
enumerable: !0, | ||
value: f, | ||
writable: !0 | ||
getOwnPropertyDescriptor: /* @__PURE__ */ __name(() => ({ | ||
configurable: true, | ||
enumerable: true, | ||
value: param, | ||
writable: true | ||
}), "getOwnPropertyDescriptor") | ||
@@ -179,7 +272,8 @@ } | ||
}); | ||
let u = r(i); | ||
return y([u], n).replaceAll(/ (\S+)="{{ (\S+) }}"/g, ' :$1="$2"'); | ||
const returnValue = child(proxied); | ||
const slotSourceCode = generateSlotChildrenSourceCode([returnValue], ctx); | ||
return slotSourceCode.replaceAll(/ (\S+)="{{ (\S+) }}"/g, ` :$1="$2"`); | ||
} | ||
case "bigint": | ||
return `{{ BigInt(${r.toString()}) }}`; | ||
return `{{ BigInt(${child.toString()}) }}`; | ||
// the only missing case here is "symbol" | ||
@@ -191,44 +285,90 @@ // because rendering a symbol as slot / HTML does not make sense and is not supported by Vue | ||
}, "generateSingleChildSourceCode"); | ||
return e.forEach((r) => { | ||
let s = o(r); | ||
s !== "" && a.push(s); | ||
}), a.join(` | ||
`); | ||
}, "generateSlotChildrenSourceCode"), O = /* @__PURE__ */ c((e, n) => { | ||
let a = w(e), o = ""; | ||
typeof e.children == "string" ? o = e.children : Array.isArray(e.children) ? o = y(e.children, n) : e.children && (o = b( | ||
e.children, | ||
// $stable is a default property in vnode.children so we need to filter it out | ||
// to not generate source code for it | ||
Object.keys(e.children).filter((s) => s !== "$stable"), | ||
n | ||
)); | ||
let r = e.props ? C(e.props, [], [], n) : ""; | ||
return o ? `<${a}${r ? ` ${r}` : ""}>${o}</${a}>` : `<${a}${r ? ` ${r}` : ""} />`; | ||
}, "generateVNodeSourceCode"), w = /* @__PURE__ */ c((e) => { | ||
if (typeof e.type == "string") | ||
return e.type; | ||
if (typeof e.type == "object") { | ||
if ("name" in e.type && e.type.name) | ||
return e.type.name; | ||
if ("__name" in e.type && e.type.__name) | ||
return e.type.__name; | ||
children.forEach((child) => { | ||
const sourceCode = generateSingleChildSourceCode(child); | ||
if (sourceCode !== "") { | ||
slotChildrenSourceCodes.push(sourceCode); | ||
} | ||
}); | ||
return slotChildrenSourceCodes.join("\n"); | ||
}, "generateSlotChildrenSourceCode"); | ||
var generateVNodeSourceCode = /* @__PURE__ */ __name((vnode, ctx) => { | ||
const componentName = getVNodeName(vnode); | ||
let childrenCode = ""; | ||
if (typeof vnode.children === "string") { | ||
childrenCode = vnode.children; | ||
} else if (Array.isArray(vnode.children)) { | ||
childrenCode = generateSlotChildrenSourceCode(vnode.children, ctx); | ||
} else if (vnode.children) { | ||
childrenCode = generateSlotSourceCode( | ||
vnode.children, | ||
// $stable is a default property in vnode.children so we need to filter it out | ||
// to not generate source code for it | ||
Object.keys(vnode.children).filter((i) => i !== "$stable"), | ||
ctx | ||
); | ||
} | ||
const props = vnode.props ? generatePropsSourceCode(vnode.props, [], [], ctx) : ""; | ||
if (childrenCode) { | ||
return `<${componentName}${props ? ` ${props}` : ""}>${childrenCode}</${componentName}>`; | ||
} | ||
return `<${componentName}${props ? ` ${props}` : ""} />`; | ||
}, "generateVNodeSourceCode"); | ||
var getVNodeName = /* @__PURE__ */ __name((vnode) => { | ||
if (typeof vnode.type === "string") { | ||
return vnode.type; | ||
} | ||
if (typeof vnode.type === "object") { | ||
if ("name" in vnode.type && vnode.type.name) { | ||
return vnode.type.name; | ||
} else if ("__name" in vnode.type && vnode.type.__name) { | ||
return vnode.type.__name; | ||
} | ||
} | ||
return "component"; | ||
}, "getVNodeName"), h = /* @__PURE__ */ c((e) => { | ||
let n = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, a = /([^\s,]+)/g, o = e.toString().replace(n, ""), r = o.slice(o.indexOf("(") + 1, o.indexOf(")")).match(a); | ||
return r ? r.flatMap((s) => { | ||
if (["{", "}"].includes(s)) | ||
return s; | ||
let t = s.split(":")[0].trim(); | ||
return t.startsWith("{") ? ["{", t.substring(1)] : s.endsWith("}") && !t.endsWith("}") ? [t, "}"] : t; | ||
}) : []; | ||
}, "getFunctionParamNames"), V = /* @__PURE__ */ c((e, n) => n.length ? n.length === 1 ? `#${e}="${n[0]}"` : `#${e}="{ ${n.filter((a) => !["{", "}"].includes(a)).join(", ")} }"` : `#${e}`, "slotBindingsToString"), I = /* @__PURE__ */ c((e) => Object.values(e).every( | ||
(a) => a == null || typeof a != "object" | ||
) ? JSON.stringify(e) : JSON.stringify(e, null, 2), "formatObject"); | ||
}, "getVNodeName"); | ||
var getFunctionParamNames = /* @__PURE__ */ __name((func) => { | ||
const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; | ||
const ARGUMENT_NAMES = /([^\s,]+)/g; | ||
const fnStr = func.toString().replace(STRIP_COMMENTS, ""); | ||
const result = fnStr.slice(fnStr.indexOf("(") + 1, fnStr.indexOf(")")).match(ARGUMENT_NAMES); | ||
if (!result) { | ||
return []; | ||
} | ||
return result.flatMap((param) => { | ||
if (["{", "}"].includes(param)) { | ||
return param; | ||
} | ||
const nonMinifiedName = param.split(":")[0].trim(); | ||
if (nonMinifiedName.startsWith("{")) { | ||
return ["{", nonMinifiedName.substring(1)]; | ||
} | ||
if (param.endsWith("}") && !nonMinifiedName.endsWith("}")) { | ||
return [nonMinifiedName, "}"]; | ||
} | ||
return nonMinifiedName; | ||
}); | ||
}, "getFunctionParamNames"); | ||
var slotBindingsToString = /* @__PURE__ */ __name((slotName, params) => { | ||
if (!params.length) { | ||
return `#${slotName}`; | ||
} | ||
if (params.length === 1) { | ||
return `#${slotName}="${params[0]}"`; | ||
} | ||
return `#${slotName}="{ ${params.filter((i) => !["{", "}"].includes(i)).join(", ")} }"`; | ||
}, "slotBindingsToString"); | ||
var formatObject = /* @__PURE__ */ __name((obj) => { | ||
const isPrimitive = Object.values(obj).every( | ||
(value) => value == null || typeof value !== "object" | ||
); | ||
if (isPrimitive) { | ||
return JSON.stringify(obj); | ||
} | ||
return JSON.stringify(obj, null, 2); | ||
}, "formatObject"); | ||
// src/entry-preview-docs.ts | ||
var B = [S]; | ||
var decorators = [sourceDecorator]; | ||
export { | ||
B as decorators | ||
decorators | ||
}; |
import { | ||
a, | ||
c as b, | ||
d as c, | ||
e as d, | ||
f as e, | ||
g as f | ||
} from "./_browser-chunks/chunk-7WM5JEKB.js"; | ||
import "./_browser-chunks/chunk-A47P2DCZ.js"; | ||
argTypesEnhancers, | ||
decorateStory, | ||
mount, | ||
parameters, | ||
render, | ||
renderToCanvas | ||
} from "./_browser-chunks/chunk-GZHEVVQL.js"; | ||
import "./_browser-chunks/chunk-JFJ5UJ7Q.js"; | ||
export { | ||
c as applyDecorators, | ||
f as argTypesEnhancers, | ||
d as mount, | ||
e as parameters, | ||
a as render, | ||
b as renderToCanvas | ||
decorateStory as applyDecorators, | ||
argTypesEnhancers, | ||
mount, | ||
parameters, | ||
render, | ||
renderToCanvas | ||
}; |
import { | ||
b as S, | ||
c as a, | ||
h as i | ||
} from "./_browser-chunks/chunk-7WM5JEKB.js"; | ||
entry_preview_exports, | ||
renderToCanvas, | ||
setup | ||
} from "./_browser-chunks/chunk-GZHEVVQL.js"; | ||
import { | ||
a as t | ||
} from "./_browser-chunks/chunk-A47P2DCZ.js"; | ||
__name | ||
} from "./_browser-chunks/chunk-JFJ5UJ7Q.js"; | ||
// src/globals.ts | ||
import { global as d } from "@storybook/global"; | ||
var { window: m } = d; | ||
m.STORYBOOK_ENV = "vue3"; | ||
m.PLUGINS_SETUP_FUNCTIONS ||= /* @__PURE__ */ new Set(); | ||
import { global } from "@storybook/global"; | ||
var { window: globalWindow } = global; | ||
globalWindow.STORYBOOK_ENV = "vue3"; | ||
globalWindow.PLUGINS_SETUP_FUNCTIONS ||= /* @__PURE__ */ new Set(); | ||
// src/portable-stories.ts | ||
import { | ||
composeStories as l, | ||
composeStory as u, | ||
setProjectAnnotations as c, | ||
setDefaultProjectAnnotations as g | ||
composeStories as originalComposeStories, | ||
composeStory as originalComposeStory, | ||
setProjectAnnotations as originalSetProjectAnnotations, | ||
setDefaultProjectAnnotations | ||
} from "storybook/preview-api"; | ||
import { h as C } from "vue"; | ||
function O(o) { | ||
return g(A), c( | ||
o | ||
import { h } from "vue"; | ||
function setProjectAnnotations(projectAnnotations) { | ||
setDefaultProjectAnnotations(vueProjectAnnotations); | ||
return originalSetProjectAnnotations( | ||
projectAnnotations | ||
); | ||
} | ||
t(O, "setProjectAnnotations"); | ||
var A = { | ||
...i, | ||
__name(setProjectAnnotations, "setProjectAnnotations"); | ||
var vueProjectAnnotations = { | ||
...entry_preview_exports, | ||
/** @deprecated */ | ||
renderToCanvas: /* @__PURE__ */ t((o, e) => { | ||
if (o.storyContext.testingLibraryRender == null) | ||
return a(o, e); | ||
let { | ||
storyFn: r, | ||
storyContext: { testingLibraryRender: s } | ||
} = o, { unmount: n } = s(r(), { container: e }); | ||
return n; | ||
renderToCanvas: /* @__PURE__ */ __name((renderContext, canvasElement) => { | ||
if (renderContext.storyContext.testingLibraryRender == null) { | ||
return renderToCanvas(renderContext, canvasElement); | ||
} | ||
const { | ||
storyFn, | ||
storyContext: { testingLibraryRender: render } | ||
} = renderContext; | ||
const { unmount } = render(storyFn(), { container: canvasElement }); | ||
return unmount; | ||
}, "renderToCanvas") | ||
}; | ||
function T(o, e, r, s) { | ||
let n = u( | ||
o, | ||
e, | ||
r, | ||
globalThis.globalProjectAnnotations ?? A, | ||
s | ||
), p = /* @__PURE__ */ t((...y) => C(n(...y)), "renderable"); | ||
return Object.assign(p, n), p; | ||
function composeStory(story, componentAnnotations, projectAnnotations, exportsName) { | ||
const composedStory = originalComposeStory( | ||
story, | ||
componentAnnotations, | ||
projectAnnotations, | ||
globalThis.globalProjectAnnotations ?? vueProjectAnnotations, | ||
exportsName | ||
); | ||
const renderable = /* @__PURE__ */ __name((...args) => h(composedStory(...args)), "renderable"); | ||
Object.assign(renderable, composedStory); | ||
return renderable; | ||
} | ||
t(T, "composeStory"); | ||
function R(o, e) { | ||
return l(o, e, T); | ||
__name(composeStory, "composeStory"); | ||
function composeStories(csfExports, projectAnnotations) { | ||
const composedStories = originalComposeStories(csfExports, projectAnnotations, composeStory); | ||
return composedStories; | ||
} | ||
t(R, "composeStories"); | ||
__name(composeStories, "composeStories"); | ||
export { | ||
R as composeStories, | ||
T as composeStory, | ||
O as setProjectAnnotations, | ||
S as setup, | ||
A as vueProjectAnnotations | ||
composeStories, | ||
composeStory, | ||
setProjectAnnotations, | ||
setup, | ||
vueProjectAnnotations | ||
}; |
@@ -1,7 +0,7 @@ | ||
import "./_browser-chunks/chunk-A47P2DCZ.js"; | ||
import "./_browser-chunks/chunk-JFJ5UJ7Q.js"; | ||
// src/playwright.ts | ||
import { createPlaywrightTest as r } from "storybook/preview-api"; | ||
import { createPlaywrightTest } from "storybook/preview-api"; | ||
export { | ||
r as createTest | ||
createPlaywrightTest as createTest | ||
}; |
@@ -1,24 +0,26 @@ | ||
import CJS_COMPAT_NODE_URL from 'node:url'; | ||
import CJS_COMPAT_NODE_PATH from 'node:path'; | ||
import CJS_COMPAT_NODE_MODULE from "node:module"; | ||
import CJS_COMPAT_NODE_URL_nlzb0oymyjh from 'node:url'; | ||
import CJS_COMPAT_NODE_PATH_nlzb0oymyjh from 'node:path'; | ||
import CJS_COMPAT_NODE_MODULE_nlzb0oymyjh from "node:module"; | ||
const __filename = CJS_COMPAT_NODE_URL.fileURLToPath(import.meta.url); | ||
const __dirname = CJS_COMPAT_NODE_PATH.dirname(__filename); | ||
const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url); | ||
var __filename = CJS_COMPAT_NODE_URL_nlzb0oymyjh.fileURLToPath(import.meta.url); | ||
var __dirname = CJS_COMPAT_NODE_PATH_nlzb0oymyjh.dirname(__filename); | ||
var require = CJS_COMPAT_NODE_MODULE_nlzb0oymyjh.createRequire(import.meta.url); | ||
// ------------------------------------------------------------ | ||
// end of CJS compatibility banner, injected by Storybook's esbuild configuration | ||
// ------------------------------------------------------------ | ||
var n = Object.defineProperty; | ||
var o = (t, e) => n(t, "name", { value: e, configurable: !0 }); | ||
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
// src/preset.ts | ||
import { fileURLToPath as r } from "node:url"; | ||
var i = /* @__PURE__ */ o(async (t = [], e) => { | ||
let s = Object.keys(await e.presets.apply("docs", {}, e)).length > 0; | ||
return [].concat(t).concat([r(import.meta.resolve("@storybook/vue3/entry-preview"))]).concat( | ||
s ? [r(import.meta.resolve("@storybook/vue3/entry-preview-docs"))] : [] | ||
import { fileURLToPath } from "node:url"; | ||
var previewAnnotations = /* @__PURE__ */ __name(async (input = [], options) => { | ||
const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0; | ||
const result = []; | ||
return result.concat(input).concat([fileURLToPath(import.meta.resolve("@storybook/vue3/entry-preview"))]).concat( | ||
docsEnabled ? [fileURLToPath(import.meta.resolve("@storybook/vue3/entry-preview-docs"))] : [] | ||
); | ||
}, "previewAnnotations"); | ||
export { | ||
i as previewAnnotations | ||
previewAnnotations | ||
}; |
{ | ||
"name": "@storybook/vue3", | ||
"version": "0.0.0-pr-31819-sha-19546591", | ||
"version": "0.0.0-pr-31819-sha-19dfdec3", | ||
"description": "Storybook Vue 3 renderer", | ||
@@ -62,3 +62,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"storybook": "^0.0.0-pr-31819-sha-19546591", | ||
"storybook": "^0.0.0-pr-31819-sha-19dfdec3", | ||
"vue": "^3.0.0" | ||
@@ -69,3 +69,3 @@ }, | ||
}, | ||
"gitHead": "a6e7fd8a655c69780bc20b9749c2699e44beae78" | ||
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae14" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60863
22.26%1365
28.65%1
Infinity%