@hh.ru/magritte-ui-media-viewer 1.3.11 → 1.3.12
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/index.css +83 -83
- package/index.js +2 -2
- package/internal/Counter.js +2 -2
- package/internal/GalleryItemBody.js +14 -5
- package/internal/GalleryItemBody.js.map +1 -1
- package/internal/PreviewItem.js +2 -2
- package/internal/PreviewItemBody.js +2 -2
- package/internal/PreviewZoomControl.js +8 -5
- package/internal/PreviewZoomControl.js.map +1 -1
- package/internal/animations.d.ts +1 -1
- package/internal/animations.js +5 -5
- package/internal/animations.js.map +1 -1
- package/internal/context.js +1 -1
- package/internal/hooks/useAutoHideTools.js +3 -3
- package/internal/hooks/useAutoHideTools.js.map +1 -1
- package/internal/hooks/useDoubleTapScale.js +10 -4
- package/internal/hooks/useDoubleTapScale.js.map +1 -1
- package/internal/hooks/useGalleryItemController.js +2 -2
- package/internal/hooks/useGalleryItemController.js.map +1 -1
- package/internal/hooks/usePan.js +1 -1
- package/internal/hooks/usePinchToZoom.js +1 -1
- package/internal/hooks/useSwipe.js +2 -2
- package/internal/hooks/useSwipe.js.map +1 -1
- package/internal/hooks/useSwipeToClose.js +4 -4
- package/internal/hooks/useSwipeToClose.js.map +1 -1
- package/internal/hooks/useTapToToggleTools.js +2 -2
- package/internal/hooks/useTapToToggleTools.js.map +1 -1
- package/internal/hooks/useVirtualization.js +1 -1
- package/internal/hooks/useWheelToZoom.js +1 -1
- package/internal/utils.js +7 -4
- package/internal/utils.js.map +1 -1
- package/media-viewer-CY3dE_bP.js +5 -0
- package/media-viewer-CY3dE_bP.js.map +1 -0
- package/package.json +9 -9
- package/public/Footer.js +1 -1
- package/public/Gallery.js +2 -2
- package/public/GalleryItem.js +2 -2
- package/public/Header.js +1 -1
- package/public/MediaViewer.js +4 -4
- package/public/MediaViewer.js.map +1 -1
- package/public/Preview.js +16 -7
- package/public/Preview.js.map +1 -1
- package/public/Toolbar.js +2 -2
- package/public/Tools.js +1 -1
- package/media-viewer-Cc0v73D3.js +0 -5
- package/media-viewer-Cc0v73D3.js.map +0 -1
package/index.css
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
:root{
|
|
2
|
-
--magritte-color-background-overlay-viewer-
|
|
3
|
-
--magritte-color-background-overlay-toolbar-
|
|
4
|
-
--magritte-color-text-constant-
|
|
5
|
-
--magritte-color-text-constant-secondary-
|
|
6
|
-
--magritte-color-component-skeleton-background-content-
|
|
7
|
-
--magritte-gradient-component-media-viewer-background-fade-
|
|
2
|
+
--magritte-color-background-overlay-viewer-v25-0-0:#000000;
|
|
3
|
+
--magritte-color-background-overlay-toolbar-v25-0-0:#000000a3;
|
|
4
|
+
--magritte-color-text-constant-v25-0-0:#ffffff;
|
|
5
|
+
--magritte-color-text-constant-secondary-v25-0-0:#ffffffb3;
|
|
6
|
+
--magritte-color-component-skeleton-background-content-v25-0-0:#8293a23d;;
|
|
7
|
+
--magritte-gradient-component-media-viewer-background-fade-v25-0-0:#00000000 0%, #00000052 100%;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
:root{
|
|
11
|
-
--magritte-semantic-animation-time-m-duration-
|
|
12
|
-
--magritte-semantic-animation-ease-base-timing-function-
|
|
11
|
+
--magritte-semantic-animation-time-m-duration-v25-0-0:400ms;
|
|
12
|
+
--magritte-semantic-animation-ease-base-timing-function-v25-0-0:cubic-bezier(0.4, 0.24, 0, 1);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.magritte-night-theme{
|
|
16
|
-
--magritte-color-component-skeleton-background-content-
|
|
16
|
+
--magritte-color-component-skeleton-background-content-v25-0-0:#5e5e5e3d;
|
|
17
17
|
}
|
|
18
|
-
.magritte-media-viewer___KnrXP_1-3-
|
|
18
|
+
.magritte-media-viewer___KnrXP_1-3-12{
|
|
19
19
|
position:fixed;
|
|
20
20
|
inset:0;
|
|
21
21
|
display:grid;
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
user-select:none;
|
|
26
26
|
--media-viewer-toolbars-opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress) - var(--magritte-ui-media-viewer-hide-tools-progress));
|
|
27
27
|
--media-viewer-background-opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress));
|
|
28
|
-
--magritte-ui-nav-bar-background-color-override:var(--magritte-color-background-overlay-toolbar-
|
|
28
|
+
--magritte-ui-nav-bar-background-color-override:var(--magritte-color-background-overlay-toolbar-v25-0-0);
|
|
29
29
|
}
|
|
30
|
-
.magritte-media-viewer___KnrXP_1-3-
|
|
30
|
+
.magritte-media-viewer___KnrXP_1-3-12::before{
|
|
31
31
|
content:'';
|
|
32
32
|
position:absolute;
|
|
33
33
|
inset:0;
|
|
34
|
-
background:var(--magritte-color-background-overlay-viewer-
|
|
34
|
+
background:var(--magritte-color-background-overlay-viewer-v25-0-0);
|
|
35
35
|
opacity:var(--media-viewer-background-opacity);
|
|
36
36
|
pointer-events:none;
|
|
37
37
|
}
|
|
38
|
-
.magritte-gallery-placeholder___rUoGL_1-3-
|
|
38
|
+
.magritte-gallery-placeholder___rUoGL_1-3-12{
|
|
39
39
|
display:flex;
|
|
40
40
|
align-items:stretch;
|
|
41
41
|
grid-row:2;
|
|
42
42
|
min-height:0;
|
|
43
43
|
}
|
|
44
|
-
.magritte-media-viewer-gallery___P0SnN_1-3-
|
|
44
|
+
.magritte-media-viewer-gallery___P0SnN_1-3-12{
|
|
45
45
|
display:grid;
|
|
46
46
|
flex-grow:1;
|
|
47
47
|
contain:layout size;
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
inset:0;
|
|
51
51
|
}
|
|
52
52
|
@media (min-width: 1020px){
|
|
53
|
-
body.magritte-old-layout .magritte-media-viewer-gallery___P0SnN_1-3-
|
|
53
|
+
body.magritte-old-layout .magritte-media-viewer-gallery___P0SnN_1-3-12{
|
|
54
54
|
position:relative;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
@media (min-width: 1024px){
|
|
58
|
-
body:not(.magritte-old-layout) .magritte-media-viewer-gallery___P0SnN_1-3-
|
|
58
|
+
body:not(.magritte-old-layout) .magritte-media-viewer-gallery___P0SnN_1-3-12{
|
|
59
59
|
position:relative;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
.magritte-gallery-item___Js0Z5_1-3-
|
|
62
|
+
.magritte-gallery-item___Js0Z5_1-3-12{
|
|
63
63
|
position:relative;
|
|
64
64
|
grid-area:1 / 1;
|
|
65
65
|
contain:size;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
overflow-y:visible;
|
|
69
69
|
opacity:calc(1 - var(--magritte-ui-media-viewer-image-close-progress, 0));
|
|
70
70
|
}
|
|
71
|
-
.magritte-gallery-item-transform-container___N8-sA_1-3-
|
|
71
|
+
.magritte-gallery-item-transform-container___N8-sA_1-3-12{
|
|
72
72
|
position:absolute;
|
|
73
73
|
top:50%;
|
|
74
74
|
left:50%;
|
|
@@ -76,64 +76,64 @@
|
|
|
76
76
|
will-change:transform;
|
|
77
77
|
touch-action:none;
|
|
78
78
|
}
|
|
79
|
-
.magritte-preview-counter___uP2Hc_1-3-
|
|
79
|
+
.magritte-preview-counter___uP2Hc_1-3-12{
|
|
80
80
|
min-width:0;
|
|
81
81
|
text-align:center;
|
|
82
82
|
}
|
|
83
83
|
@media (min-width: 1020px){
|
|
84
|
-
body.magritte-old-layout .magritte-preview-counter___uP2Hc_1-3-
|
|
84
|
+
body.magritte-old-layout .magritte-preview-counter___uP2Hc_1-3-12{
|
|
85
85
|
text-align:left;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
@media (min-width: 1024px){
|
|
89
|
-
body:not(.magritte-old-layout) .magritte-preview-counter___uP2Hc_1-3-
|
|
89
|
+
body:not(.magritte-old-layout) .magritte-preview-counter___uP2Hc_1-3-12{
|
|
90
90
|
text-align:left;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
.magritte-preview-counter___uP2Hc_1-3-
|
|
93
|
+
.magritte-preview-counter___uP2Hc_1-3-12.magritte-with-description___-w7ld_1-3-12{
|
|
94
94
|
cursor:pointer;
|
|
95
95
|
}
|
|
96
|
-
.magritte-counter-number___gUpMp_1-3-
|
|
96
|
+
.magritte-counter-number___gUpMp_1-3-12{
|
|
97
97
|
display:block;
|
|
98
98
|
transform:translateY(calc(18px * 0.5));
|
|
99
|
-
transition:transform var(--magritte-semantic-animation-time-m-duration-
|
|
99
|
+
transition:transform var(--magritte-semantic-animation-time-m-duration-v25-0-0) var(--magritte-semantic-animation-ease-base-timing-function-v25-0-0);
|
|
100
100
|
}
|
|
101
|
-
.magritte-with-description___-w7ld_1-3-
|
|
101
|
+
.magritte-with-description___-w7ld_1-3-12 .magritte-counter-number___gUpMp_1-3-12{
|
|
102
102
|
transform:translateY(0);
|
|
103
103
|
}
|
|
104
|
-
.magritte-no-description-placeholder___qc6h2_1-3-
|
|
104
|
+
.magritte-no-description-placeholder___qc6h2_1-3-12{
|
|
105
105
|
display:block;
|
|
106
106
|
height:18px;
|
|
107
107
|
padding:0;
|
|
108
108
|
}
|
|
109
|
-
.magritte-preview-zoom-control___026jA_1-3-
|
|
109
|
+
.magritte-preview-zoom-control___026jA_1-3-12{
|
|
110
110
|
display:flex;
|
|
111
111
|
flex-direction:row;
|
|
112
112
|
gap:2px;
|
|
113
113
|
align-items:center;
|
|
114
114
|
justify-self:end;
|
|
115
115
|
}
|
|
116
|
-
.magritte-preview-container___nwjNY_1-3-
|
|
116
|
+
.magritte-preview-container___nwjNY_1-3-12{
|
|
117
117
|
display:grid;
|
|
118
118
|
grid-template-columns:1fr auto 1fr;
|
|
119
119
|
gap:16px;
|
|
120
120
|
padding:4px 16px;
|
|
121
|
-
background:var(--magritte-color-background-overlay-toolbar-
|
|
121
|
+
background:var(--magritte-color-background-overlay-toolbar-v25-0-0);
|
|
122
122
|
align-items:center;
|
|
123
123
|
grid-row:3;
|
|
124
124
|
z-index:10;
|
|
125
125
|
}
|
|
126
126
|
@media (min-width: 1020px){
|
|
127
|
-
body.magritte-old-layout .magritte-preview-container___nwjNY_1-3-
|
|
127
|
+
body.magritte-old-layout .magritte-preview-container___nwjNY_1-3-12{
|
|
128
128
|
padding:16px 24px;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
@media (min-width: 1024px){
|
|
132
|
-
body:not(.magritte-old-layout) .magritte-preview-container___nwjNY_1-3-
|
|
132
|
+
body:not(.magritte-old-layout) .magritte-preview-container___nwjNY_1-3-12{
|
|
133
133
|
padding:16px 24px;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
.magritte-preview___0Ge4C_1-3-
|
|
136
|
+
.magritte-preview___0Ge4C_1-3-12{
|
|
137
137
|
display:flex;
|
|
138
138
|
flex-direction:row;
|
|
139
139
|
touch-action:none;
|
|
@@ -141,18 +141,18 @@
|
|
|
141
141
|
min-width:0;
|
|
142
142
|
}
|
|
143
143
|
@media (min-width: 1020px){
|
|
144
|
-
body.magritte-old-layout .magritte-preview___0Ge4C_1-3-
|
|
144
|
+
body.magritte-old-layout .magritte-preview___0Ge4C_1-3-12{
|
|
145
145
|
max-width:calc(((40 + 8) * (var(--media-viewer-max-visible-items) - 1) + 80) * 1px);
|
|
146
146
|
overflow:hidden;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
@media (min-width: 1024px){
|
|
150
|
-
body:not(.magritte-old-layout) .magritte-preview___0Ge4C_1-3-
|
|
150
|
+
body:not(.magritte-old-layout) .magritte-preview___0Ge4C_1-3-12{
|
|
151
151
|
max-width:calc(((40 + 8) * (var(--media-viewer-max-visible-items) - 1) + 80) * 1px);
|
|
152
152
|
overflow:hidden;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
.magritte-preview-list___SAXLZ_1-3-
|
|
155
|
+
.magritte-preview-list___SAXLZ_1-3-12{
|
|
156
156
|
margin-left:50%;
|
|
157
157
|
contain:layout paint;
|
|
158
158
|
display:flex;
|
|
@@ -162,18 +162,18 @@
|
|
|
162
162
|
flex:0 0 auto;
|
|
163
163
|
}
|
|
164
164
|
@media (min-width: 1020px){
|
|
165
|
-
body.magritte-old-layout .magritte-preview-list___SAXLZ_1-3-
|
|
165
|
+
body.magritte-old-layout .magritte-preview-list___SAXLZ_1-3-12{
|
|
166
166
|
margin:0;
|
|
167
167
|
gap:8px;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
@media (min-width: 1024px){
|
|
171
|
-
body:not(.magritte-old-layout) .magritte-preview-list___SAXLZ_1-3-
|
|
171
|
+
body:not(.magritte-old-layout) .magritte-preview-list___SAXLZ_1-3-12{
|
|
172
172
|
margin:0;
|
|
173
173
|
gap:8px;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
.magritte-preview-item___gz5f2_1-3-
|
|
176
|
+
.magritte-preview-item___gz5f2_1-3-12{
|
|
177
177
|
contain:layout paint size;
|
|
178
178
|
position:relative;
|
|
179
179
|
flex-shrink:0;
|
|
@@ -184,36 +184,36 @@
|
|
|
184
184
|
display:flex;
|
|
185
185
|
align-items:center;
|
|
186
186
|
justify-content:center;
|
|
187
|
-
background-color:var(--magritte-color-component-skeleton-background-content-
|
|
187
|
+
background-color:var(--magritte-color-component-skeleton-background-content-v25-0-0);
|
|
188
188
|
}
|
|
189
189
|
@media (min-width: 1020px){
|
|
190
|
-
body.magritte-old-layout .magritte-preview-item___gz5f2_1-3-
|
|
190
|
+
body.magritte-old-layout .magritte-preview-item___gz5f2_1-3-12{
|
|
191
191
|
height:80px;
|
|
192
192
|
border-radius:8px;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
@media (min-width: 1024px){
|
|
196
|
-
body:not(.magritte-old-layout) .magritte-preview-item___gz5f2_1-3-
|
|
196
|
+
body:not(.magritte-old-layout) .magritte-preview-item___gz5f2_1-3-12{
|
|
197
197
|
height:80px;
|
|
198
198
|
border-radius:8px;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
.magritte-preview-item-container___JDVsk_1-3-
|
|
201
|
+
.magritte-preview-item-container___JDVsk_1-3-12{
|
|
202
202
|
contain:layout paint size;
|
|
203
203
|
overflow:hidden;
|
|
204
204
|
scale:1;
|
|
205
205
|
}
|
|
206
206
|
@media (min-width: 1020px){
|
|
207
|
-
body.magritte-old-layout .magritte-preview-item-container___JDVsk_1-3-
|
|
207
|
+
body.magritte-old-layout .magritte-preview-item-container___JDVsk_1-3-12{
|
|
208
208
|
scale:1.66666667;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
@media (min-width: 1024px){
|
|
212
|
-
body:not(.magritte-old-layout) .magritte-preview-item-container___JDVsk_1-3-
|
|
212
|
+
body:not(.magritte-old-layout) .magritte-preview-item-container___JDVsk_1-3-12{
|
|
213
213
|
scale:1.66666667;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
.magritte-preview-item-container___JDVsk_1-3-
|
|
216
|
+
.magritte-preview-item-container___JDVsk_1-3-12 *{
|
|
217
217
|
touch-action:none;
|
|
218
218
|
position:absolute;
|
|
219
219
|
top:0;
|
|
@@ -223,8 +223,8 @@
|
|
|
223
223
|
height:100%;
|
|
224
224
|
user-select:none;
|
|
225
225
|
}
|
|
226
|
-
.magritte-media-viewer-toolbar___2C8nr_1-3-
|
|
227
|
-
background:var(--magritte-color-background-overlay-toolbar-
|
|
226
|
+
.magritte-media-viewer-toolbar___2C8nr_1-3-12{
|
|
227
|
+
background:var(--magritte-color-background-overlay-toolbar-v25-0-0);
|
|
228
228
|
padding:0 8px;
|
|
229
229
|
display:grid;
|
|
230
230
|
grid-template-columns:1fr auto 1fr;
|
|
@@ -234,30 +234,30 @@
|
|
|
234
234
|
grid-row:4;
|
|
235
235
|
z-index:10;
|
|
236
236
|
}
|
|
237
|
-
.magritte-media-viewer-toolbar___2C8nr_1-3-
|
|
237
|
+
.magritte-media-viewer-toolbar___2C8nr_1-3-12.magritte-no-description___NebrT_1-3-12{
|
|
238
238
|
display:flex;
|
|
239
239
|
justify-content:space-between;
|
|
240
240
|
}
|
|
241
241
|
@media (min-width: 1020px){
|
|
242
|
-
body.magritte-old-layout .magritte-media-viewer-toolbar___2C8nr_1-3-
|
|
242
|
+
body.magritte-old-layout .magritte-media-viewer-toolbar___2C8nr_1-3-12{
|
|
243
243
|
display:none;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
@media (min-width: 1024px){
|
|
247
|
-
body:not(.magritte-old-layout) .magritte-media-viewer-toolbar___2C8nr_1-3-
|
|
247
|
+
body:not(.magritte-old-layout) .magritte-media-viewer-toolbar___2C8nr_1-3-12{
|
|
248
248
|
display:none;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
.magritte-media-viewer-toolbar-left___YzkJt_1-3-
|
|
252
|
-
.magritte-media-viewer-toolbar-right___kBER9_1-3-
|
|
251
|
+
.magritte-media-viewer-toolbar-left___YzkJt_1-3-12,
|
|
252
|
+
.magritte-media-viewer-toolbar-right___kBER9_1-3-12{
|
|
253
253
|
display:flex;
|
|
254
254
|
gap:4px;
|
|
255
255
|
}
|
|
256
|
-
.magritte-media-viewer-toolbar-right___kBER9_1-3-
|
|
256
|
+
.magritte-media-viewer-toolbar-right___kBER9_1-3-12{
|
|
257
257
|
justify-content:end;
|
|
258
258
|
}
|
|
259
|
-
.magritte-prev-button___WMYjR_1-3-
|
|
260
|
-
.magritte-next-button___f8hJT_1-3-
|
|
259
|
+
.magritte-prev-button___WMYjR_1-3-12,
|
|
260
|
+
.magritte-next-button___f8hJT_1-3-12{
|
|
261
261
|
cursor:pointer;
|
|
262
262
|
position:absolute;
|
|
263
263
|
top:0;
|
|
@@ -265,40 +265,40 @@
|
|
|
265
265
|
width:48px;
|
|
266
266
|
opacity:var(--media-viewer-background-opacity);
|
|
267
267
|
}
|
|
268
|
-
.magritte-prev-button___WMYjR_1-3-
|
|
269
|
-
.magritte-next-button___f8hJT_1-3-
|
|
270
|
-
background:linear-gradient(90deg, var(--magritte-gradient-component-media-viewer-background-fade-
|
|
268
|
+
.magritte-prev-button___WMYjR_1-3-12:active,
|
|
269
|
+
.magritte-next-button___f8hJT_1-3-12:active{
|
|
270
|
+
background:linear-gradient(90deg, var(--magritte-gradient-component-media-viewer-background-fade-v25-0-0));
|
|
271
271
|
}
|
|
272
272
|
@media (min-width: 1020px){
|
|
273
|
-
body.magritte-old-layout .magritte-prev-button___WMYjR_1-3-
|
|
274
|
-
body.magritte-old-layout .magritte-next-button___f8hJT_1-3-
|
|
273
|
+
body.magritte-old-layout .magritte-prev-button___WMYjR_1-3-12,
|
|
274
|
+
body.magritte-old-layout .magritte-next-button___f8hJT_1-3-12{
|
|
275
275
|
width:88px;
|
|
276
276
|
}
|
|
277
|
-
body.magritte-old-layout .magritte-prev-button___WMYjR_1-3-
|
|
278
|
-
body.magritte-old-layout .magritte-next-button___f8hJT_1-3-
|
|
277
|
+
body.magritte-old-layout .magritte-prev-button___WMYjR_1-3-12:active,
|
|
278
|
+
body.magritte-old-layout .magritte-next-button___f8hJT_1-3-12:active{
|
|
279
279
|
background:none;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
@media (min-width: 1024px){
|
|
283
|
-
body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-3-
|
|
284
|
-
body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-3-
|
|
283
|
+
body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-3-12,
|
|
284
|
+
body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-3-12{
|
|
285
285
|
width:88px;
|
|
286
286
|
}
|
|
287
|
-
body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-3-
|
|
288
|
-
body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-3-
|
|
287
|
+
body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-3-12:active,
|
|
288
|
+
body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-3-12:active{
|
|
289
289
|
background:none;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
.magritte-prev-button___WMYjR_1-3-
|
|
292
|
+
.magritte-prev-button___WMYjR_1-3-12{
|
|
293
293
|
left:0;
|
|
294
294
|
}
|
|
295
|
-
.magritte-prev-button___WMYjR_1-3-
|
|
296
|
-
background:linear-gradient(270deg, var(--magritte-gradient-component-media-viewer-background-fade-
|
|
295
|
+
.magritte-prev-button___WMYjR_1-3-12:active{
|
|
296
|
+
background:linear-gradient(270deg, var(--magritte-gradient-component-media-viewer-background-fade-v25-0-0));
|
|
297
297
|
}
|
|
298
|
-
.magritte-next-button___f8hJT_1-3-
|
|
298
|
+
.magritte-next-button___f8hJT_1-3-12{
|
|
299
299
|
right:0;
|
|
300
300
|
}
|
|
301
|
-
.magritte-slide-button___sY8LB_1-3-
|
|
301
|
+
.magritte-slide-button___sY8LB_1-3-12{
|
|
302
302
|
display:flex;
|
|
303
303
|
background:none;
|
|
304
304
|
padding:0;
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
position:absolute;
|
|
309
309
|
inset:0;
|
|
310
310
|
}
|
|
311
|
-
.magritte-preview-placeholder___yuhW1_1-3-
|
|
311
|
+
.magritte-preview-placeholder___yuhW1_1-3-12{
|
|
312
312
|
--magritte-media-viewer-preview-width:24px;
|
|
313
313
|
--magritte-media-viewer-preview-gap:2px;
|
|
314
314
|
flex:0 0 auto;
|
|
@@ -317,24 +317,24 @@
|
|
|
317
317
|
flex-grow:0;
|
|
318
318
|
}
|
|
319
319
|
@media (min-width: 1020px){
|
|
320
|
-
body.magritte-old-layout .magritte-preview-placeholder___yuhW1_1-3-
|
|
320
|
+
body.magritte-old-layout .magritte-preview-placeholder___yuhW1_1-3-12{
|
|
321
321
|
--magritte-media-viewer-preview-width:40px;
|
|
322
322
|
--magritte-media-viewer-preview-gap:8px;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
@media (min-width: 1024px){
|
|
326
|
-
body:not(.magritte-old-layout) .magritte-preview-placeholder___yuhW1_1-3-
|
|
326
|
+
body:not(.magritte-old-layout) .magritte-preview-placeholder___yuhW1_1-3-12{
|
|
327
327
|
--magritte-media-viewer-preview-width:40px;
|
|
328
328
|
--magritte-media-viewer-preview-gap:8px;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
.magritte-gallery-item-loader___70TDe_1-3-
|
|
331
|
+
.magritte-gallery-item-loader___70TDe_1-3-12{
|
|
332
332
|
position:absolute;
|
|
333
333
|
top:50%;
|
|
334
334
|
left:50%;
|
|
335
335
|
transform:translate(-50%, -50%);
|
|
336
336
|
}
|
|
337
|
-
.magritte-gallery-item-error-container___Z-HyZ_1-3-
|
|
337
|
+
.magritte-gallery-item-error-container___Z-HyZ_1-3-12{
|
|
338
338
|
display:flex;
|
|
339
339
|
flex-direction:column;
|
|
340
340
|
align-items:center;
|
|
@@ -348,24 +348,24 @@
|
|
|
348
348
|
width:100%;
|
|
349
349
|
box-sizing:border-box;
|
|
350
350
|
}
|
|
351
|
-
.magritte-description-bottom-sheet-content___swnEV_1-3-
|
|
351
|
+
.magritte-description-bottom-sheet-content___swnEV_1-3-12{
|
|
352
352
|
padding:8px 0;
|
|
353
353
|
}
|
|
354
|
-
.magritte-header___egZXt_1-3-
|
|
354
|
+
.magritte-header___egZXt_1-3-12{
|
|
355
355
|
grid-row:1;
|
|
356
356
|
z-index:2;
|
|
357
357
|
opacity:var(--media-viewer-toolbars-opacity);
|
|
358
358
|
transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * -100%));
|
|
359
|
-
--magritte-ui-nav-bar-title-color-override:var(--magritte-color-text-constant-
|
|
360
|
-
--magritte-ui-nav-bar-subtitle-color-override:var(--magritte-color-text-constant-secondary-
|
|
359
|
+
--magritte-ui-nav-bar-title-color-override:var(--magritte-color-text-constant-v25-0-0);
|
|
360
|
+
--magritte-ui-nav-bar-subtitle-color-override:var(--magritte-color-text-constant-secondary-v25-0-0);
|
|
361
361
|
}
|
|
362
|
-
.magritte-footer___rOH-M_1-3-
|
|
362
|
+
.magritte-footer___rOH-M_1-3-12{
|
|
363
363
|
grid-row:3;
|
|
364
364
|
z-index:2;
|
|
365
365
|
opacity:var(--media-viewer-toolbars-opacity);
|
|
366
366
|
transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * 100%));
|
|
367
367
|
}
|
|
368
|
-
.magritte-description___dYc-E_1-3-
|
|
368
|
+
.magritte-description___dYc-E_1-3-12{
|
|
369
369
|
display:inline-block;
|
|
370
370
|
max-width:100%;
|
|
371
371
|
}
|
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import 'motion/react';
|
|
7
7
|
import '@hh.ru/magritte-common-modal-helper';
|
|
8
8
|
import '@hh.ru/magritte-common-use-translation';
|
|
9
|
-
import '@hh.ru/magritte-design-tokens/
|
|
9
|
+
import '@hh.ru/magritte-design-tokens/core-tokens';
|
|
10
10
|
import '@hh.ru/magritte-internal-accessible-region';
|
|
11
11
|
import '@hh.ru/magritte-ui-breakpoint';
|
|
12
12
|
import '@hh.ru/magritte-ui-layer';
|
|
@@ -18,7 +18,7 @@ import './internal/utils.js';
|
|
|
18
18
|
import './internal/hooks/useTapToToggleTools.js';
|
|
19
19
|
import './internal/hooks/useVirtualization.js';
|
|
20
20
|
import './public/Footer.js';
|
|
21
|
-
import './media-viewer-
|
|
21
|
+
import './media-viewer-CY3dE_bP.js';
|
|
22
22
|
import './public/Gallery.js';
|
|
23
23
|
import '@hh.ru/magritte-common-resize';
|
|
24
24
|
import '@hh.ru/magritte-ui-icon/icon';
|
package/internal/Counter.js
CHANGED
|
@@ -8,10 +8,10 @@ import { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';
|
|
|
8
8
|
import { useMediaViewerContext } from './context.js';
|
|
9
9
|
import { TooltipHover } from '@hh.ru/magritte-ui-tooltip';
|
|
10
10
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
11
|
-
import { s as styles } from '../media-viewer-
|
|
11
|
+
import { s as styles } from '../media-viewer-CY3dE_bP.js';
|
|
12
12
|
import './ImagesLoader.js';
|
|
13
13
|
import './utils.js';
|
|
14
|
-
import '@hh.ru/magritte-design-tokens/
|
|
14
|
+
import '@hh.ru/magritte-design-tokens/core-tokens';
|
|
15
15
|
import './animations.js';
|
|
16
16
|
|
|
17
17
|
const Counter = ({ items }) => {
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { useMotionValueEvent, useTransform, useMotionValue, animate, motion } from 'motion/react';
|
|
5
5
|
import { useTranslation } from '@hh.ru/magritte-common-use-translation';
|
|
6
|
-
import
|
|
6
|
+
import CoreTokens from '@hh.ru/magritte-design-tokens/core-tokens';
|
|
7
7
|
import { Loader } from '@hh.ru/magritte-ui-loader';
|
|
8
8
|
import { EASE_BASE } from './animations.js';
|
|
9
9
|
import { useMediaViewerContext, GalleryItemContext } from './context.js';
|
|
@@ -14,7 +14,7 @@ import { usePinchToZoom } from './hooks/usePinchToZoom.js';
|
|
|
14
14
|
import { useWheelToZoom } from './hooks/useWheelToZoom.js';
|
|
15
15
|
import { lerp, clamp } from './utils.js';
|
|
16
16
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
17
|
-
import { s as styles } from '../media-viewer-
|
|
17
|
+
import { s as styles } from '../media-viewer-CY3dE_bP.js';
|
|
18
18
|
import './ImagesLoader.js';
|
|
19
19
|
import '@use-gesture/react';
|
|
20
20
|
|
|
@@ -70,9 +70,18 @@ const GalleryItemBody = ({ index = 0, src, description }) => {
|
|
|
70
70
|
rotate.set(targetRotation);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
animate(rotate, targetRotation, {
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
animate(rotate, targetRotation, {
|
|
74
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
75
|
+
ease: EASE_BASE,
|
|
76
|
+
});
|
|
77
|
+
animate(controller.offsetX, 0, {
|
|
78
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
79
|
+
ease: EASE_BASE,
|
|
80
|
+
});
|
|
81
|
+
animate(controller.offsetY, 0, {
|
|
82
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
83
|
+
ease: EASE_BASE,
|
|
84
|
+
});
|
|
76
85
|
});
|
|
77
86
|
return (jsx(GalleryItemContext.Provider, { value: setContentSize, children: jsxs(motion.div, { className: styles.galleryItem, style: { x: translateX }, ...bindPinchToZoom, ...bindPan(), ...bindDoubleTapScale, ...bindWheelToZoom, children: [!!loadingFailed && (jsxs("div", { className: styles.galleryItemErrorContainer, children: [jsx(Text, { typography: "title-5-semibold", style: "constant", Element: "span", children: loadErrTrl }), jsx(Text, { typography: "paragraph-2-regular", style: "constant-secondary", Element: "span", children: loadErrDescTrl })] })), !isVisible && !loadingFailed && (jsx("div", { className: styles.galleryItemLoader, children: jsx(Loader, { size: 48, color: "constant-secondary" }) })), !!isVisible && (jsx(motion.div, { className: styles.galleryItemTransformContainer, style: {
|
|
78
87
|
scale: controller.scale,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryItemBody.js","sources":["src/internal/GalleryItemBody.tsx"],"sourcesContent":["import { type FC, useEffect, useState } from 'react';\nimport { motion, useMotionValue, useTransform, animate, useMotionValueEvent, HTMLMotionProps } from 'motion/react';\n\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { tokenSemanticAnimationTimeMDuration } from '@hh.ru/magritte-design-tokens/types';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { EASE_BASE } from '@hh.ru/magritte-ui-media-viewer/internal/animations';\nimport { useMediaViewerContext, GalleryItemContext } from '@hh.ru/magritte-ui-media-viewer/internal/context';\nimport { useDoubleTapScale } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useDoubleTapScale';\nimport {\n useGalleryItemController,\n isFullyInvisible,\n} from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useGalleryItemController';\nimport { usePan } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/usePan';\nimport { usePinchToZoom } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/usePinchToZoom';\nimport { useWheelToZoom } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useWheelToZoom';\nimport { lerp, clamp } from '@hh.ru/magritte-ui-media-viewer/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from '../public/media-viewer.less';\n\n/** Внешние пропсы GalleryItem — то, что передаёт пользователь */\nexport interface GalleryItemProps {\n /** Описание элемента */\n description?: string;\n /** URL изображения */\n src: string;\n /** URL превью изображения */\n previewSrc?: string;\n}\n\n/** Внутренние пропсы GalleryItem — включают index, инжектируемый Gallery */\nexport interface GalleryItemInternalProps extends GalleryItemProps {\n index: number;\n}\n\nconst SLIDE_GAP = 24;\n\nexport const GalleryItemBody: FC<GalleryItemInternalProps> = ({ index = 0, src, description }) => {\n const globalContext = useMediaViewerContext();\n const [setContentSize, controller] = useGalleryItemController(globalContext, src, index, description);\n controller.index.set(index);\n\n const bindPinchToZoom = usePinchToZoom(controller, globalContext.viewPortDimensions);\n const bindPan = usePan(controller, globalContext.viewPortDimensions);\n const bindDoubleTapScale = useDoubleTapScale(controller);\n const bindWheelToZoom = useWheelToZoom(controller, globalContext.viewPortDimensions);\n\n const [isVisible, setIsVisible] = useState(() => controller.contentSize.get() !== null);\n const [loadingFailed, setLoadingFailed] = useState(false);\n\n const loadErrTrl = useTranslation('MediaViewer', 'itemLoadErrorTitle');\n const loadErrDescTrl = useTranslation('MediaViewer', 'itemLoadErrorDescription');\n\n useMotionValueEvent(controller.contentSize, 'change', () => {\n setIsVisible(controller.contentSize.get() !== null);\n });\n\n useEffect(() => {\n const meta = globalContext.imagesLoader.getUrlMeta(src);\n if (meta) {\n if (meta.status === 'loaded' && meta.width && meta.height) {\n setContentSize({ width: meta.width, height: meta.height });\n return void 0;\n }\n if (meta.status === 'error') {\n setLoadingFailed(true);\n return void 0;\n }\n }\n\n setIsVisible(false);\n setLoadingFailed(false);\n\n return globalContext.imagesLoader.waitingForUrl(src, ({ status, width, height }) => {\n if (status === 'error') {\n setLoadingFailed(true);\n return;\n }\n\n width && height && setContentSize({ width, height });\n });\n }, [setContentSize, globalContext, src]);\n\n const translateX = useTransform(globalContext.currentSlideIndex, (value) => {\n const progress = clamp(index - value, -1, 1);\n return `calc(${lerp(0, 100, progress)}% + ${lerp(0, SLIDE_GAP, progress)}px)`;\n });\n\n const x = useTransform(controller.offsetX, (value) => `calc(-50% + ${value}px)`);\n const y = useTransform(controller.offsetY, (value) => `calc(-50% + ${value}px)`);\n const rotate = useMotionValue(0);\n useMotionValueEvent(controller.rotation, 'change', (value) => {\n const targetRotation = value * 90;\n rotate.stop();\n if (isFullyInvisible(controller, globalContext)) {\n rotate.set(targetRotation);\n return;\n }\n animate(rotate, targetRotation, { duration: tokenSemanticAnimationTimeMDuration / 1000, ease: EASE_BASE });\n animate(controller.offsetX, 0, { duration: tokenSemanticAnimationTimeMDuration / 1000, ease: EASE_BASE });\n animate(controller.offsetY, 0, { duration: tokenSemanticAnimationTimeMDuration / 1000, ease: EASE_BASE });\n });\n\n return (\n <GalleryItemContext.Provider value={setContentSize}>\n <motion.div\n className={styles.galleryItem}\n style={{ x: translateX }}\n {...bindPinchToZoom}\n {...(bindPan() as HTMLMotionProps<'div'>)}\n {...bindDoubleTapScale}\n {...bindWheelToZoom}\n >\n {!!loadingFailed && (\n <div className={styles.galleryItemErrorContainer}>\n <Text typography=\"title-5-semibold\" style=\"constant\" Element=\"span\">\n {loadErrTrl}\n </Text>\n <Text typography=\"paragraph-2-regular\" style=\"constant-secondary\" Element=\"span\">\n {loadErrDescTrl}\n </Text>\n </div>\n )}\n {!isVisible && !loadingFailed && (\n <div className={styles.galleryItemLoader}>\n <Loader size={48} color=\"constant-secondary\" />\n </div>\n )}\n {!!isVisible && (\n <motion.div\n className={styles.galleryItemTransformContainer}\n style={{\n scale: controller.scale,\n rotate,\n x,\n y,\n }}\n draggable={false}\n >\n <img src={src} alt={description || ''} draggable={false} />\n </motion.div>\n )}\n </motion.div>\n </GalleryItemContext.Provider>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAS,GAAG,EAAE,CAAC;AAEd,MAAM,eAAe,GAAiC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,KAAI;AAC7F,IAAA,MAAM,aAAa,GAAG,qBAAqB,EAAE,CAAC;AAC9C,IAAA,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG,wBAAwB,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AACtG,IAAA,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAE5B,MAAM,eAAe,GAAG,cAAc,CAAC,UAAU,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACrF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACrE,IAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,cAAc,CAAC,UAAU,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAErF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IACxF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,UAAU,GAAG,cAAc,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,cAAc,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;IAEjF,mBAAmB,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,EAA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,EAEhB,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAA,CAAI,GAClD,CAChB,CAAA,EAAA,CACQ,EACa,CAAA,EAChC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"GalleryItemBody.js","sources":["src/internal/GalleryItemBody.tsx"],"sourcesContent":["import { type FC, useEffect, useState } from 'react';\nimport { motion, useMotionValue, useTransform, animate, useMotionValueEvent, HTMLMotionProps } from 'motion/react';\n\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport CoreTokens from '@hh.ru/magritte-design-tokens/core-tokens';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { EASE_BASE } from '@hh.ru/magritte-ui-media-viewer/internal/animations';\nimport { useMediaViewerContext, GalleryItemContext } from '@hh.ru/magritte-ui-media-viewer/internal/context';\nimport { useDoubleTapScale } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useDoubleTapScale';\nimport {\n useGalleryItemController,\n isFullyInvisible,\n} from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useGalleryItemController';\nimport { usePan } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/usePan';\nimport { usePinchToZoom } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/usePinchToZoom';\nimport { useWheelToZoom } from '@hh.ru/magritte-ui-media-viewer/internal/hooks/useWheelToZoom';\nimport { lerp, clamp } from '@hh.ru/magritte-ui-media-viewer/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from '../public/media-viewer.less';\n\n/** Внешние пропсы GalleryItem — то, что передаёт пользователь */\nexport interface GalleryItemProps {\n /** Описание элемента */\n description?: string;\n /** URL изображения */\n src: string;\n /** URL превью изображения */\n previewSrc?: string;\n}\n\n/** Внутренние пропсы GalleryItem — включают index, инжектируемый Gallery */\nexport interface GalleryItemInternalProps extends GalleryItemProps {\n index: number;\n}\n\nconst SLIDE_GAP = 24;\n\nexport const GalleryItemBody: FC<GalleryItemInternalProps> = ({ index = 0, src, description }) => {\n const globalContext = useMediaViewerContext();\n const [setContentSize, controller] = useGalleryItemController(globalContext, src, index, description);\n controller.index.set(index);\n\n const bindPinchToZoom = usePinchToZoom(controller, globalContext.viewPortDimensions);\n const bindPan = usePan(controller, globalContext.viewPortDimensions);\n const bindDoubleTapScale = useDoubleTapScale(controller);\n const bindWheelToZoom = useWheelToZoom(controller, globalContext.viewPortDimensions);\n\n const [isVisible, setIsVisible] = useState(() => controller.contentSize.get() !== null);\n const [loadingFailed, setLoadingFailed] = useState(false);\n\n const loadErrTrl = useTranslation('MediaViewer', 'itemLoadErrorTitle');\n const loadErrDescTrl = useTranslation('MediaViewer', 'itemLoadErrorDescription');\n\n useMotionValueEvent(controller.contentSize, 'change', () => {\n setIsVisible(controller.contentSize.get() !== null);\n });\n\n useEffect(() => {\n const meta = globalContext.imagesLoader.getUrlMeta(src);\n if (meta) {\n if (meta.status === 'loaded' && meta.width && meta.height) {\n setContentSize({ width: meta.width, height: meta.height });\n return void 0;\n }\n if (meta.status === 'error') {\n setLoadingFailed(true);\n return void 0;\n }\n }\n\n setIsVisible(false);\n setLoadingFailed(false);\n\n return globalContext.imagesLoader.waitingForUrl(src, ({ status, width, height }) => {\n if (status === 'error') {\n setLoadingFailed(true);\n return;\n }\n\n width && height && setContentSize({ width, height });\n });\n }, [setContentSize, globalContext, src]);\n\n const translateX = useTransform(globalContext.currentSlideIndex, (value) => {\n const progress = clamp(index - value, -1, 1);\n return `calc(${lerp(0, 100, progress)}% + ${lerp(0, SLIDE_GAP, progress)}px)`;\n });\n\n const x = useTransform(controller.offsetX, (value) => `calc(-50% + ${value}px)`);\n const y = useTransform(controller.offsetY, (value) => `calc(-50% + ${value}px)`);\n const rotate = useMotionValue(0);\n useMotionValueEvent(controller.rotation, 'change', (value) => {\n const targetRotation = value * 90;\n rotate.stop();\n if (isFullyInvisible(controller, globalContext)) {\n rotate.set(targetRotation);\n return;\n }\n animate(rotate, targetRotation, {\n duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,\n ease: EASE_BASE,\n });\n animate(controller.offsetX, 0, {\n duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,\n ease: EASE_BASE,\n });\n animate(controller.offsetY, 0, {\n duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,\n ease: EASE_BASE,\n });\n });\n\n return (\n <GalleryItemContext.Provider value={setContentSize}>\n <motion.div\n className={styles.galleryItem}\n style={{ x: translateX }}\n {...bindPinchToZoom}\n {...(bindPan() as HTMLMotionProps<'div'>)}\n {...bindDoubleTapScale}\n {...bindWheelToZoom}\n >\n {!!loadingFailed && (\n <div className={styles.galleryItemErrorContainer}>\n <Text typography=\"title-5-semibold\" style=\"constant\" Element=\"span\">\n {loadErrTrl}\n </Text>\n <Text typography=\"paragraph-2-regular\" style=\"constant-secondary\" Element=\"span\">\n {loadErrDescTrl}\n </Text>\n </div>\n )}\n {!isVisible && !loadingFailed && (\n <div className={styles.galleryItemLoader}>\n <Loader size={48} color=\"constant-secondary\" />\n </div>\n )}\n {!!isVisible && (\n <motion.div\n className={styles.galleryItemTransformContainer}\n style={{\n scale: controller.scale,\n rotate,\n x,\n y,\n }}\n draggable={false}\n >\n <img src={src} alt={description || ''} draggable={false} />\n </motion.div>\n )}\n </motion.div>\n </GalleryItemContext.Provider>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAS,GAAG,EAAE,CAAC;AAEd,MAAM,eAAe,GAAiC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,KAAI;AAC7F,IAAA,MAAM,aAAa,GAAG,qBAAqB,EAAE,CAAC;AAC9C,IAAA,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG,wBAAwB,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,C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breakpoint';
|
|
9
9
|
import './utils.js';
|
|
10
|
-
import '@hh.ru/magritte-design-tokens/
|
|
10
|
+
import '@hh.ru/magritte-design-tokens/core-tokens';
|
|
11
11
|
import './animations.js';
|
|
12
|
-
import '../media-viewer-
|
|
12
|
+
import '../media-viewer-CY3dE_bP.js';
|
|
13
13
|
import './ImagesLoader.js';
|
|
14
14
|
|
|
15
15
|
const PreviewItem = ({ index, ...props }) => {
|
|
@@ -5,9 +5,9 @@ import { useMotionValue, useTransform, useMotionValueEvent, animate, motion } fr
|
|
|
5
5
|
import { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
|
|
6
6
|
import { useMediaViewerContext, usePreviewContext } from './context.js';
|
|
7
7
|
import { useDetectDiscreteChange, clamp } from './utils.js';
|
|
8
|
-
import { s as styles } from '../media-viewer-
|
|
8
|
+
import { s as styles } from '../media-viewer-CY3dE_bP.js';
|
|
9
9
|
import './ImagesLoader.js';
|
|
10
|
-
import '@hh.ru/magritte-design-tokens/
|
|
10
|
+
import '@hh.ru/magritte-design-tokens/core-tokens';
|
|
11
11
|
import './animations.js';
|
|
12
12
|
|
|
13
13
|
const calcSizeFactor = (activeItemIndex, itemIndex, dragFactor) => {
|
|
@@ -3,13 +3,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { animate } from 'motion/react';
|
|
5
5
|
import { useTranslation } from '@hh.ru/magritte-common-use-translation';
|
|
6
|
-
import
|
|
6
|
+
import CoreTokens from '@hh.ru/magritte-design-tokens/core-tokens';
|
|
7
7
|
import { MagnifierMinusOutlinedSize24, MagnifierPlusOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
8
8
|
import { EASE_BASE } from './animations.js';
|
|
9
9
|
import { useMediaViewerContext } from './context.js';
|
|
10
10
|
import { useInitOnce, findNextValue, getDimensionsAfterRotation, clampOffset } from './utils.js';
|
|
11
11
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
12
|
-
import { s as styles } from '../media-viewer-
|
|
12
|
+
import { s as styles } from '../media-viewer-CY3dE_bP.js';
|
|
13
13
|
import './ImagesLoader.js';
|
|
14
14
|
|
|
15
15
|
const getCurrentControllerLimits = (globalContext) => {
|
|
@@ -52,13 +52,16 @@ const PreviewZoomControl = () => {
|
|
|
52
52
|
const sizeAfterRotation = getDimensionsAfterRotation(contentSize, rotation);
|
|
53
53
|
const clampedOffsetX = clampOffset(controller.offsetX.get(), sizeAfterRotation.width * nextZoom, viewPortDimensions.width);
|
|
54
54
|
const clampedOffsetY = clampOffset(controller.offsetY.get(), sizeAfterRotation.height * nextZoom, viewPortDimensions.height);
|
|
55
|
-
animate(controller.scale, nextZoom, {
|
|
55
|
+
animate(controller.scale, nextZoom, {
|
|
56
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
57
|
+
ease: EASE_BASE,
|
|
58
|
+
});
|
|
56
59
|
animate(controller.offsetX, clampedOffsetX, {
|
|
57
|
-
duration:
|
|
60
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
58
61
|
ease: EASE_BASE,
|
|
59
62
|
});
|
|
60
63
|
animate(controller.offsetY, clampedOffsetY, {
|
|
61
|
-
duration:
|
|
64
|
+
duration: CoreTokens['magritte-semantic-animation-time-m'].duration / 1000,
|
|
62
65
|
ease: EASE_BASE,
|
|
63
66
|
});
|
|
64
67
|
};
|