@doyourjob/gravity-ui-page-constructor 5.31.175 → 5.31.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/Audio/Audio.css +199 -0
- package/build/cjs/blocks/Audio/Audio.d.ts +4 -0
- package/build/cjs/blocks/Audio/Audio.js +206 -0
- package/build/cjs/blocks/Audio/schema.d.ts +147 -0
- package/build/cjs/blocks/Audio/schema.js +14 -0
- package/build/cjs/blocks/Cat/Cat.css +1 -0
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/blocks/index.js +3 -1
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +9 -2
- package/build/cjs/models/constructor-items/blocks.js +1 -0
- package/build/cjs/schema/constants.d.ts +4 -4
- package/build/cjs/schema/constants.js +2 -1
- package/build/cjs/schema/validators/blocks.d.ts +1 -0
- package/build/cjs/schema/validators/blocks.js +1 -0
- package/build/esm/blocks/Audio/Audio.css +199 -0
- package/build/esm/blocks/Audio/Audio.d.ts +5 -0
- package/build/esm/blocks/Audio/Audio.js +202 -0
- package/build/esm/blocks/Audio/schema.d.ts +147 -0
- package/build/esm/blocks/Audio/schema.js +11 -0
- package/build/esm/blocks/Cat/Cat.css +1 -0
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/blocks/index.js +1 -0
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/models/constructor-items/blocks.d.ts +9 -2
- package/build/esm/models/constructor-items/blocks.js +1 -0
- package/build/esm/schema/constants.d.ts +4 -4
- package/build/esm/schema/constants.js +3 -2
- package/build/esm/schema/validators/blocks.d.ts +1 -0
- package/build/esm/schema/validators/blocks.js +1 -0
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +9 -2
- package/server/models/constructor-items/blocks.js +1 -0
- package/widget/index.js +1 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-audio-block {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 10px;
|
|
7
|
+
padding: 8px 12px;
|
|
8
|
+
border-radius: 40px;
|
|
9
|
+
background: var(--g-color-base-float, #fff);
|
|
10
|
+
border: 1px solid var(--g-color-line-generic, #e0e0e0);
|
|
11
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
|
12
|
+
width: 100%;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
font-family: inherit;
|
|
15
|
+
}
|
|
16
|
+
.pc-audio-block__play-btn {
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
width: 36px;
|
|
22
|
+
height: 36px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
border: none;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
27
|
+
color: #fff;
|
|
28
|
+
transition: background 0.15s, transform 0.1s;
|
|
29
|
+
outline: none;
|
|
30
|
+
padding: 0;
|
|
31
|
+
}
|
|
32
|
+
.pc-audio-block__play-btn:hover {
|
|
33
|
+
background: var(--g-color-base-brand-hover, #0263cc);
|
|
34
|
+
}
|
|
35
|
+
.pc-audio-block__play-btn:active {
|
|
36
|
+
transform: scale(0.93);
|
|
37
|
+
}
|
|
38
|
+
.pc-audio-block__play-btn:focus-visible {
|
|
39
|
+
box-shadow: 0 0 0 3px var(--g-color-base-brand-light, rgba(2, 123, 243, 0.25));
|
|
40
|
+
}
|
|
41
|
+
.pc-audio-block__play-btn_loading {
|
|
42
|
+
cursor: default;
|
|
43
|
+
}
|
|
44
|
+
.pc-audio-block__spinner {
|
|
45
|
+
display: block;
|
|
46
|
+
width: 16px;
|
|
47
|
+
height: 16px;
|
|
48
|
+
border: 2px solid rgba(255, 255, 255, 0.4);
|
|
49
|
+
border-top-color: #fff;
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
animation: pc-audio-spin 0.7s linear infinite;
|
|
52
|
+
}
|
|
53
|
+
.pc-audio-block__timeline {
|
|
54
|
+
flex: 1;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 3px;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
}
|
|
60
|
+
.pc-audio-block__progress-bar {
|
|
61
|
+
position: relative;
|
|
62
|
+
padding: 6px 0;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
outline: none;
|
|
65
|
+
}
|
|
66
|
+
.pc-audio-block__progress-bar:focus-visible .pc-audio-block__progress-track {
|
|
67
|
+
box-shadow: 0 0 0 2px var(--g-color-base-brand, #027bf3);
|
|
68
|
+
}
|
|
69
|
+
.pc-audio-block__progress-bar:hover .pc-audio-block__progress-thumb {
|
|
70
|
+
transform: translateY(-50%) scale(1);
|
|
71
|
+
}
|
|
72
|
+
.pc-audio-block__progress-track {
|
|
73
|
+
height: 4px;
|
|
74
|
+
border-radius: 2px;
|
|
75
|
+
background: var(--g-color-base-generic, #e8e8e8);
|
|
76
|
+
overflow: visible;
|
|
77
|
+
position: relative;
|
|
78
|
+
}
|
|
79
|
+
.pc-audio-block__progress-fill {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
height: 100%;
|
|
84
|
+
border-radius: 2px;
|
|
85
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
min-width: 0;
|
|
89
|
+
transition: width 0.05s linear;
|
|
90
|
+
}
|
|
91
|
+
.pc-audio-block__progress-thumb {
|
|
92
|
+
position: absolute;
|
|
93
|
+
right: -6px;
|
|
94
|
+
top: 50%;
|
|
95
|
+
transform: translateY(-50%) scale(0);
|
|
96
|
+
width: 12px;
|
|
97
|
+
height: 12px;
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
100
|
+
transition: transform 0.15s;
|
|
101
|
+
box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
}
|
|
104
|
+
.pc-audio-block__time {
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
font-size: 11px;
|
|
108
|
+
line-height: 1;
|
|
109
|
+
color: var(--g-color-text-secondary, #888);
|
|
110
|
+
user-select: none;
|
|
111
|
+
font-variant-numeric: tabular-nums;
|
|
112
|
+
}
|
|
113
|
+
.pc-audio-block__volume {
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 4px;
|
|
118
|
+
}
|
|
119
|
+
.pc-audio-block__mute-btn {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
width: 28px;
|
|
124
|
+
height: 28px;
|
|
125
|
+
border: none;
|
|
126
|
+
border-radius: 50%;
|
|
127
|
+
background: transparent;
|
|
128
|
+
color: var(--g-color-text-secondary, #888);
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
padding: 0;
|
|
131
|
+
outline: none;
|
|
132
|
+
transition: color 0.15s, background 0.15s;
|
|
133
|
+
}
|
|
134
|
+
.pc-audio-block__mute-btn:hover {
|
|
135
|
+
color: var(--g-color-text-primary, #333);
|
|
136
|
+
background: var(--g-color-base-generic-hover, #f0f0f0);
|
|
137
|
+
}
|
|
138
|
+
.pc-audio-block__mute-btn:focus-visible {
|
|
139
|
+
box-shadow: 0 0 0 2px var(--g-color-base-brand, #027bf3);
|
|
140
|
+
}
|
|
141
|
+
.pc-audio-block__volume-slider {
|
|
142
|
+
appearance: none;
|
|
143
|
+
width: 64px;
|
|
144
|
+
height: 4px;
|
|
145
|
+
border-radius: 2px;
|
|
146
|
+
outline: none;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
border: none;
|
|
149
|
+
padding: 0;
|
|
150
|
+
margin: 0;
|
|
151
|
+
background: linear-gradient(to right, var(--g-color-base-brand, #027bf3) 0%, var(--g-color-base-brand, #027bf3) var(--volume-pct, 100%), var(--g-color-base-generic, #e8e8e8) var(--volume-pct, 100%), var(--g-color-base-generic, #e8e8e8) 100%);
|
|
152
|
+
}
|
|
153
|
+
.pc-audio-block__volume-slider::-webkit-slider-thumb {
|
|
154
|
+
appearance: none;
|
|
155
|
+
width: 12px;
|
|
156
|
+
height: 12px;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
161
|
+
transition: transform 0.12s;
|
|
162
|
+
}
|
|
163
|
+
.pc-audio-block__volume-slider::-webkit-slider-thumb:active {
|
|
164
|
+
transform: scale(1.25);
|
|
165
|
+
}
|
|
166
|
+
.pc-audio-block__volume-slider::-moz-range-thumb {
|
|
167
|
+
width: 12px;
|
|
168
|
+
height: 12px;
|
|
169
|
+
border-radius: 50%;
|
|
170
|
+
border: none;
|
|
171
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
174
|
+
transition: transform 0.12s;
|
|
175
|
+
}
|
|
176
|
+
.pc-audio-block__volume-slider::-moz-range-thumb:active {
|
|
177
|
+
transform: scale(1.25);
|
|
178
|
+
}
|
|
179
|
+
.pc-audio-block__volume-slider::-moz-range-track {
|
|
180
|
+
height: 4px;
|
|
181
|
+
border-radius: 2px;
|
|
182
|
+
background: transparent;
|
|
183
|
+
border: none;
|
|
184
|
+
}
|
|
185
|
+
.pc-audio-block__volume-slider::-moz-range-progress {
|
|
186
|
+
height: 4px;
|
|
187
|
+
border-radius: 2px 0 0 2px;
|
|
188
|
+
background: var(--g-color-base-brand, #027bf3);
|
|
189
|
+
}
|
|
190
|
+
.pc-audio-block__volume-slider:focus-visible {
|
|
191
|
+
box-shadow: 0 0 0 2px var(--g-color-base-brand-light, rgba(2, 123, 243, 0.3));
|
|
192
|
+
border-radius: 2px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@keyframes pc-audio-spin {
|
|
196
|
+
to {
|
|
197
|
+
transform: rotate(360deg);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Audio = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Audio.tsx — все исправления помечены комментарием // FIX
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const cn_1 = require("../../utils/cn");
|
|
8
|
+
const b = (0, cn_1.block)('audio-block');
|
|
9
|
+
function formatTime(seconds) {
|
|
10
|
+
if (!isFinite(seconds) || isNaN(seconds))
|
|
11
|
+
return '0:00';
|
|
12
|
+
const m = Math.floor(seconds / 60);
|
|
13
|
+
const s = Math.floor(seconds % 60);
|
|
14
|
+
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
15
|
+
}
|
|
16
|
+
const Audio = ({ url }) => {
|
|
17
|
+
const audioRef = (0, react_1.useRef)(null);
|
|
18
|
+
const progressRef = (0, react_1.useRef)(null);
|
|
19
|
+
const volumeSliderRef = (0, react_1.useRef)(null); // FIX: нужен ref для --volume-pct
|
|
20
|
+
const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
|
|
21
|
+
const [isMuted, setIsMuted] = (0, react_1.useState)(false);
|
|
22
|
+
const [currentTime, setCurrentTime] = (0, react_1.useState)(0);
|
|
23
|
+
const [duration, setDuration] = (0, react_1.useState)(0);
|
|
24
|
+
const [volume, setVolume] = (0, react_1.useState)(1);
|
|
25
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
26
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
27
|
+
// FIX: сброс состояния при смене url
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
setIsLoading(true);
|
|
30
|
+
setCurrentTime(0);
|
|
31
|
+
setDuration(0);
|
|
32
|
+
setIsPlaying(false);
|
|
33
|
+
}, [url]);
|
|
34
|
+
// FIX: обновление CSS-переменной --volume-pct для градиента слайдера
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
36
|
+
const el = volumeSliderRef.current;
|
|
37
|
+
if (!el)
|
|
38
|
+
return;
|
|
39
|
+
const pct = isMuted ? 0 : volume * 100;
|
|
40
|
+
el.style.setProperty('--volume-pct', `${pct}%`);
|
|
41
|
+
}, [volume, isMuted]);
|
|
42
|
+
const togglePlay = (0, react_1.useCallback)(() => {
|
|
43
|
+
const audio = audioRef.current;
|
|
44
|
+
if (!audio)
|
|
45
|
+
return;
|
|
46
|
+
if (isPlaying) {
|
|
47
|
+
audio.pause();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// FIX: обрабатываем Promise от audio.play()
|
|
51
|
+
audio.play().catch(() => {
|
|
52
|
+
// autoplay заблокирован браузером — просто игнорируем
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, [isPlaying]);
|
|
56
|
+
const toggleMute = (0, react_1.useCallback)(() => {
|
|
57
|
+
const audio = audioRef.current;
|
|
58
|
+
if (!audio)
|
|
59
|
+
return;
|
|
60
|
+
audio.muted = !isMuted;
|
|
61
|
+
setIsMuted(!isMuted);
|
|
62
|
+
}, [isMuted]);
|
|
63
|
+
const handleVolumeChange = (0, react_1.useCallback)((e) => {
|
|
64
|
+
const audio = audioRef.current;
|
|
65
|
+
if (!audio)
|
|
66
|
+
return;
|
|
67
|
+
const val = parseFloat(e.target.value);
|
|
68
|
+
audio.volume = val;
|
|
69
|
+
setVolume(val);
|
|
70
|
+
setIsMuted(val === 0);
|
|
71
|
+
}, []);
|
|
72
|
+
const seekTo = (0, react_1.useCallback)((clientX) => {
|
|
73
|
+
const audio = audioRef.current;
|
|
74
|
+
const bar = progressRef.current;
|
|
75
|
+
if (!audio || !bar || !duration)
|
|
76
|
+
return;
|
|
77
|
+
const rect = bar.getBoundingClientRect();
|
|
78
|
+
const ratio = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);
|
|
79
|
+
audio.currentTime = ratio * duration;
|
|
80
|
+
setCurrentTime(ratio * duration);
|
|
81
|
+
}, [duration]);
|
|
82
|
+
// FIX: убираем handleProgressClick — onMouseDown уже покрывает одиночный клик,
|
|
83
|
+
// двойной вызов seekTo при клике был багом (onClick + onMouseDown оба срабатывали).
|
|
84
|
+
const handleProgressMouseDown = (0, react_1.useCallback)((e) => {
|
|
85
|
+
setIsDragging(true);
|
|
86
|
+
seekTo(e.clientX);
|
|
87
|
+
}, [seekTo]);
|
|
88
|
+
// FIX: keyboard-навигация для role="slider"
|
|
89
|
+
const handleProgressKeyDown = (0, react_1.useCallback)((e) => {
|
|
90
|
+
const audio = audioRef.current;
|
|
91
|
+
if (!audio || !duration)
|
|
92
|
+
return;
|
|
93
|
+
const STEP = 5; // секунд
|
|
94
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
const next = Math.min(audio.currentTime + STEP, duration);
|
|
97
|
+
audio.currentTime = next;
|
|
98
|
+
setCurrentTime(next);
|
|
99
|
+
}
|
|
100
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
const next = Math.max(audio.currentTime - STEP, 0);
|
|
103
|
+
audio.currentTime = next;
|
|
104
|
+
setCurrentTime(next);
|
|
105
|
+
}
|
|
106
|
+
else if (e.key === 'Home') {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
audio.currentTime = 0;
|
|
109
|
+
setCurrentTime(0);
|
|
110
|
+
}
|
|
111
|
+
else if (e.key === 'End') {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
audio.currentTime = duration;
|
|
114
|
+
setCurrentTime(duration);
|
|
115
|
+
}
|
|
116
|
+
}, [duration]);
|
|
117
|
+
(0, react_1.useEffect)(() => {
|
|
118
|
+
if (!isDragging)
|
|
119
|
+
return;
|
|
120
|
+
const onMove = (e) => seekTo(e.clientX);
|
|
121
|
+
const onUp = () => setIsDragging(false);
|
|
122
|
+
window.addEventListener('mousemove', onMove);
|
|
123
|
+
window.addEventListener('mouseup', onUp);
|
|
124
|
+
// eslint-disable-next-line consistent-return
|
|
125
|
+
return () => {
|
|
126
|
+
window.removeEventListener('mousemove', onMove);
|
|
127
|
+
window.removeEventListener('mouseup', onUp);
|
|
128
|
+
};
|
|
129
|
+
}, [isDragging, seekTo]);
|
|
130
|
+
(0, react_1.useEffect)(() => {
|
|
131
|
+
const audio = audioRef.current;
|
|
132
|
+
if (!audio)
|
|
133
|
+
return;
|
|
134
|
+
const onPlay = () => setIsPlaying(true);
|
|
135
|
+
const onPause = () => setIsPlaying(false);
|
|
136
|
+
const onEnded = () => setIsPlaying(false);
|
|
137
|
+
// FIX: игнорируем timeupdate во время drag — seekTo уже ставит точное значение,
|
|
138
|
+
// а timeupdate с задержкой вызывал "прыжок" ползунка назад
|
|
139
|
+
const onTimeUpdate = () => {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
141
|
+
if (!isDraggingRef.current) {
|
|
142
|
+
setCurrentTime(audio.currentTime);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const onDurationChange = () => setDuration(audio.duration);
|
|
146
|
+
const onCanPlay = () => setIsLoading(false);
|
|
147
|
+
const onWaiting = () => setIsLoading(true);
|
|
148
|
+
audio.addEventListener('play', onPlay);
|
|
149
|
+
audio.addEventListener('pause', onPause);
|
|
150
|
+
audio.addEventListener('ended', onEnded);
|
|
151
|
+
audio.addEventListener('timeupdate', onTimeUpdate);
|
|
152
|
+
audio.addEventListener('durationchange', onDurationChange);
|
|
153
|
+
audio.addEventListener('canplay', onCanPlay);
|
|
154
|
+
audio.addEventListener('waiting', onWaiting);
|
|
155
|
+
// eslint-disable-next-line consistent-return
|
|
156
|
+
return () => {
|
|
157
|
+
audio.removeEventListener('play', onPlay);
|
|
158
|
+
audio.removeEventListener('pause', onPause);
|
|
159
|
+
audio.removeEventListener('ended', onEnded);
|
|
160
|
+
audio.removeEventListener('timeupdate', onTimeUpdate);
|
|
161
|
+
audio.removeEventListener('durationchange', onDurationChange);
|
|
162
|
+
audio.removeEventListener('canplay', onCanPlay);
|
|
163
|
+
audio.removeEventListener('waiting', onWaiting);
|
|
164
|
+
};
|
|
165
|
+
}, []);
|
|
166
|
+
// FIX: ref-копия isDragging для замыкания в timeupdate (без перепривязки слушателей)
|
|
167
|
+
const isDraggingRef = (0, react_1.useRef)(false);
|
|
168
|
+
(0, react_1.useEffect)(() => {
|
|
169
|
+
isDraggingRef.current = isDragging;
|
|
170
|
+
}, [isDragging]);
|
|
171
|
+
const progress = duration ? (currentTime / duration) * 100 : 0;
|
|
172
|
+
const volumeIcon = (0, react_1.useMemo)(() => {
|
|
173
|
+
if (isMuted || volume === 0) {
|
|
174
|
+
return 'M18.5 12a8.46 8.46 0 0 0-2.08-5.58l1.1-1.1A10 10 0 0 1 20.5 12a10 10 0 0 1-2.98 7.08l-1.1-1.1A8.46 8.46 0 0 0 18.5 12zM3 9h4l5-5v16l-5-5H3V9zm13.46 3-2.3-2.3 1.07-1.07L17.54 11H20v2h-2.46l-2.31 2.31-1.07-1.07L16.46 12z';
|
|
175
|
+
}
|
|
176
|
+
if (volume < 0.5) {
|
|
177
|
+
return 'M18.5 12a8.46 8.46 0 0 0-2.08-5.58l1.1-1.1A10 10 0 0 1 20.5 12a10 10 0 0 1-2.98 7.08l-1.1-1.1A8.46 8.46 0 0 0 18.5 12zM3 9h4l5-5v16l-5-5H3V9zm11.47.53 1.06-1.06A6 6 0 0 1 18 12a6 6 0 0 1-2.47 4.87l-1.06-1.06A4.5 4.5 0 0 0 16.5 12a4.5 4.5 0 0 0-2.03-3.47z';
|
|
178
|
+
}
|
|
179
|
+
return 'M3 9h4l5-5v16l-5-5H3V9zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zm-2.5-7a7 7 0 0 1 0 14V14a5 5 0 0 0 0-10V5z';
|
|
180
|
+
}, [isMuted, volume]);
|
|
181
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
182
|
+
react_1.default.createElement("audio", { ref: audioRef, src: url, preload: "metadata" }),
|
|
183
|
+
react_1.default.createElement("button", { className: b('play-btn', { loading: isLoading }), onClick: togglePlay, "aria-label": isPlaying ? 'Pause' : 'Play', type: "button" },
|
|
184
|
+
isLoading && react_1.default.createElement("span", { className: b('spinner') }),
|
|
185
|
+
!isLoading &&
|
|
186
|
+
(isPlaying ? (react_1.default.createElement("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" },
|
|
187
|
+
react_1.default.createElement("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" }))) : (react_1.default.createElement("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" },
|
|
188
|
+
react_1.default.createElement("path", { d: "M8 5v14l11-7z" }))))),
|
|
189
|
+
react_1.default.createElement("div", { className: b('timeline') },
|
|
190
|
+
react_1.default.createElement("div", { ref: progressRef, className: b('progress-bar'),
|
|
191
|
+
// FIX: убран onClick — onMouseDown уже обрабатывает клик без дублирования
|
|
192
|
+
onMouseDown: handleProgressMouseDown, onKeyDown: handleProgressKeyDown, role: "slider", "aria-label": "Seek", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(progress), tabIndex: 0 },
|
|
193
|
+
react_1.default.createElement("div", { className: b('progress-track') },
|
|
194
|
+
react_1.default.createElement("div", { className: b('progress-fill'), style: { width: `${progress}%` } },
|
|
195
|
+
react_1.default.createElement("div", { className: b('progress-thumb') })))),
|
|
196
|
+
react_1.default.createElement("div", { className: b('time') },
|
|
197
|
+
react_1.default.createElement("span", null, formatTime(currentTime)),
|
|
198
|
+
react_1.default.createElement("span", null, formatTime(duration)))),
|
|
199
|
+
react_1.default.createElement("div", { className: b('volume') },
|
|
200
|
+
react_1.default.createElement("button", { className: b('mute-btn'), onClick: toggleMute, "aria-label": isMuted ? 'Unmute' : 'Mute', type: "button" },
|
|
201
|
+
react_1.default.createElement("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18" },
|
|
202
|
+
react_1.default.createElement("path", { d: volumeIcon }))),
|
|
203
|
+
react_1.default.createElement("input", { ref: volumeSliderRef, className: b('volume-slider'), type: "range", min: 0, max: 1, step: 0.02, value: isMuted ? 0 : volume, onChange: handleVolumeChange, "aria-label": "Volume" }))));
|
|
204
|
+
};
|
|
205
|
+
exports.Audio = Audio;
|
|
206
|
+
exports.default = exports.Audio;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export declare const AudioBlock: {
|
|
2
|
+
"audio-block": {
|
|
3
|
+
type: string;
|
|
4
|
+
additionalProperties: boolean;
|
|
5
|
+
required: string[];
|
|
6
|
+
properties: {
|
|
7
|
+
url: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
anchor: {
|
|
11
|
+
type: string;
|
|
12
|
+
additionalProperties: boolean;
|
|
13
|
+
required: string[];
|
|
14
|
+
properties: {
|
|
15
|
+
text: {
|
|
16
|
+
type: string;
|
|
17
|
+
contentType: string;
|
|
18
|
+
};
|
|
19
|
+
url: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
urlTitle: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
visibility: {
|
|
28
|
+
oneOf: ({
|
|
29
|
+
type: string;
|
|
30
|
+
enum: string[];
|
|
31
|
+
additionalProperties?: undefined;
|
|
32
|
+
properties?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
additionalProperties: boolean;
|
|
36
|
+
properties: {
|
|
37
|
+
xs: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
sm: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
md: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
lg: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
xl: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
xxl: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
enum?: undefined;
|
|
57
|
+
})[];
|
|
58
|
+
};
|
|
59
|
+
visible: {
|
|
60
|
+
type: string;
|
|
61
|
+
enum: string[];
|
|
62
|
+
};
|
|
63
|
+
hidden: {
|
|
64
|
+
type: string;
|
|
65
|
+
enum: string[];
|
|
66
|
+
};
|
|
67
|
+
resetPaddings: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
context: {
|
|
71
|
+
type: string;
|
|
72
|
+
};
|
|
73
|
+
indent: {
|
|
74
|
+
type: string;
|
|
75
|
+
additionalProperties: boolean;
|
|
76
|
+
properties: {
|
|
77
|
+
top: {
|
|
78
|
+
enum: string[];
|
|
79
|
+
};
|
|
80
|
+
bottom: {
|
|
81
|
+
enum: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
backgroundFull: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
visibilityFilter: {
|
|
89
|
+
oneOf: ({
|
|
90
|
+
type: string;
|
|
91
|
+
items?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
type: string;
|
|
94
|
+
items: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
})[];
|
|
98
|
+
};
|
|
99
|
+
blockUnicorn: {
|
|
100
|
+
type: string;
|
|
101
|
+
};
|
|
102
|
+
blockBackground: {
|
|
103
|
+
oneOf: ({
|
|
104
|
+
type: string;
|
|
105
|
+
additionalProperties?: undefined;
|
|
106
|
+
properties?: undefined;
|
|
107
|
+
} | {
|
|
108
|
+
type: string;
|
|
109
|
+
additionalProperties: boolean;
|
|
110
|
+
properties: {
|
|
111
|
+
color: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
image: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
size: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
repeat: {
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
position: {
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
attachment: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
clip: {
|
|
130
|
+
type: string;
|
|
131
|
+
};
|
|
132
|
+
origin: {
|
|
133
|
+
type: string;
|
|
134
|
+
};
|
|
135
|
+
blendMode: {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
})[];
|
|
140
|
+
};
|
|
141
|
+
type: {};
|
|
142
|
+
when: {
|
|
143
|
+
type: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AudioBlock = void 0;
|
|
4
|
+
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
exports.AudioBlock = {
|
|
6
|
+
['audio-block']: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ['url'],
|
|
10
|
+
properties: Object.assign(Object.assign({}, common_1.BlockBaseProps), { url: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
} }),
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -27,6 +27,7 @@ unpredictable css rules order in build */
|
|
|
27
27
|
border: 1.5px solid rgba(20, 7, 15, 0.1);
|
|
28
28
|
color: var(--g-color-science-primary);
|
|
29
29
|
transition: opacity 0.2s ease;
|
|
30
|
+
font-family: var(--g-font-family-science-inter);
|
|
30
31
|
}
|
|
31
32
|
.pc-cat-block__button:hover {
|
|
32
33
|
opacity: 0.7;
|
|
@@ -52,3 +52,4 @@ export { default as MiniCaseBlock } from './MiniCase/MiniCase';
|
|
|
52
52
|
export { default as BenchmarkBlock } from './Benchmark/Benchmark';
|
|
53
53
|
export { default as SidebarWidgetBlock } from './SidebarWidget/SidebarWidget';
|
|
54
54
|
export { default as CatBlock } from './Cat/Cat';
|
|
55
|
+
export { default as AudioBlock } from './Audio/Audio';
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HighlightTableBlock = exports.PressReleasesBlock = exports.RelevantReportsBlock = exports.RelevantReportsCardsBlock = exports.RelevantPostsBlock = exports.ScienceFeedBlock = exports.BlogFeedBlock = exports.EventsSectionBlock = exports.ResourceHubPostsBlock = exports.EventsFeedBlock = exports.LinkTableBlock = exports.FormWallBlock = exports.ReportsSectionsBlock = exports.ReportsCardsBlock = exports.AboutHeaderBlock = exports.ScienceHeaderBlock = exports.ReportsBlock = exports.QuotesBlock = exports.ServicesBlock = exports.SolutionsBlock = exports.MarqueeLinksBlock = exports.FormBlock = exports.FilterCardLayoutBlock = exports.FilterBlock = exports.ShareBlock = exports.BannerMinifyBlock = exports.ContentLayoutBlock = exports.CardLayoutBlock = exports.HeaderSliderBlock = exports.IconsBlock = exports.HeaderMinifyBlock = exports.HeaderBlock = exports.TabLinksBlock = exports.TabsHighlightTableBlock = exports.TabsBlock = exports.TableBlock = exports.QuestionsBlock = exports.ScrollerBlock = exports.BenefitsBlock = exports.AdvantagesBlock = exports.PromoFeaturesBlock = exports.ExtendedFeaturesBlock = exports.SliderNewBlock = exports.SliderBlock = exports.MapBlock = exports.MediaBlock = exports.InfoBlock = exports.CompaniesBlock = exports.LogoRotatorBlock = exports.BannerBlock = void 0;
|
|
7
|
-
exports.CatBlock = exports.SidebarWidgetBlock = exports.BenchmarkBlock = exports.MiniCaseBlock = void 0;
|
|
7
|
+
exports.AudioBlock = exports.CatBlock = exports.SidebarWidgetBlock = exports.BenchmarkBlock = exports.MiniCaseBlock = void 0;
|
|
8
8
|
var Banner_1 = require("./Banner/Banner");
|
|
9
9
|
Object.defineProperty(exports, "BannerBlock", { enumerable: true, get: function () { return __importDefault(Banner_1).default; } });
|
|
10
10
|
var LogoRotator_1 = require("./LogoRotator/LogoRotator");
|
|
@@ -113,3 +113,5 @@ var SidebarWidget_1 = require("./SidebarWidget/SidebarWidget");
|
|
|
113
113
|
Object.defineProperty(exports, "SidebarWidgetBlock", { enumerable: true, get: function () { return __importDefault(SidebarWidget_1).default; } });
|
|
114
114
|
var Cat_1 = require("./Cat/Cat");
|
|
115
115
|
Object.defineProperty(exports, "CatBlock", { enumerable: true, get: function () { return __importDefault(Cat_1).default; } });
|
|
116
|
+
var Audio_1 = require("./Audio/Audio");
|
|
117
|
+
Object.defineProperty(exports, "AudioBlock", { enumerable: true, get: function () { return __importDefault(Audio_1).default; } });
|
|
@@ -53,6 +53,7 @@ export declare const blockMap: {
|
|
|
53
53
|
"form-wall-block": (props: import("./models").FormWallBlockProps) => JSX.Element;
|
|
54
54
|
"slider-new-block": (props: import("react").PropsWithChildren<import("./blocks/SliderNew/SliderClient").SliderNewProps>) => JSX.Element;
|
|
55
55
|
"cat-block": ({ title, children }: import("react").PropsWithChildren<import("./models").CatBlockProps>) => JSX.Element;
|
|
56
|
+
"audio-block": ({ url }: import("react").PropsWithChildren<import("./models").AudioBlockProps>) => JSX.Element;
|
|
56
57
|
};
|
|
57
58
|
export declare const subBlockMap: {
|
|
58
59
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -62,6 +62,7 @@ exports.blockMap = {
|
|
|
62
62
|
[models_1.BlockType.FormWallBlock]: blocks_1.FormWallBlock,
|
|
63
63
|
[models_1.BlockType.SliderNewBlock]: blocks_1.SliderNewBlock,
|
|
64
64
|
[models_1.BlockType.CatBlock]: blocks_1.CatBlock,
|
|
65
|
+
[models_1.BlockType.AudioBlock]: blocks_1.AudioBlock,
|
|
65
66
|
};
|
|
66
67
|
exports.subBlockMap = {
|
|
67
68
|
[models_1.SubBlockType.Divider]: sub_blocks_1.Divider,
|
|
@@ -60,7 +60,8 @@ export declare enum BlockType {
|
|
|
60
60
|
MiniCaseBlock = "mini-case-block",
|
|
61
61
|
BenchmarkBlock = "benchmark-block",
|
|
62
62
|
SidebarWidgetBlock = "sidebar-widget-block",
|
|
63
|
-
CatBlock = "cat-block"
|
|
63
|
+
CatBlock = "cat-block",
|
|
64
|
+
AudioBlock = "audio-block"
|
|
64
65
|
}
|
|
65
66
|
export declare const BlockTypes: BlockType[];
|
|
66
67
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -598,6 +599,9 @@ export interface CardLayoutBlockProps extends Themable, Childable, Animatable, L
|
|
|
598
599
|
export interface CatBlockProps {
|
|
599
600
|
title?: string;
|
|
600
601
|
}
|
|
602
|
+
export interface AudioBlockProps {
|
|
603
|
+
url?: string;
|
|
604
|
+
}
|
|
601
605
|
export interface BenchmarkBlockProps extends Animatable {
|
|
602
606
|
title?: string;
|
|
603
607
|
duration?: number;
|
|
@@ -841,6 +845,9 @@ export type CardLayoutBlockModel = {
|
|
|
841
845
|
export type CatBlockModel = {
|
|
842
846
|
type: BlockType.CatBlock;
|
|
843
847
|
} & CatBlockProps;
|
|
848
|
+
export type AudioBlockModel = {
|
|
849
|
+
type: BlockType.AudioBlock;
|
|
850
|
+
} & AudioBlockProps;
|
|
844
851
|
export type FilterBlockModel = {
|
|
845
852
|
type: BlockType.FilterBlock;
|
|
846
853
|
} & FilterBlockProps;
|
|
@@ -934,6 +941,6 @@ export type SliderNewBlockModel = {
|
|
|
934
941
|
export type SidebarWidgetBlockModel = {
|
|
935
942
|
type: BlockType.SidebarWidgetBlock;
|
|
936
943
|
} & SidebarWidgetBlockProps;
|
|
937
|
-
type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | LogoRotatorBlockModel | AdvantagesBlockModel | BenefitsBlockModel | ScrollerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | HighlightTableBlockModel | MiniCaseBlockModel | TabsBlockModel | TabsHighlightTableBlockModel | TabLinksBlockModel | HeaderBlockModel | HeaderMinifyBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | BannerMinifyBlockModel | ShareBLockModel | FilterBlockModel | FilterCardLayoutBlockModel | FormBlockModel | MarqueeLinksBlockModel | SolutionsBlockModel | ServicesBlockModel | QuotesBlockModel | ReportsBlockModel | ScienceHeaderBlockModel | AboutHeaderBlockModel | ReportsCardsBlockModel | ReportsSectionsBlockModel | LinkTableBlockModel | EventsFeedBlockModel | ResourceHubPostsBlockModel | BenchmarkBlockModel | EventsSectionBlockModel | BlogFeedBlockModel | ScienceFeedBlockModel | RelevantPostsBlockModel | RelevantReportsCardsBlockModel | RelevantReportsBlockModel | PressReleasesBlockModel | FormWallBlockModel | SliderNewBlockModel | SidebarWidgetBlockModel | CatBlockModel;
|
|
944
|
+
type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | LogoRotatorBlockModel | AdvantagesBlockModel | BenefitsBlockModel | ScrollerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | HighlightTableBlockModel | MiniCaseBlockModel | TabsBlockModel | TabsHighlightTableBlockModel | TabLinksBlockModel | HeaderBlockModel | HeaderMinifyBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | BannerMinifyBlockModel | ShareBLockModel | FilterBlockModel | FilterCardLayoutBlockModel | FormBlockModel | MarqueeLinksBlockModel | SolutionsBlockModel | ServicesBlockModel | QuotesBlockModel | ReportsBlockModel | ScienceHeaderBlockModel | AboutHeaderBlockModel | ReportsCardsBlockModel | ReportsSectionsBlockModel | LinkTableBlockModel | EventsFeedBlockModel | ResourceHubPostsBlockModel | BenchmarkBlockModel | EventsSectionBlockModel | BlogFeedBlockModel | ScienceFeedBlockModel | RelevantPostsBlockModel | RelevantReportsCardsBlockModel | RelevantReportsBlockModel | PressReleasesBlockModel | FormWallBlockModel | SliderNewBlockModel | SidebarWidgetBlockModel | CatBlockModel | AudioBlockModel;
|
|
938
945
|
export type Block = BlockModels & BlockBaseProps;
|
|
939
946
|
export {};
|
|
@@ -57,6 +57,7 @@ var BlockType;
|
|
|
57
57
|
BlockType["BenchmarkBlock"] = "benchmark-block";
|
|
58
58
|
BlockType["SidebarWidgetBlock"] = "sidebar-widget-block";
|
|
59
59
|
BlockType["CatBlock"] = "cat-block";
|
|
60
|
+
BlockType["AudioBlock"] = "audio-block";
|
|
60
61
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
|
61
62
|
exports.BlockTypes = Object.values(BlockType);
|
|
62
63
|
exports.HeaderBlockTypes = [
|