@andersundsehr/storybook-typo3
Version:
The one and only Storybook Renderer for TYPO3 Fluid Components
41 lines (40 loc) • 1.77 kB
JavaScript
import { dirname, join } from 'node:path';
import { createRequire } from 'module';
import { viteFinal } from "./functions/viteFinal.js";
const require = createRequire(import.meta.url);
function getAbsolutePath(value) {
return dirname(require.resolve(join(value, 'package.json')));
}
export const addons = ['@storybook/addon-docs', '@storybook/addon-a11y'];
/**
* We want storybook to not use your local vite config.
* As that is not really needed, and can cause issues or break storybook.
*/
export { viteFinal };
export const core = {
builder: getAbsolutePath('@storybook/builder-vite'),
renderer: getAbsolutePath('@storybook/server'),
disableTelemetry: true,
};
export const previewAnnotations = async (entry = [], options) => {
const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;
return entry
.concat(require.resolve('./entry-preview'))
.concat(docsEnabled ? [require.resolve('./entry-preview-docs')] : []);
};
export const tags = ['autodocs'];
/**
* BUGFIX for chromium based browsers on windows
* @see https://github.com/talkjs/country-flag-emoji-polyfill?tab=readme-ov-file
*/
export const managerHead = `<style>
body {
font-family: "Twemoji Country Flags", "Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}
@font-face {
font-family: "Twemoji Country Flags";
unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2');
font-display: swap;
}
</style>`;