fix: Fix containing various changes that stacked up in a period of time (#22)

This commit is contained in:
deytenit authored and GitHub committed 2026-08-10 09:04:39 +03:00
1 parent 1b3d7cecb2
commit 77afcca98e
163 files changed
+4268 -3852

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
import { pluginBabel } from '@rsbuild/plugin-babel';
import { resolve } from 'path';
import type { StorybookConfig } from 'storybook-react-rsbuild';
const config: StorybookConfig = {
stories: ['../../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
'@storybook/addon-themes',
],
framework: {
name: 'storybook-react-rsbuild',
options: {},
},
typescript: {
check: false,
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
rsbuildFinal: (config) => {
config.resolve = config.resolve || {};
config.resolve.alias = {
...config.resolve.alias,
'@ermnvldmr/stl': resolve(__dirname, '../../stl/src'),
'@ermnvldmr/ui': resolve(__dirname, '../../ui/src'),
};
config.plugins = config.plugins || [];
config.plugins.push(
pluginBabel({
include: /\.(?:jsx|tsx)$/,
exclude: /[\\/]node_modules[\\/]/,
babelLoaderOptions: (opts) => {
opts.plugins = opts.plugins || [];
opts.plugins.push([
'babel-plugin-istanbul',
{
exclude: ['**/*.stories.tsx', '**/*.test.tsx', 'node_modules/**'],
extension: ['.js', '.jsx', '.ts', '.tsx'],
},
]);
},
})
);
return config;
},
};
export default config;
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react';
import '../../../ui/src/static/styles.css';
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;
+48
View File
@@ -0,0 +1,48 @@
import '@testing-library/jest-dom';
import { vi } from 'vitest';
class ResizeObserverMock {
observe = vi.fn();
unobserve = vi.fn();
disconnect = vi.fn();
}
global.ResizeObserver = ResizeObserverMock;
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // Deprecated
removeListener: vi.fn(), // Deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});
// jsdom sometimes does not expose localStorage.clear(); provide a functional polyfill
if (typeof window.localStorage.clear !== 'function') {
const store = new Map<string, string>();
Object.defineProperty(window, 'localStorage', {
configurable: true,
value: {
getItem: (key: string): string | null => store.get(key) ?? null,
setItem: (key: string, value: string): void => {
store.set(key, value);
},
removeItem: (key: string): void => {
store.delete(key);
},
clear: (): void => {
store.clear();
},
key: (index: number): string | null => [...store.keys()][index] ?? null,
get length(): number {
return store.size;
},
},
});
}