Skip to content

Commit c5a07af

Browse files
v0.4.8 react 18 final build
1 parent cd5da4c commit c5a07af

File tree

161 files changed

+25731
-11497
lines changed

Some content is hidden

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

161 files changed

+25731
-11497
lines changed

.storybook/main.ts

Lines changed: 12 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,96 +3,24 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
33
const config: StorybookConfig = {
44
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
55
addons: [
6-
'@storybook/addon-webpack5-compiler-swc',
7-
'@storybook/addon-onboarding',
6+
'@storybook/addon-links',
87
'@storybook/addon-essentials',
9-
'@chromatic-com/storybook',
8+
'@storybook/preset-create-react-app',
9+
'@storybook/addon-onboarding',
1010
'@storybook/addon-interactions',
11+
'@storybook/addon-viewport'
1112
],
1213
framework: {
1314
name: '@storybook/react-webpack5',
14-
options: {},
15-
},
16-
webpackFinal: async (config) => {
17-
// ✅ Гарантируем, что module и module.rules существуют
18-
if (!config.module) {
19-
config.module = { rules: [] };
20-
}
21-
if (!config.module.rules) {
22-
config.module.rules = [];
23-
}
24-
25-
// ✅ Удаляем встроенные Storybook'ом правила для SVG и других медиафайлов
26-
config.module.rules = config.module.rules.filter(
27-
(rule) =>
28-
rule &&
29-
typeof rule === 'object' &&
30-
'test' in rule &&
31-
rule.test instanceof RegExp &&
32-
!rule.test.toString().includes(
33-
'(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)'
34-
)
35-
);
36-
37-
// ✅ Поддержка SVG как React-компонентов (если импортируется с `?react`)
38-
config.module.rules.unshift({
39-
test: /\.svg$/i,
40-
oneOf: [
41-
{
42-
resourceQuery: /react/, // 🔥 `?react` → импорт как React-компонент
43-
use: [
44-
{
45-
loader: '@svgr/webpack',
46-
options: {
47-
icon: true,
48-
esModule: true,
49-
},
50-
},
51-
],
52-
},
53-
{
54-
// 🔥 Обычные импорты SVG без `?react` → обрабатываются как файлы
55-
type: 'asset/resource',
56-
},
57-
],
58-
});
59-
60-
// ✅ Восстанавливаем обработку PNG, JPG, шрифтов и других медиафайлов
61-
config.module.rules.push({
62-
test: /\.(png|jpg|jpeg|gif|woff|woff2|eot|ttf)$/i,
63-
type: 'asset/resource',
64-
});
65-
66-
// ✅ Поддержка SCSS/SASS
67-
config.module.rules.push({
68-
test: /\.scss$/,
69-
use: ['style-loader', 'css-loader', 'sass-loader'],
70-
});
71-
72-
// ✅ Поддержка Babel для JS/TS файлов
73-
config.module.rules.push({
74-
test: /\.(ts|tsx|js|jsx)$/,
75-
exclude: /node_modules/,
76-
use: {
77-
loader: 'babel-loader',
78-
},
79-
});
80-
81-
// ✅ Поддержка alias
82-
if (!config.resolve) {
83-
config.resolve = {};
84-
}
85-
config.resolve = {
86-
...config.resolve,
87-
extensions: ['.tsx', '.ts', '.js', '.jsx', '.scss', '.css', '.svg'],
88-
alias: {
89-
...config.resolve?.alias,
90-
path: require.resolve('path-browserify'),
15+
options: {
16+
builder: {
17+
useSWC: true,
9118
},
92-
};
93-
94-
return config;
19+
},
20+
},
21+
docs: {
22+
autodocs: 'tag',
9523
},
24+
staticDirs: ['../public'],
9625
};
97-
9826
export default config;

.storybook/preview.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import type { Preview } from '@storybook/react';
2-
import { fn } from '@storybook/test';
32
import '../src/index.scss';
43

54
const preview: Preview = {
65
parameters: {
7-
actions: {
8-
onClick: fn(),
9-
onChange: fn(),
10-
},
6+
actions: { argTypesRegex: '^on[A-Z].*' },
117
controls: {
128
matchers: {
139
color: /(background|color)$/i,
1410
date: /Date$/i,
1511
},
1612
},
17-
viewMode: 'docs',
1813
},
1914
};
2015

babel.config.js

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

global.d.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
type Dictionary<T> = Record<string, T>;
22

3-
declare module "*.svg" {
4-
import React from "react";
5-
const content: (props: React.SVGProps<SVGSVGElement>) => JSX.Element;
6-
export default content;
7-
}
8-
9-
declare module "*.svg?react" {
10-
import React from "react";
11-
const content: (props: React.SVGProps<SVGSVGElement>) => JSX.Element;
12-
export default content;
13-
}
14-
153
interface Window {
164
webkitAudioContext: typeof AudioContext;
175
}

media-recorder-js.d.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
11
declare module 'media-recorder-js' {
22
interface QBMediaRecorderConstructorProps {
33
/** Preferred MIME type */
4-
mimeType?: string
5-
workerPath?: string
4+
mimeType?: string;
5+
workerPath?: string;
66
/**
77
* The minimum number of milliseconds of data to return
88
* in a single Blob, fire 'ondataavaible' callback
99
* (isn't need to use with 'audio/wav' of 'audio/mp3')
1010
*
1111
* @default 1000
1212
*/
13-
timeslice?: number
13+
timeslice?: number;
1414
/**
1515
* What to do with a muted input MediaStreamTrack,
1616
* e.g. insert black frames/zero audio volume in the recording
1717
* or ignore altogether
1818
*
1919
* @default true
2020
*/
21-
ignoreMutedMedia?: boolean
21+
ignoreMutedMedia?: boolean;
2222
/** Recording start event handler */
23-
onstart?: VoidFunction
23+
onstart?: VoidFunction;
2424
/** Recording stop event handler */
25-
onstop?: (file: Blob) => void
25+
onstop?: (file: Blob) => void;
2626
/** Recording pause event handler */
27-
onpause?: VoidFunction
27+
onpause?: VoidFunction;
2828
/** Recording resume event handler */
29-
onresume?: VoidFunction
29+
onresume?: VoidFunction;
3030
/** Error event handler */
31-
onerror?: (error: unknown) => void
31+
onerror?: (error: unknown) => void;
3232
/**
3333
* `dataavailable` event handler.
3434
* The Blob of recorded data is contained in this event (callback
3535
* isn't supported if use 'audio/wav' of 'audio/mp3' for recording)
3636
*/
37-
ondataavailable?: (event: { data: Blob }) => void
37+
ondataavailable?: (event: { data: Blob }) => void;
3838
}
3939

4040
class QBMediaRecorder {
41-
constructor(config: QBMediaRecorderConstructorProps)
41+
constructor(config: QBMediaRecorderConstructorProps);
4242

4343
/**
4444
* Switch recording Blob objects to the specified
4545
* MIME type if `MediaRecorder` support it.
4646
*/
47-
toggleMimeType(mimeType: string): void
47+
toggleMimeType(mimeType: string): void;
4848

4949
/**
5050
* Returns current `MediaRecorder` state
5151
*/
52-
getState(): 'inactive' | 'recording' | 'paused'
52+
getState(): 'inactive' | 'recording' | 'paused';
5353

5454
/**
5555
* Starts recording a stream.
5656
* Fires `onstart` callback.
5757
*/
58-
start(stream: MediaStream): void
58+
start(stream: MediaStream): void;
5959

6060
/**
6161
* Stops recording a stream
6262
*
6363
* @fires `onstop` callback and passing there Blob recorded
6464
*/
65-
stop(): void
65+
stop(): void;
6666

6767
/** Pausing stream recording */
68-
pause(): void
68+
pause(): void;
6969

7070
/** Resumes stream recording */
71-
resume(): void
71+
resume(): void;
7272

7373
/**
7474
* Change record source
7575
*/
76-
change(stream: MediaStream): void
76+
change(stream: MediaStream): void;
7777

7878
/**
7979
* Create a file from blob and download as file.
@@ -82,9 +82,9 @@ declare module 'media-recorder-js' {
8282
* @param {string} filename Name of video file to be downloaded
8383
* (default to `Date.now()`)
8484
*/
85-
download(filename?: string): void
85+
download(filename?: string): void;
8686

87-
_getBlobRecorded(): Blob
87+
_getBlobRecorded(): Blob;
8888

8989
callbacks: Pick<
9090
QBMediaRecorderConstructorProps,
@@ -94,19 +94,19 @@ declare module 'media-recorder-js' {
9494
| 'onresume'
9595
| 'ondataavailable'
9696
| 'onerror'
97-
>
97+
>;
9898

9999
/**
100100
* Checks capability of recording in the environment.
101101
* Checks `MediaRecorder`, `MediaRecorder.isTypeSupported` and `Blob`.
102102
*/
103-
static isAvailable(): boolean
103+
static isAvailable(): boolean;
104104

105105
/**
106106
* Checks if AudioContext API is available.
107107
* Checks `window.AudioContext` or `window.webkitAudioContext`.
108108
*/
109-
static isAudioContext(): boolean
109+
static isAudioContext(): boolean;
110110
/**
111111
* The `QBMediaRecorder.isTypeSupported()` static method returns
112112
* a Boolean which is true if the MIME type specified is one
@@ -120,14 +120,14 @@ declare module 'media-recorder-js' {
120120
* agent is incapable of recording the specified format.
121121
*/
122122

123-
static isTypeSupported(mimeType: string): boolean
123+
static isTypeSupported(mimeType: string): boolean;
124124

125125
/**
126126
* Return supported mime types
127127
* @param type video or audio (dafault to 'video')
128128
*/
129-
static getSupportedMimeTypes(type: 'audio' | 'video' = 'video'): string[]
129+
static getSupportedMimeTypes(type: 'audio' | 'video' = 'video'): string[];
130130
}
131131

132-
export default QBMediaRecorder
132+
export default QBMediaRecorder;
133133
}

0 commit comments

Comments
 (0)