@vyriy/storybook-config 0.1.9
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/LICENSE +21 -0
- package/README.md +59 -0
- package/main.d.ts +4 -0
- package/main.js +64 -0
- package/package.json +46 -0
- package/preview.d.ts +3 -0
- package/preview.js +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vyriy contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @vyriy/storybook-config
|
|
2
|
+
|
|
3
|
+
Shared Storybook config for Vyriy projects.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package provides the base Storybook setup used in Vyriy repositories:
|
|
8
|
+
|
|
9
|
+
- shared `main` config
|
|
10
|
+
- shared `preview` config
|
|
11
|
+
- addon defaults
|
|
12
|
+
- docs and theme behavior
|
|
13
|
+
- common Storybook ergonomics for React projects
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
With npm:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -D @vyriy/storybook-config storybook
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
With Yarn:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add -D @vyriy/storybook-config storybook
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Install `storybook` in the consumer project so CLI commands are available.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Create `.storybook/main.ts`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import config from '@vyriy/storybook-config/main';
|
|
37
|
+
import { path } from '@vyriy/path';
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
...config,
|
|
41
|
+
stories: [
|
|
42
|
+
path('packages', '**/*.mdx'),
|
|
43
|
+
path('packages', '**/*.stories.@(js|jsx|mjs|ts|tsx)'),
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Create `.storybook/preview.ts`:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
export { default } from '@vyriy/storybook-config/preview';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Current Vyriy Usage
|
|
55
|
+
|
|
56
|
+
In this repository:
|
|
57
|
+
|
|
58
|
+
- `.storybook/main.ts` re-exports `@vyriy/storybook-config/main`
|
|
59
|
+
- `.storybook/preview.ts` imports local styles and re-exports `@vyriy/storybook-config/preview`
|
package/main.d.ts
ADDED
package/main.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
addons: [
|
|
3
|
+
'@storybook/addon-webpack5-compiler-swc',
|
|
4
|
+
'@storybook/addon-a11y',
|
|
5
|
+
'@storybook/addon-docs',
|
|
6
|
+
'@storybook/addon-themes',
|
|
7
|
+
'storybook-addon-pseudo-states',
|
|
8
|
+
'@vueless/storybook-dark-mode',
|
|
9
|
+
'storybook-addon-tag-badges',
|
|
10
|
+
],
|
|
11
|
+
framework: '@storybook/react-webpack5',
|
|
12
|
+
features: {
|
|
13
|
+
sidebarOnboardingChecklist: false,
|
|
14
|
+
},
|
|
15
|
+
core: {
|
|
16
|
+
disableTelemetry: true,
|
|
17
|
+
},
|
|
18
|
+
docs: {
|
|
19
|
+
defaultName: 'API',
|
|
20
|
+
},
|
|
21
|
+
webpackFinal: (webpackConfig) => {
|
|
22
|
+
return {
|
|
23
|
+
...webpackConfig,
|
|
24
|
+
performance: {
|
|
25
|
+
...webpackConfig.performance,
|
|
26
|
+
hints: false,
|
|
27
|
+
},
|
|
28
|
+
module: {
|
|
29
|
+
...webpackConfig.module,
|
|
30
|
+
rules: [
|
|
31
|
+
...(webpackConfig.module?.rules ?? []),
|
|
32
|
+
{
|
|
33
|
+
test: /\.scss$/,
|
|
34
|
+
use: [
|
|
35
|
+
'style-loader',
|
|
36
|
+
'css-loader',
|
|
37
|
+
'sass-loader',
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
resolve: {
|
|
43
|
+
...webpackConfig.resolve,
|
|
44
|
+
extensionAlias: {
|
|
45
|
+
...webpackConfig.resolve?.extensionAlias,
|
|
46
|
+
'.js': [
|
|
47
|
+
'.ts',
|
|
48
|
+
'.tsx',
|
|
49
|
+
'.js',
|
|
50
|
+
],
|
|
51
|
+
'.mjs': [
|
|
52
|
+
'.mts',
|
|
53
|
+
'.mjs',
|
|
54
|
+
],
|
|
55
|
+
'.cjs': [
|
|
56
|
+
'.cts',
|
|
57
|
+
'.cjs',
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export default config;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vyriy/storybook-config",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Shared Storybook config for Vyriy projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./main.js",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@storybook/addon-docs": "^10.3.6",
|
|
9
|
+
"@storybook/react-webpack5": "^10.3.6",
|
|
10
|
+
"@vueless/storybook-dark-mode": "^10.0.8",
|
|
11
|
+
"css-loader": "^7.1.4",
|
|
12
|
+
"react": "^19.2.6",
|
|
13
|
+
"sass-loader": "^16.0.8",
|
|
14
|
+
"storybook": "^10.3.6",
|
|
15
|
+
"style-loader": "^4.0.0"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"types": "./main.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./main.d.ts",
|
|
22
|
+
"import": "./main.js",
|
|
23
|
+
"default": "./main.js"
|
|
24
|
+
},
|
|
25
|
+
"./main": {
|
|
26
|
+
"types": "./main.d.ts",
|
|
27
|
+
"import": "./main.js",
|
|
28
|
+
"default": "./main.js"
|
|
29
|
+
},
|
|
30
|
+
"./main.js": {
|
|
31
|
+
"types": "./main.d.ts",
|
|
32
|
+
"import": "./main.js",
|
|
33
|
+
"default": "./main.js"
|
|
34
|
+
},
|
|
35
|
+
"./preview": {
|
|
36
|
+
"types": "./preview.d.ts",
|
|
37
|
+
"import": "./preview.js",
|
|
38
|
+
"default": "./preview.js"
|
|
39
|
+
},
|
|
40
|
+
"./preview.js": {
|
|
41
|
+
"types": "./preview.d.ts",
|
|
42
|
+
"import": "./preview.js",
|
|
43
|
+
"default": "./preview.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/preview.d.ts
ADDED
package/preview.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DocsContainer } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { themes } from 'storybook/theming';
|
|
4
|
+
import { useDarkMode } from '@vueless/storybook-dark-mode';
|
|
5
|
+
const ThemedDocsContainer = ({ children, context }) => {
|
|
6
|
+
const isDark = useDarkMode();
|
|
7
|
+
return (_jsx(DocsContainer, { context: context, theme: isDark ? themes.dark : themes.light, children: children }));
|
|
8
|
+
};
|
|
9
|
+
const preview = {
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
items: {
|
|
13
|
+
table: {
|
|
14
|
+
disable: true,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
controls: {
|
|
20
|
+
matchers: {
|
|
21
|
+
color: /(background|color)$/i,
|
|
22
|
+
date: /Date$/i,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
docs: {
|
|
26
|
+
container: ThemedDocsContainer,
|
|
27
|
+
},
|
|
28
|
+
backgrounds: { disable: true },
|
|
29
|
+
darkMode: {
|
|
30
|
+
classTarget: 'html',
|
|
31
|
+
stylePreview: true,
|
|
32
|
+
current: 'light',
|
|
33
|
+
dark: { ...themes.dark },
|
|
34
|
+
light: { ...themes.light },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export default preview;
|