@storybook/svelte-vite 11.0.0-alpha.8 → 11.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ type FrameworkOptions = {
11
11
  * slots. When disabled, Storybook will skip the docgen processing step during build, which can
12
12
  * improve build performance.
13
13
  *
14
+ * @deprecated Builder docgen is removed in Storybook 12. Use `features.docgenServer`.
14
15
  * @default true
15
16
  */
16
17
  docgen?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as StorybookConfig, t as FrameworkOptions } from "./chunk-DAg8hspc.js";
1
+ import { n as StorybookConfig, t as FrameworkOptions } from "./chunk-BWzDcG_q.js";
2
2
  import { __definePreview as definePreview } from "@storybook/svelte";
3
3
  export * from "@storybook/svelte";
4
4
  export { FrameworkOptions, StorybookConfig, definePreview };
@@ -1,4 +1,4 @@
1
- import { n as StorybookConfig } from "../chunk-DAg8hspc.js";
1
+ import { n as StorybookConfig } from "../chunk-BWzDcG_q.js";
2
2
 
3
3
  //#region code/frameworks/svelte-vite/.dts-emit/code/frameworks/svelte-vite/src/node/index.d.ts
4
4
  declare function defineMain(config: StorybookConfig): StorybookConfig;
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_euhb73pg96c from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_euhb73pg96c from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_euhb73pg96c from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0g9mf97iegft from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0g9mf97iegft from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0g9mf97iegft from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_euhb73pg96c.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_euhb73pg96c.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_euhb73pg96c.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0g9mf97iegft.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0g9mf97iegft.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0g9mf97iegft.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as StorybookConfig$1 } from "./chunk-DAg8hspc.js";
1
+ import { n as StorybookConfig$1 } from "./chunk-BWzDcG_q.js";
2
2
  import { PresetProperty } from "storybook/internal/types";
3
3
 
4
4
  //#region code/frameworks/svelte-vite/.dts-emit/code/frameworks/svelte-vite/src/preset.d.ts
package/dist/preset.js CHANGED
@@ -1,16 +1,21 @@
1
- import CJS_COMPAT_NODE_URL_euhb73pg96c from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_euhb73pg96c from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_euhb73pg96c from "node:module";
1
+ import CJS_COMPAT_NODE_URL_0g9mf97iegft from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_0g9mf97iegft from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_0g9mf97iegft from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_euhb73pg96c.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_euhb73pg96c.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_euhb73pg96c.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_0g9mf97iegft.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_0g9mf97iegft.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_0g9mf97iegft.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
 
13
13
  // src/preset.ts
14
+ import {
15
+ getTypeScriptForDocgenError,
16
+ isDocgenServerDisabledInMainConfig
17
+ } from "storybook/internal/common";
18
+ import { deprecate } from "storybook/internal/node-logger";
14
19
  import { assertSvelteCsfAddonNotInstalled } from "@storybook/svelte/internal/svelte-csf/addon-check";
15
20
 
16
21
  // ../../../node_modules/@rolldown/pluginutils/dist/filter-B_mD-HGz.mjs
@@ -28,6 +33,7 @@ import {
28
33
  svelteCsfRuntimeStoriesPath,
29
34
  transformSvelteCsf
30
35
  } from "@storybook/svelte/internal/svelte-csf/transform";
