@repobuddy/storybook 2.27.0 → 2.28.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 +11 -4
- package/esm/index.js +2 -22
- package/esm/manager/index.js +1 -2
- package/esm/storybook-addon-tag-badges/index.d.ts +6 -3
- package/esm/storybook-addon-tag-badges/index.js +57 -27
- package/esm/storybook-dark-mode/index.d.ts +2 -2
- package/esm/storybook-dark-mode/index.js +1 -5
- package/package.json +6 -6
- package/readme.md +1 -0
- package/src/storybook-addon-tag-badges/tag_badges.ts +50 -32
- package/styles.css +1 -1
package/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { UserConfig } from "htmlfy";
|
|
3
|
-
import * as react from "react";
|
|
3
|
+
import * as _$react from "react";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import { AnyFunction, CreateTuple, IsStringLiteral, Properties, Tail } from "type-plus";
|
|
7
7
|
import { ClassNameProps, StyleProps } from "@just-web/css";
|
|
8
8
|
import { Args, DecoratorFunction, Renderer } from "storybook/internal/csf";
|
|
@@ -39,7 +39,7 @@ declare function ShowHtml({
|
|
|
39
39
|
selector,
|
|
40
40
|
config,
|
|
41
41
|
...props
|
|
42
|
-
}: ShowHtmlProps): react_jsx_runtime0.JSX.Element;
|
|
42
|
+
}: ShowHtmlProps): _$react_jsx_runtime0.JSX.Element;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/story_card.d.ts
|
|
45
45
|
/**
|
|
@@ -99,7 +99,14 @@ type StoryCardThemeState = Pick<StoryCardProps, 'status' | 'appearance'> & {
|
|
|
99
99
|
* @param props - StoryCard component props
|
|
100
100
|
* @returns A section element containing the card content
|
|
101
101
|
*/
|
|
102
|
-
declare const StoryCard: react.
|
|
102
|
+
declare const StoryCard: _$react.MemoExoticComponent<({
|
|
103
|
+
status,
|
|
104
|
+
appearance,
|
|
105
|
+
className,
|
|
106
|
+
children,
|
|
107
|
+
title,
|
|
108
|
+
...rest
|
|
109
|
+
}: StoryCardProps) => _$react_jsx_runtime0.JSX.Element>;
|
|
103
110
|
//#endregion
|
|
104
111
|
//#region src/decorators/show_source.d.ts
|
|
105
112
|
/**
|
package/esm/index.js
CHANGED
|
@@ -8,9 +8,7 @@ import { twJoin, twMerge } from "tailwind-merge";
|
|
|
8
8
|
import { SyntaxHighlighter } from "storybook/internal/components";
|
|
9
9
|
import { addons } from "storybook/preview-api";
|
|
10
10
|
import { ThemeProvider, convert, themes } from "storybook/theming";
|
|
11
|
-
|
|
12
|
-
export * from "@repobuddy/test"
|
|
13
|
-
|
|
11
|
+
export * from "@repobuddy/test";
|
|
14
12
|
//#region src/components/show_html.tsx
|
|
15
13
|
/**
|
|
16
14
|
* A component that displays the HTML of a subject element.
|
|
@@ -36,7 +34,6 @@ function ShowHtml({ selector = "[data-testid=\"subject\"]", config, ...props })
|
|
|
36
34
|
children: html
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
//#endregion
|
|
41
38
|
//#region src/components/story_card.tsx
|
|
42
39
|
function resolveAppearance(appearance, status) {
|
|
@@ -79,7 +76,6 @@ const StoryCard = memo(function StoryCard({ status, appearance, className, child
|
|
|
79
76
|
}), children]
|
|
80
77
|
});
|
|
81
78
|
});
|
|
82
|
-
|
|
83
79
|
//#endregion
|
|
84
80
|
//#region src/utils/generate_key.ts
|
|
85
81
|
/**
|
|
@@ -92,11 +88,9 @@ function generateKey(prefix) {
|
|
|
92
88
|
const randomId = typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
93
89
|
return prefix ? `${prefix}-${randomId}` : randomId;
|
|
94
90
|
}
|
|
95
|
-
|
|
96
91
|
//#endregion
|
|
97
92
|
//#region src/contexts/_story_card_registry_context.tsx
|
|
98
93
|
const StoryCardRegistryContext = createContext(null);
|
|
99
|
-
|
|
100
94
|
//#endregion
|
|
101
95
|
//#region src/contexts/_story_card_scope.tsx
|
|
102
96
|
/**
|
|
@@ -182,7 +176,6 @@ const StoryCardCollector = memo(function StoryCardCollector({ Story, title, stat
|
|
|
182
176
|
}, [context, entry]);
|
|
183
177
|
return /* @__PURE__ */ jsx(Story, {});
|
|
184
178
|
}, entryPropsEqual);
|
|
185
|
-
|
|
186
179
|
//#endregion
|
|
187
180
|
//#region src/decorators/show_source.tsx
|
|
188
181
|
const channel = addons.getChannel();
|
|
@@ -257,7 +250,6 @@ function showSource({ className, placement, showOriginalSource, source, ...optio
|
|
|
257
250
|
});
|
|
258
251
|
};
|
|
259
252
|
}
|
|
260
|
-
|
|
261
253
|
//#endregion
|
|
262
254
|
//#region src/decorators/show_doc_source.tsx
|
|
263
255
|
/**
|
|
@@ -274,7 +266,6 @@ function showDocSource(options) {
|
|
|
274
266
|
...options
|
|
275
267
|
});
|
|
276
268
|
}
|
|
277
|
-
|
|
278
269
|
//#endregion
|
|
279
270
|
//#region src/decorators/with_story_card.tsx
|
|
280
271
|
/**
|
|
@@ -379,7 +370,6 @@ function withStoryCard({ title, status, appearance, content: contentProp, classN
|
|
|
379
370
|
});
|
|
380
371
|
};
|
|
381
372
|
}
|
|
382
|
-
|
|
383
373
|
//#endregion
|
|
384
374
|
//#region src/parameters/define_actions_param.ts
|
|
385
375
|
/**
|
|
@@ -393,7 +383,6 @@ function withStoryCard({ title, status, appearance, content: contentProp, classN
|
|
|
393
383
|
function defineActionsParam(actions) {
|
|
394
384
|
return { actions };
|
|
395
385
|
}
|
|
396
|
-
|
|
397
386
|
//#endregion
|
|
398
387
|
//#region src/parameters/define_backgrounds_param.ts
|
|
399
388
|
/**
|
|
@@ -403,7 +392,6 @@ function defineActionsParam(actions) {
|
|
|
403
392
|
* @returns An object containing the backgrounds parameter configuration
|
|
404
393
|
*/
|
|
405
394
|
const defineBackgroundsParam = (backgrounds) => ({ backgrounds });
|
|
406
|
-
|
|
407
395
|
//#endregion
|
|
408
396
|
//#region src/parameters/define_docs_param.ts
|
|
409
397
|
/**
|
|
@@ -436,7 +424,6 @@ const defineBackgroundsParam = (backgrounds) => ({ backgrounds });
|
|
|
436
424
|
function defineDocsParam(docs) {
|
|
437
425
|
return { docs };
|
|
438
426
|
}
|
|
439
|
-
|
|
440
427
|
//#endregion
|
|
441
428
|
//#region src/parameters/define_layout_param.ts
|
|
442
429
|
/**
|
|
@@ -454,7 +441,6 @@ function defineDocsParam(docs) {
|
|
|
454
441
|
* ```
|
|
455
442
|
*/
|
|
456
443
|
const defineLayoutParam = (layout) => ({ layout });
|
|
457
|
-
|
|
458
444
|
//#endregion
|
|
459
445
|
//#region src/parameters/define_parameters.ts
|
|
460
446
|
/**
|
|
@@ -489,7 +475,6 @@ const defineLayoutParam = (layout) => ({ layout });
|
|
|
489
475
|
function defineParameters(param, ...rest) {
|
|
490
476
|
return rest.reduce((acc, param) => Object.assign(acc, param), param);
|
|
491
477
|
}
|
|
492
|
-
|
|
493
478
|
//#endregion
|
|
494
479
|
//#region src/parameters/define_story_card_param.ts
|
|
495
480
|
/**
|
|
@@ -537,7 +522,6 @@ function defineParameters(param, ...rest) {
|
|
|
537
522
|
function defineStoryCardParam(storyCard) {
|
|
538
523
|
return { storyCard };
|
|
539
524
|
}
|
|
540
|
-
|
|
541
525
|
//#endregion
|
|
542
526
|
//#region src/parameters/define_test_param.ts
|
|
543
527
|
/**
|
|
@@ -559,7 +543,6 @@ function defineStoryCardParam(storyCard) {
|
|
|
559
543
|
function defineTestParam(test) {
|
|
560
544
|
return { test };
|
|
561
545
|
}
|
|
562
|
-
|
|
563
546
|
//#endregion
|
|
564
547
|
//#region src/parameters/define_viewport_param.ts
|
|
565
548
|
/**
|
|
@@ -592,11 +575,9 @@ function defineTestParam(test) {
|
|
|
592
575
|
function defineViewportParam(viewport) {
|
|
593
576
|
return { viewport };
|
|
594
577
|
}
|
|
595
|
-
|
|
596
578
|
//#endregion
|
|
597
579
|
//#region src/testing/decorators/when_running_in_text.ctx.ts
|
|
598
580
|
const ctx = { isRunningInTest };
|
|
599
|
-
|
|
600
581
|
//#endregion
|
|
601
582
|
//#region src/testing/decorators/when_running_in_test.tsx
|
|
602
583
|
/**
|
|
@@ -607,6 +588,5 @@ function whenRunningInTest(decoratorOrHandler) {
|
|
|
607
588
|
return ctx.isRunningInTest() ? decoratorOrHandler(Story, context) ?? /* @__PURE__ */ jsx(Story, {}) : /* @__PURE__ */ jsx(Story, {});
|
|
608
589
|
};
|
|
609
590
|
}
|
|
610
|
-
|
|
611
591
|
//#endregion
|
|
612
|
-
export { ShowHtml, StoryCard, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineStoryCardParam, defineTestParam, defineViewportParam, showDocSource, showSource, whenRunningInTest, withStoryCard };
|
|
592
|
+
export { ShowHtml, StoryCard, defineActionsParam, defineBackgroundsParam, defineDocsParam, defineLayoutParam, defineParameters, defineStoryCardParam, defineTestParam, defineViewportParam, showDocSource, showSource, whenRunningInTest, withStoryCard };
|
package/esm/manager/index.js
CHANGED
|
@@ -8,7 +8,7 @@ type TagBadgeParameter = TagBadgeParameters[0];
|
|
|
8
8
|
/**
|
|
9
9
|
* Type representing the names of predefined tags used in Storybook stories.
|
|
10
10
|
*/
|
|
11
|
-
type TagNames = '!test' | 'editor' | 'source' | 'type' | '!type' | 'class' | '!class' | 'func' | '!func' | 'var' | '!var' | 'new' | 'a11y' | 'alpha' | 'beta' | 'rc' | 'props' | 'deprecated' | 'outdated' | 'danger' | 'todo' | 'code-only' | 'spec' | 'snapshot' | '!snapshot' | 'unit' | 'integration' | 'keyboard' | 'internal' | 'usecase' | 'use-case' | 'playground' | 'example' | 'perf' | 'version:next' | 'remove' | 'remove:next' | 'autodocs';
|
|
11
|
+
type TagNames = '!test' | 'editor' | 'source' | 'type' | '!type' | 'class' | '!class' | 'func' | '!func' | 'var' | '!var' | 'new' | 'a11y' | 'alpha' | 'beta' | 'bug' | 'rc' | 'props' | 'deprecated' | 'outdated' | 'danger' | 'todo' | 'code-only' | 'spec' | 'snapshot' | '!snapshot' | 'unit' | 'integration' | 'keyboard' | 'internal' | 'usecase' | 'use-case' | 'playground' | 'example' | 'perf' | 'version:next' | 'remove' | 'remove:next' | 'autodocs';
|
|
12
12
|
/** Badge (✏️) for stories with a live editor. Shown in sidebar on story and inherited. */
|
|
13
13
|
declare const editorBadge: TagBadgeParameter;
|
|
14
14
|
/** Badge (🆕) for recently added stories. */
|
|
@@ -29,6 +29,8 @@ declare const removeBadge: TagBadgeParameter;
|
|
|
29
29
|
declare const outdatedBadge: TagBadgeParameter;
|
|
30
30
|
/** Badge (🚨) for stories demonstrating dangerous or cautionary patterns. */
|
|
31
31
|
declare const dangerBadge: TagBadgeParameter;
|
|
32
|
+
/** Badge (🐛) for stories that document or reproduce a known bug. */
|
|
33
|
+
declare const bugBadge: TagBadgeParameter;
|
|
32
34
|
/** Badge (📜) for stories that serve as the specification of the component or code. */
|
|
33
35
|
declare const specBadge: TagBadgeParameter;
|
|
34
36
|
/** Badge (📋) for stories marked as todo or incomplete. */
|
|
@@ -69,7 +71,7 @@ declare const perfBadge: TagBadgeParameter;
|
|
|
69
71
|
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
70
72
|
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
71
73
|
*
|
|
72
|
-
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Use Case →
|
|
74
|
+
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Bug → Use Case →
|
|
73
75
|
* Spec → Playground → Example → Perf → A11y → Keyboard → Source → Type → Class → Function → Var → Props → Todo → Unit →
|
|
74
76
|
* Integration → Editor → Code Only → Version → Internal → Snapshot.
|
|
75
77
|
*
|
|
@@ -81,6 +83,7 @@ declare const perfBadge: TagBadgeParameter;
|
|
|
81
83
|
* - ☠️ Remove - (`remove` or `remove:next` = next release; `remove:<version>` = specific version) The feature or component will be removed in the specified version
|
|
82
84
|
* - ⚠️ Outdated - Stories that need updating
|
|
83
85
|
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
86
|
+
* - 🐛 Bug - Stories that document or reproduce a known bug
|
|
84
87
|
* - 🎯 Use Case - Stories that demonstrate a specific use case or scenario
|
|
85
88
|
* - 📜 Spec - Stories that serve as the specification of the component or code
|
|
86
89
|
* - ▶️ Playground - High-quality interactive stories for users to explore and interact with the component
|
|
@@ -177,4 +180,4 @@ type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryO
|
|
|
177
180
|
tag: TagNames;
|
|
178
181
|
}>;
|
|
179
182
|
//#endregion
|
|
180
|
-
export { Meta, StoryObj, TagNames, a11yBadge, alphaBadge, betaBadge, classBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, exampleBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, perfBadge, playgroundBadge, propsBadge, rcBadge, removeBadge, snapshotBadge, sourceBadge, specBadge, tagBadges, todoBadge, typeBadge, unitBadge, useCaseBadge, varBadge };
|
|
183
|
+
export { Meta, StoryObj, TagNames, a11yBadge, alphaBadge, betaBadge, bugBadge, classBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, exampleBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, perfBadge, playgroundBadge, propsBadge, rcBadge, removeBadge, snapshotBadge, sourceBadge, specBadge, tagBadges, todoBadge, typeBadge, unitBadge, useCaseBadge, varBadge };
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
import { defaultConfig } from "storybook-addon-tag-badges/manager-helpers";
|
|
3
|
-
|
|
4
3
|
//#region src/storybook-addon-tag-badges/tag_badges.ts
|
|
5
4
|
const [, , , , , , versionBadge] = defaultConfig;
|
|
5
|
+
const componentDisplay = {
|
|
6
|
+
mdx: true,
|
|
7
|
+
sidebar: [{
|
|
8
|
+
type: "component",
|
|
9
|
+
skipInherited: false
|
|
10
|
+
}, {
|
|
11
|
+
type: "story",
|
|
12
|
+
skipInherited: false
|
|
13
|
+
}]
|
|
14
|
+
};
|
|
6
15
|
/** Badge (✏️) for stories with a live editor. Shown in sidebar on story and inherited. */
|
|
7
16
|
const editorBadge = {
|
|
8
17
|
tags: "editor",
|
|
@@ -144,6 +153,22 @@ const dangerBadge = {
|
|
|
144
153
|
tooltip: "Dangerous"
|
|
145
154
|
}
|
|
146
155
|
};
|
|
156
|
+
/** Badge (🐛) for stories that document or reproduce a known bug. */
|
|
157
|
+
const bugBadge = {
|
|
158
|
+
tags: "bug",
|
|
159
|
+
badge: {
|
|
160
|
+
text: "🐛",
|
|
161
|
+
style: {
|
|
162
|
+
backgroundColor: "transparent",
|
|
163
|
+
borderColor: "transparent"
|
|
164
|
+
},
|
|
165
|
+
tooltip: "Known bug"
|
|
166
|
+
},
|
|
167
|
+
display: { sidebar: {
|
|
168
|
+
type: "story",
|
|
169
|
+
skipInherited: false
|
|
170
|
+
} }
|
|
171
|
+
};
|
|
147
172
|
/** Badge (📜) for stories that serve as the specification of the component or code. */
|
|
148
173
|
const specBadge = {
|
|
149
174
|
tags: "spec",
|
|
@@ -196,7 +221,7 @@ const typeBadge = {
|
|
|
196
221
|
},
|
|
197
222
|
tooltip: "TypeScript Types"
|
|
198
223
|
},
|
|
199
|
-
display:
|
|
224
|
+
display: componentDisplay
|
|
200
225
|
};
|
|
201
226
|
/** Badge (🔷) for stories that showcase or document classes. Hidden in MDX. */
|
|
202
227
|
const classBadge = {
|
|
@@ -209,7 +234,7 @@ const classBadge = {
|
|
|
209
234
|
},
|
|
210
235
|
tooltip: "Class"
|
|
211
236
|
},
|
|
212
|
-
display:
|
|
237
|
+
display: componentDisplay
|
|
213
238
|
};
|
|
214
239
|
/** Badge (ƒ(x)) for stories that showcase or document functions. Hidden in MDX. */
|
|
215
240
|
const functionBadge = {
|
|
@@ -222,7 +247,7 @@ const functionBadge = {
|
|
|
222
247
|
},
|
|
223
248
|
tooltip: "Function"
|
|
224
249
|
},
|
|
225
|
-
display:
|
|
250
|
+
display: componentDisplay
|
|
226
251
|
};
|
|
227
252
|
/** Badge (var) for stories that describe values and variables. */
|
|
228
253
|
const varBadge = {
|
|
@@ -235,7 +260,7 @@ const varBadge = {
|
|
|
235
260
|
},
|
|
236
261
|
tooltip: "Variables"
|
|
237
262
|
},
|
|
238
|
-
display:
|
|
263
|
+
display: componentDisplay
|
|
239
264
|
};
|
|
240
265
|
/** Badge (`</>`) for source-code-focused stories. Hidden in MDX. */
|
|
241
266
|
const sourceBadge = {
|
|
@@ -253,7 +278,8 @@ const sourceBadge = {
|
|
|
253
278
|
sidebar: {
|
|
254
279
|
type: "story",
|
|
255
280
|
skipInherited: false
|
|
256
|
-
}
|
|
281
|
+
},
|
|
282
|
+
toolbar: ["story"]
|
|
257
283
|
}
|
|
258
284
|
};
|
|
259
285
|
/** Badge (📸) for stories with snapshot tests. Shown in toolbar only, not in sidebar. */
|
|
@@ -412,7 +438,7 @@ const perfBadge = {
|
|
|
412
438
|
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
413
439
|
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
414
440
|
*
|
|
415
|
-
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Use Case →
|
|
441
|
+
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Bug → Use Case →
|
|
416
442
|
* Spec → Playground → Example → Perf → A11y → Keyboard → Source → Type → Class → Function → Var → Props → Todo → Unit →
|
|
417
443
|
* Integration → Editor → Code Only → Version → Internal → Snapshot.
|
|
418
444
|
*
|
|
@@ -424,6 +450,7 @@ const perfBadge = {
|
|
|
424
450
|
* - ☠️ Remove - (`remove` or `remove:next` = next release; `remove:<version>` = specific version) The feature or component will be removed in the specified version
|
|
425
451
|
* - ⚠️ Outdated - Stories that need updating
|
|
426
452
|
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
453
|
+
* - 🐛 Bug - Stories that document or reproduce a known bug
|
|
427
454
|
* - 🎯 Use Case - Stories that demonstrate a specific use case or scenario
|
|
428
455
|
* - 📜 Spec - Stories that serve as the specification of the component or code
|
|
429
456
|
* - ▶️ Playground - High-quality interactive stories for users to explore and interact with the component
|
|
@@ -448,36 +475,39 @@ const perfBadge = {
|
|
|
448
475
|
* - 📸 Snapshot - Stories with snapshot tests
|
|
449
476
|
*/
|
|
450
477
|
const tagBadges = [
|
|
478
|
+
[bugBadge, todoBadge],
|
|
451
479
|
newBadge,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
480
|
+
[
|
|
481
|
+
alphaBadge,
|
|
482
|
+
betaBadge,
|
|
483
|
+
rcBadge
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
deprecatedBadge,
|
|
487
|
+
removeBadge,
|
|
488
|
+
outdatedBadge,
|
|
489
|
+
dangerBadge
|
|
490
|
+
],
|
|
459
491
|
useCaseBadge,
|
|
460
492
|
specBadge,
|
|
461
493
|
playgroundBadge,
|
|
462
494
|
exampleBadge,
|
|
463
495
|
perfBadge,
|
|
464
496
|
sourceBadge,
|
|
465
|
-
a11yBadge,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
497
|
+
[a11yBadge, keyboardBadge],
|
|
498
|
+
[
|
|
499
|
+
propsBadge,
|
|
500
|
+
typeBadge,
|
|
501
|
+
classBadge,
|
|
502
|
+
functionBadge,
|
|
503
|
+
varBadge
|
|
504
|
+
],
|
|
473
505
|
unitBadge,
|
|
474
506
|
integrationBadge,
|
|
475
507
|
editorBadge,
|
|
476
508
|
codeOnlyBadge,
|
|
477
509
|
versionBadge,
|
|
478
|
-
internalBadge,
|
|
479
|
-
|
|
480
|
-
];
|
|
481
|
-
|
|
510
|
+
[internalBadge, snapshotBadge]
|
|
511
|
+
].flat();
|
|
482
512
|
//#endregion
|
|
483
|
-
export { a11yBadge, alphaBadge, betaBadge, classBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, exampleBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, perfBadge, playgroundBadge, propsBadge, rcBadge, removeBadge, snapshotBadge, sourceBadge, specBadge, tagBadges, todoBadge, typeBadge, unitBadge, useCaseBadge, varBadge };
|
|
513
|
+
export { a11yBadge, alphaBadge, betaBadge, bugBadge, classBadge, codeOnlyBadge, dangerBadge, deprecatedBadge, editorBadge, exampleBadge, functionBadge, integrationBadge, internalBadge, keyboardBadge, newBadge, outdatedBadge, perfBadge, playgroundBadge, propsBadge, rcBadge, removeBadge, snapshotBadge, sourceBadge, specBadge, tagBadges, todoBadge, typeBadge, unitBadge, useCaseBadge, varBadge };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { DocsContextProps } from "@storybook/addon-docs/blocks";
|
|
3
3
|
import { PropsWithChildren } from "react";
|
|
4
4
|
import { ThemeVars } from "storybook/theming";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import { CSSProperties } from "@just-web/css";
|
|
7
7
|
import { DecoratorFunction } from "storybook/internal/types";
|
|
8
8
|
|
|
@@ -29,7 +29,7 @@ declare function createDarkModeDocsContainer(customThemes?: {
|
|
|
29
29
|
dark?: ThemeVars | undefined;
|
|
30
30
|
} | undefined): (props: PropsWithChildren<{
|
|
31
31
|
context: DocsContextProps;
|
|
32
|
-
}>) => react_jsx_runtime0.JSX.Element;
|
|
32
|
+
}>) => _$react_jsx_runtime0.JSX.Element;
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/storybook-dark-mode/define_dark_mode.d.ts
|
|
35
35
|
/**
|
|
@@ -5,7 +5,6 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { themes } from "storybook/theming";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { toDOMStyle } from "@just-web/css";
|
|
8
|
-
|
|
9
8
|
//#region src/storybook-dark-mode/dark_mode_docs_container.tsx
|
|
10
9
|
/**
|
|
11
10
|
* Creates a `DocsContainer` for `storybook` that works with `@storybook-community/storybook-dark-mode`.
|
|
@@ -38,7 +37,6 @@ function createDarkModeDocsContainer(customThemes) {
|
|
|
38
37
|
});
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
|
|
42
40
|
//#endregion
|
|
43
41
|
//#region src/storybook-dark-mode/define_dark_mode.ts
|
|
44
42
|
/**
|
|
@@ -60,7 +58,6 @@ function createDarkModeDocsContainer(customThemes) {
|
|
|
60
58
|
function defineDarkModeParam(darkMode) {
|
|
61
59
|
return { darkMode };
|
|
62
60
|
}
|
|
63
|
-
|
|
64
61
|
//#endregion
|
|
65
62
|
//#region src/storybook-dark-mode/with_dark_mode.tsx
|
|
66
63
|
/**
|
|
@@ -98,6 +95,5 @@ function addStyle(target, style) {
|
|
|
98
95
|
function removeStyle(target, style) {
|
|
99
96
|
if (style) for (const key of Object.keys(toDOMStyle(style))) target.style.removeProperty(key);
|
|
100
97
|
}
|
|
101
|
-
|
|
102
98
|
//#endregion
|
|
103
|
-
export { createDarkModeDocsContainer, defineDarkModeParam, withDarkMode };
|
|
99
|
+
export { createDarkModeDocsContainer, defineDarkModeParam, withDarkMode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repobuddy/storybook",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "Storybook repo buddy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"@repobuddy/vitest": "^2.1.1",
|
|
88
88
|
"@storybook-community/storybook-dark-mode": "^7.1.0",
|
|
89
89
|
"@storybook/addon-docs": "^10.2.8",
|
|
90
|
-
"@storybook/addon-vitest": "^10.
|
|
91
|
-
"@storybook/react-vite": "^10.
|
|
90
|
+
"@storybook/addon-vitest": "^10.3.3",
|
|
91
|
+
"@storybook/react-vite": "^10.3.3",
|
|
92
92
|
"@tailwindcss/cli": "^4.1.17",
|
|
93
93
|
"@tailwindcss/vite": "^4.1.17",
|
|
94
94
|
"@vitest/browser": "^4.0.16",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"react": "^19.2.0",
|
|
100
100
|
"react-dom": "^19.2.0",
|
|
101
101
|
"rimraf": "^6.1.0",
|
|
102
|
-
"storybook": "^10.
|
|
102
|
+
"storybook": "^10.3.3",
|
|
103
103
|
"storybook-addon-code-editor": "^6.1.3",
|
|
104
104
|
"storybook-addon-tag-badges": "^3.0.6",
|
|
105
105
|
"storybook-addon-vis": "^3.1.2",
|
|
106
|
-
"tsdown": "^0.
|
|
107
|
-
"vite": "^
|
|
106
|
+
"tsdown": "^0.21.4",
|
|
107
|
+
"vite": "^8.0.0",
|
|
108
108
|
"vitest": "^4.0.16"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -88,6 +88,7 @@ we provide a different set of badges that uses emojis (order: first match wins):
|
|
|
88
88
|
| ☠️ | `remove`<br/>`remove:next` (same)<br/>`remove:<version>` | Will be removed in the next or specified version |
|
|
89
89
|
| ⚠️ | `outdated` | Stories that need updating |
|
|
90
90
|
| 🚨 | `danger` | Dangerous or cautionary patterns |
|
|
91
|
+
| 🐛 | `bug` | Known bug (documents or reproduces the issue) |
|
|
91
92
|
| 🎯 | `use-case` | Specific use case or scenario |
|
|
92
93
|
| 📜 | `spec` | Specification of the component or code |
|
|
93
94
|
| ▶️ | `playground` | High-quality interactive stories for users to explore and interact with the component |
|
|
@@ -4,6 +4,20 @@ const [, , , , , , versionBadge] = defaultConfig
|
|
|
4
4
|
|
|
5
5
|
type TagBadgeParameter = TagBadgeParameters[0]
|
|
6
6
|
|
|
7
|
+
const componentDisplay: TagBadgeParameter['display'] = {
|
|
8
|
+
mdx: true,
|
|
9
|
+
sidebar: [
|
|
10
|
+
{
|
|
11
|
+
type: 'component',
|
|
12
|
+
skipInherited: false
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'story',
|
|
16
|
+
skipInherited: false
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
/**
|
|
8
22
|
* Type representing the names of predefined tags used in Storybook stories.
|
|
9
23
|
*/
|
|
@@ -23,6 +37,7 @@ export type TagNames =
|
|
|
23
37
|
| 'a11y'
|
|
24
38
|
| 'alpha'
|
|
25
39
|
| 'beta'
|
|
40
|
+
| 'bug'
|
|
26
41
|
| 'rc'
|
|
27
42
|
| 'props'
|
|
28
43
|
| 'deprecated'
|
|
@@ -203,6 +218,25 @@ export const dangerBadge: TagBadgeParameter = {
|
|
|
203
218
|
}
|
|
204
219
|
}
|
|
205
220
|
|
|
221
|
+
/** Badge (🐛) for stories that document or reproduce a known bug. */
|
|
222
|
+
export const bugBadge: TagBadgeParameter = {
|
|
223
|
+
tags: 'bug',
|
|
224
|
+
badge: {
|
|
225
|
+
text: '🐛',
|
|
226
|
+
style: {
|
|
227
|
+
backgroundColor: 'transparent',
|
|
228
|
+
borderColor: 'transparent'
|
|
229
|
+
},
|
|
230
|
+
tooltip: 'Known bug'
|
|
231
|
+
},
|
|
232
|
+
display: {
|
|
233
|
+
sidebar: {
|
|
234
|
+
type: 'story',
|
|
235
|
+
skipInherited: false
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
206
240
|
/** Badge (📜) for stories that serve as the specification of the component or code. */
|
|
207
241
|
export const specBadge: TagBadgeParameter = {
|
|
208
242
|
tags: 'spec',
|
|
@@ -262,9 +296,7 @@ export const typeBadge: TagBadgeParameter = {
|
|
|
262
296
|
},
|
|
263
297
|
tooltip: 'TypeScript Types'
|
|
264
298
|
},
|
|
265
|
-
display:
|
|
266
|
-
mdx: true
|
|
267
|
-
}
|
|
299
|
+
display: componentDisplay
|
|
268
300
|
}
|
|
269
301
|
|
|
270
302
|
/** Badge (🔷) for stories that showcase or document classes. Hidden in MDX. */
|
|
@@ -278,9 +310,7 @@ export const classBadge: TagBadgeParameter = {
|
|
|
278
310
|
},
|
|
279
311
|
tooltip: 'Class'
|
|
280
312
|
},
|
|
281
|
-
display:
|
|
282
|
-
mdx: true
|
|
283
|
-
}
|
|
313
|
+
display: componentDisplay
|
|
284
314
|
}
|
|
285
315
|
|
|
286
316
|
/** Badge (ƒ(x)) for stories that showcase or document functions. Hidden in MDX. */
|
|
@@ -294,9 +324,7 @@ export const functionBadge: TagBadgeParameter = {
|
|
|
294
324
|
},
|
|
295
325
|
tooltip: 'Function'
|
|
296
326
|
},
|
|
297
|
-
display:
|
|
298
|
-
mdx: true
|
|
299
|
-
}
|
|
327
|
+
display: componentDisplay
|
|
300
328
|
}
|
|
301
329
|
|
|
302
330
|
/** Badge (var) for stories that describe values and variables. */
|
|
@@ -310,9 +338,7 @@ export const varBadge: TagBadgeParameter = {
|
|
|
310
338
|
},
|
|
311
339
|
tooltip: 'Variables'
|
|
312
340
|
},
|
|
313
|
-
display:
|
|
314
|
-
mdx: true
|
|
315
|
-
}
|
|
341
|
+
display: componentDisplay
|
|
316
342
|
}
|
|
317
343
|
|
|
318
344
|
/** Badge (`</>`) for source-code-focused stories. Hidden in MDX. */
|
|
@@ -331,7 +357,8 @@ export const sourceBadge: TagBadgeParameter = {
|
|
|
331
357
|
sidebar: {
|
|
332
358
|
type: 'story',
|
|
333
359
|
skipInherited: false
|
|
334
|
-
}
|
|
360
|
+
},
|
|
361
|
+
toolbar: ['story']
|
|
335
362
|
}
|
|
336
363
|
}
|
|
337
364
|
|
|
@@ -515,7 +542,7 @@ export const perfBadge: TagBadgeParameter = {
|
|
|
515
542
|
* Configuration for story tag badges that appear in the Storybook sidebar.
|
|
516
543
|
* Each badge is associated with a specific tag and displays an emoji or symbol with a tooltip.
|
|
517
544
|
*
|
|
518
|
-
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Use Case →
|
|
545
|
+
* Badge order (first match wins): New → Alpha → Beta → RC → Deprecated → Remove → Outdated → Danger → Bug → Use Case →
|
|
519
546
|
* Spec → Playground → Example → Perf → A11y → Keyboard → Source → Type → Class → Function → Var → Props → Todo → Unit →
|
|
520
547
|
* Integration → Editor → Code Only → Version → Internal → Snapshot.
|
|
521
548
|
*
|
|
@@ -527,6 +554,7 @@ export const perfBadge: TagBadgeParameter = {
|
|
|
527
554
|
* - ☠️ Remove - (`remove` or `remove:next` = next release; `remove:<version>` = specific version) The feature or component will be removed in the specified version
|
|
528
555
|
* - ⚠️ Outdated - Stories that need updating
|
|
529
556
|
* - 🚨 Danger - Stories demonstrating dangerous patterns
|
|
557
|
+
* - 🐛 Bug - Stories that document or reproduce a known bug
|
|
530
558
|
* - 🎯 Use Case - Stories that demonstrate a specific use case or scenario
|
|
531
559
|
* - 📜 Spec - Stories that serve as the specification of the component or code
|
|
532
560
|
* - ▶️ Playground - High-quality interactive stories for users to explore and interact with the component
|
|
@@ -551,33 +579,23 @@ export const perfBadge: TagBadgeParameter = {
|
|
|
551
579
|
* - 📸 Snapshot - Stories with snapshot tests
|
|
552
580
|
*/
|
|
553
581
|
export const tagBadges: TagBadgeParameters = [
|
|
582
|
+
// Story states
|
|
583
|
+
[bugBadge, todoBadge],
|
|
554
584
|
newBadge,
|
|
555
|
-
alphaBadge,
|
|
556
|
-
|
|
557
|
-
rcBadge,
|
|
558
|
-
deprecatedBadge,
|
|
559
|
-
removeBadge,
|
|
560
|
-
outdatedBadge,
|
|
561
|
-
dangerBadge,
|
|
585
|
+
[alphaBadge, betaBadge, rcBadge],
|
|
586
|
+
[deprecatedBadge, removeBadge, outdatedBadge, dangerBadge],
|
|
562
587
|
useCaseBadge,
|
|
563
588
|
specBadge,
|
|
564
589
|
playgroundBadge,
|
|
565
590
|
exampleBadge,
|
|
566
591
|
perfBadge,
|
|
567
592
|
sourceBadge,
|
|
568
|
-
a11yBadge,
|
|
569
|
-
|
|
570
|
-
propsBadge,
|
|
571
|
-
typeBadge,
|
|
572
|
-
classBadge,
|
|
573
|
-
functionBadge,
|
|
574
|
-
varBadge,
|
|
575
|
-
todoBadge,
|
|
593
|
+
[a11yBadge, keyboardBadge],
|
|
594
|
+
[propsBadge, typeBadge, classBadge, functionBadge, varBadge],
|
|
576
595
|
unitBadge,
|
|
577
596
|
integrationBadge,
|
|
578
597
|
editorBadge,
|
|
579
598
|
codeOnlyBadge,
|
|
580
599
|
versionBadge,
|
|
581
|
-
internalBadge,
|
|
582
|
-
|
|
583
|
-
]
|
|
600
|
+
[internalBadge, snapshotBadge]
|
|
601
|
+
].flat()
|
package/styles.css
CHANGED