@repobuddy/storybook 2.6.0 → 2.8.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 +15 -1
- package/esm/index.js +5 -4
- package/package.json +4 -4
- package/src/decorators/show_doc_source.tsx +7 -3
- package/src/index.ts +1 -0
package/esm/index.d.ts
CHANGED
|
@@ -70,6 +70,18 @@ type StoryCardProps = {
|
|
|
70
70
|
*/
|
|
71
71
|
children?: ReactNode | undefined;
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* A card component that displays information with optional title and status styling.
|
|
75
|
+
*
|
|
76
|
+
* @param props - StoryCard component props
|
|
77
|
+
* @returns A section element containing the card content
|
|
78
|
+
*/
|
|
79
|
+
declare function StoryCard({
|
|
80
|
+
status,
|
|
81
|
+
className,
|
|
82
|
+
children,
|
|
83
|
+
title
|
|
84
|
+
}: StoryCardProps): react_jsx_runtime0.JSX.Element;
|
|
73
85
|
//#endregion
|
|
74
86
|
//#region src/decorators/show_doc_source.d.ts
|
|
75
87
|
/**
|
|
@@ -79,9 +91,11 @@ type StoryCardProps = {
|
|
|
79
91
|
* @param options - Options for the showDocSource decorator
|
|
80
92
|
* @param options.showOriginalSource - Whether to show the original source code in a card
|
|
81
93
|
* @param options.className - Class name to apply to the card
|
|
94
|
+
* @param options.source - Source code to show if provided.
|
|
82
95
|
* @returns A decorator function that shows the source code of a story above the rendered story
|
|
83
96
|
*/
|
|
84
97
|
declare function showDocSource<TRenderer extends Renderer = Renderer, TArgs = Args>(options?: Pick<StoryCardProps, 'className'> & {
|
|
98
|
+
source?: string | undefined;
|
|
85
99
|
showOriginalSource?: boolean | undefined;
|
|
86
100
|
}): DecoratorFunction<TRenderer, TArgs>;
|
|
87
101
|
//#endregion
|
|
@@ -798,4 +812,4 @@ type ExtendsStoryObj<S extends {
|
|
|
798
812
|
tags?: ExtractStringLiterals<NonNullable<S['tags']>[number]> extends infer MT ? IsStringLiteral<MT> extends true ? Array<(string & {}) | MT | E['tag']> | undefined : Array<(string & {}) | E['tag']> | undefined : never;
|
|
799
813
|
};
|
|
800
814
|
//#endregion
|
|
801
|
-
export { ActionsParam, BackgroundsParam, DocsParam, ExtendMeta, ExtendStoryObj, ExtendsMeta, ExtendsStoryObj, FnToArgTypes, GlobalApiBackgroundsParam, GlobalApiViewportParam, LayoutParam, ShowHtml, ShowHtmlProps, SourceProps, StorySortParam, StorybookBuiltInParams, TestParam, Viewport, ViewportParam, WithStoryCardProps, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
|
815
|
+
export { ActionsParam, BackgroundsParam, DocsParam, ExtendMeta, ExtendStoryObj, ExtendsMeta, ExtendsStoryObj, FnToArgTypes, GlobalApiBackgroundsParam, GlobalApiViewportParam, LayoutParam, ShowHtml, ShowHtmlProps, SourceProps, StoryCard, StoryCardProps, StorySortParam, StorybookBuiltInParams, TestParam, Viewport, ViewportParam, WithStoryCardProps, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
package/esm/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { isRunningInTest } from "@repobuddy/test";
|
|
|
3
3
|
import { prettify } from "htmlfy";
|
|
4
4
|
import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { twJoin, twMerge } from "tailwind-merge";
|
|
6
8
|
import { SyntaxHighlighter } from "storybook/internal/components";
|
|
7
9
|
import { addons } from "storybook/preview-api";
|
|
8
10
|
import { ThemeProvider, convert, themes } from "storybook/theming";
|
|
9
|
-
import { twJoin, twMerge } from "tailwind-merge";
|
|
10
|
-
import { cva } from "class-variance-authority";
|
|
11
11
|
|
|
12
12
|
export * from "@repobuddy/test"
|
|
13
13
|
|
|
@@ -81,6 +81,7 @@ const channel = addons.getChannel();
|
|
|
81
81
|
* @param options - Options for the showDocSource decorator
|
|
82
82
|
* @param options.showOriginalSource - Whether to show the original source code in a card
|
|
83
83
|
* @param options.className - Class name to apply to the card
|
|
84
|
+
* @param options.source - Source code to show if provided.
|
|
84
85
|
* @returns A decorator function that shows the source code of a story above the rendered story
|
|
85
86
|
*/
|
|
86
87
|
function showDocSource(options) {
|
|
@@ -92,7 +93,7 @@ function showDocSource(options) {
|
|
|
92
93
|
channel.on("DARK_MODE", setIsDark);
|
|
93
94
|
return () => channel.off("DARK_MODE", setIsDark);
|
|
94
95
|
}, []);
|
|
95
|
-
const code = options?.showOriginalSource ? docs?.source?.originalSource : docs?.source?.code ?? docs?.source?.originalSource;
|
|
96
|
+
const code = options?.source ?? (options?.showOriginalSource ? docs?.source?.originalSource : docs?.source?.code ?? docs?.source?.originalSource);
|
|
96
97
|
const language = code === docs?.source?.originalSource ? void 0 : docs?.source?.language;
|
|
97
98
|
const isOriginalSource = code === docs?.source?.originalSource;
|
|
98
99
|
const content = /* @__PURE__ */ jsx(SyntaxHighlighter, {
|
|
@@ -454,4 +455,4 @@ function whenRunningInTest(decoratorOrHandler) {
|
|
|
454
455
|
}
|
|
455
456
|
|
|
456
457
|
//#endregion
|
|
457
|
-
export { ShowHtml, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
|
458
|
+
export { ShowHtml, StoryCard, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repobuddy/storybook",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Storybook repo buddy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@repobuddy/vitest": "^2.0.0",
|
|
62
62
|
"@storybook-community/storybook-dark-mode": "^7.0.2",
|
|
63
|
-
"@storybook/addon-docs": "^10.
|
|
63
|
+
"@storybook/addon-docs": "^10.2.4",
|
|
64
64
|
"@storybook/addon-vitest": "^10.1.10",
|
|
65
|
-
"@storybook/react-vite": "^10.
|
|
65
|
+
"@storybook/react-vite": "^10.2.4",
|
|
66
66
|
"@tailwindcss/cli": "^4.1.17",
|
|
67
67
|
"@tailwindcss/vite": "^4.1.17",
|
|
68
68
|
"@vitest/browser": "^4.0.16",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@storybook-community/storybook-dark-mode": "^7.0.0",
|
|
85
|
-
"@storybook/addon-docs": "^10.
|
|
85
|
+
"@storybook/addon-docs": "^10.2.4",
|
|
86
86
|
"storybook-addon-tag-badges": "^3.0.2"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
@@ -15,10 +15,12 @@ const channel = addons.getChannel()
|
|
|
15
15
|
* @param options - Options for the showDocSource decorator
|
|
16
16
|
* @param options.showOriginalSource - Whether to show the original source code in a card
|
|
17
17
|
* @param options.className - Class name to apply to the card
|
|
18
|
+
* @param options.source - Source code to show if provided.
|
|
18
19
|
* @returns A decorator function that shows the source code of a story above the rendered story
|
|
19
20
|
*/
|
|
20
21
|
export function showDocSource<TRenderer extends Renderer = Renderer, TArgs = Args>(
|
|
21
22
|
options?: Pick<StoryCardProps, 'className'> & {
|
|
23
|
+
source?: string | undefined
|
|
22
24
|
showOriginalSource?: boolean | undefined
|
|
23
25
|
}
|
|
24
26
|
): DecoratorFunction<TRenderer, TArgs> {
|
|
@@ -34,9 +36,11 @@ export function showDocSource<TRenderer extends Renderer = Renderer, TArgs = Arg
|
|
|
34
36
|
return () => channel.off('DARK_MODE', setIsDark)
|
|
35
37
|
}, [])
|
|
36
38
|
|
|
37
|
-
const code =
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const code =
|
|
40
|
+
options?.source ??
|
|
41
|
+
(options?.showOriginalSource
|
|
42
|
+
? docs?.source?.originalSource
|
|
43
|
+
: (docs?.source?.code ?? docs?.source?.originalSource))
|
|
40
44
|
|
|
41
45
|
const language = code === docs?.source?.originalSource ? undefined : docs?.source?.language
|
|
42
46
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '@repobuddy/test'
|
|
2
2
|
export type * from './arg-types/fn-to-arg-types.ts'
|
|
3
3
|
export * from './components/show_html.tsx'
|
|
4
|
+
export * from './components/story_card.tsx'
|
|
4
5
|
export * from './decorators/show_doc_source.tsx'
|
|
5
6
|
export * from './decorators/with_story_card.tsx'
|
|
6
7
|
export * from './parameters/define_actions_param.ts'
|