36
+ import { normalizePath } from "vite";
31
37
  function svelteCsf() {
32
38
  let sveltePlugin;
33
39
  return {
@@ -43,7 +49,7 @@ function svelteCsf() {
43
49
  order: "pre",
44
50
  filter: { id: exactRegex(SVELTE_CSF_RUNTIME_STORIES_IMPORT_SOURCE) },
45
51
  handler() {
46
- return svelteCsfRuntimeStoriesPath;
52
+ return normalizePath(svelteCsfRuntimeStoriesPath);
47
53
  }
48
54
  },
49
55
  transform: {
@@ -65,259 +71,22 @@ function svelteCsf() {
65
71
  };
66
72
  }
67
73
 
68
- // src/plugins/svelte-docgen.ts
69
- import { basename, relative } from "node:path";
70
- import MagicString from "magic-string";
71
-
72
- // src/plugins/generateDocgen.ts
73
- import path from "node:path";
74
- import svelte2tsx, { internalHelpers } from "svelte2tsx";
75
- import { VERSION } from "svelte/compiler";
76
- import ts from "typescript";
77
- function convertType(type, checker) {
78
- if (type.flags & ts.TypeFlags.Any)
79
- return { type: "any" };
80
- if (type.flags & ts.TypeFlags.Number)
81
- return { type: "number" };
82
- if (type.flags & ts.TypeFlags.String)
83
- return { type: "string" };
84
- if (type.flags & ts.TypeFlags.Boolean)
85
- return { type: "boolean" };
86
- if (type.flags & ts.TypeFlags.ESSymbol)
87
- return { type: "symbol" };
88
- if (type.flags & ts.TypeFlags.Null)
89
- return { type: "null" };
90
- if (type.flags & ts.TypeFlags.Undefined)
91
- return { type: "undefined" };
92
- if (type.flags & ts.TypeFlags.Void)
93
- return { type: "void" };
94
- if (type.getCallSignatures().length > 0)
95
- return { type: "function", text: checker.typeToString(type) };
96
- if (type.flags & ts.TypeFlags.Object)
97
- return checker.getIndexTypeOfType(type, ts.IndexKind.Number) ? { type: "array", text: checker.typeToString(type) } : { type: "object", text: checker.typeToString(type) };
98
- if (type.isNumberLiteral() || type.isStringLiteral())
99
- return {
100
- type: "literal",
101
- value: type.value,
102
- text: type.flags & ts.TypeFlags.EnumLiteral ? checker.typeToString(type) : JSON.stringify(type.value)
103
- };
104
- if (type.flags & ts.TypeFlags.BooleanLiteral) {
105
- let text = checker.typeToString(type);
106
- return { type: "literal", value: text === "true", text };
107
- }
108
- if (type.isUnion()) {
109
- let types = type.types.map((t) => convertType(t, checker)).filter((t) => t !== void 0 && t.type !== "undefined"), idxTrue = types.findIndex((t) => t.type === "literal" && t.value === !0), idxFalse = types.findIndex((t) => t.type === "literal" && t.value === !1);
110
- return idxTrue !== -1 && idxFalse !== -1 && (types.splice(Math.max(idxTrue, idxFalse), 1), types.splice(Math.min(idxTrue, idxFalse), 1, { type: "boolean" })), types.length > 1 ? { type: "union", types } : types[0];
111
- }
112
- if (type.isIntersection())
113
- return { type: "intersection", types: type.types.map((t) => convertType(t, checker)).filter((t) => t !== void 0) };
114
- }
115
- function initializerToDefaultValue(expr, checker) {
116
- if (ts.isNumericLiteral(expr))
117
- return { text: expr.text };
118
- if (ts.isStringLiteral(expr))
119
- return { text: JSON.stringify(expr.text) };
120
- if (ts.isIdentifier(expr) || ts.isPropertyAccessExpression(expr)) {
121
- let symbol = checker.getSymbolAtLocation(expr);
122
- if (symbol && checker.isUndefinedSymbol(symbol))
123
- return;
124
- let type = checker.getTypeAtLocation(expr);
125
- if (type.flags & ts.TypeFlags.EnumLiteral)
126
- return { text: checker.typeToString(type) };
127
- if (type.isLiteral())
128
- return { text: JSON.stringify(type.value) };
129
- if (type.flags & ts.TypeFlags.Null)
130
- return { text: "null" };
131
- if (type.flags & ts.TypeFlags.BooleanLiteral)
132
- return { text: checker.typeToString(type) };
133
- if (type.getCallSignatures().length > 0)
134
- return { text: "function" };
135
- } else {
136
- if (ts.isArrayLiteralExpression(expr) || ts.isObjectLiteralExpression(expr) || ts.isNewExpression(expr))
137
- return { text: expr.getText() };
138
- if (ts.isArrowFunction(expr))
139
- return { text: "function" };
140
- }
141
- switch (expr.kind) {
142
- case ts.SyntaxKind.TrueKeyword:
143
- return { text: "true" };
144
- case ts.SyntaxKind.FalseKeyword:
145
- return { text: "false" };
146
- case ts.SyntaxKind.NullKeyword:
147
- return { text: "null" };
148
- }
149
- return { text: "..." };
150
- }
151
- function loadConfig(basepath) {
152
- let configPath = ts.findConfigFile(basepath, ts.sys.fileExists) || ts.findConfigFile(basepath, ts.sys.fileExists, "jsconfig.json"), forcedOptions = {
153
- sourceMap: !1,
154
- noEmit: !0,
155
- strict: !0,
156
- allowJs: !0,
157
- checkJs: !0,
158
- skipLibCheck: !0,
159
- skipDefaultLibCheck: !0
160
- };
161
- if (!configPath)
162
- return [forcedOptions, /* @__PURE__ */ new Set()];
163
- let configFile = ts.readConfigFile(configPath, ts.sys.readFile), config = ts.parseJsonConfigFileContent(
164
- configFile.config,
165
- ts.sys,
166
- path.dirname(configPath),
167
- void 0,
168
- configPath,
169
- void 0,
170
- [
171
- {
172
- extension: "svelte",
173
- isMixedContent: !0,
174
- scriptKind: ts.ScriptKind.Deferred
175
- }
176
- ]
177
- ), fileNames = new Set(
178
- config.fileNames.filter((fileName) => fileName.endsWith(".svelte")).map((fileName) => fileName + ".tsx")
179
- );
180
- return [
181
- {
182
- ...config.options,
183
- ...forcedOptions
184
- },
185
- fileNames
186
- ];
187
- }
188
- function createDocgenCache() {
74
+ // src/docgen/options.ts
75
+ var SVELTE_BUILDER_DOCGEN_DEPRECATION = "Builder docgen (the `docgen` option of `@storybook/svelte-vite` and `@storybook/sveltekit`) is deprecated and will be removed in Storybook 12. It runs because your Storybook main config sets `features.docgenServer: false`. Remove that setting to use server-side docgen.";
76
+ async function resolveDocgenContext(options) {
77
+ let [frameworkOptions, features] = await Promise.all([
78
+ options.presets.apply("frameworkOptions"),
79
+ options.presets.apply("features", {})
80
+ ]);
189
81
  return {
190
- filenameToModifiedTime: {},
191
- filenameToSourceFile: {},
192
- fileCache: {}
193
- };
194
- }
195
- function generateDocgen(targetFileName, cache) {
196
- if (targetFileName.endsWith(".svelte") && (targetFileName = targetFileName + ".tsx"), cache.options === void 0 || !cache.rootNames?.has(targetFileName)) {
197
- [cache.options, cache.rootNames] = loadConfig(targetFileName);
198
- let shimFilename = import.meta.resolve("svelte2tsx/svelte-shims-v4.d.ts");
199
- cache.rootNames.add(shimFilename), cache.rootNames.add(targetFileName);
200
- }
201
- let originalHost = ts.createCompilerHost(cache.options), host = {
202
- ...originalHost,
203
- readFile(fileName) {
204
- let isCacheTarget = fileName.endsWith(path.sep + "package.json");
205
- if (isCacheTarget && cache.fileCache[fileName])
206
- return cache.fileCache[fileName];
207
- let content = originalHost.readFile(fileName);
208
- return content && isCacheTarget && (cache.fileCache[fileName] = content), content;
209
- },
210
- fileExists(fileName) {
211
- if (fileName.endsWith(path.sep + "package.json") && cache.fileCache[fileName])
212
- return !0;
213
- let exists = originalHost.fileExists(fileName);
214
- return exists || (fileName.endsWith(".svelte.tsx") || fileName.endsWith(".svelte.jsx") ? (fileName = fileName.slice(0, -4), exists = originalHost.fileExists(fileName), exists) : !1);
215
- },
216
- getSourceFile(fileName, languageVersion, onError) {
217
- if (fileName.endsWith(".svelte.tsx") || fileName.endsWith(".svelte.jsx")) {
218
- let realFileName = fileName.slice(0, -4), modifiedTime = ts.sys.getModifiedTime ? ts.sys.getModifiedTime(realFileName) : void 0;
219
- if (modifiedTime && cache.filenameToModifiedTime[fileName]?.getTime() === modifiedTime.getTime())
220
- return cache.filenameToSourceFile[fileName];
221
- let content = originalHost.readFile(realFileName);
222
- if (content === void 0)
223
- return;
224
- let isTsFile = /<script\s+[^>]*?lang=('|")(ts|typescript)('|")/.test(content), tsx = svelte2tsx.svelte2tsx(content, {
225
- version: VERSION,
226
- isTsFile,
227
- mode: "dts"
228
- }), sourceFile2 = ts.createSourceFile(
229
- fileName,
230
- tsx.code,
231
- languageVersion,
232
- !0,
233
- isTsFile ? ts.ScriptKind.TS : ts.ScriptKind.JS
234
- // Set to 'JS' to enable TypeScript to parse JSDoc.
235
- );
236
- return cache.filenameToSourceFile[fileName] = sourceFile2, cache.filenameToModifiedTime[fileName] = modifiedTime, sourceFile2;
237
- } else {
238
- let staticCaching = !1;
239
- staticCaching ||= fileName.split(path.sep).some((part) => part.toLowerCase() === "node_modules");
240
- let cachedSourceFile = cache.filenameToSourceFile[fileName];
241
- if (cachedSourceFile && staticCaching)
242
- return cachedSourceFile;
243
- let modifiedTime = ts.sys.getModifiedTime ? ts.sys.getModifiedTime(fileName) : void 0;
244
- if (modifiedTime && cache.filenameToModifiedTime[fileName]?.getTime() === modifiedTime.getTime())
245
- return cache.filenameToSourceFile[fileName];
246
- let content = originalHost.readFile(fileName);
247
- if (content === void 0)
248
- return;
249
- let sourceFile2 = ts.createSourceFile(fileName, content, languageVersion, !0);
250
- return cache.filenameToSourceFile[fileName] = sourceFile2, cache.filenameToModifiedTime[fileName] = modifiedTime, sourceFile2;
251
- }
252
- },
253
- writeFile() {
254
- }
255
- }, program = ts.createProgram({
256
- rootNames: Array.from(cache.rootNames),
257
- options: cache.options,
258
- host,
259
- oldProgram: cache.oldProgram
260
- });
261
- cache.oldProgram = program;
262
- let checker = program.getTypeChecker(), sourceFile = program.getSourceFile(targetFileName);
263
- if (sourceFile === void 0)
264
- return {
265
- props: []
266
- };
267
- let propMap = /* @__PURE__ */ new Map(), renderFunction = sourceFile.statements.find((statement) => ts.isFunctionDeclaration(statement) && statement.name?.text === internalHelpers.renderName);
268
- if (renderFunction === void 0)
269
- return {
270
- props: []
271
- };
272
- let propsType, signature = checker.getSignatureFromDeclaration(renderFunction);
273
- return signature && signature.declaration && checker.getReturnTypeOfSignature(signature).getProperties().forEach((retObjProp) => {
274
- if (retObjProp.name === "props") {
275
- let decl = signature.getDeclaration();
276
- propsType = checker.getTypeOfSymbolAtLocation(retObjProp, decl), propsType.getProperties().forEach((prop) => {
277
- let name = prop.getName(), description = ts.displayPartsToString(prop.getDocumentationComment(checker)) || void 0, propType = checker.getTypeOfSymbolAtLocation(prop, decl);
278
- if (prop.valueDeclaration) {
279
- let typeTag = ts.getJSDocTypeTag(prop.valueDeclaration);
280
- typeTag?.comment && (description = ((description || "") + `
281
- ` + typeTag.comment).trim());
282
- }
283
- if ((prop.valueDeclaration ?? prop?.links?.syntheticOrigin?.valueDeclaration)?.getSourceFile().fileName.includes("node_modules/svelte/elements.d.ts"))
284
- return;
285
- let optional = (prop.flags & ts.SymbolFlags.Optional) !== 0;
286
- propMap.set(name, {
287
- name,
288
- optional,
289
- description,
290
- type: convertType(propType, checker)
291
- });
292
- });
293
- }
294
- }), renderFunction.body?.forEachChild((node) => {
295
- ts.isVariableStatement(node) && node.declarationList.declarations.forEach((declaration) => {
296
- if (ts.isObjectBindingPattern(declaration.name)) {
297
- let isPropsRune = declaration.initializer && ts.isCallExpression(declaration.initializer) && ts.isIdentifier(declaration.initializer.expression) && declaration.initializer.expression.text === "$props", isPropsType = declaration.type && propsType === checker.getTypeFromTypeNode(declaration.type);
298
- (isPropsRune || isPropsType) && declaration.name.elements.forEach((element) => {
299
- let name = element.name.getText(), prop = propMap.get(name);
300
- if (prop && element.initializer) {
301
- let defaultValue = initializerToDefaultValue(element.initializer, checker);
302
- defaultValue && (prop.defaultValue = defaultValue);
303
- }
304
- });
305
- }
306
- if (ts.isVariableDeclaration(declaration) && ts.isIdentifier(declaration.name) && propMap.has(declaration.name.text)) {
307
- let prop = propMap.get(declaration.name.text);
308
- if (prop && declaration.initializer) {
309
- prop.optional = !0;
310
- let defaultValue = initializerToDefaultValue(declaration.initializer, checker);
311
- defaultValue && (prop.defaultValue = defaultValue);
312
- }
313
- }
314
- });
315
- }), {
316
- props: Array.from(propMap.values())
82
+ docgen: frameworkOptions?.docgen !== !1,
83
+ docgenServerActive: features?.docgenServer === !0
317
84
  };
318
85
  }
319
86
 
320
87
  // src/plugins/svelte-docgen.ts
88
+ import { basename, relative } from "node:path";
89
+ import MagicString from "magic-string";
321
90
  function getComponentName(ast) {
322
91
  let exportDefaultDeclaration = ast.body.find((n) => n.type === "ExportDefaultDeclaration");
323
92
  if (!exportDefaultDeclaration)
@@ -384,7 +153,11 @@ function transformToSvelteDocParserDataItems(docgen) {
384
153
  });
385
154
  }
386
155
  async function svelteDocgen() {
387
- let cwd = process.cwd(), include2 = /\.svelte$/, exclude2 = /node_modules\/.*/, { createFilter } = await import("vite"), filter = createFilter(include2, exclude2), sourceFileCache = createDocgenCache();
156
+ let cwd = process.cwd(), include2 = /\.svelte$/, exclude2 = /node_modules\/.*/, [{ createFilter }, { createDocgenCache, generateDocgen }] = await Promise.all([
157
+ import("vite"),
158
+ // The engine loads `typescript`, so it is imported only when builder docgen runs.
159
+ import("@storybook/svelte/internal/docgen-engine")
160
+ ]), filter = createFilter(include2, exclude2), sourceFileCache = createDocgenCache();
388
161
  return {
389
162
  name: "storybook:svelte-docgen-plugin",
390
163
  transform: {
@@ -424,7 +197,11 @@ var core = {
424
197
  renderer: import.meta.resolve("@storybook/svelte/preset")
425
198
  }, viteFinal = async (config, options) => {
426
199
  let { plugins = [] } = config, framework = await options.presets.apply("framework");
427
- return assertSvelteCsfAddonNotInstalled({ presetsList: options.presetsList, framework }), (typeof framework == "string" ? {} : framework.options ?? {}).docgen !== !1 && plugins.push(await svelteDocgen()), await handleSvelteKit(plugins, options), plugins.push(svelteCsf()), {
200
+ assertSvelteCsfAddonNotInstalled({ presetsList: options.presetsList, framework });
201
+ let { docgen, docgenServerActive } = await resolveDocgenContext(options), typescriptUsable = !getTypeScriptForDocgenError(
202
+ (specifier) => import.meta.resolve(specifier)
203
+ );
204
+ return docgen && !docgenServerActive && (await isDocgenServerDisabledInMainConfig(options) && deprecate(SVELTE_BUILDER_DOCGEN_DEPRECATION), typescriptUsable && plugins.push(await svelteDocgen())), await handleSvelteKit(plugins, options), plugins.push(svelteCsf()), {
428
205
  ...config,
429
206
  plugins
430
207
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/svelte-vite",
3
- "version": "11.0.0-alpha.8",
3
+ "version": "11.0.0-beta.0",
4
4
  "description": "Storybook for Svelte and Vite: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -52,11 +52,9 @@
52
52
  "!src/**/*"
53
53
  ],
54
54
  "dependencies": {
55
- "@storybook/builder-vite": "11.0.0-alpha.8",
56
- "@storybook/svelte": "11.0.0-alpha.8",
57
- "magic-string": "^1.1.0",
58
- "svelte2tsx": "^0.7.55",
59
- "typescript": "^5.9.0 || ^6.0.0"
55
+ "@storybook/builder-vite": "11.0.0-beta.0",
56
+ "@storybook/svelte": "11.0.0-beta.0",
57
+ "magic-string": "^1.1.0"
60
58
  },
61
59
  "devDependencies": {
62
60
  "@rolldown/pluginutils": "^1.0.1",
@@ -69,7 +67,7 @@
69
67
  },
70
68
  "peerDependencies": {
71
69
  "@sveltejs/vite-plugin-svelte": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
72
- "storybook": "^11.0.0-alpha.8",
70
+ "storybook": "^11.0.0-beta.0",
73
71
  "svelte": "^5.0.0",
74
72
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
75
73
  "vite": "^6.3.0 || ^7.0.0 || ^8.0.0"
@@ -6,10 +6,8 @@ import JSDoc from './jsdoc.svelte';
6
6
  const meta = {
7
7
  component: JSDoc,
8
8
  tags: ['autodocs'],
9
- render: (args, { argTypes }) => ({
10
- Component: JSDoc,
11
- props: { ...args, argTypes },
12
- }),
9
+ // These stories exist for the docgen sandbox baselines; the canvas shows no docgen output.
10
+ parameters: { chromatic: { disableSnapshot: true } },
13
11
  };
14
12
 
15
13
  export default meta;
@@ -26,7 +26,6 @@
26
26
  * @property {{ a: number } & { b: string }} [intersection] Intersection of types
27
27
  * @property {import('svelte').Snippet} children Snippet contents
28
28
  * @property {(event: MouseEvent) => number} [func] Event callback function
29
- * @property {Record<string, any>} [argTypes] Actual arg types inferred from the component
30
29
  */
31
30
 
32
31
  /** @type {MyProps} */
@@ -50,7 +49,6 @@
50
49
  intersection = undefined,
51
50
  children,
52
51
  func = () => 10,
53
- argTypes,
54
52
  } = $props();
55
53
  </script>
56
54
 
@@ -86,6 +84,3 @@
86
84
  {#if children}
87
85
  {@render children()}
88
86
  {/if}
89
-
90
- <h2>Arg Types</h2>
91
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -5,10 +5,8 @@ import TSInlinePropTypes from './ts-inline-prop-types.svelte';
5
5
  const meta = {
6
6
  component: TSInlinePropTypes,
7
7
  tags: ['autodocs'],
8
- render: (args, { argTypes }) => ({
9
- Component: TSInlinePropTypes,
10
- props: { ...args, argTypes },
11
- }),
8
+ // These stories exist for the docgen sandbox baselines; the canvas shows no docgen output.
9
+ parameters: { chromatic: { disableSnapshot: true } },
12
10
  } satisfies Meta<typeof TSInlinePropTypes>;
13
11
 
14
12
  export default meta;
@@ -21,7 +21,6 @@
21
21
  unionTypes = 123,
22
22
  func = () => 10,
23
23
  children,
24
- argTypes,
25
24
  }: {
26
25
  /** Boolean */
27
26
  boolean?: boolean;
@@ -68,8 +67,6 @@
68
67
  func?: (event: MouseEvent) => number;
69
68
  /** Snippet contents */
70
69
  children: Snippet;
71
- /** Actual arg types inferred from the component */
72
- argTypes: Record<string, any>;
73
70
  } = $props();
74
71
  </script>
75
72
 
@@ -98,6 +95,3 @@
98
95
  {#if children}
99
96
  {@render children()}
100
97
  {/if}
101
-
102
- <h2>Arg Types</h2>
103
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -5,10 +5,8 @@ import TSLegacy from './ts-legacy.svelte';
5
5
  const meta = {
6
6
  component: TSLegacy,
7
7
  tags: ['autodocs'],
8
- render: (args, { argTypes }) => ({
9
- Component: TSLegacy,
10
- props: { ...args, argTypes } as any,
11
- }),
8
+ // These stories exist for the docgen sandbox baselines; the canvas shows no docgen output.
9
+ parameters: { chromatic: { disableSnapshot: true } },
12
10
  } satisfies Meta<typeof TSLegacy>;
13
11
 
14
12
  export default meta;
@@ -55,8 +55,6 @@
55
55
  export let func: (event: MouseEvent) => number = () => 10;
56
56
  /** Snippet contents */
57
57
  export let children: Snippet;
58
- /** Actual arg types inferred from the component */
59
- export let argTypes: Record<string, any> = {};
60
58
  </script>
61
59
 
62
60
  <h1>Docgen: TS - legacy</h1>
@@ -93,6 +91,3 @@
93
91
  {#if children}
94
92
  {@render children()}
95
93
  {/if}
96
-
97
- <h2>Arg Types</h2>
98
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -5,10 +5,8 @@ import TSReferencedPropTypes from './ts-referenced-prop-types.svelte';
5
5
  const meta = {
6
6
  component: TSReferencedPropTypes,
7
7
  tags: ['autodocs'],
8
- render: (args, { argTypes }) => ({
9
- Component: TSReferencedPropTypes,
10
- props: { ...args, argTypes },
11
- }),
8
+ // These stories exist for the docgen sandbox baselines; the canvas shows no docgen output.
9
+ parameters: { chromatic: { disableSnapshot: true } },
12
10
  } satisfies Meta<typeof TSReferencedPropTypes>;
13
11
 
14
12
  export default meta;
@@ -56,8 +56,6 @@
56
56
  func?: (event: MouseEvent) => number;
57
57
  /** Snippet contents */
58
58
  children: Snippet;
59
- /** Actual arg types inferred from the component */
60
- argTypes: Record<string, any>;
61
59
  };
62
60
 
63
61
  let {
@@ -73,7 +71,6 @@
73
71
  unionTypes = 123,
74
72
  children,
75
73
  func = () => 10,
76
- argTypes,
77
74
  }: PropsA & PropsB = $props();
78
75
  </script>
79
76
 
@@ -102,6 +99,3 @@
102
99
  {#if children}
103
100
  {@render children()}
104
101
  {/if}
105
-
106
- <h2>Arg Types</h2>
107
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -5,10 +5,8 @@ import TS from './ts.svelte';
5
5
  const meta = {
6
6
  component: TS,
7
7
  tags: ['autodocs'],
8
- render: (args, { argTypes }) => ({
9
- Component: TS,
10
- props: { ...args, argTypes },
11
- }),
8
+ // These stories exist for the docgen sandbox baselines; the canvas shows no docgen output.
9
+ parameters: { chromatic: { disableSnapshot: true } },
12
10
  } satisfies Meta<typeof TS>;
13
11
 
14
12
  export default meta;
@@ -56,8 +56,6 @@
56
56
  func?: (event: MouseEvent) => number;
57
57
  /** Children */
58
58
  children: Snippet;
59
- /** Actual arg types inferred from the component */
60
- argTypes: Record<string, any>;
61
59
  };
62
60
 
63
61
  const {
@@ -82,7 +80,6 @@
82
80
  intersection = undefined,
83
81
  func = () => 10,
84
82
  children,
85
- argTypes,
86
83
  }: Props = $props();
87
84
  </script>
88
85
 
@@ -120,6 +117,3 @@
120
117
  {#if children}
121
118
  {@render children()}
122
119
  {/if}
123
-
124
- <h2>Arg Types</h2>
125
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -1,17 +0,0 @@
1
- import JSDoc from './jsdoc.svelte';
2
-
3
- /** @typedef {import('@storybook/svelte-vite').StoryObj} StoryObj */
4
-
5
- /** @type {Meta<typeof JSDoc>} */
6
- const meta = {
7
- component: JSDoc,
8
- tags: ['autodocs'],
9
- render: (args, { argTypes }) => ({
10
- Component: JSDoc,
11
- props: { ...args, argTypes },
12
- }),
13
- };
14
-
15
- export default meta;
16
-
17
- export const Default = {};
@@ -1,92 +0,0 @@
1
- <script>
2
- /**
3
- * @typedef {Object} MyObject
4
- * @property {string} foo
5
- * @property {number} bar
6
- */
7
-
8
- /**
9
- * @typedef {Object} MyProps
10
- * @property {boolean} [boolean] Boolean
11
- * @property {string} [string] String
12
- * @property {string} stringRequired String (required)
13
- * @property {number} [number] Number
14
- * @property {true} [trueLiteral] True literal
15
- * @property {symbol} [symbol] Symbol
16
- * @property {null} [nullValue] Null
17
- * @property {undefined} [undefinedValue] Undefined
18
- * @property {any} [any] Any
19
- * @property {Date} [date] Date
20
- * @property {import('./types').LiteralStrings} [unionLiteralStrings] Union of literal strings
21
- * @property {import('./types').LiteralNumbers} [unionLiteralNumbers] Union of literal numbers
22
- * @property {MyObject} [object] Object
23
- * @property {{ foo: string; bar: number }} [inlineObject] Inline object
24
- * @property {Record<string, number>} [record] Record
25
- * @property {number | string} [unionTypes] Union of types
26
- * @property {{ a: number } & { b: string }} [intersection] Intersection of types
27
- * @property {(event: MouseEvent) => number} [func] Event callback function
28
- * @property {import('svelte').Snippet} children Snippet contents
29
- * @property {Record<string, any>} [argTypes] Actual arg types inferred from the component
30
- */
31
-
32
- /** @type {MyProps} */
33
- let {
34
- boolean = true,
35
- string = 'default',
36
- stringRequired,
37
- number = 123,
38
- trueLiteral = undefined,
39
- symbol = undefined,
40
- nullValue = null,
41
- undefinedValue = undefined,
42
- any = undefined,
43
- date = new Date('20 Jan 1983'),
44
- unionLiteralStrings = 'apple',
45
- unionLiteralNumbers = 1000,
46
- object = undefined,
47
- inlineObject = undefined,
48
- record = { a: 1, b: 2 },
49
- unionTypes = 123,
50
- intersection = undefined,
51
- func = () => 10,
52
- children,
53
- argTypes,
54
- } = $props();
55
- </script>
56
-
57
- <h1>Docgen: JS - JSDoc</h1>
58
-
59
- <h2>Args</h2>
60
- <pre>{JSON.stringify(
61
- {
62
- boolean,
63
- string,
64
- stringRequired,
65
- number,
66
- trueLiteral,
67
- symbol,
68
- nullValue,
69
- undefinedValue,
70
- any,
71
- date,
72
- unionLiteralStrings,
73
- unionLiteralNumbers,
74
- object,
75
- inlineObject,
76
- record,
77
- unionTypes,
78
- intersection,
79
- func,
80
- argTypes,
81
- },
82
- null,
83
- 2
84
- )}</pre>
85
-
86
- <h2>Children</h2>
87
- {#if children}
88
- {@render children()}
89
- {/if}
90
-
91
- <h2>Arg Types</h2>
92
- <pre>{JSON.stringify(argTypes, null, 2)}</pre>