@storybook/core
Advanced tools
Comparing version 0.0.0-pr-28768-sha-2e4b1992 to 0.0.0-pr-28768-sha-416cd00d
@@ -244,4 +244,4 @@ var Qt = Object.create; | ||
// src/channels/postmessage/index.ts | ||
import { logger as Ht, pretty as qt } from "@storybook/core/client-logger"; | ||
import * as Qn from "@storybook/core/core-events"; | ||
import { logger as Ht, pretty as qt } from "@storybook/core/client-logger"; | ||
@@ -248,0 +248,0 @@ // ../node_modules/telejson/dist/chunk-465TF3XA.mjs |
@@ -36,4 +36,4 @@ import ESM_COMPAT_Module from "node:module"; | ||
// ../node_modules/commander/index.js | ||
var le = j((C, ae) => { | ||
var Le = S("events").EventEmitter, G = S("child_process").spawn, y = S("path"), U = S("fs"), F = class { | ||
var ye = j((C, be) => { | ||
var Ze = S("events").EventEmitter, Y = S("child_process").spawn, y = S("path"), J = S("fs"), T = class { | ||
static { | ||
@@ -52,3 +52,3 @@ l(this, "Option"); | ||
!1; | ||
let n = re(e); | ||
let n = _e(e); | ||
this.short = n.shortFlag, this.long = n.longFlag, this.negate = !1, this.long && (this.negate = this.long.startsWith("--no-")), this.description = | ||
@@ -74,3 +74,3 @@ t || "", this.defaultValue = void 0; | ||
attributeName() { | ||
return He(this.name().replace(/^no-/, "")); | ||
return et(this.name().replace(/^no-/, "")); | ||
} | ||
@@ -87,3 +87,3 @@ /** | ||
} | ||
}, x = class extends Error { | ||
}, E = class extends Error { | ||
static { | ||
@@ -103,3 +103,3 @@ l(this, "CommanderError"); | ||
} | ||
}, I = class i extends Le { | ||
}, M = class i extends Ze { | ||
static { | ||
@@ -279,3 +279,3 @@ l(this, "Command"); | ||
_exit(e, t, n) { | ||
this._exitCallback && this._exitCallback(new x(e, t, n)), process.exit(e); | ||
this._exitCallback && this._exitCallback(new E(e, t, n)), process.exit(e); | ||
} | ||
@@ -347,3 +347,3 @@ /** | ||
_optionEx(e, t, n, o, s) { | ||
let a = new F(t, n), r = a.name(), c = a.attributeName(); | ||
let a = new T(t, n), r = a.name(), c = a.attributeName(); | ||
if (a.mandatory = !!e.mandatory, this._checkForOptionNameClash(a), typeof o != "function") | ||
@@ -588,3 +588,3 @@ if (o instanceof RegExp) { | ||
try { | ||
let u = U.realpathSync(s); | ||
let u = J.realpathSync(s); | ||
a = y.dirname(u); | ||
@@ -597,8 +597,8 @@ } catch { | ||
let c = y.join(a, r); | ||
U.existsSync(c) ? r = c : o.forEach((u) => { | ||
U.existsSync(`${c}${u}`) && (r = `${c}${u}`); | ||
J.existsSync(c) ? r = c : o.forEach((u) => { | ||
J.existsSync(`${c}${u}`) && (r = `${c}${u}`); | ||
}), n = o.includes(y.extname(r)); | ||
let h; | ||
process.platform !== "win32" ? n ? (t.unshift(r), t = oe(process.execArgv).concat(t), h = G(process.argv[0], t, { stdio: "inherit" })) : | ||
h = G(r, t, { stdio: "inherit" }) : (t.unshift(r), t = oe(process.execArgv).concat(t), h = G(process.execPath, t, { stdio: "inherit" })), | ||
process.platform !== "win32" ? n ? (t.unshift(r), t = fe(process.execArgv).concat(t), h = Y(process.argv[0], t, { stdio: "inherit" })) : | ||
h = Y(r, t, { stdio: "inherit" }) : (t.unshift(r), t = fe(process.execArgv).concat(t), h = Y(process.execPath, t, { stdio: "inherit" })), | ||
["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((u) => { | ||
@@ -611,3 +611,3 @@ process.on(u, () => { | ||
f ? h.on("close", () => { | ||
f(new x(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)")); | ||
f(new E(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)")); | ||
}) : h.on("close", process.exit.bind(process)), h.on("error", (u) => { | ||
@@ -625,3 +625,3 @@ if (u.code === "ENOENT") { | ||
else { | ||
let w = new x(1, "commander.executeSubCommandAsync", "(error)"); | ||
let w = new E(1, "commander.executeSubCommandAsync", "(error)"); | ||
w.nestedError = u, f(w); | ||
@@ -650,4 +650,4 @@ } | ||
else if (this._defaultCommandName) | ||
ne(this, t), this._dispatchSubcommand(this._defaultCommandName, e, t); | ||
else if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName && this._helpAndError(), ne( | ||
me(this, t), this._dispatchSubcommand(this._defaultCommandName, e, t); | ||
else if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName && this._helpAndError(), me( | ||
this, n.unknown), this._checkForMissingMandatoryOptions(), n.unknown.length > 0 && this.unknownOption(n.unknown[0]), this._actionHandler) { | ||
@@ -848,3 +848,3 @@ let o = this.args.slice(); | ||
this._version = e, t = t || "-V, --version", n = n || "output the version number"; | ||
let o = new F(t, n); | ||
let o = new T(t, n); | ||
return this._versionOptionName = o.attributeName(), this.options.push(o), this.on("option:" + o.name(), () => { | ||
@@ -904,3 +904,3 @@ process.stdout.write(e + ` | ||
if (this._usage) return this._usage; | ||
let t = this._args.map((n) => ie(n)); | ||
let t = this._args.map((n) => de(n)); | ||
return [].concat( | ||
@@ -932,3 +932,3 @@ this.options.length || this._hasHelpOption ? "[options]" : [], | ||
let e = this.commands.filter((t) => !t._hidden).map((t) => { | ||
let n = t._args.map((o) => ie(o)).join(" "); | ||
let n = t._args.map((o) => de(o)).join(" "); | ||
return [ | ||
@@ -991,3 +991,3 @@ t._name + (t._aliases[0] ? "|" + t._aliases[0] : "") + (t.options.length ? " [options]" : "") + (n ? " " + n : ""), | ||
function o(c, h) { | ||
return W(c, e) + " " + te(h, n, e + 2); | ||
return K(c, e) + " " + ue(h, n, e + 2); | ||
} | ||
@@ -1020,3 +1020,3 @@ l(o, "padOptionDetails"); | ||
let a = s[1] ? " " + s[1] : ""; | ||
return (a ? W(s[0], t) : s[0]) + te(a, o, t + 2); | ||
return (a ? K(s[0], t) : s[0]) + ue(a, o, t + 2); | ||
}).join(` | ||
@@ -1045,3 +1045,3 @@ `).replace(/^/gm, " "), | ||
e.push("Arguments:"), this._args.forEach((u) => { | ||
e.push(" " + W(u.name, h) + " " + se(c[u.name] || "", f, h + 4)); | ||
e.push(" " + K(u.name, h) + " " + ge(c[u.name] || "", f, h + 4)); | ||
}), e.push(""); | ||
@@ -1097,3 +1097,3 @@ } | ||
this._helpFlags = e || this._helpFlags, this._helpDescription = t || this._helpDescription; | ||
let n = re(this._helpFlags); | ||
let n = _e(this._helpFlags); | ||
return this._helpShortFlag = n.shortFlag, this._helpLongFlag = n.longFlag, this; | ||
@@ -1119,17 +1119,17 @@ } | ||
}; | ||
C = ae.exports = new I(); | ||
C = be.exports = new M(); | ||
C.program = C; | ||
C.Command = I; | ||
C.Option = F; | ||
C.CommanderError = x; | ||
function He(i) { | ||
C.Command = M; | ||
C.Option = T; | ||
C.CommanderError = E; | ||
function et(i) { | ||
return i.split("-").reduce((e, t) => e + t[0].toUpperCase() + t.slice(1)); | ||
} | ||
l(He, "camelcase"); | ||
function W(i, e) { | ||
l(et, "camelcase"); | ||
function K(i, e) { | ||
let t = Math.max(0, e - i.length); | ||
return i + Array(t + 1).join(" "); | ||
} | ||
l(W, "pad"); | ||
function se(i, e, t) { | ||
l(K, "pad"); | ||
function ge(i, e, t) { | ||
let n = new RegExp(".{1," + (e - 1) + "}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)", "g"); | ||
@@ -1140,18 +1140,18 @@ return (i.match(n) || []).map((s, a) => (s.slice(-1) === ` | ||
} | ||
l(se, "wrap"); | ||
function te(i, e, t) { | ||
return i.match(/[\n]\s+/) || e < 40 ? i : se(i, e, t); | ||
l(ge, "wrap"); | ||
function ue(i, e, t) { | ||
return i.match(/[\n]\s+/) || e < 40 ? i : ge(i, e, t); | ||
} | ||
l(te, "optionalWrap"); | ||
function ne(i, e) { | ||
l(ue, "optionalWrap"); | ||
function me(i, e) { | ||
i._hasHelpOption && e.find((n) => n === i._helpLongFlag || n === i._helpShortFlag) && (i.outputHelp(), i._exit(0, "commander.helpDisplay\ | ||
ed", "(outputHelp)")); | ||
} | ||
l(ne, "outputHelpIfRequested"); | ||
function ie(i) { | ||
l(me, "outputHelpIfRequested"); | ||
function de(i) { | ||
let e = i.name + (i.variadic === !0 ? "..." : ""); | ||
return i.required ? "<" + e + ">" : "[" + e + "]"; | ||
} | ||
l(ie, "humanReadableArgName"); | ||
function re(i) { | ||
l(de, "humanReadableArgName"); | ||
function _e(i) { | ||
let e, t, n = i.split(/[ |,]+/); | ||
@@ -1161,4 +1161,4 @@ return n.length > 1 && !/^[[<]/.test(n[1]) && (e = n.shift()), t = n.shift(), !e && /^-[^-]$/.test(t) && (e = t, t = void 0), { shortFlag: e, | ||
} | ||
l(re, "_parseOptionFlags"); | ||
function oe(i) { | ||
l(_e, "_parseOptionFlags"); | ||
function fe(i) { | ||
return i.map((e) => { | ||
@@ -1173,14 +1173,14 @@ if (!e.startsWith("--inspect")) | ||
} | ||
l(oe, "incrementNodeInspectorPort"); | ||
l(fe, "incrementNodeInspectorPort"); | ||
}); | ||
// ../node_modules/walk-up-path/dist/cjs/index.js | ||
var ve = j((B) => { | ||
var Oe = j((B) => { | ||
"use strict"; | ||
Object.defineProperty(B, "__esModule", { value: !0 }); | ||
B.walkUp = void 0; | ||
var Oe = S("path"), tt = /* @__PURE__ */ l(function* (i) { | ||
for (i = (0, Oe.resolve)(i); i; ) { | ||
var Ce = S("path"), tt = /* @__PURE__ */ l(function* (i) { | ||
for (i = (0, Ce.resolve)(i); i; ) { | ||
yield i; | ||
let e = (0, Oe.dirname)(i); | ||
let e = (0, Ce.dirname)(i); | ||
if (e === i) | ||
@@ -1195,7 +1195,7 @@ break; | ||
// ../node_modules/ts-dedent/dist/index.js | ||
var Ee = j((P) => { | ||
var ke = j((P) => { | ||
"use strict"; | ||
Object.defineProperty(P, "__esModule", { value: !0 }); | ||
P.dedent = void 0; | ||
function Ae(i) { | ||
function Ee(i) { | ||
for (var e = [], t = 1; t < arguments.length; t++) | ||
@@ -1232,13 +1232,15 @@ e[t - 1] = arguments[t]; | ||
} | ||
l(Ae, "dedent"); | ||
P.dedent = Ae; | ||
P.default = Ae; | ||
l(Ee, "dedent"); | ||
P.dedent = Ee; | ||
P.default = Ee; | ||
}); | ||
// src/cli/bin/index.ts | ||
var v = V(le(), 1); | ||
import { getEnvConfig as Fe, parseList as yt, versions as Ct } from "@storybook/core/common"; | ||
import { addToGlobalContext as Ot } from "@storybook/core/telemetry"; | ||
import { logger as Ne } from "@storybook/core/node-logger"; | ||
// node_modules/chalk/source/vendor/ansi-styles/index.js | ||
var ce = /* @__PURE__ */ l((i = 0) => (e) => `\x1B[${e + i}m`, "wrapAnsi16"), he = /* @__PURE__ */ l((i = 0) => (e) => `\x1B[${38 + i};5;${e}\ | ||
m`, "wrapAnsi256"), pe = /* @__PURE__ */ l((i = 0) => (e, t, n) => `\x1B[${38 + i};2;${e};${t};${n}m`, "wrapAnsi16m"), m = { | ||
var te = /* @__PURE__ */ l((i = 0) => (e) => `\x1B[${e + i}m`, "wrapAnsi16"), ne = /* @__PURE__ */ l((i = 0) => (e) => `\x1B[${38 + i};5;${e}\ | ||
m`, "wrapAnsi256"), ie = /* @__PURE__ */ l((i = 0) => (e, t, n) => `\x1B[${38 + i};2;${e};${t};${n}m`, "wrapAnsi16m"), m = { | ||
modifier: { | ||
@@ -1302,4 +1304,4 @@ reset: [0, 0], | ||
} | ||
}, xt = Object.keys(m.modifier), $e = Object.keys(m.color), je = Object.keys(m.bgColor), At = [...$e, ...je]; | ||
function Ve() { | ||
}, wt = Object.keys(m.modifier), Le = Object.keys(m.color), He = Object.keys(m.bgColor), xt = [...Le, ...He]; | ||
function $e() { | ||
let i = /* @__PURE__ */ new Map(); | ||
@@ -1320,4 +1322,4 @@ for (let [e, t] of Object.entries(m)) { | ||
enumerable: !1 | ||
}), m.color.close = "\x1B[39m", m.bgColor.close = "\x1B[49m", m.color.ansi = ce(), m.color.ansi256 = he(), m.color.ansi16m = pe(), m.bgColor. | ||
ansi = ce(10), m.bgColor.ansi256 = he(10), m.bgColor.ansi16m = pe(10), Object.defineProperties(m, { | ||
}), m.color.close = "\x1B[39m", m.bgColor.close = "\x1B[49m", m.color.ansi = te(), m.color.ansi256 = ne(), m.color.ansi16m = ie(), m.bgColor. | ||
ansi = te(10), m.bgColor.ansi256 = ne(10), m.bgColor.ansi16m = ie(10), Object.defineProperties(m, { | ||
rgbToAnsi256: { | ||
@@ -1384,10 +1386,10 @@ value(e, t, n) { | ||
} | ||
l(Ve, "assembleStyles"); | ||
var Ge = Ve(), _ = Ge; | ||
l($e, "assembleStyles"); | ||
var je = $e(), _ = je; | ||
// node_modules/chalk/source/vendor/supports-color/index.js | ||
import q from "node:process"; | ||
import Ue from "node:os"; | ||
import ue from "node:tty"; | ||
function g(i, e = globalThis.Deno ? globalThis.Deno.args : q.argv) { | ||
import G from "node:process"; | ||
import Ve from "node:os"; | ||
import oe from "node:tty"; | ||
function g(i, e = globalThis.Deno ? globalThis.Deno.args : G.argv) { | ||
let t = i.startsWith("-") ? "" : i.length === 1 ? "-" : "--", n = e.indexOf(t + i), o = e.indexOf("--"); | ||
@@ -1397,6 +1399,6 @@ return n !== -1 && (o === -1 || n < o); | ||
l(g, "hasFlag"); | ||
var { env: d } = q, R; | ||
g("no-color") || g("no-colors") || g("color=false") || g("color=never") ? R = 0 : (g("color") || g("colors") || g("color=true") || g("color=\ | ||
always")) && (R = 1); | ||
function We() { | ||
var { env: d } = G, I; | ||
g("no-color") || g("no-colors") || g("color=false") || g("color=never") ? I = 0 : (g("color") || g("colors") || g("color=true") || g("color=\ | ||
always")) && (I = 1); | ||
function Ge() { | ||
if ("FORCE_COLOR" in d) | ||
@@ -1406,4 +1408,4 @@ return d.FORCE_COLOR === "true" ? 1 : d.FORCE_COLOR === "false" ? 0 : d.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(d.FORCE_COLOR, | ||
} | ||
l(We, "envForceColor"); | ||
function qe(i) { | ||
l(Ge, "envForceColor"); | ||
function Ue(i) { | ||
return i === 0 ? !1 : { | ||
@@ -1416,7 +1418,7 @@ level: i, | ||
} | ||
l(qe, "translateLevel"); | ||
function Ye(i, { streamIsTTY: e, sniffFlags: t = !0 } = {}) { | ||
let n = We(); | ||
n !== void 0 && (R = n); | ||
let o = t ? R : n; | ||
l(Ue, "translateLevel"); | ||
function We(i, { streamIsTTY: e, sniffFlags: t = !0 } = {}) { | ||
let n = Ge(); | ||
n !== void 0 && (I = n); | ||
let o = t ? I : n; | ||
if (o === 0) | ||
@@ -1437,4 +1439,4 @@ return 0; | ||
return s; | ||
if (q.platform === "win32") { | ||
let a = Ue.release().split("."); | ||
if (G.platform === "win32") { | ||
let a = Ve.release().split("."); | ||
return Number(a[0]) >= 10 && Number(a[2]) >= 10586 ? Number(a[2]) >= 14931 ? 3 : 2 : 1; | ||
@@ -1461,18 +1463,18 @@ } | ||
} | ||
l(Ye, "_supportsColor"); | ||
function me(i, e = {}) { | ||
let t = Ye(i, { | ||
l(We, "_supportsColor"); | ||
function se(i, e = {}) { | ||
let t = We(i, { | ||
streamIsTTY: i && i.isTTY, | ||
...e | ||
}); | ||
return qe(t); | ||
return Ue(t); | ||
} | ||
l(me, "createSupportsColor"); | ||
var Je = { | ||
stdout: me({ isTTY: ue.isatty(1) }), | ||
stderr: me({ isTTY: ue.isatty(2) }) | ||
}, de = Je; | ||
l(se, "createSupportsColor"); | ||
var qe = { | ||
stdout: se({ isTTY: oe.isatty(1) }), | ||
stderr: se({ isTTY: oe.isatty(2) }) | ||
}, re = qe; | ||
// node_modules/chalk/source/utilities.js | ||
function fe(i, e, t) { | ||
function ae(i, e, t) { | ||
let n = i.indexOf(e); | ||
@@ -1487,4 +1489,4 @@ if (n === -1) | ||
} | ||
l(fe, "stringReplaceAll"); | ||
function ge(i, e, t, n) { | ||
l(ae, "stringReplaceAll"); | ||
function le(i, e, t, n) { | ||
let o = 0, s = ""; | ||
@@ -1500,6 +1502,6 @@ do { | ||
} | ||
l(ge, "stringEncaseCRLFWithFirstIndex"); | ||
l(le, "stringEncaseCRLFWithFirstIndex"); | ||
// node_modules/chalk/source/index.js | ||
var { stdout: _e, stderr: be } = de, Y = Symbol("GENERATOR"), A = Symbol("STYLER"), N = Symbol("IS_EMPTY"), ye = [ | ||
var { stdout: ce, stderr: he } = re, U = Symbol("GENERATOR"), x = Symbol("STYLER"), F = Symbol("IS_EMPTY"), pe = [ | ||
"ansi", | ||
@@ -1509,40 +1511,40 @@ "ansi", | ||
"ansi16m" | ||
], E = /* @__PURE__ */ Object.create(null), Ke = /* @__PURE__ */ l((i, e = {}) => { | ||
], A = /* @__PURE__ */ Object.create(null), Ye = /* @__PURE__ */ l((i, e = {}) => { | ||
if (e.level && !(Number.isInteger(e.level) && e.level >= 0 && e.level <= 3)) | ||
throw new Error("The `level` option should be an integer from 0 to 3"); | ||
let t = _e ? _e.level : 0; | ||
let t = ce ? ce.level : 0; | ||
i.level = e.level === void 0 ? t : e.level; | ||
}, "applyOptions"); | ||
var ze = /* @__PURE__ */ l((i) => { | ||
var Je = /* @__PURE__ */ l((i) => { | ||
let e = /* @__PURE__ */ l((...t) => t.join(" "), "chalk"); | ||
return Ke(e, i), Object.setPrototypeOf(e, T.prototype), e; | ||
return Ye(e, i), Object.setPrototypeOf(e, N.prototype), e; | ||
}, "chalkFactory"); | ||
function T(i) { | ||
return ze(i); | ||
function N(i) { | ||
return Je(i); | ||
} | ||
l(T, "createChalk"); | ||
Object.setPrototypeOf(T.prototype, Function.prototype); | ||
l(N, "createChalk"); | ||
Object.setPrototypeOf(N.prototype, Function.prototype); | ||
for (let [i, e] of Object.entries(_)) | ||
E[i] = { | ||
A[i] = { | ||
get() { | ||
let t = D(this, K(e.open, e.close, this[A]), this[N]); | ||
let t = R(this, q(e.open, e.close, this[x]), this[F]); | ||
return Object.defineProperty(this, i, { value: t }), t; | ||
} | ||
}; | ||
E.visible = { | ||
A.visible = { | ||
get() { | ||
let i = D(this, this[A], !0); | ||
let i = R(this, this[x], !0); | ||
return Object.defineProperty(this, "visible", { value: i }), i; | ||
} | ||
}; | ||
var J = /* @__PURE__ */ l((i, e, t, ...n) => i === "rgb" ? e === "ansi16m" ? _[t].ansi16m(...n) : e === "ansi256" ? _[t].ansi256(_.rgbToAnsi256( | ||
...n)) : _[t].ansi(_.rgbToAnsi(...n)) : i === "hex" ? J("rgb", e, t, ..._.hexToRgb(...n)) : _[t][i](...n), "getModelAnsi"), Qe = ["rgb", "he\ | ||
var W = /* @__PURE__ */ l((i, e, t, ...n) => i === "rgb" ? e === "ansi16m" ? _[t].ansi16m(...n) : e === "ansi256" ? _[t].ansi256(_.rgbToAnsi256( | ||
...n)) : _[t].ansi(_.rgbToAnsi(...n)) : i === "hex" ? W("rgb", e, t, ..._.hexToRgb(...n)) : _[t][i](...n), "getModelAnsi"), Ke = ["rgb", "he\ | ||
x", "ansi256"]; | ||
for (let i of Qe) { | ||
E[i] = { | ||
for (let i of Ke) { | ||
A[i] = { | ||
get() { | ||
let { level: t } = this; | ||
return function(...n) { | ||
let o = K(J(i, ye[t], "color", ...n), _.color.close, this[A]); | ||
return D(this, o, this[N]); | ||
let o = q(W(i, pe[t], "color", ...n), _.color.close, this[x]); | ||
return R(this, o, this[F]); | ||
}; | ||
@@ -1552,8 +1554,8 @@ } | ||
let e = "bg" + i[0].toUpperCase() + i.slice(1); | ||
E[e] = { | ||
A[e] = { | ||
get() { | ||
let { level: t } = this; | ||
return function(...n) { | ||
let o = K(J(i, ye[t], "bgColor", ...n), _.bgColor.close, this[A]); | ||
return D(this, o, this[N]); | ||
let o = q(W(i, pe[t], "bgColor", ...n), _.bgColor.close, this[x]); | ||
return R(this, o, this[F]); | ||
}; | ||
@@ -1563,15 +1565,15 @@ } | ||
} | ||
var Xe = Object.defineProperties(() => { | ||
var ze = Object.defineProperties(() => { | ||
}, { | ||
...E, | ||
...A, | ||
level: { | ||
enumerable: !0, | ||
get() { | ||
return this[Y].level; | ||
return this[U].level; | ||
}, | ||
set(i) { | ||
this[Y].level = i; | ||
this[U].level = i; | ||
} | ||
} | ||
}), K = /* @__PURE__ */ l((i, e, t) => { | ||
}), q = /* @__PURE__ */ l((i, e, t) => { | ||
let n, o; | ||
@@ -1585,9 +1587,9 @@ return t === void 0 ? (n = i, o = e) : (n = t.openAll + i, o = e + t.closeAll), { | ||
}; | ||
}, "createStyler"), D = /* @__PURE__ */ l((i, e, t) => { | ||
let n = /* @__PURE__ */ l((...o) => Ze(n, o.length === 1 ? "" + o[0] : o.join(" ")), "builder"); | ||
return Object.setPrototypeOf(n, Xe), n[Y] = i, n[A] = e, n[N] = t, n; | ||
}, "createBuilder"), Ze = /* @__PURE__ */ l((i, e) => { | ||
}, "createStyler"), R = /* @__PURE__ */ l((i, e, t) => { | ||
let n = /* @__PURE__ */ l((...o) => Qe(n, o.length === 1 ? "" + o[0] : o.join(" ")), "builder"); | ||
return Object.setPrototypeOf(n, ze), n[U] = i, n[x] = e, n[F] = t, n; | ||
}, "createBuilder"), Qe = /* @__PURE__ */ l((i, e) => { | ||
if (i.level <= 0 || !e) | ||
return i[N] ? "" : e; | ||
let t = i[A]; | ||
return i[F] ? "" : e; | ||
let t = i[x]; | ||
if (t === void 0) | ||
@@ -1598,39 +1600,17 @@ return e; | ||
for (; t !== void 0; ) | ||
e = fe(e, t.close, t.open), t = t.parent; | ||
e = ae(e, t.close, t.open), t = t.parent; | ||
let s = e.indexOf(` | ||
`); | ||
return s !== -1 && (e = ge(e, o, n, s)), n + e + o; | ||
return s !== -1 && (e = le(e, o, n, s)), n + e + o; | ||
}, "applyStyle"); | ||
Object.defineProperties(T.prototype, E); | ||
var et = T(), Lt = T({ level: be ? be.level : 0 }); | ||
var M = et; | ||
Object.defineProperties(N.prototype, A); | ||
var Xe = N(), Bt = N({ level: he ? he.level : 0 }); | ||
var D = Xe; | ||
// node_modules/leven/index.js | ||
var z = [], Ce = []; | ||
function Q(i, e) { | ||
if (i === e) | ||
return 0; | ||
let t = i; | ||
i.length > e.length && (i = e, e = t); | ||
let n = i.length, o = e.length; | ||
for (; n > 0 && i.charCodeAt(~-n) === e.charCodeAt(~-o); ) | ||
n--, o--; | ||
let s = 0; | ||
for (; s < n && i.charCodeAt(s) === e.charCodeAt(s); ) | ||
s++; | ||
if (n -= s, o -= s, n === 0) | ||
return o; | ||
let a, r, c, h, p = 0, f = 0; | ||
for (; p < n; ) | ||
Ce[p] = i.charCodeAt(s + p), z[p] = ++p; | ||
for (; f < o; ) | ||
for (a = e.charCodeAt(s + f), c = f++, r = f, p = 0; p < n; p++) | ||
h = a === Ce[p] ? c : c + 1, c = z[p], r = z[p] = c > r ? h > r ? r + 1 : h : h > c ? c + 1 : h; | ||
return r; | ||
} | ||
l(Q, "leven"); | ||
// src/cli/bin/index.ts | ||
var v = V(ye(), 1); | ||
// ../node_modules/fd-package-json/dist/esm/main.js | ||
var X = V(ve(), 1); | ||
import { resolve as we } from "node:path"; | ||
var z = V(Oe(), 1); | ||
import { resolve as ve } from "node:path"; | ||
import { stat as nt, readFile as it } from "node:fs/promises"; | ||
@@ -1655,4 +1635,4 @@ import { statSync as ot, readFileSync as st } from "node:fs"; | ||
async function lt(i) { | ||
for (let e of (0, X.walkUp)(i)) { | ||
let t = we(e, "package.json"); | ||
for (let e of (0, z.walkUp)(i)) { | ||
let t = ve(e, "package.json"); | ||
if (await rt(t)) | ||
@@ -1677,4 +1657,4 @@ return t; | ||
function ct(i) { | ||
for (let e of (0, X.walkUp)(i)) { | ||
let t = we(e, "package.json"); | ||
for (let e of (0, z.walkUp)(i)) { | ||
let t = ve(e, "package.json"); | ||
if (at(t)) | ||
@@ -1686,3 +1666,3 @@ return t; | ||
l(ct, "findPackagePathSync"); | ||
function xe(i) { | ||
function we(i) { | ||
let e = ct(i); | ||
@@ -1698,4 +1678,29 @@ if (!e) | ||
} | ||
l(xe, "findPackageSync"); | ||
l(we, "findPackageSync"); | ||
// node_modules/leven/index.js | ||
var Q = [], xe = []; | ||
function X(i, e) { | ||
if (i === e) | ||
return 0; | ||
let t = i; | ||
i.length > e.length && (i = e, e = t); | ||
let n = i.length, o = e.length; | ||
for (; n > 0 && i.charCodeAt(~-n) === e.charCodeAt(~-o); ) | ||
n--, o--; | ||
let s = 0; | ||
for (; s < n && i.charCodeAt(s) === e.charCodeAt(s); ) | ||
s++; | ||
if (n -= s, o -= s, n === 0) | ||
return o; | ||
let a, r, c, h, p = 0, f = 0; | ||
for (; p < n; ) | ||
xe[p] = i.charCodeAt(s + p), Q[p] = ++p; | ||
for (; f < o; ) | ||
for (a = e.charCodeAt(s + f), c = f++, r = f, p = 0; p < n; p++) | ||
h = a === xe[p] ? c : c + 1, c = Q[p], r = Q[p] = c > r ? h > r ? r + 1 : h : h > c ? c + 1 : h; | ||
return r; | ||
} | ||
l(X, "leven"); | ||
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js | ||
@@ -1713,14 +1718,31 @@ var ht = process.env.NODE_ENV === "production", Z = "Invariant failed"; | ||
// src/cli/bin/index.ts | ||
import { logger as Fe } from "@storybook/core/node-logger"; | ||
import { addToGlobalContext as yt } from "@storybook/core/telemetry"; | ||
import { parseList as Ct, getEnvConfig as Ne, versions as Ot } from "@storybook/core/common"; | ||
// src/cli/build.ts | ||
import { cache as pt } from "@storybook/core/common"; | ||
import { buildStaticStandalone as ut, withTelemetry as mt } from "@storybook/core/core-server"; | ||
var Ae = /* @__PURE__ */ l(async (i) => { | ||
let e = await L(__dirname); | ||
k(e, "Failed to find the closest package.json file."); | ||
let t = { | ||
...i, | ||
configDir: i.configDir || "./.storybook", | ||
outputDir: i.outputDir || "./storybook-static", | ||
ignorePreview: !!i.previewUrl && !i.forceBuildPreview, | ||
configType: "PRODUCTION", | ||
cache: pt, | ||
packageJson: e | ||
}; | ||
await mt( | ||
"build", | ||
{ cliOptions: i, presetOptions: t }, | ||
() => ut(t) | ||
); | ||
}, "build"); | ||
// src/cli/dev.ts | ||
var ee = V(Ee(), 1); | ||
import { logger as O, instance as pt } from "@storybook/core/node-logger"; | ||
import { buildDevStandalone as ut, withTelemetry as mt } from "@storybook/core/core-server"; | ||
import { cache as dt } from "@storybook/core/common"; | ||
function ft(i) { | ||
pt.heading = "", i instanceof Error ? i.error ? O.error(i.error) : i.stats && i.stats.compilation.errors ? i.stats.compilation.errors.forEach( | ||
import { buildDevStandalone as ft, withTelemetry as gt } from "@storybook/core/core-server"; | ||
import { logger as O, instance as _t } from "@storybook/core/node-logger"; | ||
var ee = V(ke(), 1); | ||
function bt(i) { | ||
_t.heading = "", i instanceof Error ? i.error ? O.error(i.error) : i.stats && i.stats.compilation.errors ? i.stats.compilation.errors.forEach( | ||
(e) => O.plain(e)) : O.error(i) : i.compilation?.errors && i.compilation.errors.forEach((e) => O.plain(e)), O.line(), O.warn( | ||
@@ -1736,4 +1758,4 @@ i.close ? ee.dedent` | ||
} | ||
l(ft, "printError"); | ||
var ke = /* @__PURE__ */ l(async (i) => { | ||
l(bt, "printError"); | ||
var Se = /* @__PURE__ */ l(async (i) => { | ||
process.env.NODE_ENV = process.env.NODE_ENV || "development"; | ||
@@ -1750,3 +1772,3 @@ let e = await L(__dirname); | ||
}; | ||
await mt( | ||
await gt( | ||
"dev", | ||
@@ -1756,33 +1778,11 @@ { | ||
presetOptions: t, | ||
printError: ft | ||
printError: bt | ||
}, | ||
() => ut(t) | ||
() => ft(t) | ||
); | ||
}, "dev"); | ||
// src/cli/build.ts | ||
import { buildStaticStandalone as gt, withTelemetry as _t } from "@storybook/core/core-server"; | ||
import { cache as bt } from "@storybook/core/common"; | ||
var Se = /* @__PURE__ */ l(async (i) => { | ||
let e = await L(__dirname); | ||
k(e, "Failed to find the closest package.json file."); | ||
let t = { | ||
...i, | ||
configDir: i.configDir || "./.storybook", | ||
outputDir: i.outputDir || "./storybook-static", | ||
ignorePreview: !!i.previewUrl && !i.forceBuildPreview, | ||
configType: "PRODUCTION", | ||
cache: bt, | ||
packageJson: e | ||
}; | ||
await _t( | ||
"build", | ||
{ cliOptions: i, presetOptions: t }, | ||
() => gt(t) | ||
); | ||
}, "build"); | ||
// src/cli/bin/index.ts | ||
yt("cliVersion", Ot.storybook); | ||
var b = xe(__dirname); | ||
Ot("cliVersion", Ct.storybook); | ||
var b = we(__dirname); | ||
k(b, "Failed to find the closest package.json file."); | ||
@@ -1803,3 +1803,3 @@ var H = console, Te = /* @__PURE__ */ l((i) => v.default.command(i).option( | ||
"Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)", | ||
Ct | ||
yt | ||
).option("--ssl-cert <cert>", "Provide an SSL certificate. (Required with --https)").option("--ssl-key <key>", "Provide an SSL key. (Require\ | ||
@@ -1820,4 +1820,4 @@ d with --https)").option("--smoke-test", "Exit after successful start").option("--ci", "CI mode (skip interactive prompts, don't open browse\ | ||
).action(async (i) => { | ||
Fe.setLevel(v.default.loglevel), H.log(M.bold(`${b.name} v${b.version}`) + M.reset(` | ||
`)), Ne(i, { | ||
Ne.setLevel(v.default.loglevel), H.log(D.bold(`${b.name} v${b.version}`) + D.reset(` | ||
`)), Fe(i, { | ||
port: "SBCONFIG_PORT", | ||
@@ -1828,3 +1828,3 @@ host: "SBCONFIG_HOSTNAME", | ||
ci: "CI" | ||
}), parseInt(`${i.port}`, 10) && (i.port = parseInt(`${i.port}`, 10)), await ke({ ...i, packageJson: b }).catch(() => process.exit(1)); | ||
}), parseInt(`${i.port}`, 10) && (i.port = parseInt(`${i.port}`, 10)), await Se({ ...i, packageJson: b }).catch(() => process.exit(1)); | ||
}); | ||
@@ -1841,8 +1841,8 @@ Te("build").option("-o, --output-dir <dir-name>", "Directory where to store built files").option("-c, --config-dir <dir-name>", "Directory w\ | ||
ly site using addon-docs").option("--test", "Build stories optimized for testing purposes.").action(async (i) => { | ||
process.env.NODE_ENV = process.env.NODE_ENV || "production", Fe.setLevel(v.default.loglevel), H.log(M.bold(`${b.name} v${b.version} | ||
`)), Ne(i, { | ||
process.env.NODE_ENV = process.env.NODE_ENV || "production", Ne.setLevel(v.default.loglevel), H.log(D.bold(`${b.name} v${b.version} | ||
`)), Fe(i, { | ||
staticDir: "SBCONFIG_STATIC_DIR", | ||
outputDir: "SBCONFIG_OUTPUT_DIR", | ||
configDir: "SBCONFIG_CONFIG_DIR" | ||
}), await Se({ | ||
}), await Ae({ | ||
...i, | ||
@@ -1859,3 +1859,3 @@ packageJson: b, | ||
); | ||
let t = v.default.commands.map((n) => n._name).find((n) => Q(n, i) < 3); | ||
let t = v.default.commands.map((n) => n._name).find((n) => X(n, i) < 3); | ||
t && H.info(` | ||
@@ -1862,0 +1862,0 @@ Did you mean ${t}?`), process.exit(1); |
@@ -85,3 +85,3 @@ import * as _storybook_core_common from '@storybook/core/common'; | ||
declare function detectFrameworkPreset(packageJson?: Partial<Pick<_storybook_core_common.PackageJson, "dependencies" | "peerDependencies" | "files" | "devDependencies">>): ProjectType | null; | ||
declare function detectFrameworkPreset(packageJson?: Partial<Pick<_storybook_core_common.PackageJson, "dependencies" | "devDependencies" | "files" | "peerDependencies">>): ProjectType | null; | ||
/** | ||
@@ -130,3 +130,3 @@ * Attempts to detect which builder to use, by searching for a vite config file or webpack installation. | ||
*/ | ||
declare const frameworkToRenderer: Record<"angular" | "ember" | "html-vite" | "html-webpack5" | "nextjs" | "preact-vite" | "preact-webpack5" | "react-vite" | "react-webpack5" | "server-webpack5" | "svelte-vite" | "svelte-webpack5" | "sveltekit" | "vue3-vite" | "vue3-webpack5" | "web-components-vite" | "web-components-webpack5" | "qwik" | "solid" | "react" | "react-native" | "vue3" | "preact" | "svelte" | "html" | "web-components" | "server", SupportedRenderers$1 | "vue">; | ||
declare const frameworkToRenderer: Record<"react-native" | "react" | "vue3" | "angular" | "html" | "web-components" | "ember" | "svelte" | "preact" | "server" | "qwik" | "solid" | "experimental-nextjs-vite" | "html-vite" | "html-webpack5" | "nextjs" | "preact-vite" | "preact-webpack5" | "react-vite" | "react-webpack5" | "server-webpack5" | "svelte-vite" | "svelte-webpack5" | "sveltekit" | "vue3-vite" | "vue3-webpack5" | "web-components-vite" | "web-components-webpack5", "vue" | SupportedRenderers$1>; | ||
declare const frameworkToDefaultBuilder: Record<SupportedFrameworks, CoreBuilder>; | ||
@@ -133,0 +133,0 @@ declare function copyTemplateFiles({ packageManager, renderer, language, destination, commonAssetsDir, }: CopyTemplateFilesOptions): Promise<void>; |
@@ -7,2 +7,89 @@ import * as _storybook_core_types from '@storybook/core/types'; | ||
declare const _default: { | ||
'@storybook/addon-a11y': string; | ||
'@storybook/addon-actions': string; | ||
'@storybook/addon-backgrounds': string; | ||
'@storybook/addon-controls': string; | ||
'@storybook/addon-docs': string; | ||
'@storybook/addon-essentials': string; | ||
'@storybook/addon-mdx-gfm': string; | ||
'@storybook/addon-highlight': string; | ||
'@storybook/addon-interactions': string; | ||
'@storybook/addon-jest': string; | ||
'@storybook/addon-links': string; | ||
'@storybook/addon-measure': string; | ||
'@storybook/addon-onboarding': string; | ||
'@storybook/addon-outline': string; | ||
'@storybook/addon-storysource': string; | ||
'@storybook/addon-themes': string; | ||
'@storybook/addon-toolbars': string; | ||
'@storybook/addon-viewport': string; | ||
'@storybook/experimental-addon-vitest': string; | ||
'@storybook/builder-vite': string; | ||
'@storybook/builder-webpack5': string; | ||
'@storybook/core': string; | ||
'@storybook/builder-manager': string; | ||
'@storybook/channels': string; | ||
'@storybook/client-logger': string; | ||
'@storybook/components': string; | ||
'@storybook/core-common': string; | ||
'@storybook/core-events': string; | ||
'@storybook/core-server': string; | ||
'@storybook/csf-tools': string; | ||
'@storybook/docs-tools': string; | ||
'@storybook/manager': string; | ||
'@storybook/manager-api': string; | ||
'@storybook/node-logger': string; | ||
'@storybook/preview': string; | ||
'@storybook/preview-api': string; | ||
'@storybook/router': string; | ||
'@storybook/telemetry': string; | ||
'@storybook/theming': string; | ||
'@storybook/types': string; | ||
'@storybook/angular': string; | ||
'@storybook/ember': string; | ||
'@storybook/experimental-nextjs-vite': string; | ||
'@storybook/html-vite': string; | ||
'@storybook/html-webpack5': string; | ||
'@storybook/nextjs': string; | ||
'@storybook/preact-vite': string; | ||
'@storybook/preact-webpack5': string; | ||
'@storybook/react-vite': string; | ||
'@storybook/react-webpack5': string; | ||
'@storybook/server-webpack5': string; | ||
'@storybook/svelte-vite': string; | ||
'@storybook/svelte-webpack5': string; | ||
'@storybook/sveltekit': string; | ||
'@storybook/vue3-vite': string; | ||
'@storybook/vue3-webpack5': string; | ||
'@storybook/web-components-vite': string; | ||
'@storybook/web-components-webpack5': string; | ||
'@storybook/blocks': string; | ||
storybook: string; | ||
sb: string; | ||
'@storybook/cli': string; | ||
'@storybook/codemod': string; | ||
'@storybook/core-webpack': string; | ||
'create-storybook': string; | ||
'@storybook/csf-plugin': string; | ||
'@storybook/instrumenter': string; | ||
'@storybook/react-dom-shim': string; | ||
'@storybook/source-loader': string; | ||
'@storybook/test': string; | ||
'@storybook/preset-create-react-app': string; | ||
'@storybook/preset-html-webpack': string; | ||
'@storybook/preset-preact-webpack': string; | ||
'@storybook/preset-react-webpack': string; | ||
'@storybook/preset-server-webpack': string; | ||
'@storybook/preset-svelte-webpack': string; | ||
'@storybook/preset-vue3-webpack': string; | ||
'@storybook/html': string; | ||
'@storybook/preact': string; | ||
'@storybook/react': string; | ||
'@storybook/server': string; | ||
'@storybook/svelte': string; | ||
'@storybook/vue3': string; | ||
'@storybook/web-components': string; | ||
}; | ||
type InterPresetOptions = Omit<CLIOptions & LoadOptions & BuilderOptions & { | ||
@@ -86,2 +173,49 @@ isCritical?: boolean; | ||
declare global { | ||
interface SymbolConstructor { | ||
readonly observable: symbol; | ||
} | ||
} | ||
// Helper type. Not useful on its own. | ||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never}; | ||
/** | ||
Create a type that has mutually exclusive keys. | ||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604). | ||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`. | ||
@example | ||
``` | ||
import type {MergeExclusive} from 'type-fest'; | ||
interface ExclusiveVariation1 { | ||
exclusive1: boolean; | ||
} | ||
interface ExclusiveVariation2 { | ||
exclusive2: string; | ||
} | ||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>; | ||
let exclusiveOptions: ExclusiveOptions; | ||
exclusiveOptions = {exclusive1: true}; | ||
//=> Works | ||
exclusiveOptions = {exclusive2: 'hi'}; | ||
//=> Works | ||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'}; | ||
//=> Error | ||
``` | ||
@category Object | ||
*/ | ||
type MergeExclusive<FirstType, SecondType> = | ||
(FirstType | SecondType) extends object ? | ||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) : | ||
FirstType | SecondType; | ||
type StdioOption = | ||
@@ -541,53 +675,5 @@ | 'pipe' | ||
declare global { | ||
interface SymbolConstructor { | ||
readonly observable: symbol; | ||
} | ||
} | ||
// Helper type. Not useful on its own. | ||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never}; | ||
/** | ||
Create a type that has mutually exclusive keys. | ||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604). | ||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`. | ||
@example | ||
``` | ||
import type {MergeExclusive} from 'type-fest'; | ||
interface ExclusiveVariation1 { | ||
exclusive1: boolean; | ||
} | ||
interface ExclusiveVariation2 { | ||
exclusive2: string; | ||
} | ||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>; | ||
let exclusiveOptions: ExclusiveOptions; | ||
exclusiveOptions = {exclusive1: true}; | ||
//=> Works | ||
exclusiveOptions = {exclusive2: 'hi'}; | ||
//=> Works | ||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'}; | ||
//=> Error | ||
``` | ||
@category Object | ||
*/ | ||
type MergeExclusive<FirstType, SecondType> = | ||
(FirstType | SecondType) extends object ? | ||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) : | ||
FirstType | SecondType; | ||
declare function temporaryDirectory({ prefix }?: { | ||
prefix?: string | undefined; | ||
}): Promise<string>; | ||
type FileOptions = MergeExclusive<{ | ||
@@ -858,88 +944,24 @@ /** | ||
declare const _default: { | ||
'@storybook/addon-a11y': string; | ||
'@storybook/addon-actions': string; | ||
'@storybook/addon-backgrounds': string; | ||
'@storybook/addon-controls': string; | ||
'@storybook/addon-docs': string; | ||
'@storybook/addon-essentials': string; | ||
'@storybook/addon-mdx-gfm': string; | ||
'@storybook/addon-highlight': string; | ||
'@storybook/addon-interactions': string; | ||
'@storybook/addon-jest': string; | ||
'@storybook/addon-links': string; | ||
'@storybook/addon-measure': string; | ||
'@storybook/addon-onboarding': string; | ||
'@storybook/addon-outline': string; | ||
'@storybook/addon-storysource': string; | ||
'@storybook/addon-themes': string; | ||
'@storybook/addon-toolbars': string; | ||
'@storybook/addon-viewport': string; | ||
'@storybook/experimental-addon-vitest': string; | ||
'@storybook/builder-vite': string; | ||
'@storybook/builder-webpack5': string; | ||
'@storybook/core': string; | ||
'@storybook/builder-manager': string; | ||
'@storybook/channels': string; | ||
'@storybook/client-logger': string; | ||
'@storybook/components': string; | ||
'@storybook/core-common': string; | ||
'@storybook/core-events': string; | ||
'@storybook/core-server': string; | ||
'@storybook/csf-tools': string; | ||
'@storybook/docs-tools': string; | ||
'@storybook/manager': string; | ||
'@storybook/manager-api': string; | ||
'@storybook/node-logger': string; | ||
'@storybook/preview': string; | ||
'@storybook/preview-api': string; | ||
'@storybook/router': string; | ||
'@storybook/telemetry': string; | ||
'@storybook/theming': string; | ||
'@storybook/types': string; | ||
'@storybook/angular': string; | ||
'@storybook/ember': string; | ||
'@storybook/html-vite': string; | ||
'@storybook/html-webpack5': string; | ||
'@storybook/nextjs': string; | ||
'@storybook/preact-vite': string; | ||
'@storybook/preact-webpack5': string; | ||
'@storybook/react-vite': string; | ||
'@storybook/react-webpack5': string; | ||
'@storybook/server-webpack5': string; | ||
'@storybook/svelte-vite': string; | ||
'@storybook/svelte-webpack5': string; | ||
'@storybook/sveltekit': string; | ||
'@storybook/vue3-vite': string; | ||
'@storybook/vue3-webpack5': string; | ||
'@storybook/web-components-vite': string; | ||
'@storybook/web-components-webpack5': string; | ||
'@storybook/blocks': string; | ||
storybook: string; | ||
sb: string; | ||
'@storybook/cli': string; | ||
'@storybook/codemod': string; | ||
'@storybook/core-webpack': string; | ||
'create-storybook': string; | ||
'@storybook/csf-plugin': string; | ||
'@storybook/instrumenter': string; | ||
'@storybook/react-dom-shim': string; | ||
'@storybook/source-loader': string; | ||
'@storybook/test': string; | ||
'@storybook/preset-create-react-app': string; | ||
'@storybook/preset-html-webpack': string; | ||
'@storybook/preset-preact-webpack': string; | ||
'@storybook/preset-react-webpack': string; | ||
'@storybook/preset-server-webpack': string; | ||
'@storybook/preset-svelte-webpack': string; | ||
'@storybook/preset-vue3-webpack': string; | ||
'@storybook/html': string; | ||
'@storybook/preact': string; | ||
'@storybook/react': string; | ||
'@storybook/server': string; | ||
'@storybook/svelte': string; | ||
'@storybook/vue3': string; | ||
'@storybook/web-components': string; | ||
interface StoryIdData { | ||
storyFilePath: string; | ||
exportedStoryName: string; | ||
} | ||
type GetStoryIdOptions = StoryIdData & { | ||
configDir: string; | ||
stories: StoriesEntry[]; | ||
workingDir?: string; | ||
userTitle?: string; | ||
storyFilePath: string; | ||
}; | ||
declare function getStoryId(data: StoryIdData, options: Options$2): Promise<{ | ||
storyId: string; | ||
kind: string; | ||
}>; | ||
declare function getStoryTitle({ storyFilePath, configDir, stories, workingDir, userTitle, }: Omit<GetStoryIdOptions, 'exportedStoryName'>): string | undefined; | ||
/** | ||
* Replaces the path separator with forward slashes | ||
*/ | ||
declare const posix: (localPath: string, seperator?: string) => string; | ||
declare const Cache: (options?: FileSystemCacheOptions | undefined) => FileSystemCache$1; | ||
@@ -950,2 +972,2 @@ type Options = Parameters<typeof Cache>['0']; | ||
export { type FileOptions, HandledError, type InstallationMetadata, JsPackageManager, JsPackageManagerFactory, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, boost, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, formatFileContent, frameworkPackages, frameworkToRenderer, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getInterpretedFileWithExt, getPackageDetails, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStorybookConfiguration, getStorybookInfo, globToRegexp, handlebars, interopRequireDefault, interpolate, isCorePackage, isPreservingSymlinks, loadAllPresets, loadCustomPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, paddedLog, parseList, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolvePathInStorybookCache, satisfies, serverRequire, serverResolve, stringifyEnvs, stringifyProcessEnvs, stripAbsNodeModulesPath, temporaryDirectory, temporaryFile, validateConfigurationFiles, validateFrameworkName, _default as versions }; | ||
export { type FileOptions, HandledError, type InstallationMetadata, JsPackageManager, JsPackageManagerFactory, type PackageJsonWithDepsAndDevDeps, type PackageJsonWithMaybeDeps, type PackageManagerName, type PackageMetadata, boost, builderPackages, cache, checkAddonOrder, codeLog, commandLog, commonGlobOptions, createFileSystemCache, createLogStream, extractProperFrameworkName, extractProperRendererNameFromFramework, filterPresetsConfig, findConfigFile, formatFileContent, frameworkPackages, frameworkToRenderer, getAutoRefs, getBuilderOptions, getChars, getCoercedStorybookVersion, getConfigInfo, getDirectoryFromWorkingDir, getEnvConfig, getFrameworkName, getInterpretedFile, getInterpretedFileWithExt, getPackageDetails, getPresets, getPreviewBodyTemplate, getPreviewHeadTemplate, getProjectRoot, getRefs, getRendererName, getStoryId, getStoryTitle, getStorybookConfiguration, getStorybookInfo, globToRegexp, handlebars, interopRequireDefault, interpolate, isCorePackage, isPreservingSymlinks, loadAllPresets, loadCustomPresets, loadEnvs, loadMainConfig, loadManagerOrAddonsFile, loadPreset, loadPreviewOrConfigFile, logConfig, nodePathsToArray, normalizeStories, normalizeStoriesEntry, normalizeStoryPath, paddedLog, parseList, posix, readTemplate, removeAddon, rendererPackages, resolveAddonName, resolvePathInStorybookCache, satisfies, serverRequire, serverResolve, stringifyEnvs, stringifyProcessEnvs, stripAbsNodeModulesPath, temporaryDirectory, temporaryFile, validateConfigurationFiles, validateFrameworkName, _default as versions }; |
@@ -1,4 +0,1 @@ | ||
// src/core-server/presets/common-manager.ts | ||
import { addons as d } from "@storybook/core/manager-api"; | ||
// ../node_modules/@storybook/global/dist/index.mjs | ||
@@ -12,2 +9,3 @@ var n = (() => { | ||
// src/core-server/presets/common-manager.ts | ||
import { addons as d } from "@storybook/core/manager-api"; | ||
var s = "static-filter"; | ||
@@ -14,0 +12,0 @@ d.register(s, (e) => { |
import { StrictArgTypes, Renderer, StoryContextForEnhancers, Options } from '@storybook/core/types'; | ||
import * as _storybook_csf from '@storybook/csf'; | ||
type Component = any; | ||
interface JsDocParam { | ||
@@ -31,4 +33,2 @@ name: string | undefined | null; | ||
type Component = any; | ||
type PropsExtractor = (component: Component) => { | ||
@@ -35,0 +35,0 @@ rows?: PropDef[]; |
import React, { ReactNode, FC, Component, ReactElement } from 'react'; | ||
import { API_ProviderData, API_IframeRenderer, Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, API_StateMerger, API_Provider, API_Notification, StoryId, API_Settings, API_LoadedRefData, API_PreparedStoryIndex, API_ViewMode, API_StatusState, API_FilterFunction, API_HashEntry, API_LeafEntry, API_StoryEntry, Args, API_IndexHash, API_ComposedRef, API_StatusUpdate, API_DocsEntry, API_Refs, API_SetRefData, API_ComposedRefUpdate, API_Layout, API_UI, API_PanelPositions, API_Versions, API_UnknownEntries, API_Version, Globals, GlobalTypes, Addon_BaseType, Addon_SidebarTopType, Addon_SidebarBottomType, Addon_PageType, Addon_WrapperType, Addon_Config, API_OptionsData, Parameters, ArgTypes } from '@storybook/core/types'; | ||
import { Channel, Listener } from '@storybook/core/channels'; | ||
export { Listener as ChannelListener } from '@storybook/core/channels'; | ||
import { RouterData, NavigateOptions } from '@storybook/core/router'; | ||
import { Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, Addon_BaseType, Addon_SidebarTopType, Addon_SidebarBottomType, Addon_PageType, Addon_WrapperType, Addon_Config, API_ProviderData, API_StateMerger, API_Provider, Globals, GlobalTypes, API_Layout, API_UI, API_PanelPositions, API_Notification, API_IframeRenderer, API_Refs, API_ComposedRef, API_SetRefData, API_ComposedRefUpdate, StoryId, API_Settings, API_LoadedRefData, API_PreparedStoryIndex, API_ViewMode, API_StatusState, API_FilterFunction, API_HashEntry, API_LeafEntry, API_StoryEntry, Args, API_IndexHash, API_StatusUpdate, API_DocsEntry, API_Versions, API_UnknownEntries, API_Version, API_OptionsData, Parameters, ArgTypes } from '@storybook/core/types'; | ||
export { Addon_Type as Addon, API_ComponentEntry as ComponentEntry, API_ComposedRef as ComposedRef, API_DocsEntry as DocsEntry, API_GroupEntry as GroupEntry, API_HashEntry as HashEntry, API_IndexHash as IndexHash, API_LeafEntry as LeafEntry, API_Refs as Refs, API_RootEntry as RootEntry, API_IndexHash as StoriesHash, API_StoryEntry as StoryEntry } from '@storybook/core/types'; | ||
import { RouterData, NavigateOptions } from '@storybook/core/router'; | ||
import { Listener, Channel } from '@storybook/core/channels'; | ||
export { Listener as ChannelListener } from '@storybook/core/channels'; | ||
import { ThemeVars } from '@storybook/core/theming'; | ||
import { toId } from '@storybook/csf'; | ||
import { ThemeVars } from '@storybook/core/theming'; | ||
import { WhatsNewData } from '@storybook/core/core-events'; | ||
declare function mockChannel(): Channel; | ||
declare class AddonStore { | ||
constructor(); | ||
private loaders; | ||
private elements; | ||
private config; | ||
private channel; | ||
private promise; | ||
private resolve; | ||
getChannel: () => Channel; | ||
ready: () => Promise<Channel>; | ||
hasChannel: () => boolean; | ||
setChannel: (channel: Channel) => void; | ||
getElements<T extends Addon_Types | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_SIDEBAR_TOP>(type: T): Addon_Collection<Addon_TypesMapping[T]> | any; | ||
/** | ||
* Adds an addon to the addon store. | ||
* @param {string} id - The id of the addon. | ||
* @param {Addon_Type} addon - The addon to add. | ||
* @returns {void} | ||
*/ | ||
add(id: string, addon: Addon_BaseType | Omit<Addon_SidebarTopType, 'id'> | Omit<Addon_SidebarBottomType, 'id'> | Omit<Addon_PageType, 'id'> | Omit<Addon_WrapperType, 'id'>): void; | ||
setConfig: (value: Addon_Config) => void; | ||
getConfig: () => Addon_Config; | ||
/** | ||
* Registers an addon loader function. | ||
* | ||
* @param {string} id - The id of the addon loader. | ||
* @param {(api: API) => void} callback - The function that will be called to register the addon. | ||
* @returns {void} | ||
*/ | ||
register: (id: string, callback: (api: API) => void) => void; | ||
loadAddons: (api: any) => void; | ||
} | ||
declare const addons: AddonStore; | ||
type GetState = () => State; | ||
@@ -47,6 +83,2 @@ type SetState = (a: any, b: any) => any; | ||
interface SubAPI$c { | ||
renderPreview?: API_IframeRenderer; | ||
} | ||
interface SubAPI$b { | ||
/** | ||
@@ -91,3 +123,3 @@ * Returns a collection of elements of a specific type. | ||
interface SubAPI$a { | ||
interface SubAPI$b { | ||
/** | ||
@@ -127,2 +159,91 @@ * Returns the channel object. | ||
interface SubState$9 { | ||
globals?: Globals; | ||
userGlobals?: Globals; | ||
storyGlobals?: Globals; | ||
globalTypes?: GlobalTypes; | ||
} | ||
interface SubAPI$a { | ||
/** | ||
* Returns the current globals, which is the user globals overlaid with the story globals | ||
* @returns {Globals} The current globals. | ||
*/ | ||
getGlobals: () => Globals; | ||
/** | ||
* Returns the current globals, as set by the user (a story may have override values) | ||
* @returns {Globals} The current user globals. | ||
*/ | ||
getUserGlobals: () => Globals /** | ||
/** | ||
* Returns the current globals, as set by the story | ||
* @returns {Globals} The current story globals. | ||
*/; | ||
getStoryGlobals: () => Globals /** | ||
* Returns the globalTypes, as defined at the project level. | ||
* @returns {GlobalTypes} The globalTypes. | ||
*/; | ||
getGlobalTypes: () => GlobalTypes; | ||
/** | ||
* Updates the current globals with the provided new globals. | ||
* @param {Globals} newGlobals - The new globals to update with. | ||
* @returns {void} | ||
*/ | ||
updateGlobals: (newGlobals: Globals) => void; | ||
} | ||
interface SubState$8 { | ||
layout: API_Layout; | ||
ui: API_UI; | ||
selectedPanel: string | undefined; | ||
theme: ThemeVars; | ||
} | ||
interface SubAPI$9 { | ||
/** | ||
* Toggles the fullscreen mode of the Storybook UI. | ||
* @param toggled - Optional boolean value to set the fullscreen mode to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleFullscreen: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the visibility of the panel in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the panel visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
togglePanel: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the position of the panel in the Storybook UI. | ||
* @param position - Optional string value to set the panel position to. If not provided, it will toggle between 'bottom' and 'right'. | ||
*/ | ||
togglePanelPosition: (position?: API_PanelPositions) => void; | ||
/** | ||
* Toggles the visibility of the navigation bar in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the navigation bar visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleNav: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the visibility of the toolbar in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the toolbar visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleToolbar: (toggled?: boolean) => void; | ||
/** | ||
* Sets the options for the Storybook UI. | ||
* @param options - An object containing the options to set. | ||
*/ | ||
setOptions: (options: any) => void; | ||
/** | ||
* Sets the sizes of the resizable elements in the layout. | ||
*/ | ||
setSizes: (options: Partial<Pick<API_Layout, 'navSize' | 'bottomPanelHeight' | 'rightPanelWidth'>>) => void; | ||
/** | ||
* getIsFullscreen - Returns the current fullscreen mode of the Storybook UI. | ||
*/ | ||
getIsFullscreen: () => boolean; | ||
/** | ||
* getIsPanelShown - Returns the current visibility of the panel in the Storybook UI. | ||
*/ | ||
getIsPanelShown: () => boolean; | ||
/** | ||
* getIsNavShown - Returns the current visibility of the navigation bar in the Storybook UI. | ||
*/ | ||
getIsNavShown: () => boolean; | ||
} | ||
interface SubState$7 { | ||
notifications: API_Notification[]; | ||
@@ -133,3 +254,3 @@ } | ||
*/ | ||
interface SubAPI$9 { | ||
interface SubAPI$8 { | ||
/** | ||
@@ -148,3 +269,55 @@ * Adds a new notification to the list of notifications. | ||
interface SubAPI$8 { | ||
interface SubAPI$7 { | ||
renderPreview?: API_IframeRenderer; | ||
} | ||
interface SubState$6 { | ||
refs: API_Refs; | ||
} | ||
interface SubAPI$6 { | ||
/** | ||
* Finds a composed ref by its source. | ||
* @param {string} source - The source/URL of the composed ref. | ||
* @returns {API_ComposedRef} - The composed ref object. | ||
*/ | ||
findRef: (source: string) => API_ComposedRef; | ||
/** | ||
* Sets a composed ref by its ID and data. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {API_SetRefData} data - The data to set for the composed ref. | ||
* @param {boolean} [ready] - Whether the composed ref is ready. | ||
*/ | ||
setRef: (id: string, data: API_SetRefData, ready?: boolean) => void; | ||
/** | ||
* Updates a composed ref by its ID and update object. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {API_ComposedRefUpdate} ref - The update object for the composed ref. | ||
*/ | ||
updateRef: (id: string, ref: API_ComposedRefUpdate) => Promise<void>; | ||
/** | ||
* Gets all composed refs. | ||
* @returns {API_Refs} - The composed refs object. | ||
*/ | ||
getRefs: () => API_Refs; | ||
/** | ||
* Checks if a composed ref is valid. | ||
* @param {API_SetRefData} ref - The composed ref to check. | ||
* @returns {Promise<void>} - A promise that resolves when the check is complete. | ||
*/ | ||
checkRef: (ref: API_SetRefData) => Promise<void>; | ||
/** | ||
* Changes the version of a composed ref by its ID and URL. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {string} url - The new URL for the composed ref. | ||
*/ | ||
changeRefVersion: (id: string, url: string) => Promise<void>; | ||
/** | ||
* Changes the state of a composed ref by its ID and previewInitialized flag. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {boolean} previewInitialized - The new previewInitialized flag for the composed ref. | ||
*/ | ||
changeRefState: (id: string, previewInitialized: boolean) => void; | ||
} | ||
interface SubAPI$5 { | ||
storeSelection: () => void; | ||
@@ -168,6 +341,119 @@ retrieveSelection: () => StoryId; | ||
} | ||
interface SubState$8 { | ||
interface SubState$5 { | ||
settings: API_Settings; | ||
} | ||
declare const isMacLike: () => boolean; | ||
declare const controlOrMetaSymbol: () => "⌘" | "ctrl"; | ||
declare const controlOrMetaKey: () => "control" | "meta"; | ||
declare const optionOrAltSymbol: () => "⌥" | "alt"; | ||
declare const isShortcutTaken: (arr1: string[], arr2: string[]) => boolean; | ||
type KeyboardEventLike = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'key' | 'code' | 'keyCode' | 'preventDefault'>; | ||
declare const eventToShortcut: (e: KeyboardEventLike) => (string | string[])[] | null; | ||
declare const shortcutMatchesShortcut: (inputShortcut: (string | string[])[], shortcut: API_KeyCollection) => boolean; | ||
declare const eventMatchesShortcut: (e: KeyboardEventLike, shortcut: API_KeyCollection) => boolean; | ||
declare const keyToSymbol: (key: string) => string; | ||
declare const shortcutToHumanString: (shortcut: API_KeyCollection) => string; | ||
interface SubState$4 { | ||
shortcuts: API_Shortcuts; | ||
} | ||
interface SubAPI$4 { | ||
/** | ||
* Returns the current shortcuts. | ||
*/ | ||
getShortcutKeys(): API_Shortcuts; | ||
/** | ||
* Returns the default shortcuts. | ||
*/ | ||
getDefaultShortcuts(): API_Shortcuts | API_AddonShortcutDefaults; | ||
/** | ||
* Returns the shortcuts for addons. | ||
*/ | ||
getAddonsShortcuts(): API_AddonShortcuts; | ||
/** | ||
* Returns the labels for addon shortcuts. | ||
*/ | ||
getAddonsShortcutLabels(): API_AddonShortcutLabels; | ||
/** | ||
* Returns the default shortcuts for addons. | ||
*/ | ||
getAddonsShortcutDefaults(): API_AddonShortcutDefaults; | ||
/** | ||
* Sets the shortcuts to the given value. | ||
* @param shortcuts The new shortcuts to set. | ||
* @returns A promise that resolves to the new shortcuts. | ||
*/ | ||
setShortcuts(shortcuts: API_Shortcuts): Promise<API_Shortcuts>; | ||
/** | ||
* Sets the shortcut for the given action to the given value. | ||
* @param action The action to set the shortcut for. | ||
* @param value The new shortcut to set. | ||
* @returns A promise that resolves to the new shortcut. | ||
*/ | ||
setShortcut(action: API_Action, value: API_KeyCollection): Promise<API_KeyCollection>; | ||
/** | ||
* Sets the shortcut for the given addon to the given value. | ||
* @param addon The addon to set the shortcut for. | ||
* @param shortcut The new shortcut to set. | ||
* @returns A promise that resolves to the new addon shortcut. | ||
*/ | ||
setAddonShortcut(addon: string, shortcut: API_AddonShortcut): Promise<API_AddonShortcut>; | ||
/** | ||
* Restores all default shortcuts. | ||
* @returns A promise that resolves to the new shortcuts. | ||
*/ | ||
restoreAllDefaultShortcuts(): Promise<API_Shortcuts>; | ||
/** | ||
* Restores the default shortcut for the given action. | ||
* @param action The action to restore the default shortcut for. | ||
* @returns A promise that resolves to the new shortcut. | ||
*/ | ||
restoreDefaultShortcut(action: API_Action): Promise<API_KeyCollection>; | ||
/** | ||
* Handles a keydown event. | ||
* @param event The event to handle. | ||
*/ | ||
handleKeydownEvent(event: KeyboardEventLike): void; | ||
/** | ||
* Handles a shortcut feature. | ||
* @param feature The feature to handle. | ||
* @param event The event to handle. | ||
*/ | ||
handleShortcutFeature(feature: API_Action, event: KeyboardEventLike): void; | ||
} | ||
type API_KeyCollection = string[]; | ||
interface API_Shortcuts { | ||
fullScreen: API_KeyCollection; | ||
togglePanel: API_KeyCollection; | ||
panelPosition: API_KeyCollection; | ||
toggleNav: API_KeyCollection; | ||
toolbar: API_KeyCollection; | ||
search: API_KeyCollection; | ||
focusNav: API_KeyCollection; | ||
focusIframe: API_KeyCollection; | ||
focusPanel: API_KeyCollection; | ||
prevComponent: API_KeyCollection; | ||
nextComponent: API_KeyCollection; | ||
prevStory: API_KeyCollection; | ||
nextStory: API_KeyCollection; | ||
shortcutsPage: API_KeyCollection; | ||
aboutPage: API_KeyCollection; | ||
escape: API_KeyCollection; | ||
collapseAll: API_KeyCollection; | ||
expandAll: API_KeyCollection; | ||
remount: API_KeyCollection; | ||
} | ||
type API_Action = keyof API_Shortcuts; | ||
interface API_AddonShortcut { | ||
label: string; | ||
defaultShortcut: API_KeyCollection; | ||
actionName: string; | ||
showInMenu?: boolean; | ||
action: (...args: any[]) => any; | ||
} | ||
type API_AddonShortcuts = Record<string, API_AddonShortcut>; | ||
type API_AddonShortcutLabels = Record<string, string>; | ||
type API_AddonShortcutDefaults = Record<string, API_KeyCollection>; | ||
type Direction = -1 | 1; | ||
@@ -177,3 +463,3 @@ type ParameterName = string; | ||
type DocsUpdate = Partial<Pick<API_DocsEntry, 'prepared' | 'parameters'>>; | ||
interface SubState$7 extends API_LoadedRefData { | ||
interface SubState$3 extends API_LoadedRefData { | ||
storyId: StoryId; | ||
@@ -185,3 +471,3 @@ internal_index?: API_PreparedStoryIndex; | ||
} | ||
interface SubAPI$7 { | ||
interface SubAPI$3 { | ||
/** | ||
@@ -375,219 +661,3 @@ * The `storyId` method is a reference to the `toId` function from `@storybook/csf`, which is used to generate a unique ID for a story. | ||
interface SubState$6 { | ||
refs: API_Refs; | ||
} | ||
interface SubAPI$6 { | ||
/** | ||
* Finds a composed ref by its source. | ||
* @param {string} source - The source/URL of the composed ref. | ||
* @returns {API_ComposedRef} - The composed ref object. | ||
*/ | ||
findRef: (source: string) => API_ComposedRef; | ||
/** | ||
* Sets a composed ref by its ID and data. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {API_SetRefData} data - The data to set for the composed ref. | ||
* @param {boolean} [ready] - Whether the composed ref is ready. | ||
*/ | ||
setRef: (id: string, data: API_SetRefData, ready?: boolean) => void; | ||
/** | ||
* Updates a composed ref by its ID and update object. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {API_ComposedRefUpdate} ref - The update object for the composed ref. | ||
*/ | ||
updateRef: (id: string, ref: API_ComposedRefUpdate) => Promise<void>; | ||
/** | ||
* Gets all composed refs. | ||
* @returns {API_Refs} - The composed refs object. | ||
*/ | ||
getRefs: () => API_Refs; | ||
/** | ||
* Checks if a composed ref is valid. | ||
* @param {API_SetRefData} ref - The composed ref to check. | ||
* @returns {Promise<void>} - A promise that resolves when the check is complete. | ||
*/ | ||
checkRef: (ref: API_SetRefData) => Promise<void>; | ||
/** | ||
* Changes the version of a composed ref by its ID and URL. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {string} url - The new URL for the composed ref. | ||
*/ | ||
changeRefVersion: (id: string, url: string) => Promise<void>; | ||
/** | ||
* Changes the state of a composed ref by its ID and previewInitialized flag. | ||
* @param {string} id - The ID of the composed ref. | ||
* @param {boolean} previewInitialized - The new previewInitialized flag for the composed ref. | ||
*/ | ||
changeRefState: (id: string, previewInitialized: boolean) => void; | ||
} | ||
interface SubState$5 { | ||
layout: API_Layout; | ||
ui: API_UI; | ||
selectedPanel: string | undefined; | ||
theme: ThemeVars; | ||
} | ||
interface SubAPI$5 { | ||
/** | ||
* Toggles the fullscreen mode of the Storybook UI. | ||
* @param toggled - Optional boolean value to set the fullscreen mode to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleFullscreen: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the visibility of the panel in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the panel visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
togglePanel: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the position of the panel in the Storybook UI. | ||
* @param position - Optional string value to set the panel position to. If not provided, it will toggle between 'bottom' and 'right'. | ||
*/ | ||
togglePanelPosition: (position?: API_PanelPositions) => void; | ||
/** | ||
* Toggles the visibility of the navigation bar in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the navigation bar visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleNav: (toggled?: boolean) => void; | ||
/** | ||
* Toggles the visibility of the toolbar in the Storybook UI. | ||
* @param toggled - Optional boolean value to set the toolbar visibility to. If not provided, it will toggle the current state. | ||
*/ | ||
toggleToolbar: (toggled?: boolean) => void; | ||
/** | ||
* Sets the options for the Storybook UI. | ||
* @param options - An object containing the options to set. | ||
*/ | ||
setOptions: (options: any) => void; | ||
/** | ||
* Sets the sizes of the resizable elements in the layout. | ||
*/ | ||
setSizes: (options: Partial<Pick<API_Layout, 'navSize' | 'bottomPanelHeight' | 'rightPanelWidth'>>) => void; | ||
/** | ||
* getIsFullscreen - Returns the current fullscreen mode of the Storybook UI. | ||
*/ | ||
getIsFullscreen: () => boolean; | ||
/** | ||
* getIsPanelShown - Returns the current visibility of the panel in the Storybook UI. | ||
*/ | ||
getIsPanelShown: () => boolean; | ||
/** | ||
* getIsNavShown - Returns the current visibility of the navigation bar in the Storybook UI. | ||
*/ | ||
getIsNavShown: () => boolean; | ||
} | ||
declare const isMacLike: () => boolean; | ||
declare const controlOrMetaSymbol: () => "⌘" | "ctrl"; | ||
declare const controlOrMetaKey: () => "control" | "meta"; | ||
declare const optionOrAltSymbol: () => "⌥" | "alt"; | ||
declare const isShortcutTaken: (arr1: string[], arr2: string[]) => boolean; | ||
type KeyboardEventLike = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'key' | 'code' | 'keyCode' | 'preventDefault'>; | ||
declare const eventToShortcut: (e: KeyboardEventLike) => (string | string[])[] | null; | ||
declare const shortcutMatchesShortcut: (inputShortcut: (string | string[])[], shortcut: API_KeyCollection) => boolean; | ||
declare const eventMatchesShortcut: (e: KeyboardEventLike, shortcut: API_KeyCollection) => boolean; | ||
declare const keyToSymbol: (key: string) => string; | ||
declare const shortcutToHumanString: (shortcut: API_KeyCollection) => string; | ||
interface SubState$4 { | ||
shortcuts: API_Shortcuts; | ||
} | ||
interface SubAPI$4 { | ||
/** | ||
* Returns the current shortcuts. | ||
*/ | ||
getShortcutKeys(): API_Shortcuts; | ||
/** | ||
* Returns the default shortcuts. | ||
*/ | ||
getDefaultShortcuts(): API_Shortcuts | API_AddonShortcutDefaults; | ||
/** | ||
* Returns the shortcuts for addons. | ||
*/ | ||
getAddonsShortcuts(): API_AddonShortcuts; | ||
/** | ||
* Returns the labels for addon shortcuts. | ||
*/ | ||
getAddonsShortcutLabels(): API_AddonShortcutLabels; | ||
/** | ||
* Returns the default shortcuts for addons. | ||
*/ | ||
getAddonsShortcutDefaults(): API_AddonShortcutDefaults; | ||
/** | ||
* Sets the shortcuts to the given value. | ||
* @param shortcuts The new shortcuts to set. | ||
* @returns A promise that resolves to the new shortcuts. | ||
*/ | ||
setShortcuts(shortcuts: API_Shortcuts): Promise<API_Shortcuts>; | ||
/** | ||
* Sets the shortcut for the given action to the given value. | ||
* @param action The action to set the shortcut for. | ||
* @param value The new shortcut to set. | ||
* @returns A promise that resolves to the new shortcut. | ||
*/ | ||
setShortcut(action: API_Action, value: API_KeyCollection): Promise<API_KeyCollection>; | ||
/** | ||
* Sets the shortcut for the given addon to the given value. | ||
* @param addon The addon to set the shortcut for. | ||
* @param shortcut The new shortcut to set. | ||
* @returns A promise that resolves to the new addon shortcut. | ||
*/ | ||
setAddonShortcut(addon: string, shortcut: API_AddonShortcut): Promise<API_AddonShortcut>; | ||
/** | ||
* Restores all default shortcuts. | ||
* @returns A promise that resolves to the new shortcuts. | ||
*/ | ||
restoreAllDefaultShortcuts(): Promise<API_Shortcuts>; | ||
/** | ||
* Restores the default shortcut for the given action. | ||
* @param action The action to restore the default shortcut for. | ||
* @returns A promise that resolves to the new shortcut. | ||
*/ | ||
restoreDefaultShortcut(action: API_Action): Promise<API_KeyCollection>; | ||
/** | ||
* Handles a keydown event. | ||
* @param event The event to handle. | ||
*/ | ||
handleKeydownEvent(event: KeyboardEventLike): void; | ||
/** | ||
* Handles a shortcut feature. | ||
* @param feature The feature to handle. | ||
* @param event The event to handle. | ||
*/ | ||
handleShortcutFeature(feature: API_Action, event: KeyboardEventLike): void; | ||
} | ||
type API_KeyCollection = string[]; | ||
interface API_Shortcuts { | ||
fullScreen: API_KeyCollection; | ||
togglePanel: API_KeyCollection; | ||
panelPosition: API_KeyCollection; | ||
toggleNav: API_KeyCollection; | ||
toolbar: API_KeyCollection; | ||
search: API_KeyCollection; | ||
focusNav: API_KeyCollection; | ||
focusIframe: API_KeyCollection; | ||
focusPanel: API_KeyCollection; | ||
prevComponent: API_KeyCollection; | ||
nextComponent: API_KeyCollection; | ||
prevStory: API_KeyCollection; | ||
nextStory: API_KeyCollection; | ||
shortcutsPage: API_KeyCollection; | ||
aboutPage: API_KeyCollection; | ||
escape: API_KeyCollection; | ||
collapseAll: API_KeyCollection; | ||
expandAll: API_KeyCollection; | ||
remount: API_KeyCollection; | ||
} | ||
type API_Action = keyof API_Shortcuts; | ||
interface API_AddonShortcut { | ||
label: string; | ||
defaultShortcut: API_KeyCollection; | ||
actionName: string; | ||
showInMenu?: boolean; | ||
action: (...args: any[]) => any; | ||
} | ||
type API_AddonShortcuts = Record<string, API_AddonShortcut>; | ||
type API_AddonShortcutLabels = Record<string, string>; | ||
type API_AddonShortcutDefaults = Record<string, API_KeyCollection>; | ||
interface SubState$3 { | ||
interface SubState$2 { | ||
customQueryParams: QueryParams; | ||
@@ -601,3 +671,3 @@ } | ||
*/ | ||
interface SubAPI$3 { | ||
interface SubAPI$2 { | ||
/** | ||
@@ -647,3 +717,3 @@ * Navigate to a new URL. | ||
interface SubState$2 { | ||
interface SubState$1 { | ||
versions: API_Versions & API_UnknownEntries; | ||
@@ -653,3 +723,3 @@ lastVersionCheck: number; | ||
} | ||
interface SubAPI$2 { | ||
interface SubAPI$1 { | ||
/** | ||
@@ -685,6 +755,6 @@ * Returns the current version of the Storybook Manager. | ||
type SubState$1 = { | ||
type SubState = { | ||
whatsNewData?: WhatsNewData; | ||
}; | ||
type SubAPI$1 = { | ||
type SubAPI = { | ||
isWhatsNewUnread(): boolean; | ||
@@ -695,72 +765,2 @@ whatsNewHasBeenRead(): void; | ||
interface SubState { | ||
globals?: Globals; | ||
userGlobals?: Globals; | ||
storyGlobals?: Globals; | ||
globalTypes?: GlobalTypes; | ||
} | ||
interface SubAPI { | ||
/** | ||
* Returns the current globals, which is the user globals overlaid with the story globals | ||
* @returns {Globals} The current globals. | ||
*/ | ||
getGlobals: () => Globals; | ||
/** | ||
* Returns the current globals, as set by the user (a story may have override values) | ||
* @returns {Globals} The current user globals. | ||
*/ | ||
getUserGlobals: () => Globals /** | ||
/** | ||
* Returns the current globals, as set by the story | ||
* @returns {Globals} The current story globals. | ||
*/; | ||
getStoryGlobals: () => Globals /** | ||
* Returns the globalTypes, as defined at the project level. | ||
* @returns {GlobalTypes} The globalTypes. | ||
*/; | ||
getGlobalTypes: () => GlobalTypes; | ||
/** | ||
* Updates the current globals with the provided new globals. | ||
* @param {Globals} newGlobals - The new globals to update with. | ||
* @returns {void} | ||
*/ | ||
updateGlobals: (newGlobals: Globals) => void; | ||
} | ||
declare function mockChannel(): Channel; | ||
declare class AddonStore { | ||
constructor(); | ||
private loaders; | ||
private elements; | ||
private config; | ||
private channel; | ||
private promise; | ||
private resolve; | ||
getChannel: () => Channel; | ||
ready: () => Promise<Channel>; | ||
hasChannel: () => boolean; | ||
setChannel: (channel: Channel) => void; | ||
getElements<T extends Addon_Types | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_SIDEBAR_TOP>(type: T): Addon_Collection<Addon_TypesMapping[T]> | any; | ||
/** | ||
* Adds an addon to the addon store. | ||
* @param {string} id - The id of the addon. | ||
* @param {Addon_Type} addon - The addon to add. | ||
* @returns {void} | ||
*/ | ||
add(id: string, addon: Addon_BaseType | Omit<Addon_SidebarTopType, 'id'> | Omit<Addon_SidebarBottomType, 'id'> | Omit<Addon_PageType, 'id'> | Omit<Addon_WrapperType, 'id'>): void; | ||
setConfig: (value: Addon_Config) => void; | ||
getConfig: () => Addon_Config; | ||
/** | ||
* Registers an addon loader function. | ||
* | ||
* @param {string} id - The id of the addon loader. | ||
* @param {(api: API) => void} callback - The function that will be called to register the addon. | ||
* @returns {void} | ||
*/ | ||
register: (id: string, callback: (api: API) => void) => void; | ||
loadAddons: (api: any) => void; | ||
} | ||
declare const addons: AddonStore; | ||
declare class RequestResponseError<Payload extends Record<string, any> | void> extends Error { | ||
@@ -784,4 +784,4 @@ payload: Payload | undefined; | ||
}>; | ||
type State = SubState$5 & SubState$7 & SubState$6 & SubState$9 & SubState$2 & SubState$3 & SubState$4 & SubState$8 & SubState & SubState$1 & RouterData & API_OptionsData & DeprecatedState & Other; | ||
type API = SubAPI$b & SubAPI$a & SubAPI$c & SubAPI$7 & SubAPI$6 & SubAPI & SubAPI$5 & SubAPI$9 & SubAPI$4 & SubAPI$8 & SubAPI$2 & SubAPI$3 & SubAPI$1 & Other; | ||
type State = SubState$8 & SubState$3 & SubState$6 & SubState$7 & SubState$1 & SubState$2 & SubState$4 & SubState$5 & SubState$9 & SubState & RouterData & API_OptionsData & DeprecatedState & Other; | ||
type API = SubAPI$c & SubAPI$b & SubAPI$7 & SubAPI$3 & SubAPI$6 & SubAPI$a & SubAPI$9 & SubAPI$8 & SubAPI$4 & SubAPI$5 & SubAPI$1 & SubAPI$2 & SubAPI & Other; | ||
interface DeprecatedState { | ||
@@ -788,0 +788,0 @@ /** |
import { Channel } from '@storybook/core/channels'; | ||
import * as _storybook_core_types from '@storybook/core/types'; | ||
import { Renderer, Args, StoryContext, StoryId, DecoratorApplicator, Addon_StoryWrapper, StoryName, ComponentTitle, StoryIndex, IndexEntry, Path, PreparedStory, Globals, GlobalTypes, LegacyStoryAnnotationsOrFn, NormalizedComponentAnnotations, NormalizedStoryAnnotations, ModuleExports, CSFFile, NormalizedProjectAnnotations, ModuleExport, PreparedMeta, ProjectAnnotations, StepRunner, NamedOrDefaultProjectAnnotations, ComponentAnnotations, ComposedStoryFn, Store_CSFExports, ComposeStoryFn, ModuleImportFn, Parameters, StoryContextForEnhancers, StoryIndexV3, BoundStory, StrictArgTypes, ArgTypesEnhancer, LegacyStoryFn, DecoratorFunction, PartialStoryFn, StoryContextUpdate, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, StoryRenderOptions, RenderToCanvas, RenderContextCallbacks, DocsContextProps, ResolvedModuleExportType, ResolvedModuleExportFromType, ViewMode } from '@storybook/core/types'; | ||
import { Renderer, Args, StoryContext, StoryId, DecoratorApplicator, Addon_StoryWrapper, PreparedStory, Globals, GlobalTypes, StoryName, ComponentTitle, StoryIndex, IndexEntry, Path, LegacyStoryAnnotationsOrFn, NormalizedComponentAnnotations, NormalizedStoryAnnotations, ModuleExports, CSFFile, NormalizedProjectAnnotations, ModuleExport, PreparedMeta, StepRunner, ProjectAnnotations, NamedOrDefaultProjectAnnotations, ComponentAnnotations, ComposedStoryFn, Store_CSFExports, ComposeStoryFn, ModuleImportFn, Parameters, StoryContextForEnhancers, StoryIndexV3, BoundStory, StrictArgTypes, ArgTypesEnhancer, LegacyStoryFn, DecoratorFunction, PartialStoryFn, StoryContextUpdate, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, DocsContextProps, ResolvedModuleExportType, ResolvedModuleExportFromType, StoryRenderOptions, RenderContextCallbacks, RenderToCanvas, ViewMode } from '@storybook/core/types'; | ||
import * as _storybook_csf from '@storybook/csf'; | ||
@@ -268,14 +268,2 @@ import { CleanupCallback, Canvas } from '@storybook/csf'; | ||
type StorySpecifier = StoryId | { | ||
name: StoryName; | ||
title: ComponentTitle; | ||
} | '*'; | ||
declare class StoryIndexStore { | ||
entries: StoryIndex['entries']; | ||
constructor({ entries }?: StoryIndex); | ||
entryFromSpecifier(specifier: StorySpecifier): IndexEntry | undefined; | ||
storyIdToEntry(storyId: StoryId): IndexEntry; | ||
importPathToEntry(importPath: Path): IndexEntry; | ||
} | ||
declare class ArgsStore { | ||
@@ -309,2 +297,14 @@ initialArgsByStoryId: Record<StoryId, Args>; | ||
type StorySpecifier = StoryId | { | ||
name: StoryName; | ||
title: ComponentTitle; | ||
} | '*'; | ||
declare class StoryIndexStore { | ||
entries: StoryIndex['entries']; | ||
constructor({ entries }?: StoryIndex); | ||
entryFromSpecifier(specifier: StorySpecifier): IndexEntry | undefined; | ||
storyIdToEntry(storyId: StoryId): IndexEntry; | ||
importPathToEntry(importPath: Path): IndexEntry; | ||
} | ||
declare function normalizeStory<TRenderer extends Renderer>(key: StoryId, storyAnnotations: LegacyStoryAnnotationsOrFn<TRenderer>, meta: NormalizedComponentAnnotations<TRenderer>): NormalizedStoryAnnotations<TRenderer>; | ||
@@ -317,3 +317,3 @@ | ||
declare function composeConfigs<TRenderer extends Renderer>(moduleExportList: ModuleExports[]): ProjectAnnotations<TRenderer>; | ||
declare function composeConfigs<TRenderer extends Renderer>(moduleExportList: ModuleExports[]): NormalizedProjectAnnotations<TRenderer>; | ||
@@ -341,7 +341,7 @@ /** | ||
declare global { | ||
var globalProjectAnnotations: ProjectAnnotations<any>; | ||
var globalProjectAnnotations: NormalizedProjectAnnotations<any>; | ||
var defaultProjectAnnotations: ProjectAnnotations<any>; | ||
} | ||
declare function setDefaultProjectAnnotations<TRenderer extends Renderer = Renderer>(_defaultProjectAnnotations: ProjectAnnotations<TRenderer>): void; | ||
declare function setProjectAnnotations<TRenderer extends Renderer = Renderer>(projectAnnotations: NamedOrDefaultProjectAnnotations<TRenderer> | NamedOrDefaultProjectAnnotations<TRenderer>[]): ProjectAnnotations<TRenderer>; | ||
declare function setProjectAnnotations<TRenderer extends Renderer = Renderer>(projectAnnotations: NamedOrDefaultProjectAnnotations<TRenderer> | NamedOrDefaultProjectAnnotations<TRenderer>[]): NormalizedProjectAnnotations<TRenderer>; | ||
declare function composeStory<TRenderer extends Renderer = Renderer, TArgs extends Args = Args>(storyAnnotations: LegacyStoryAnnotationsOrFn<TRenderer>, componentAnnotations: ComponentAnnotations<TRenderer, TArgs>, projectAnnotations?: ProjectAnnotations<TRenderer>, defaultConfig?: ProjectAnnotations<TRenderer>, exportsName?: string): ComposedStoryFn<TRenderer, Partial<TArgs>>; | ||
@@ -492,70 +492,2 @@ declare function composeStories<TModule extends Store_CSFExports>(storiesImport: TModule, globalConfig: ProjectAnnotations<Renderer>, composeStoryFn?: ComposeStoryFn): {}; | ||
type RenderType = 'story' | 'docs'; | ||
/** | ||
* A "Render" represents the rendering of a single entry to a single location | ||
* | ||
* The implementations of render are used for two key purposes: | ||
* - Tracking the state of the rendering as it moves between preparing, rendering and tearing down. | ||
* - Tracking what is rendered to know if a change requires re-rendering or teardown + recreation. | ||
*/ | ||
interface Render<TRenderer extends Renderer> { | ||
type: RenderType; | ||
id: StoryId; | ||
isPreparing: () => boolean; | ||
isEqual: (other: Render<TRenderer>) => boolean; | ||
disableKeyListeners: boolean; | ||
teardown?: (options: { | ||
viewModeChanged: boolean; | ||
}) => Promise<void>; | ||
torndown: boolean; | ||
renderToElement: (canvasElement: TRenderer['canvasElement'], renderStoryToElement?: any, options?: StoryRenderOptions) => Promise<void>; | ||
} | ||
type RenderPhase = 'preparing' | 'loading' | 'beforeEach' | 'rendering' | 'playing' | 'played' | 'completed' | 'aborted' | 'errored'; | ||
declare class StoryRender<TRenderer extends Renderer> implements Render<TRenderer> { | ||
channel: Channel; | ||
store: StoryStore<TRenderer>; | ||
private renderToScreen; | ||
private callbacks; | ||
id: StoryId; | ||
viewMode: StoryContext<TRenderer>['viewMode']; | ||
renderOptions: StoryRenderOptions; | ||
type: RenderType; | ||
story?: PreparedStory<TRenderer>; | ||
phase?: RenderPhase; | ||
private abortController?; | ||
private canvasElement?; | ||
private notYetRendered; | ||
private rerenderEnqueued; | ||
disableKeyListeners: boolean; | ||
private teardownRender; | ||
torndown: boolean; | ||
constructor(channel: Channel, store: StoryStore<TRenderer>, renderToScreen: RenderToCanvas<TRenderer>, callbacks: RenderContextCallbacks<TRenderer> & { | ||
showStoryDuringRender?: () => void; | ||
}, id: StoryId, viewMode: StoryContext<TRenderer>['viewMode'], renderOptions?: StoryRenderOptions, story?: PreparedStory<TRenderer>); | ||
private runPhase; | ||
private checkIfAborted; | ||
prepare(): Promise<void>; | ||
isEqual(other: Render<TRenderer>): boolean; | ||
isPreparing(): boolean; | ||
isPending(): boolean; | ||
renderToElement(canvasElement: TRenderer['canvasElement']): Promise<void>; | ||
private storyContext; | ||
render({ initial, forceRemount, }?: { | ||
initial?: boolean; | ||
forceRemount?: boolean; | ||
}): Promise<void>; | ||
/** | ||
* Rerender the story. | ||
* If the story is currently pending (loading/rendering), the rerender will be enqueued, | ||
* and will be executed after the current render is completed. | ||
* Rerendering while playing will not be enqueued, and will be executed immediately, to support | ||
* rendering args changes while playing. | ||
*/ | ||
rerender(): Promise<void>; | ||
remount(): Promise<void>; | ||
cancelRender(): void; | ||
teardown(): Promise<void>; | ||
} | ||
declare class DocsContext<TRenderer extends Renderer> implements DocsContextProps<TRenderer> { | ||
@@ -633,3 +565,24 @@ channel: Channel; | ||
type RenderType = 'story' | 'docs'; | ||
/** | ||
* A "Render" represents the rendering of a single entry to a single location | ||
* | ||
* The implementations of render are used for two key purposes: | ||
* - Tracking the state of the rendering as it moves between preparing, rendering and tearing down. | ||
* - Tracking what is rendered to know if a change requires re-rendering or teardown + recreation. | ||
*/ | ||
interface Render<TRenderer extends Renderer> { | ||
type: RenderType; | ||
id: StoryId; | ||
isPreparing: () => boolean; | ||
isEqual: (other: Render<TRenderer>) => boolean; | ||
disableKeyListeners: boolean; | ||
teardown?: (options: { | ||
viewModeChanged: boolean; | ||
}) => Promise<void>; | ||
torndown: boolean; | ||
renderToElement: (canvasElement: TRenderer['canvasElement'], renderStoryToElement?: any, options?: StoryRenderOptions) => Promise<void>; | ||
} | ||
/** | ||
* A CsfDocsRender is a render of a docs entry that is rendered based on a CSF file. | ||
@@ -709,2 +662,49 @@ * | ||
type RenderPhase = 'preparing' | 'loading' | 'beforeEach' | 'rendering' | 'playing' | 'played' | 'completed' | 'aborted' | 'errored'; | ||
declare class StoryRender<TRenderer extends Renderer> implements Render<TRenderer> { | ||
channel: Channel; | ||
store: StoryStore<TRenderer>; | ||
private renderToScreen; | ||
private callbacks; | ||
id: StoryId; | ||
viewMode: StoryContext<TRenderer>['viewMode']; | ||
renderOptions: StoryRenderOptions; | ||
type: RenderType; | ||
story?: PreparedStory<TRenderer>; | ||
phase?: RenderPhase; | ||
private abortController?; | ||
private canvasElement?; | ||
private notYetRendered; | ||
private rerenderEnqueued; | ||
disableKeyListeners: boolean; | ||
private teardownRender; | ||
torndown: boolean; | ||
constructor(channel: Channel, store: StoryStore<TRenderer>, renderToScreen: RenderToCanvas<TRenderer>, callbacks: RenderContextCallbacks<TRenderer> & { | ||
showStoryDuringRender?: () => void; | ||
}, id: StoryId, viewMode: StoryContext<TRenderer>['viewMode'], renderOptions?: StoryRenderOptions, story?: PreparedStory<TRenderer>); | ||
private runPhase; | ||
private checkIfAborted; | ||
prepare(): Promise<void>; | ||
isEqual(other: Render<TRenderer>): boolean; | ||
isPreparing(): boolean; | ||
isPending(): boolean; | ||
renderToElement(canvasElement: TRenderer['canvasElement']): Promise<void>; | ||
private storyContext; | ||
render({ initial, forceRemount, }?: { | ||
initial?: boolean; | ||
forceRemount?: boolean; | ||
}): Promise<void>; | ||
/** | ||
* Rerender the story. | ||
* If the story is currently pending (loading/rendering), the rerender will be enqueued, | ||
* and will be executed after the current render is completed. | ||
* Rerendering while playing will not be enqueued, and will be executed immediately, to support | ||
* rendering args changes while playing. | ||
*/ | ||
rerender(): Promise<void>; | ||
remount(): Promise<void>; | ||
cancelRender(): void; | ||
teardown(): Promise<void>; | ||
} | ||
type MaybePromise<T> = Promise<T> | T; | ||
@@ -711,0 +711,0 @@ declare class Preview<TRenderer extends Renderer> { |
@@ -211,5 +211,7 @@ declare abstract class StorybookError extends Error { | ||
location: string; | ||
source?: 'storybook' | 'vitest'; | ||
}; | ||
constructor(data: { | ||
location: string; | ||
source?: 'storybook' | 'vitest'; | ||
}); | ||
@@ -216,0 +218,0 @@ } |
@@ -47,6 +47,6 @@ import ESM_COMPAT_Module from "node:module"; | ||
if (s.length) { | ||
var l = new RegExp(` | ||
var c = new RegExp(` | ||
[ ]{` + Math.min.apply(Math, s) + "}", "g"); | ||
r = r.map(function(g) { | ||
return g.replace(l, ` | ||
return g.replace(c, ` | ||
`); | ||
@@ -56,5 +56,5 @@ }); | ||
r[0] = r[0].replace(/^\r?\n/, ""); | ||
var c = r[0]; | ||
var l = r[0]; | ||
return o.forEach(function(g, _) { | ||
var O = c.match(/(?:^|\n)( *)$/), M = O ? O[1] : "", y = g; | ||
var O = l.match(/(?:^|\n)( *)$/), M = O ? O[1] : "", y = g; | ||
typeof g == "string" && g.includes(` | ||
@@ -65,4 +65,4 @@ `) && (y = String(g).split(` | ||
}).join(` | ||
`)), c += y + r[_ + 1]; | ||
}), c; | ||
`)), l += y + r[_ + 1]; | ||
}), l; | ||
} | ||
@@ -167,3 +167,3 @@ n(U, "dedent"); | ||
let [r] = e; | ||
r.length === 3 && (r = [...r].map((l) => l + l).join("")); | ||
r.length === 3 && (r = [...r].map((c) => c + c).join("")); | ||
let s = Number.parseInt(r, 16); | ||
@@ -198,7 +198,7 @@ return [ | ||
} | ||
let l = Math.max(e, r, s) * 2; | ||
if (l === 0) | ||
let c = Math.max(e, r, s) * 2; | ||
if (c === 0) | ||
return 30; | ||
let c = 30 + (Math.round(s) << 2 | Math.round(r) << 1 | Math.round(e)); | ||
return l === 2 && (c += 60), c; | ||
let l = 30 + (Math.round(s) << 2 | Math.round(r) << 1 | Math.round(e)); | ||
return c === 2 && (l += 60), l; | ||
}, | ||
@@ -263,12 +263,12 @@ enumerable: !1 | ||
return 0; | ||
let l = s || 0; | ||
let c = s || 0; | ||
if (p.TERM === "dumb") | ||
return l; | ||
return c; | ||
if (S.platform === "win32") { | ||
let c = Le.release().split("."); | ||
return Number(c[0]) >= 10 && Number(c[2]) >= 10586 ? Number(c[2]) >= 14931 ? 3 : 2 : 1; | ||
let l = Le.release().split("."); | ||
return Number(l[0]) >= 10 && Number(l[2]) >= 10586 ? Number(l[2]) >= 14931 ? 3 : 2 : 1; | ||
} | ||
if ("CI" in p) | ||
return "GITHUB_ACTIONS" in p || "GITEA_ACTIONS" in p ? 3 : ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((c) => c in | ||
p) || p.CI_NAME === "codeship" ? 1 : l; | ||
return "GITHUB_ACTIONS" in p || "GITEA_ACTIONS" in p ? 3 : ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((l) => l in | ||
p) || p.CI_NAME === "codeship" ? 1 : c; | ||
if ("TEAMCITY_VERSION" in p) | ||
@@ -279,6 +279,6 @@ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION) ? 1 : 0; | ||
if ("TERM_PROGRAM" in p) { | ||
let c = Number.parseInt((p.TERM_PROGRAM_VERSION || "").split(".")[0], 10); | ||
let l = Number.parseInt((p.TERM_PROGRAM_VERSION || "").split(".")[0], 10); | ||
switch (p.TERM_PROGRAM) { | ||
case "iTerm.app": | ||
return c >= 3 ? 3 : 2; | ||
return l >= 3 ? 3 : 2; | ||
case "Apple_Terminal": | ||
@@ -289,3 +289,3 @@ return 2; | ||
return /-256(color)?$/i.test(p.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM) || "COLORTERM" in p ? | ||
1 : l; | ||
1 : c; | ||
} | ||
@@ -311,14 +311,14 @@ n(Fe, "_supportsColor"); | ||
return t; | ||
let s = o.length, l = 0, c = ""; | ||
let s = o.length, c = 0, l = ""; | ||
do | ||
c += t.slice(l, r) + o + e, l = r + s, r = t.indexOf(o, l); | ||
l += t.slice(c, r) + o + e, c = r + s, r = t.indexOf(o, c); | ||
while (r !== -1); | ||
return c += t.slice(l), c; | ||
return l += t.slice(c), l; | ||
} | ||
n(j, "stringReplaceAll"); | ||
function V(t, o, e, r) { | ||
let s = 0, l = ""; | ||
let s = 0, c = ""; | ||
do { | ||
let c = t[r - 1] === "\r"; | ||
l += t.slice(s, c ? r - 1 : r) + o + (c ? `\r | ||
let l = t[r - 1] === "\r"; | ||
c += t.slice(s, l ? r - 1 : r) + o + (l ? `\r | ||
` : ` | ||
@@ -328,3 +328,3 @@ `) + e, s = r + 1, r = t.indexOf(` | ||
} while (r !== -1); | ||
return l += t.slice(s), l; | ||
return c += t.slice(s), c; | ||
} | ||
@@ -425,5 +425,5 @@ n(V, "stringEncaseCRLFWithFirstIndex"); | ||
o = j(o, e.close, e.open), e = e.parent; | ||
let l = o.indexOf(` | ||
let c = o.indexOf(` | ||
`); | ||
return l !== -1 && (o = V(o, s, r, l)), r + o + s; | ||
return c !== -1 && (o = V(o, s, r, c)), r + o + s; | ||
}, "applyStyle"); | ||
@@ -479,11 +479,11 @@ Object.defineProperties(k.prototype, R); | ||
category: s, | ||
message: l | ||
message: c | ||
}) { | ||
let c; | ||
return e === !0 ? c = `https://storybook.js.org/error/${H({ code: r, category: s })}` : typeof e == "string" ? c = e : Array.isArray(e) && | ||
(c = ` | ||
let l; | ||
return e === !0 ? l = `https://storybook.js.org/error/${H({ code: r, category: s })}` : typeof e == "string" ? l = e : Array.isArray(e) && | ||
(l = ` | ||
${e.map((g) => ` - ${g}`).join(` | ||
`)}`), `${l}${c != null ? ` | ||
`)}`), `${c}${l != null ? ` | ||
More info: ${c} | ||
More info: ${l} | ||
` : ""}`; | ||
@@ -823,6 +823,17 @@ } | ||
constructor(e) { | ||
let r = { | ||
storybook: { | ||
helperMessage: "You can pass a --config-dir flag to tell Storybook, where your main.js file is located at.", | ||
documentation: "https://storybook.js.org/docs/configure" | ||
}, | ||
vitest: { | ||
helperMessage: "You can pass a configDir plugin option to tell where your main.js file is located at.", | ||
// TODO: add proper docs once available | ||
documentation: "https://storybook.js.org/docs/configure" | ||
} | ||
}, { documentation: s, helperMessage: c } = r[e.source || "storybook"]; | ||
super({ | ||
category: "CORE-SERVER", | ||
code: 6, | ||
documentation: "https://storybook.js.org/docs/configure", | ||
documentation: s, | ||
message: u.dedent` | ||
@@ -832,3 +843,3 @@ No configuration files have been found in your configDir: ${m.yellow(e.location)}. | ||
You can pass a --config-dir flag to tell Storybook, where your main.js file is located at).` | ||
${c}` | ||
}); | ||
@@ -835,0 +846,0 @@ this.data = e; |
@@ -57,2 +57,3 @@ import { TypescriptOptions, StorybookConfig, PackageJson } from '@storybook/core/types'; | ||
}; | ||
portableStoriesFileCount?: number; | ||
}; | ||
@@ -95,4 +96,9 @@ interface Payload { | ||
/** | ||
* Is this story part of the CLI generated examples, | ||
* including user-created stories in those files | ||
*/ | ||
declare const isExampleStoryId: (storyId: string) => boolean; | ||
declare const telemetry: (eventType: EventType, payload?: Payload, options?: Partial<Options>) => Promise<void>; | ||
export { type Dependency, type EventType, type Options, type Payload, type StorybookAddon, type StorybookMetadata, type TelemetryData, addToGlobalContext, computeStorybookMetadata, getPrecedingUpgrade, getStorybookMetadata, metaFrameworks, oneWayHash, sanitizeAddonName, telemetry }; | ||
export { type Dependency, type EventType, type Options, type Payload, type StorybookAddon, type StorybookMetadata, type TelemetryData, addToGlobalContext, computeStorybookMetadata, getPrecedingUpgrade, getStorybookMetadata, isExampleStoryId, metaFrameworks, oneWayHash, sanitizeAddonName, telemetry }; |
@@ -869,5 +869,5 @@ var ie = Object.defineProperty; | ||
// src/theming/themes/light.ts | ||
// src/theming/themes/dark.ts | ||
var ke = { | ||
base: "light", | ||
base: "dark", | ||
// Storybook-specific color palette | ||
@@ -879,6 +879,6 @@ colorPrimary: "#FF4785", | ||
// UI | ||
appBg: P.app, | ||
appContentBg: s.lightest, | ||
appBg: "#222425", | ||
appContentBg: "#1B1C1D", | ||
appPreviewBg: s.lightest, | ||
appBorderColor: s.border, | ||
appBorderColor: "rgba(255,255,255,.1)", | ||
appBorderRadius: 4, | ||
@@ -889,5 +889,5 @@ // Fonts | ||
// Text colors | ||
textColor: s.darkest, | ||
textInverseColor: s.lightest, | ||
textMutedColor: s.dark, | ||
textColor: "#C9CDCF", | ||
textInverseColor: "#222425", | ||
textMutedColor: "#798186", | ||
// Toolbar default and active colors | ||
@@ -897,17 +897,17 @@ barTextColor: s.mediumdark, | ||
barSelectedColor: s.secondary, | ||
barBg: s.lightest, | ||
barBg: "#292C2E", | ||
// Form colors | ||
buttonBg: P.app, | ||
buttonBorder: s.medium, | ||
booleanBg: s.mediumlight, | ||
booleanSelectedBg: s.lightest, | ||
inputBg: s.lightest, | ||
inputBorder: s.border, | ||
inputTextColor: s.darkest, | ||
buttonBg: "#222425", | ||
buttonBorder: "rgba(255,255,255,.1)", | ||
booleanBg: "#222425", | ||
booleanSelectedBg: "#2E3438", | ||
inputBg: "#1B1C1D", | ||
inputBorder: "rgba(255,255,255,.1)", | ||
inputTextColor: s.lightest, | ||
inputBorderRadius: 4 | ||
}, E = ke; | ||
}, _ = ke; | ||
// src/theming/themes/dark.ts | ||
// src/theming/themes/light.ts | ||
var $e = { | ||
base: "dark", | ||
base: "light", | ||
// Storybook-specific color palette | ||
@@ -919,6 +919,6 @@ colorPrimary: "#FF4785", | ||
// UI | ||
appBg: "#222425", | ||
appContentBg: "#1B1C1D", | ||
appBg: P.app, | ||
appContentBg: s.lightest, | ||
appPreviewBg: s.lightest, | ||
appBorderColor: "rgba(255,255,255,.1)", | ||
appBorderColor: s.border, | ||
appBorderRadius: 4, | ||
@@ -929,5 +929,5 @@ // Fonts | ||
// Text colors | ||
textColor: "#C9CDCF", | ||
textInverseColor: "#222425", | ||
textMutedColor: "#798186", | ||
textColor: s.darkest, | ||
textInverseColor: s.lightest, | ||
textMutedColor: s.dark, | ||
// Toolbar default and active colors | ||
@@ -937,13 +937,13 @@ barTextColor: s.mediumdark, | ||
barSelectedColor: s.secondary, | ||
barBg: "#292C2E", | ||
barBg: s.lightest, | ||
// Form colors | ||
buttonBg: "#222425", | ||
buttonBorder: "rgba(255,255,255,.1)", | ||
booleanBg: "#222425", | ||
booleanSelectedBg: "#2E3438", | ||
inputBg: "#1B1C1D", | ||
inputBorder: "rgba(255,255,255,.1)", | ||
inputTextColor: s.lightest, | ||
buttonBg: P.app, | ||
buttonBorder: s.medium, | ||
booleanBg: s.mediumlight, | ||
booleanSelectedBg: s.lightest, | ||
inputBg: s.lightest, | ||
inputBorder: s.border, | ||
inputTextColor: s.darkest, | ||
inputBorderRadius: 4 | ||
}, _ = $e; | ||
}, E = $e; | ||
@@ -950,0 +950,0 @@ // ../node_modules/@storybook/global/dist/index.mjs |
{ | ||
"name": "@storybook/core", | ||
"version": "0.0.0-pr-28768-sha-2e4b1992", | ||
"version": "0.0.0-pr-28768-sha-416cd00d", | ||
"description": "Storybook framework-agnostic API", | ||
@@ -268,4 +268,4 @@ "keywords": [ | ||
"scripts": { | ||
"check": "bun ./scripts/check.ts", | ||
"prep": "bun ./scripts/prep.ts" | ||
"check": "jiti ./scripts/check.ts", | ||
"prep": "jiti ./scripts/prep.ts" | ||
}, | ||
@@ -275,3 +275,2 @@ "dependencies": { | ||
"@types/express": "^4.17.21", | ||
"@types/node": "^18.0.0", | ||
"browser-assert": "^1.2.1", | ||
@@ -319,4 +318,3 @@ "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0", | ||
"@types/lodash": "^4.14.167", | ||
"@types/mock-fs": "^4.13.1", | ||
"@types/node": "^18.0.0", | ||
"@types/node": "^22.0.0", | ||
"@types/npmlog": "^7.0.0", | ||
@@ -381,4 +379,4 @@ "@types/picomatch": "^2.3.0", | ||
"markdown-to-jsx": "^7.4.5", | ||
"memfs": "^4.11.1", | ||
"memoizerific": "^1.11.3", | ||
"mock-fs": "^5.2.0", | ||
"nanoid": "^4.0.2", | ||
@@ -406,2 +404,3 @@ "npmlog": "^7.0.0", | ||
"slash": "^5.0.0", | ||
"source-map": "^0.7.4", | ||
"store2": "^2.14.2", | ||
@@ -408,0 +407,0 @@ "strip-json-comments": "^5.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
40262344
10
740646
248
+ Added@types/node@22.5.4(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removed@types/node@^18.0.0
- Removed@types/node@18.19.50(transitive)
- Removedundici-types@5.26.5(transitive)