@repobuddy/storybook 2.9.0 → 2.10.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 +48 -48
- package/esm/index.js +2 -2
- package/esm/storybook-addon-tag-badges/index.d.ts +24 -24
- package/esm/storybook-dark-mode/index.js +1 -1
- package/package.json +5 -1
- package/readme.md +8 -3
- package/src/decorators/with_story_card.tsx +3 -3
- package/src/index.ts +1 -1
- package/src/parameters/define_story_card_param.ts +1 -1
- package/src/storybook-addon-tag-badges/tag_badges.ts +1 -1
- package/src/storybook-addon-tag-badges/types.ts +1 -1
- package/src/storybook-dark-mode/dark_mode_docs_container.tsx +1 -1
- package/styles.css +0 -1
- package/tailwind.css +4 -0
package/esm/index.d.ts
CHANGED
|
@@ -785,7 +785,7 @@ interface StoryCardParam {
|
|
|
785
785
|
* }
|
|
786
786
|
* ```
|
|
787
787
|
*/
|
|
788
|
-
declare function
|
|
788
|
+
declare function defineStoryCardParam(storyCard: StoryCardParam['storyCard']): StoryCardParam;
|
|
789
789
|
//#endregion
|
|
790
790
|
//#region src/testing/decorators/when_running_in_test.d.ts
|
|
791
791
|
/**
|
|
@@ -793,52 +793,6 @@ declare function defineStoryCard(storyCard: StoryCardParam['storyCard']): StoryC
|
|
|
793
793
|
*/
|
|
794
794
|
declare function whenRunningInTest<TArgs = StrictArgs>(decoratorOrHandler: ((...args: Parameters<Decorator<TArgs>>) => ReturnType<Decorator<TArgs>> | undefined | void) | (() => ReturnType<Decorator<TArgs>> | undefined | void)): Decorator<TArgs>;
|
|
795
795
|
//#endregion
|
|
796
|
-
//#region src/types.d.ts
|
|
797
|
-
/**
|
|
798
|
-
* Extends the Storybook Meta type with custom tag types
|
|
799
|
-
* @template TCmpOrArgs - The component or args type
|
|
800
|
-
* @template M - The base Meta type
|
|
801
|
-
* @template E - The extension type containing tagType
|
|
802
|
-
*
|
|
803
|
-
* @deprecated use `import { ExtendsMeta } from '@repobuddy/storybook'` instead.
|
|
804
|
-
*
|
|
805
|
-
* @example
|
|
806
|
-
* ```ts
|
|
807
|
-
* // Create a generic Meta type for a project
|
|
808
|
-
* type Meta<TCmpOrArgs = Args> = ExtendMeta<TCmpOrArgs, Meta<TCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
809
|
-
*
|
|
810
|
-
* // Create a specific Meta type for a component
|
|
811
|
-
* type Meta = ExtendMeta<typeof Component, Meta<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
812
|
-
* ```
|
|
813
|
-
*/
|
|
814
|
-
type ExtendMeta<TCmpOrArgs, M extends Meta<TCmpOrArgs>, E extends {
|
|
815
|
-
tag: string;
|
|
816
|
-
}> = Omit<M, 'tags'> & {
|
|
817
|
-
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
818
|
-
};
|
|
819
|
-
/**
|
|
820
|
-
* Extends the Storybook StoryObj type with custom tag types
|
|
821
|
-
* @template TMetaOrCmpOrArgs - The meta, component or args type
|
|
822
|
-
* @template S - The base StoryObj type
|
|
823
|
-
* @template E - The extension type containing tagType
|
|
824
|
-
*
|
|
825
|
-
* @deprecated use `import { ExtendsStoryObj } from '@repobuddy/storybook'` instead.
|
|
826
|
-
*
|
|
827
|
-
* @example
|
|
828
|
-
* ```ts
|
|
829
|
-
* // Create a generic StoryObj type for a project
|
|
830
|
-
* type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryObj<TMetaOrCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
831
|
-
*
|
|
832
|
-
* // Create a specific StoryObj type for a component
|
|
833
|
-
* type StoryObj = ExtendStoryObj<typeof Component, StoryObj<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
834
|
-
* ```
|
|
835
|
-
*/
|
|
836
|
-
type ExtendStoryObj<TMetaOrCmpOrArgs, S extends StoryObj<TMetaOrCmpOrArgs>, E extends {
|
|
837
|
-
tag: string;
|
|
838
|
-
}> = Omit<S, 'tags'> & {
|
|
839
|
-
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
840
|
-
};
|
|
841
|
-
//#endregion
|
|
842
796
|
//#region src/types/_extract_string_literals.d.ts
|
|
843
797
|
type ExtractStringLiterals<T> = T extends any ? (string extends T ? never : T) : never;
|
|
844
798
|
//#endregion
|
|
@@ -914,4 +868,50 @@ type ExtendsStoryObj<S extends {
|
|
|
914
868
|
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;
|
|
915
869
|
};
|
|
916
870
|
//#endregion
|
|
917
|
-
|
|
871
|
+
//#region src/types.d.ts
|
|
872
|
+
/**
|
|
873
|
+
* Extends the Storybook Meta type with custom tag types
|
|
874
|
+
* @template TCmpOrArgs - The component or args type
|
|
875
|
+
* @template M - The base Meta type
|
|
876
|
+
* @template E - The extension type containing tagType
|
|
877
|
+
*
|
|
878
|
+
* @deprecated use `import { ExtendsMeta } from '@repobuddy/storybook'` instead.
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```ts
|
|
882
|
+
* // Create a generic Meta type for a project
|
|
883
|
+
* type Meta<TCmpOrArgs = Args> = ExtendMeta<TCmpOrArgs, Meta<TCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
884
|
+
*
|
|
885
|
+
* // Create a specific Meta type for a component
|
|
886
|
+
* type Meta = ExtendMeta<typeof Component, Meta<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
887
|
+
* ```
|
|
888
|
+
*/
|
|
889
|
+
type ExtendMeta<TCmpOrArgs, M extends Meta<TCmpOrArgs>, E extends {
|
|
890
|
+
tag: string;
|
|
891
|
+
}> = Omit<M, 'tags'> & {
|
|
892
|
+
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* Extends the Storybook StoryObj type with custom tag types
|
|
896
|
+
* @template TMetaOrCmpOrArgs - The meta, component or args type
|
|
897
|
+
* @template S - The base StoryObj type
|
|
898
|
+
* @template E - The extension type containing tagType
|
|
899
|
+
*
|
|
900
|
+
* @deprecated use `import { ExtendsStoryObj } from '@repobuddy/storybook'` instead.
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```ts
|
|
904
|
+
* // Create a generic StoryObj type for a project
|
|
905
|
+
* type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryObj<TMetaOrCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
906
|
+
*
|
|
907
|
+
* // Create a specific StoryObj type for a component
|
|
908
|
+
* type StoryObj = ExtendStoryObj<typeof Component, StoryObj<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
909
|
+
* ```
|
|
910
|
+
*/
|
|
911
|
+
type ExtendStoryObj<TMetaOrCmpOrArgs, S extends StoryObj<TMetaOrCmpOrArgs>, E extends {
|
|
912
|
+
tag: string;
|
|
913
|
+
}> = Omit<S, 'tags'> & {
|
|
914
|
+
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
915
|
+
};
|
|
916
|
+
//#endregion
|
|
917
|
+
export { ActionsParam, BackgroundsParam, DocsParam, ExtendMeta, ExtendStoryObj, ExtendsMeta, ExtendsStoryObj, FnToArgTypes, GlobalApiBackgroundsParam, GlobalApiViewportParam, LayoutParam, ShowHtml, ShowHtmlProps, SourceProps, StoryCard, StoryCardParam, StoryCardProps, StoryCardStatus, StorySortParam, StorybookBuiltInParams, TestParam, Viewport, ViewportParam, WithStoryCardProps, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineStoryCardParam, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
package/esm/index.js
CHANGED
|
@@ -447,7 +447,7 @@ function defineParameters(param, ...rest) {
|
|
|
447
447
|
* }
|
|
448
448
|
* ```
|
|
449
449
|
*/
|
|
450
|
-
function
|
|
450
|
+
function defineStoryCardParam(storyCard) {
|
|
451
451
|
return { storyCard };
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -522,4 +522,4 @@ function whenRunningInTest(decoratorOrHandler) {
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
//#endregion
|
|
525
|
-
export { ShowHtml, StoryCard, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters,
|
|
525
|
+
export { ShowHtml, StoryCard, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineStoryCardParam, defineTestParam, defineViewportParam, showDocSource, whenRunningInTest, withStoryCard };
|
|
@@ -44,30 +44,6 @@ declare const keyboardBadge: TagBadgeParameter;
|
|
|
44
44
|
declare const internalBadge: TagBadgeParameter;
|
|
45
45
|
declare const tagBadges: TagBadgeParameters;
|
|
46
46
|
//#endregion
|
|
47
|
-
//#region src/types.d.ts
|
|
48
|
-
/**
|
|
49
|
-
* Extends the Storybook StoryObj type with custom tag types
|
|
50
|
-
* @template TMetaOrCmpOrArgs - The meta, component or args type
|
|
51
|
-
* @template S - The base StoryObj type
|
|
52
|
-
* @template E - The extension type containing tagType
|
|
53
|
-
*
|
|
54
|
-
* @deprecated use `import { ExtendsStoryObj } from '@repobuddy/storybook'` instead.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* // Create a generic StoryObj type for a project
|
|
59
|
-
* type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryObj<TMetaOrCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
60
|
-
*
|
|
61
|
-
* // Create a specific StoryObj type for a component
|
|
62
|
-
* type StoryObj = ExtendStoryObj<typeof Component, StoryObj<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
type ExtendStoryObj<TMetaOrCmpOrArgs, S extends StoryObj$1<TMetaOrCmpOrArgs>, E extends {
|
|
66
|
-
tag: string;
|
|
67
|
-
}> = Omit<S, 'tags'> & {
|
|
68
|
-
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
69
|
-
};
|
|
70
|
-
//#endregion
|
|
71
47
|
//#region src/types/_extract_string_literals.d.ts
|
|
72
48
|
type ExtractStringLiterals<T> = T extends any ? (string extends T ? never : T) : never;
|
|
73
49
|
//#endregion
|
|
@@ -107,6 +83,30 @@ type ExtendsMeta<M extends {
|
|
|
107
83
|
tags?: ExtractStringLiterals<NonNullable<M['tags']>[number]> extends infer MT ? IsStringLiteral<MT> extends true ? Array<(string & {}) | MT | E['tag']> | undefined : Array<(string & {}) | E['tag']> | undefined : never;
|
|
108
84
|
};
|
|
109
85
|
//#endregion
|
|
86
|
+
//#region src/types.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* Extends the Storybook StoryObj type with custom tag types
|
|
89
|
+
* @template TMetaOrCmpOrArgs - The meta, component or args type
|
|
90
|
+
* @template S - The base StoryObj type
|
|
91
|
+
* @template E - The extension type containing tagType
|
|
92
|
+
*
|
|
93
|
+
* @deprecated use `import { ExtendsStoryObj } from '@repobuddy/storybook'` instead.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // Create a generic StoryObj type for a project
|
|
98
|
+
* type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryObj<TMetaOrCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
99
|
+
*
|
|
100
|
+
* // Create a specific StoryObj type for a component
|
|
101
|
+
* type StoryObj = ExtendStoryObj<typeof Component, StoryObj<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
type ExtendStoryObj<TMetaOrCmpOrArgs, S extends StoryObj$1<TMetaOrCmpOrArgs>, E extends {
|
|
105
|
+
tag: string;
|
|
106
|
+
}> = Omit<S, 'tags'> & {
|
|
107
|
+
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
110
|
//#region src/storybook-addon-tag-badges/types.d.ts
|
|
111
111
|
type Meta<TCmpOrArgs = Args> = ExtendsMeta<Meta$1<TCmpOrArgs>, {
|
|
112
112
|
tag: TagNames;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { DARK_MODE_EVENT_NAME, useDarkMode } from "@storybook-community/storybook-dark-mode";
|
|
3
2
|
import { DocsContainer } from "@storybook/addon-docs/blocks";
|
|
3
|
+
import { DARK_MODE_EVENT_NAME, useDarkMode } from "@storybook-community/storybook-dark-mode";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { themes } from "storybook/theming";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repobuddy/storybook",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Storybook repo buddy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
"types": "./esm/storybook-dark-mode/index.d.ts",
|
|
40
40
|
"default": "./esm/storybook-dark-mode/index.js"
|
|
41
41
|
},
|
|
42
|
+
"./tailwind": {
|
|
43
|
+
"style": "./tailwind.css"
|
|
44
|
+
},
|
|
42
45
|
"./styles.css": "./styles.css"
|
|
43
46
|
},
|
|
44
47
|
"files": [
|
|
@@ -46,6 +49,7 @@
|
|
|
46
49
|
"esm",
|
|
47
50
|
"src",
|
|
48
51
|
"styles.css",
|
|
52
|
+
"tailwind.css",
|
|
49
53
|
"!**/*.{spec,test,unit,accept,integrate,system,perf,stress,study,stories}.*",
|
|
50
54
|
"!**/*.mdx"
|
|
51
55
|
],
|
package/readme.md
CHANGED
|
@@ -139,10 +139,15 @@ export const preview: Preview = {
|
|
|
139
139
|
|
|
140
140
|
[`@repobuddy/storybook`][`@repobuddy/storybook`] uses Tailwind CSS 4 and the prefix `rbsb:` to avoid conflicts with user styles.
|
|
141
141
|
|
|
142
|
-
To use the styles, import `@repobuddy/storybook/
|
|
142
|
+
To use the styles, import `@repobuddy/storybook/tailwind` in your Tailwind config:
|
|
143
143
|
|
|
144
|
-
```
|
|
145
|
-
|
|
144
|
+
```css
|
|
145
|
+
/* tailwind.css */
|
|
146
|
+
@import "tailwindcss";
|
|
147
|
+
@import "@repobuddy/storybook/tailwind";
|
|
148
|
+
|
|
149
|
+
/* specify your dark variant mechanism */
|
|
150
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
146
151
|
```
|
|
147
152
|
|
|
148
153
|
[`@repobuddy/storybook`]: https://github.com/repobuddy/storybook
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type ComponentType,
|
|
2
3
|
createContext,
|
|
4
|
+
type ReactNode,
|
|
3
5
|
useContext,
|
|
4
6
|
useLayoutEffect,
|
|
5
7
|
useMemo,
|
|
6
8
|
useRef,
|
|
7
|
-
useState
|
|
8
|
-
type ComponentType,
|
|
9
|
-
type ReactNode
|
|
9
|
+
useState
|
|
10
10
|
} from 'react'
|
|
11
11
|
import type { DecoratorFunction, Renderer } from 'storybook/internal/csf'
|
|
12
12
|
import type { RequiredPick } from 'type-plus'
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,6 @@ export * from './parameters/define_test_param.ts'
|
|
|
14
14
|
export * from './parameters/define_viewport_param.ts'
|
|
15
15
|
export * from './parameters/story_sort.ts'
|
|
16
16
|
export * from './testing/decorators/when_running_in_test.tsx'
|
|
17
|
-
export type * from './types.ts'
|
|
18
17
|
export * from './types/extends_meta.ts'
|
|
19
18
|
export * from './types/extends_story_obj.ts'
|
|
19
|
+
export type * from './types.ts'
|
|
@@ -78,6 +78,6 @@ export interface StoryCardParam {
|
|
|
78
78
|
* }
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export function
|
|
81
|
+
export function defineStoryCardParam(storyCard: StoryCardParam['storyCard']): StoryCardParam {
|
|
82
82
|
return { storyCard }
|
|
83
83
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Args, Meta as M, StoryObj as SBO } from '@storybook/react-vite'
|
|
2
|
-
import type { ExtendStoryObj } from '../types.js'
|
|
3
2
|
import type { ExtendsMeta } from '../types/extends_meta.js'
|
|
3
|
+
import type { ExtendStoryObj } from '../types.js'
|
|
4
4
|
import type { TagNames } from './tag_badges.js'
|
|
5
5
|
|
|
6
6
|
export type Meta<TCmpOrArgs = Args> = ExtendsMeta<M<TCmpOrArgs>, { tag: TagNames }>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DARK_MODE_EVENT_NAME } from '@storybook-community/storybook-dark-mode'
|
|
2
1
|
import { DocsContainer, type DocsContextProps } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import { DARK_MODE_EVENT_NAME } from '@storybook-community/storybook-dark-mode'
|
|
3
3
|
import { type PropsWithChildren, useEffect, useState } from 'react'
|
|
4
4
|
import { type ThemeVars, themes } from 'storybook/theming'
|
|
5
5
|
|
package/styles.css
CHANGED
package/tailwind.css
ADDED