@storybook/svelte 11.0.0-beta.4 → 11.0.0-beta.5

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.
@@ -5,11 +5,8 @@ var skipSourceRender = (context) => {
5
5
  let sourceParams = context.parameters.docs?.source, isArgsStory = context.parameters.__isArgsStory;
6
6
  return sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
7
7
  };
8
- function toSvelteProperty(key, value, argTypes) {
9
- if (value == null)
10
- return null;
11
- let argType = argTypes[key];
12
- return argType && argType.action ? null : value === !0 ? key : typeof value == "string" ? `${key}=${JSON.stringify(value)}` : typeof value == "function" ? `${key}={<handler>}` : `${key}={${JSON.stringify(value)}}`;
8
+ function toSvelteProperty(key, value) {
9
+ return value == null || value.isAction ? null : value === !0 ? key : typeof value == "string" ? `${key}=${JSON.stringify(value)}` : typeof value == "function" ? `${key}={<handler>}` : `${key}={${JSON.stringify(value)}}`;
13
10
  }
14
11
  function getComponentName(component) {
15
12
  if (component == null)
@@ -17,11 +14,11 @@ function getComponentName(component) {
17
14
  let { __docgen = {} } = component, { name } = __docgen;
18
15
  return name ? (name.endsWith(".svelte") && (name = name.substring(0, name.length - 7)), name) : component.name;
19
16
  }
20
- function generateSvelteSource(component, args, argTypes, slotProperty) {
17
+ function generateSvelteSource(component, args, slotProperty) {
21
18
  let name = getComponentName(component);
22
19
  if (!name)
23
20
  return null;
24
- let propsArray = Object.entries(args).filter(([k]) => k !== slotProperty).map(([k, v]) => toSvelteProperty(k, v, argTypes)).filter((p) => p), props = propsArray.join(" "), multiline = props.length > 50, slotValue = slotProperty ? args[slotProperty] : null, srcStart = multiline ? `<${name}
21
+ let propsArray = Object.entries(args).filter(([k]) => k !== slotProperty).map(([k, v]) => toSvelteProperty(k, v)).filter((p) => p), props = propsArray.join(" "), multiline = props.length > 50, slotValue = slotProperty ? args[slotProperty] : null, srcStart = multiline ? `<${name}
25
22
  ${propsArray.join(`
26
23
  `)}` : `<${name} ${props}`;
27
24
  return slotValue ? `${srcStart}>
@@ -44,7 +41,7 @@ var sourceDecorator = (storyFn, context) => {
44
41
  context
45
42
  ), { wrapper, slotProperty } = getWrapperProperties(component);
46
43
  wrapper && (component = ctxComponent);
47
- let generated = generateSvelteSource(component, args, context?.argTypes, slotProperty);
44
+ let generated = generateSvelteSource(component, args, slotProperty);
48
45
  generated && source.current !== generated && (emitTransformCode(generated, context), source.current = generated);
49
46
  }), story;
50
47
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sourceDecorator
3
- } from "./chunk-D3HHTIN7.js";
3
+ } from "./chunk-BMWD75KG.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-4BE7D4DS.js";
@@ -11,6 +11,7 @@ __export(entry_preview_docs_exports, {
11
11
  decorators: () => decorators,
12
12
  parameters: () => parameters
13
13
  });
14
+ import { getSourceSnippetRuntime } from "storybook/internal/docs-tools";
14
15
 
15
16
  // src/docs/print-hole.ts
16
17
  import { printValue, unknownHoleKind } from "storybook/internal/docs-tools";
@@ -75,7 +76,7 @@ function propValue(value, name) {
75
76
  }
76
77
 
77
78
  // src/entry-preview-docs.ts
78
- var decorators = globalThis.FEATURES?.docgenServer ? [] : [sourceDecorator], parameters = globalThis.FEATURES?.docgenServer ? { docs: { source: { printHole } } } : {};
79
+ var snippetRuntime = getSourceSnippetRuntime(), decorators = snippetRuntime === "preview" ? [sourceDecorator] : [], parameters = snippetRuntime === "server" ? { docs: { source: { printHole } } } : {};
79
80
 
80
81
  export {
81
82
  decorators,
@@ -182,7 +182,7 @@ function prepareStory(context, rawStory, rawInnerStory) {
182
182
  ...innerStory,
183
183
  decorator: preparedStory
184
184
  }
185
- } : { ...preparedStory, argTypes: context.argTypes };
185
+ } : preparedStory;
186
186
  }
187
187
  function decorateStory(storyFn, decorators) {
188
188
  return decorators.reduce(
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "./_browser-chunks/chunk-QPNLWHUT.js";
5
- import "./_browser-chunks/chunk-D3HHTIN7.js";
4
+ } from "./_browser-chunks/chunk-JSFXTARB.js";
5
+ import "./_browser-chunks/chunk-BMWD75KG.js";
6
6
  import "./_browser-chunks/chunk-4BE7D4DS.js";
7
7
  export {
8
8
  decorators,
@@ -5,7 +5,7 @@ import {
5
5
  parameters,
6
6
  render,
7
7
  renderToCanvas
8
- } from "./_browser-chunks/chunk-UQPE7TCS.js";
8
+ } from "./_browser-chunks/chunk-SPDFOPD5.js";
9
9
  import "./_browser-chunks/chunk-4BE7D4DS.js";
10
10
  export {
11
11
  decorateStory as applyDecorators,
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  entry_preview_exports,
3
3
  renderToCanvas
4
- } from "./_browser-chunks/chunk-UQPE7TCS.js";
4
+ } from "./_browser-chunks/chunk-SPDFOPD5.js";
5
5
  import {
6
6
  entry_preview_docs_exports
7
- } from "./_browser-chunks/chunk-QPNLWHUT.js";
8
- import "./_browser-chunks/chunk-D3HHTIN7.js";
7
+ } from "./_browser-chunks/chunk-JSFXTARB.js";
8
+ import "./_browser-chunks/chunk-BMWD75KG.js";
9
9
  import "./_browser-chunks/chunk-4BE7D4DS.js";
10
10
 
11
11
  // src/globals.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  skipSourceRender
3
- } from "../../_browser-chunks/chunk-D3HHTIN7.js";
3
+ } from "../../_browser-chunks/chunk-BMWD75KG.js";
4
4
  import {
5
5
  syncStoryArgs
6
6
  } from "../../_browser-chunks/chunk-QOQZ54LJ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/svelte",
3
- "version": "11.0.0-beta.4",
3
+ "version": "11.0.0-beta.5",
4
4
  "description": "Storybook Svelte renderer: Develop, document, and test UI components in isolation.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -101,11 +101,11 @@
101
101
  "svelte-check": "^4.4.8",
102
102
  "sveltedoc-parser": "^4.2.1",
103
103
  "typescript": "^6.0.3",
104
- "vite": "^7.0.4",
104
+ "vite": "^7.3.8",
105
105
  "zimmerframe": "^1.1.2"
106
106
  },
107
107
  "peerDependencies": {
108
- "storybook": "^11.0.0-beta.4",
108
+ "storybook": "^11.0.0-beta.5",
109
109
  "svelte": "^5.0.0",
110
110
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
111
111
  },