@repobuddy/storybook 2.0.1 → 2.1.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 +574 -13
- package/esm/index.js +491 -12
- package/esm/manager/index.d.ts +38 -1
- package/esm/manager/index.js +32 -1
- package/esm/storybook-addon-tag-badges/index.d.ts +95 -2
- package/esm/storybook-addon-tag-badges/index.js +207 -1
- package/esm/storybook-dark-mode/index.d.ts +110 -3
- package/esm/storybook-dark-mode/index.js +342 -3
- package/package.json +4 -12
- package/cjs/components/show_html.d.ts +0 -16
- package/cjs/components/show_html.js +0 -29
- package/cjs/decorators/show_doc_source.d.ts +0 -6
- package/cjs/decorators/show_doc_source.js +0 -38
- package/cjs/index.d.ts +0 -13
- package/cjs/index.js +0 -137
- package/cjs/manager/brand_title.d.ts +0 -35
- package/cjs/manager/brand_title.js +0 -12
- package/cjs/manager/index.d.ts +0 -1
- package/cjs/manager/index.js +0 -16
- package/cjs/parameters/define_actions_param.d.ts +0 -24
- package/cjs/parameters/define_actions_param.js +0 -11
- package/cjs/parameters/define_backgrounds_param.d.ts +0 -45
- package/cjs/parameters/define_backgrounds_param.js +0 -10
- package/cjs/parameters/define_docs_param.d.ts +0 -217
- package/cjs/parameters/define_docs_param.js +0 -11
- package/cjs/parameters/define_layout_param.d.ts +0 -20
- package/cjs/parameters/define_layout_param.js +0 -10
- package/cjs/parameters/define_parameters.d.ts +0 -39
- package/cjs/parameters/define_parameters.js +0 -9
- package/cjs/parameters/define_test_param.d.ts +0 -34
- package/cjs/parameters/define_test_param.js +0 -11
- package/cjs/parameters/define_viewport_param.d.ts +0 -78
- package/cjs/parameters/define_viewport_param.js +0 -11
- package/cjs/parameters/story_sort.d.ts +0 -27
- package/cjs/parameters/story_sort.js +0 -1
- package/cjs/storybook-addon-tag-badges/index.d.ts +0 -2
- package/cjs/storybook-addon-tag-badges/index.js +0 -16
- package/cjs/storybook-addon-tag-badges/tag_badges.d.ts +0 -41
- package/cjs/storybook-addon-tag-badges/tag_badges.js +0 -179
- package/cjs/storybook-addon-tag-badges/types.d.ts +0 -9
- package/cjs/storybook-addon-tag-badges/types.js +0 -1
- package/cjs/storybook-dark-mode/dark_mode_docs_container.d.ts +0 -26
- package/cjs/storybook-dark-mode/dark_mode_docs_container.js +0 -23
- package/cjs/storybook-dark-mode/define_dark_mode.d.ts +0 -54
- package/cjs/storybook-dark-mode/define_dark_mode.js +0 -11
- package/cjs/storybook-dark-mode/index.d.ts +0 -3
- package/cjs/storybook-dark-mode/index.js +0 -38
- package/cjs/storybook-dark-mode/with_dark_mode.d.ts +0 -22
- package/cjs/storybook-dark-mode/with_dark_mode.js +0 -54
- package/cjs/testing/decorators/when_running_in_test.d.ts +0 -5
- package/cjs/testing/decorators/when_running_in_test.js +0 -12
- package/cjs/testing/decorators/when_running_in_text.ctx.d.ts +0 -3
- package/cjs/testing/decorators/when_running_in_text.ctx.js +0 -10
- package/cjs/types.d.ts +0 -41
- package/cjs/types.js +0 -1
- package/cjs/variants/index.d.ts +0 -1
- package/cjs/variants/index.js +0 -8
- package/cjs/variants/package.json +0 -3
- package/cjs/variants/preset.d.ts +0 -11
- package/cjs/variants/preset.js +0 -3
- package/esm/components/show_html.d.ts +0 -16
- package/esm/components/show_html.js +0 -19
- package/esm/decorators/show_doc_source.d.ts +0 -6
- package/esm/decorators/show_doc_source.js +0 -28
- package/esm/manager/brand_title.d.ts +0 -35
- package/esm/manager/brand_title.js +0 -6
- package/esm/parameters/define_actions_param.d.ts +0 -24
- package/esm/parameters/define_actions_param.js +0 -3
- package/esm/parameters/define_backgrounds_param.d.ts +0 -45
- package/esm/parameters/define_backgrounds_param.js +0 -3
- package/esm/parameters/define_docs_param.d.ts +0 -217
- package/esm/parameters/define_docs_param.js +0 -3
- package/esm/parameters/define_layout_param.d.ts +0 -20
- package/esm/parameters/define_layout_param.js +0 -3
- package/esm/parameters/define_parameters.d.ts +0 -39
- package/esm/parameters/define_parameters.js +0 -3
- package/esm/parameters/define_test_param.d.ts +0 -34
- package/esm/parameters/define_test_param.js +0 -3
- package/esm/parameters/define_viewport_param.d.ts +0 -78
- package/esm/parameters/define_viewport_param.js +0 -3
- package/esm/parameters/story_sort.d.ts +0 -27
- package/esm/parameters/story_sort.js +0 -0
- package/esm/storybook-addon-tag-badges/tag_badges.d.ts +0 -41
- package/esm/storybook-addon-tag-badges/tag_badges.js +0 -189
- package/esm/storybook-addon-tag-badges/types.d.ts +0 -9
- package/esm/storybook-addon-tag-badges/types.js +0 -0
- package/esm/storybook-dark-mode/dark_mode_docs_container.d.ts +0 -26
- package/esm/storybook-dark-mode/dark_mode_docs_container.js +0 -21
- package/esm/storybook-dark-mode/define_dark_mode.d.ts +0 -54
- package/esm/storybook-dark-mode/define_dark_mode.js +0 -3
- package/esm/storybook-dark-mode/with_dark_mode.d.ts +0 -22
- package/esm/storybook-dark-mode/with_dark_mode.js +0 -46
- package/esm/testing/decorators/when_running_in_test.d.ts +0 -5
- package/esm/testing/decorators/when_running_in_test.js +0 -6
- package/esm/testing/decorators/when_running_in_text.ctx.d.ts +0 -3
- package/esm/testing/decorators/when_running_in_text.ctx.js +0 -4
- package/esm/types.d.ts +0 -41
- package/esm/types.js +0 -0
- package/esm/variants/index.d.ts +0 -1
- package/esm/variants/index.js +0 -2
- package/esm/variants/package.json +0 -3
- package/esm/variants/preset.d.ts +0 -11
- package/esm/variants/preset.js +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _dark_mode_docs_container = require("./dark_mode_docs_container.js");
|
|
7
|
-
Object.keys(_dark_mode_docs_container).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _dark_mode_docs_container[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _dark_mode_docs_container[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _define_dark_mode = require("./define_dark_mode.js");
|
|
18
|
-
Object.keys(_define_dark_mode).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _define_dark_mode[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _define_dark_mode[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _with_dark_mode = require("./with_dark_mode.js");
|
|
29
|
-
Object.keys(_with_dark_mode).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _with_dark_mode[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _with_dark_mode[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from '@just-web/css';
|
|
2
|
-
import type { DecoratorFunction } from 'storybook/internal/types';
|
|
3
|
-
/**
|
|
4
|
-
* Applies additional dark mode behavior.
|
|
5
|
-
*
|
|
6
|
-
* @see https://storybook.js.org/addons/@storybook/addon-themes#dark-mode
|
|
7
|
-
* @returns A decorator function that applies additional dark mode behavior.
|
|
8
|
-
*/
|
|
9
|
-
export declare function withDarkMode(options?: {
|
|
10
|
-
/**
|
|
11
|
-
* CSS class(es) to apply to the body element.
|
|
12
|
-
*
|
|
13
|
-
* Useful when using Tailwind CSS and `classTarget: 'html'`
|
|
14
|
-
*/
|
|
15
|
-
bodyClass?: string | string[] | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* CSS style(s) to apply to the body element.
|
|
18
|
-
*
|
|
19
|
-
* Useful when using Tailwind CSS and `classTarget: 'html'`
|
|
20
|
-
*/
|
|
21
|
-
bodyStyle?: CSSProperties | undefined;
|
|
22
|
-
} | undefined): DecoratorFunction<any, any>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.withDarkMode = withDarkMode;
|
|
7
|
-
var _css = require("@just-web/css");
|
|
8
|
-
var _storybookDarkMode = require("@storybook-community/storybook-dark-mode");
|
|
9
|
-
function withDarkMode(options) {
|
|
10
|
-
return function darkModeDecorator(Story, {
|
|
11
|
-
parameters
|
|
12
|
-
}) {
|
|
13
|
-
const darkMode = parameters.darkMode;
|
|
14
|
-
if (!darkMode) return /* @__PURE__ */React.createElement(Story, null);
|
|
15
|
-
const dark = (0, _storybookDarkMode.useDarkMode)();
|
|
16
|
-
const target = darkMode.classTarget === "html" ? document.documentElement : document.body;
|
|
17
|
-
if (dark) {
|
|
18
|
-
removeStyle(target, darkMode.lightStyle);
|
|
19
|
-
addStyle(target, darkMode.darkStyle);
|
|
20
|
-
} else {
|
|
21
|
-
removeStyle(target, darkMode.darkStyle);
|
|
22
|
-
addStyle(target, darkMode.lightStyle);
|
|
23
|
-
}
|
|
24
|
-
if (options?.bodyClass) {
|
|
25
|
-
addClass(document.body, options.bodyClass);
|
|
26
|
-
}
|
|
27
|
-
if (options?.bodyStyle) {
|
|
28
|
-
addStyle(document.body, options.bodyStyle);
|
|
29
|
-
}
|
|
30
|
-
return /* @__PURE__ */React.createElement(Story, null);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function addClass(target, className) {
|
|
34
|
-
if (!className) return;
|
|
35
|
-
if (typeof className === "string") {
|
|
36
|
-
target.classList.add(...className.split(" "));
|
|
37
|
-
} else if (Array.isArray(className)) {
|
|
38
|
-
target.classList.add(...className);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function addStyle(target, style) {
|
|
42
|
-
if (style) {
|
|
43
|
-
for (const [key, value] of Object.entries((0, _css.toDOMStyle)(style))) {
|
|
44
|
-
target.style.setProperty(key, value);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function removeStyle(target, style) {
|
|
49
|
-
if (style) {
|
|
50
|
-
for (const key of Object.keys((0, _css.toDOMStyle)(style))) {
|
|
51
|
-
target.style.removeProperty(key);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Decorator, StrictArgs } from '@storybook/react-vite';
|
|
2
|
-
/**
|
|
3
|
-
* executes the specified decorator or handler if the code is running in test.
|
|
4
|
-
*/
|
|
5
|
-
export declare function whenRunningInTest<TArgs = StrictArgs>(decoratorOrHandler: ((...args: Parameters<Decorator<TArgs>>) => ReturnType<Decorator<TArgs>> | undefined | void) | (() => ReturnType<Decorator<TArgs>> | undefined | void)): Decorator<TArgs>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.whenRunningInTest = whenRunningInTest;
|
|
7
|
-
var _when_running_in_textCtx = require("./when_running_in_text.ctx.js");
|
|
8
|
-
function whenRunningInTest(decoratorOrHandler) {
|
|
9
|
-
return function RunInTest(Story, context) {
|
|
10
|
-
return _when_running_in_textCtx.ctx.isRunningInTest() ? decoratorOrHandler(Story, context) ?? /* @__PURE__ */React.createElement(Story, null) : /* @__PURE__ */React.createElement(Story, null);
|
|
11
|
-
};
|
|
12
|
-
}
|
package/cjs/types.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
/**
|
|
3
|
-
* Extends the Storybook Meta type with custom tag types
|
|
4
|
-
* @template TCmpOrArgs - The component or args type
|
|
5
|
-
* @template M - The base Meta type
|
|
6
|
-
* @template E - The extension type containing tagType
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* // Create a generic Meta type for a project
|
|
11
|
-
* type Meta<TCmpOrArgs = Args> = ExtendMeta<TCmpOrArgs, Meta<TCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
12
|
-
*
|
|
13
|
-
* // Create a specific Meta type for a component
|
|
14
|
-
* type Meta = ExtendMeta<typeof Component, Meta<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export type ExtendMeta<TCmpOrArgs, M extends Meta<TCmpOrArgs>, E extends {
|
|
18
|
-
tag: string;
|
|
19
|
-
}> = Omit<M, 'tags'> & {
|
|
20
|
-
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Extends the Storybook StoryObj type with custom tag types
|
|
24
|
-
* @template TMetaOrCmpOrArgs - The meta, component or args type
|
|
25
|
-
* @template S - The base StoryObj type
|
|
26
|
-
* @template E - The extension type containing tagType
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* // Create a generic StoryObj type for a project
|
|
31
|
-
* type StoryObj<TMetaOrCmpOrArgs = Args> = ExtendStoryObj<TMetaOrCmpOrArgs, StoryObj<TMetaOrCmpOrArgs>, { tagType: 'tag1' | 'tag2' }>
|
|
32
|
-
*
|
|
33
|
-
* // Create a specific StoryObj type for a component
|
|
34
|
-
* type StoryObj = ExtendStoryObj<typeof Component, StoryObj<typeof Component>, { tagType: 'tag1' | 'tag2' }>
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export type ExtendStoryObj<TMetaOrCmpOrArgs, S extends StoryObj<TMetaOrCmpOrArgs>, E extends {
|
|
38
|
-
tag: string;
|
|
39
|
-
}> = Omit<S, 'tags'> & {
|
|
40
|
-
tags?: Array<E['tag'] | (string & {})> | undefined;
|
|
41
|
-
};
|
package/cjs/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/cjs/variants/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const empty: {};
|
package/cjs/variants/index.js
DELETED
package/cjs/variants/preset.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User specifies `@repobuddy/storybook/variants/addon` in the `.storybook/main.ts`.
|
|
3
|
-
*
|
|
4
|
-
* Storybook loads it on the server side.
|
|
5
|
-
*
|
|
6
|
-
* It provides a default export (or in CJS, `module.exports =`) that contains:
|
|
7
|
-
*
|
|
8
|
-
* - `managerEntries` a function that returns an array of strings on where to load the manager (on the client side)
|
|
9
|
-
* - `previewAnnotations` a function that returns an array of strings on where to load the preview (on the client side)
|
|
10
|
-
* - `experimental_serverChannel` a function that handles the server-side channel
|
|
11
|
-
*/
|
package/cjs/variants/preset.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ClassNameProps, StyleProps } from '@just-web/css';
|
|
2
|
-
import { type UserConfig } from 'htmlfy';
|
|
3
|
-
export type ShowHtmlProps = ClassNameProps & StyleProps & {
|
|
4
|
-
selector?: string | undefined;
|
|
5
|
-
config?: UserConfig | undefined;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* A component that displays the HTML of a subject element.
|
|
9
|
-
* Uses `htmlfy` internally to format and prettify the HTML output.
|
|
10
|
-
*
|
|
11
|
-
* @param selector - CSS selector to find the subject element. Defaults to '[data-testid="subject"]'
|
|
12
|
-
* @param config - Configuration options passed to htmlfy's prettify function
|
|
13
|
-
* @param props - Additional props (className, style) passed to the pre element
|
|
14
|
-
* @returns A pre element containing the formatted HTML
|
|
15
|
-
*/
|
|
16
|
-
export declare function ShowHtml({ selector, config, ...props }: ShowHtmlProps): import("react").JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { prettify } from "htmlfy";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
export function ShowHtml({ selector = '[data-testid="subject"]', config, ...props }) {
|
|
4
|
-
const [html, setHtml] = useState("");
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const subject = document.querySelector(selector);
|
|
7
|
-
if (subject) {
|
|
8
|
-
setHtml(
|
|
9
|
-
prettify(subject.outerHTML, {
|
|
10
|
-
tag_wrap: 40,
|
|
11
|
-
...config
|
|
12
|
-
})
|
|
13
|
-
);
|
|
14
|
-
} else {
|
|
15
|
-
setHtml("No subject found");
|
|
16
|
-
}
|
|
17
|
-
}, [selector]);
|
|
18
|
-
return /* @__PURE__ */ React.createElement("pre", { ...props }, html);
|
|
19
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Args, DecoratorFunction, Renderer } from 'storybook/internal/csf';
|
|
2
|
-
/**
|
|
3
|
-
* A decorator that shows the source code of a story above the rendered story.
|
|
4
|
-
* The source code is taken from the story's `parameters.docs.source.code`.
|
|
5
|
-
*/
|
|
6
|
-
export declare function showDocSource<TRenderer extends Renderer = Renderer, TArgs = Args>(): DecoratorFunction<TRenderer, TArgs>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { SyntaxHighlighter } from "storybook/internal/components";
|
|
3
|
-
import { addons } from "storybook/preview-api";
|
|
4
|
-
import { convert, ThemeProvider, themes } from "storybook/theming";
|
|
5
|
-
const channel = addons.getChannel();
|
|
6
|
-
export function showDocSource() {
|
|
7
|
-
return (Story, { parameters: { docs, darkMode } }) => {
|
|
8
|
-
const storedItem = window.localStorage.getItem("sb-addon-themes-3");
|
|
9
|
-
const current = typeof storedItem === "string" ? JSON.parse(storedItem).current : darkMode?.current;
|
|
10
|
-
const [isDark, setIsDark] = useState((darkMode?.stylePreview && current === "dark") ?? false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
channel.on("DARK_MODE", setIsDark);
|
|
13
|
-
return () => channel.off("DARK_MODE", setIsDark);
|
|
14
|
-
}, []);
|
|
15
|
-
return /* @__PURE__ */ React.createElement(ThemeProvider, { theme: convert(docs?.theme ?? (isDark ? themes.dark : themes.light)) }, /* @__PURE__ */ React.createElement(
|
|
16
|
-
"section",
|
|
17
|
-
{
|
|
18
|
-
style: {
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
gap: "1rem"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
/* @__PURE__ */ React.createElement(SyntaxHighlighter, { language: docs?.source?.language }, docs?.source?.code),
|
|
25
|
-
/* @__PURE__ */ React.createElement(Story, null)
|
|
26
|
-
));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface BrandTitleOptions {
|
|
2
|
-
/**
|
|
3
|
-
* The title to display in the brand title.
|
|
4
|
-
* It can be a simple string or raw HTML.
|
|
5
|
-
*/
|
|
6
|
-
title: string;
|
|
7
|
-
/**
|
|
8
|
-
* The logo to display in the brand title.
|
|
9
|
-
* It can be a simple string or raw HTML (e.g. `<svg>`).
|
|
10
|
-
*/
|
|
11
|
-
logo?: string | undefined;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Creates a brand title element for the Storybook manager UI.
|
|
15
|
-
*
|
|
16
|
-
* @param options - The options for customizing the brand title
|
|
17
|
-
* @param options.title - The title text or HTML to display
|
|
18
|
-
* @param options.logo - Optional logo HTML to display before the title
|
|
19
|
-
* @returns An HTML string containing the brand title element
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { brandTitle } from '@repobuddy/storybook'
|
|
25
|
-
* import { addons } from 'storybook/manager-api'
|
|
26
|
-
*
|
|
27
|
-
* addons.setConfig({
|
|
28
|
-
* brandTitle: brandTitle({
|
|
29
|
-
* title: 'My Storybook',
|
|
30
|
-
* logo: '<img src="logo.png" alt="Logo" width="24" height="24">'
|
|
31
|
-
* })
|
|
32
|
-
* })
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function brandTitle(options: BrandTitleOptions): string;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface ActionsParam {
|
|
2
|
-
actions: {
|
|
3
|
-
argTypesRegex?: string | undefined;
|
|
4
|
-
disable?: boolean | undefined;
|
|
5
|
-
handles?: string[] | undefined;
|
|
6
|
-
[k: string]: unknown;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Defines actions parameters for Storybook stories.
|
|
11
|
-
*
|
|
12
|
-
* @see https://storybook.js.org/docs/essentials/actions#parameters
|
|
13
|
-
*
|
|
14
|
-
* @param actions - Configuration for actions parameters
|
|
15
|
-
* @returns An object containing the actions parameter configuration
|
|
16
|
-
*/
|
|
17
|
-
export declare function defineActionsParam(actions: ActionsParam['actions']): {
|
|
18
|
-
actions: {
|
|
19
|
-
[k: string]: unknown;
|
|
20
|
-
argTypesRegex?: string | undefined;
|
|
21
|
-
disable?: boolean | undefined;
|
|
22
|
-
handles?: string[] | undefined;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface BackgroundsParam {
|
|
2
|
-
backgrounds: {
|
|
3
|
-
default?: string | undefined;
|
|
4
|
-
values?: Array<{
|
|
5
|
-
name: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}>;
|
|
8
|
-
disable?: boolean | undefined;
|
|
9
|
-
grid?: {
|
|
10
|
-
cellAmount?: number | undefined;
|
|
11
|
-
cellSize?: number | undefined;
|
|
12
|
-
disable?: boolean | undefined;
|
|
13
|
-
offsetX?: number | undefined;
|
|
14
|
-
offsetY?: number | undefined;
|
|
15
|
-
opacity?: number | undefined;
|
|
16
|
-
} | undefined;
|
|
17
|
-
[k: string]: unknown;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export interface GlobalApiBackgroundsParam {
|
|
21
|
-
backgrounds: {
|
|
22
|
-
default?: string | undefined;
|
|
23
|
-
options?: Array<{
|
|
24
|
-
name: string;
|
|
25
|
-
value: string;
|
|
26
|
-
}>;
|
|
27
|
-
disabled?: boolean | undefined;
|
|
28
|
-
grid?: {
|
|
29
|
-
cellAmount?: number | undefined;
|
|
30
|
-
cellSize?: number | undefined;
|
|
31
|
-
disable?: boolean | undefined;
|
|
32
|
-
offsetX?: number | undefined;
|
|
33
|
-
offsetY?: number | undefined;
|
|
34
|
-
opacity?: number | undefined;
|
|
35
|
-
} | undefined;
|
|
36
|
-
[k: string]: unknown;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Defines backgrounds parameters for Storybook stories.
|
|
41
|
-
*
|
|
42
|
-
* @param backgrounds - The backgrounds configuration
|
|
43
|
-
* @returns An object containing the backgrounds parameter configuration
|
|
44
|
-
*/
|
|
45
|
-
export declare const defineBackgroundsParam: (backgrounds: BackgroundsParam["backgrounds"] | GlobalApiBackgroundsParam["backgrounds"]) => BackgroundsParam;
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import type { StoryContext } from '@storybook/react-vite';
|
|
2
|
-
declare global {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface Element {
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export interface SourceProps {
|
|
9
|
-
/**
|
|
10
|
-
* Provides the source code to be rendered.
|
|
11
|
-
*
|
|
12
|
-
* This is useful when the story contains extra code that would be confusing in the docs.
|
|
13
|
-
*
|
|
14
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#code
|
|
15
|
-
*/
|
|
16
|
-
code?: string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Specifies whether the source code should be rendered in dark mode.
|
|
19
|
-
*
|
|
20
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#dark
|
|
21
|
-
*/
|
|
22
|
-
dark?: boolean | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Specifies whether decorators should be excluded from the source code.
|
|
25
|
-
*
|
|
26
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#excludedecorators
|
|
27
|
-
*
|
|
28
|
-
* Note: Has no effect in React.
|
|
29
|
-
* @see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#parameter-docssourceexcludedecorators-has-no-effect-in-react
|
|
30
|
-
*/
|
|
31
|
-
excludeDecorators?: boolean | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Specifies the language of the source code.
|
|
34
|
-
*
|
|
35
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#language
|
|
36
|
-
*/
|
|
37
|
-
language?: string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* A function to dynamically transform the source before being rendered,
|
|
40
|
-
* based on the original source and any story context necessary.
|
|
41
|
-
* The returned string is displayed as-is.
|
|
42
|
-
*
|
|
43
|
-
* If both code and transform are specified, transform will be ignored.
|
|
44
|
-
*
|
|
45
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#transform
|
|
46
|
-
*/
|
|
47
|
-
transform?: ((code: string, storyContext: StoryContext) => string) | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Specifies how the source code is rendered.
|
|
50
|
-
*
|
|
51
|
-
* - auto: Same as dynamic, if the story's render function accepts args inputs and dynamic is supported by the framework in use; otherwise same as code
|
|
52
|
-
* - code: Renders the value of code prop, otherwise renders static story source
|
|
53
|
-
* - dynamic: Renders the story source with dynamically updated arg values
|
|
54
|
-
*
|
|
55
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#type
|
|
56
|
-
*/
|
|
57
|
-
type?: 'auto' | 'code' | 'dynamic' | undefined;
|
|
58
|
-
}
|
|
59
|
-
export interface DocsParam {
|
|
60
|
-
docs: {
|
|
61
|
-
argTypes?: {
|
|
62
|
-
/**
|
|
63
|
-
* Specifies which controls to exclude from the args table.
|
|
64
|
-
* Any controls whose names match the regex or are part of the array will be left out.
|
|
65
|
-
*
|
|
66
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#exclude
|
|
67
|
-
*/
|
|
68
|
-
exclude?: string[] | RegExp | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Specifies which controls to include in the args table.
|
|
71
|
-
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
72
|
-
*
|
|
73
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#include
|
|
74
|
-
*/
|
|
75
|
-
include?: string[] | RegExp | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* Specifies how the arg types are sorted.
|
|
78
|
-
*
|
|
79
|
-
* - none: Unsorted, displayed in the same order the arg types are processed in
|
|
80
|
-
* - alpha: Sorted alphabetically, by the arg type's name
|
|
81
|
-
* - requiredFirst: Same as alpha, with any required arg types displayed first
|
|
82
|
-
*
|
|
83
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#sort
|
|
84
|
-
*/
|
|
85
|
-
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined;
|
|
86
|
-
} | undefined;
|
|
87
|
-
description?: {
|
|
88
|
-
/**
|
|
89
|
-
* `docs.description.story` can be used to describe the story in doc.
|
|
90
|
-
*/
|
|
91
|
-
story?: string | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* `docs.description.component` can be used to describe the component in meta.
|
|
94
|
-
* It has no effect on the stories.
|
|
95
|
-
*/
|
|
96
|
-
component?: string | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Determines whether to show the code panel.
|
|
100
|
-
*
|
|
101
|
-
* @see https://storybook.js.org/docs/writing-docs/code-panel
|
|
102
|
-
*/
|
|
103
|
-
codePanel?: boolean | undefined;
|
|
104
|
-
source?: SourceProps | undefined;
|
|
105
|
-
canvas?: {
|
|
106
|
-
/**
|
|
107
|
-
* Provides any additional custom actions to show in the bottom right corner.
|
|
108
|
-
* These are simple buttons that do anything you specify in the onClick function.
|
|
109
|
-
*
|
|
110
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#additionalactions
|
|
111
|
-
*/
|
|
112
|
-
additionalActions?: Array<{
|
|
113
|
-
title: string | JSX.Element;
|
|
114
|
-
className?: string;
|
|
115
|
-
onClick: () => void;
|
|
116
|
-
disabled?: boolean;
|
|
117
|
-
}> | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* Provides HTML class(es) to the preview element, for custom styling.
|
|
120
|
-
*
|
|
121
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#classname
|
|
122
|
-
*/
|
|
123
|
-
className?: string | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Specifies how the canvas should layout the story.
|
|
126
|
-
*
|
|
127
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#layout
|
|
128
|
-
*/
|
|
129
|
-
layout?: 'centered' | 'padded' | 'fullscreen' | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* Specifies the initial state of the source panel.
|
|
132
|
-
*
|
|
133
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#sourcestate
|
|
134
|
-
*/
|
|
135
|
-
sourceState?: 'hidden' | 'shown' | 'none' | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* Determines whether to render a toolbar containing tools to interact with the story.
|
|
138
|
-
*
|
|
139
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#withtoolbar
|
|
140
|
-
*/
|
|
141
|
-
withToolbar?: boolean | undefined;
|
|
142
|
-
} | undefined;
|
|
143
|
-
controls?: {
|
|
144
|
-
/**
|
|
145
|
-
* Specifies which controls to exclude from the args table.
|
|
146
|
-
* Any controls whose names match the regex or are part of the array will be left out.
|
|
147
|
-
*
|
|
148
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#exclude
|
|
149
|
-
*/
|
|
150
|
-
exclude?: string[] | RegExp | undefined;
|
|
151
|
-
/**
|
|
152
|
-
* Specifies which controls to include in the args table.
|
|
153
|
-
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
154
|
-
*
|
|
155
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#include
|
|
156
|
-
*/
|
|
157
|
-
include?: string[] | RegExp | undefined;
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
160
|
-
* Specifies how the controls are sorted.
|
|
161
|
-
*
|
|
162
|
-
* - none: Unsorted, displayed in the same order the controls are processed in
|
|
163
|
-
* - alpha: Sorted alphabetically, by the arg type's name
|
|
164
|
-
* - requiredFirst: Same as alpha, with any required controls displayed first
|
|
165
|
-
*
|
|
166
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#sort
|
|
167
|
-
*/
|
|
168
|
-
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined;
|
|
169
|
-
} | undefined;
|
|
170
|
-
story?: {
|
|
171
|
-
/**
|
|
172
|
-
* Specifies whether the story should be autoplayed.
|
|
173
|
-
*
|
|
174
|
-
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-story#autoplay
|
|
175
|
-
*/
|
|
176
|
-
autoplay?: boolean | undefined;
|
|
177
|
-
/**
|
|
178
|
-
* Set a minimum height (note for an iframe this is the actual height) when rendering a story in an iframe or inline.
|
|
179
|
-
* This overrides parameters.docs.story.iframeHeight for iframes.
|
|
180
|
-
*/
|
|
181
|
-
height?: string | undefined;
|
|
182
|
-
/**
|
|
183
|
-
* Determines whether the story is rendered inline (in the same browser frame as the other docs content) or in an iframe.
|
|
184
|
-
*/
|
|
185
|
-
inline?: boolean | undefined;
|
|
186
|
-
} | undefined;
|
|
187
|
-
[k: string]: unknown;
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Defines docs parameters for Storybook stories.
|
|
192
|
-
*
|
|
193
|
-
* @param docs - Configuration for docs parameters including options for:
|
|
194
|
-
* - Controls display and sorting
|
|
195
|
-
* - Story rendering (autoplay, height, inline vs iframe)
|
|
196
|
-
* - And other docs-related settings
|
|
197
|
-
* @returns An object containing the docs parameter configuration
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* ```ts
|
|
201
|
-
* import { defineDocsParam } from '@repobuddy/storybook'
|
|
202
|
-
*
|
|
203
|
-
* export default {
|
|
204
|
-
* parameters: defineDocsParam({
|
|
205
|
-
* controls: {
|
|
206
|
-
* sort: 'alpha',
|
|
207
|
-
* exclude: ['internal*']
|
|
208
|
-
* },
|
|
209
|
-
* story: {
|
|
210
|
-
* inline: true,
|
|
211
|
-
* height: '400px'
|
|
212
|
-
* }
|
|
213
|
-
* })
|
|
214
|
-
* }
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
export declare function defineDocsParam(docs: DocsParam['docs']): DocsParam['docs'];
|