Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,567 changes: 1,931 additions & 636 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/craftcms-garnish/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist
/node_modules
/coverage
/storybook-static
1 change: 1 addition & 0 deletions packages/craftcms-garnish/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22
34 changes: 34 additions & 0 deletions packages/craftcms-garnish/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type {StorybookConfig} from '@storybook/html-vite';

import {dirname} from 'path';
import {fileURLToPath} from 'url';

/**
* Resolve the absolute path of a package. Needed in monorepos so Storybook finds
* the hoisted addons/framework regardless of where node_modules ends up.
*/
function getAbsolutePath(value: string): string {
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
}

/**
* Storybook config for @craftcms/garnish.
*
* Garnish widgets are imperative (`new Modal(container)`, `new DisclosureMenu(trigger)`)
* operating on plain DOM — NOT web components — so we use the `html-vite` renderer
* (cp uses `web-components-vite`). Each story's `render()` returns an `HTMLElement`
* in which the Garnish class is instantiated against the REAL source under `../src`.
*/
const config: StorybookConfig = {
stories: ['../stories/**/*.stories.@(ts|mdx)'],
addons: [
getAbsolutePath('@storybook/addon-docs'),
getAbsolutePath('@storybook/addon-a11y'),
getAbsolutePath('@storybook/addon-themes'),
],
framework: {
name: getAbsolutePath('@storybook/html-vite'),
options: {},
},
};
export default config;
Loading
Loading