Skip to content

Commit 1dae5ba

Browse files
committed
Update Storybook to 8, with Vite
1 parent 381ad75 commit 1dae5ba

File tree

1,410 files changed

+12271
-40613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,410 files changed

+12271
-40613
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// These are the extensions that are included in VS Code for the container
2525
"extensions": [
2626
"arcanis.vscode-zipfs",
27+
"unifiedjs.vscode-mdx",
2728
"vitest.explorer",
2829
"Vue.volar"
2930
]

.pnp.cjs

Lines changed: 3888 additions & 20618 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.storybook/main.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This is used to get tables in MDX
2+
import remarkGfm from 'remark-gfm';
3+
4+
import type { StorybookConfig } from '@storybook/vue3-vite';
5+
6+
import { join, dirname } from "path"
7+
8+
/**
9+
* This function is used to resolve the absolute path of a package.
10+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
11+
*/
12+
function getAbsolutePath(value: string): any {
13+
return dirname(require.resolve(join(value, 'package.json')))
14+
}
15+
const config: StorybookConfig = {
16+
"stories": [
17+
"../src/**/*.mdx",
18+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
19+
],
20+
"addons": [
21+
getAbsolutePath('@storybook/addon-essentials'),
22+
getAbsolutePath('@storybook/addon-links'),
23+
getAbsolutePath('@chromatic-com/storybook'),
24+
{
25+
name: '@storybook/addon-docs',
26+
options: {
27+
mdxPluginOptions: {
28+
mdxCompileOptions: {
29+
remarkPlugins: [remarkGfm],
30+
},
31+
},
32+
},
33+
},
34+
],
35+
"framework": {
36+
"name": getAbsolutePath('@storybook/vue3-vite'),
37+
"options": {}
38+
},
39+
"core": {
40+
disableTelemetry: true,
41+
},
42+
staticDirs: [ // Copy the data used in examples so they can be directly linked from story descriptions
43+
{ from: '../src/stories/assets/data', to: "assets_data" },
44+
{ from: '../src/stories/assets/css', to: 'assets_css' }
45+
],
46+
};
47+
export default config;

.storybook/preview.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

.storybook/preview.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Preview } from '@storybook/vue3'
2+
3+
const preview: Preview = {
4+
parameters: {
5+
actions: { argTypesRegex: "^on[A-Z].*" },
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/i,
10+
},
11+
},
12+
options: {
13+
// Sort the Home page before anything else. Then, sort by the type of documentation (docs or story).
14+
// Finally, just pass through in import order.
15+
// The `a` and `b` arguments in this function have a type of `import('@storybook/types').IndexEntry`,
16+
// But Storybook doesn't like it if we use that type.
17+
storySort: (a, b) => {
18+
if (a.id === 'grapoza-vue-tree-home--docs') {
19+
return -1;
20+
}
21+
if (b.id === 'grapoza-vue-tree-home--docs') {
22+
return 1;
23+
}
24+
25+
if (a.type !== b.type) {
26+
return a.type === 'docs' ? -1 : 1;
27+
}
28+
29+
return 0;
30+
},
31+
},
32+
},
33+
};
34+
35+
export default preview;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)