@repobuddy/storybook 2.28.1 → 2.29.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.
package/esm/index.d.ts CHANGED
@@ -121,6 +121,7 @@ type ShowSourceOptions = Pick<StoryCardProps, 'className' | 'data-testid'> & {
121
121
  source?: ((source: string | undefined) => string) | string | undefined;
122
122
  showOriginalSource?: boolean | undefined;
123
123
  placement?: 'before' | 'after' | undefined;
124
+ language?: 'json' | 'md' | 'html' | 'css' | 'js' | 'ts' | (string & {}) | undefined;
124
125
  };
125
126
  /**
126
127
  * A decorator that shows the source code of a story relative to the rendered story.
@@ -138,6 +139,7 @@ declare function showSource<TRenderer extends Renderer = Renderer, TArgs = Args>
138
139
  placement,
139
140
  showOriginalSource,
140
141
  source,
142
+ language,
141
143
  ...options
142
144
  }?: ShowSourceOptions): DecoratorFunction<TRenderer, TArgs>;
143
145
  //#endregion
package/esm/index.js CHANGED
@@ -190,7 +190,7 @@ const channel = addons.getChannel();
190
190
  * @param options.placement - Where to show the source code relative to the story.
191
191
  * @returns A decorator function that shows the source code of a story above or below the rendered story
192
192
  */
193
- function showSource({ className, placement, showOriginalSource, source, ...options } = {}) {
193
+ function showSource({ className, placement, showOriginalSource, source, language, ...options } = {}) {
194
194
  if (isRunningInTest()) return (Story) => /* @__PURE__ */ jsx(Story, {});
195
195
  return (Story, { parameters: { docs, darkMode } }) => {
196
196
  const storedItem = window.localStorage.getItem("sb-addon-themes-3");
@@ -202,13 +202,13 @@ function showSource({ className, placement, showOriginalSource, source, ...optio
202
202
  }, []);
203
203
  const originalSource = showOriginalSource ? docs?.source?.originalSource : docs?.source?.code ?? docs?.source?.originalSource;
204
204
  const code = typeof source === "function" ? source(originalSource) : source ?? originalSource;
205
- const language = code === docs?.source?.originalSource ? void 0 : docs?.source?.language;
205
+ const lang = language ?? (code === docs?.source?.originalSource ? void 0 : docs?.source?.language);
206
206
  const isOriginalSource = code === docs?.source?.originalSource;
207
207
  const sourceContent = useMemo(() => /* @__PURE__ */ jsx(SyntaxHighlighter, {
208
208
  "data-testid": "source-content",
209
- language,
209
+ language: lang,
210
210
  children: code
211
- }), [code, language]);
211
+ }), [code, lang]);
212
212
  const showBefore = (placement ?? "before") === "before";
213
213
  const sourceCardClassName = useCallback((state) => {
214
214
  const modifiedState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobuddy/storybook",
3
- "version": "2.28.1",
3
+ "version": "2.29.0",
4
4
  "description": "Storybook repo buddy",
5
5
  "keywords": [
6
6
  "storybook",
@@ -90,7 +90,7 @@
90
90
  "@tailwindcss/cli": "^4.1.17",
91
91
  "@tailwindcss/vite": "^4.1.17",
92
92
  "@vitest/browser": "^4.0.16",
93
- "@vitest/browser-playwright": "^4.0.16",
93
+ "@vitest/browser-playwright": "^4.1.4",
94
94
  "@vitest/coverage-v8": "^4.0.16",
95
95
  "dedent": "^1.7.0",
96
96
  "npm-run-all2": "^8.0.4",
@@ -100,8 +100,8 @@
100
100
  "storybook": "^10.3.5",
101
101
  "storybook-addon-code-editor": "^6.1.3",
102
102
  "storybook-addon-tag-badges": "^3.1.0",
103
- "storybook-addon-vis": "^3.1.4",
104
- "tsdown": "^0.21.4",
103
+ "storybook-addon-vis": "^4.0.0",
104
+ "tsdown": "^0.22.0",
105
105
  "vite": "^8.0.8",
106
106
  "vitest": "^4.0.16"
107
107
  },
@@ -22,6 +22,7 @@ export type ShowSourceOptions = Pick<StoryCardProps, 'className' | 'data-testid'
22
22
  source?: ((source: string | undefined) => string) | string | undefined
23
23
  showOriginalSource?: boolean | undefined
24
24
  placement?: 'before' | 'after' | undefined
25
+ language?: 'json' | 'md' | 'html' | 'css' | 'js' | 'ts' | (string & {}) | undefined
25
26
  }
26
27
 
27
28
  /**
@@ -40,6 +41,7 @@ export function showSource<TRenderer extends Renderer = Renderer, TArgs = Args>(
40
41
  placement,
41
42
  showOriginalSource,
42
43
  source,
44
+ language,
43
45
  ...options
44
46
  }: ShowSourceOptions = {}): DecoratorFunction<TRenderer, TArgs> {
45
47
  if (isRunningInTest()) {
@@ -64,17 +66,17 @@ export function showSource<TRenderer extends Renderer = Renderer, TArgs = Args>(
64
66
 
65
67
  const code = typeof source === 'function' ? source(originalSource) : (source ?? originalSource)
66
68
 
67
- const language = code === docs?.source?.originalSource ? undefined : docs?.source?.language
69
+ const lang = language ?? (code === docs?.source?.originalSource ? undefined : docs?.source?.language)
68
70
 
69
71
  const isOriginalSource = code === docs?.source?.originalSource
70
72
 
71
73
  const sourceContent = useMemo(
72
74
  () => (
73
- <SyntaxHighlighter data-testid="source-content" language={language}>
75
+ <SyntaxHighlighter data-testid="source-content" language={lang}>
74
76
  {code}
75
77
  </SyntaxHighlighter>
76
78
  ),
77
- [code, language]
79
+ [code, lang]
78
80
  )
79
81
 
80
82
  const showBefore = (placement ?? 'before') === 'before'
package/styles.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme {
4
4
  :root, :host {