Skip to content

Commit bd57c58

Browse files
committed
feat: Added minimal functionality for the library
1 parent 4d8a1e3 commit bd57c58

9 files changed

+79
-1
lines changed

lib/core/Echo.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Echo implements IEcho {
2+
private defaultOptions: EchoDefaultOptions
3+
4+
constructor(defaultOptions = {}) {
5+
this.defaultOptions = {
6+
visualEffect: "wave",
7+
sound: null,
8+
delay: 0,
9+
duration: 500,
10+
color: "#3498db",
11+
size: 100,
12+
...defaultOptions,
13+
}
14+
}
15+
16+
public trigger(element: HTMLElement, options: TriggerOptions): void {
17+
18+
}
19+
}

lib/core/EchoEffects.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class EchoEffects implements IEchoEffect {
2+
_createVisualEffect(element: HTMLElement, config: VisualEffectConfig): void {
3+
4+
}
5+
}

lib/core/EchoError.ts

Whitespace-only changes.

lib/echo.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";

lib/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict";

lib/types/core/EchoEffect.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type VisualEffects = 'wave' | 'pulse' | 'flash'
2+
3+
interface VisualEffectConfig {}
4+
5+
interface IEchoEffect {
6+
/**
7+
* Создает визуальный эффект (например, волны)
8+
* @param {HTMLElement} element
9+
* @param {Object} config
10+
*/
11+
_createVisualEffect(element: HTMLElement, config: VisualEffectConfig): void;
12+
}

lib/types/echo.d.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
interface EchoDefaultOptions {
2+
/**
3+
* Визуальные эффекты,
4+
* использует тип @type {VisualEffects}
5+
*/
6+
visualEffect: VisualEffects;
7+
/**
8+
* URL аудиофайла или null
9+
*/
10+
sound: string | null;
11+
/**
12+
* Задержка перед эффектом
13+
*/
14+
delay: number;
15+
/**
16+
* Длительность эффекта в мс
17+
*/
18+
duration: number;
19+
/**
20+
* Цвет эффекта
21+
*/
22+
color: string;
23+
/**
24+
* Размер эффекта в px
25+
*/
26+
size: number;
27+
}
28+
29+
interface TriggerOptions {}
30+
31+
interface IEcho {
32+
/**
33+
* Триггерит эффект на указанном элементе
34+
* @param {HTMLElement} element - элемент, на котором сработает эффект
35+
* @param {TriggerOptions} options - настройки эффекта
36+
*/
37+
trigger(element: HTMLElement, options: TriggerOptions): void;
38+
}

lib/utils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"use strict"

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"type": "commonjs",
1616
"main": "index.js",
1717
"scripts": {
18-
"build": "webpack"
18+
"build:dev": "webpack",
19+
"build:prod": "webpack"
1920
},
2021
"devDependencies": {
2122
"@eslint/js": "^9.19.0",

0 commit comments

Comments
 (0)