react-zoom-pan-pinch 4.0.0 → 4.0.2
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/package.json +4 -3
- package/src/stories/assets/big-image.jpeg +0 -0
- package/src/stories/assets/map.jpg +0 -0
- package/src/stories/assets/medium-image.jpg +0 -0
- package/src/stories/assets/pin.svg +0 -1
- package/src/stories/assets/small-image.jpg +0 -0
- package/src/stories/assets/svg-example.svg +0 -14
- package/src/stories/docs/DocTable.tsx +0 -59
- package/src/stories/docs/HandlerCards.tsx +0 -102
- package/src/stories/docs/Introduction.stories.mdx +0 -135
- package/src/stories/docs/PropTable.tsx +0 -116
- package/src/stories/docs/docs.module.css +0 -370
- package/src/stories/docs/handlers.stories.mdx +0 -7
- package/src/stories/docs/handlers.tsx +0 -111
- package/src/stories/docs/props.stories.mdx +0 -11
- package/src/stories/docs/props.tsx +0 -571
- package/src/stories/examples/axis-lock/axis-lock.stories.mdx +0 -35
- package/src/stories/examples/axis-lock/example.tsx +0 -114
- package/src/stories/examples/bounds/bounds.data.tsx +0 -191
- package/src/stories/examples/bounds/bounds.stories.mdx +0 -99
- package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +0 -206
- package/src/stories/examples/cinema/cinema-data.tsx +0 -578
- package/src/stories/examples/cinema/cinema.stories.mdx +0 -30
- package/src/stories/examples/cinema/example.tsx +0 -378
- package/src/stories/examples/cinema/image.png +0 -0
- package/src/stories/examples/content/content.stories.mdx +0 -172
- package/src/stories/examples/content/mixed-content.data.tsx +0 -624
- package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -34
- package/src/stories/examples/content-rerendering/example.tsx +0 -631
- package/src/stories/examples/controls/controls.stories.mdx +0 -120
- package/src/stories/examples/image/example.tsx +0 -149
- package/src/stories/examples/image/image.stories.mdx +0 -46
- package/src/stories/examples/image-annotations/example.tsx +0 -1442
- package/src/stories/examples/image-annotations/image-annotations.stories.mdx +0 -39
- package/src/stories/examples/image-responsive/example.tsx +0 -152
- package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -51
- package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -107
- package/src/stories/examples/initial-transform/example.tsx +0 -233
- package/src/stories/examples/initial-transform/initial-transform.stories.mdx +0 -37
- package/src/stories/examples/keep-scale/example.tsx +0 -882
- package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -30
- package/src/stories/examples/keep-scale/map.stories.mdx +0 -28
- package/src/stories/examples/medical-viewer/chest-xray.tsx +0 -246
- package/src/stories/examples/medical-viewer/example.tsx +0 -690
- package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +0 -49
- package/src/stories/examples/mini-map/example.tsx +0 -122
- package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -26
- package/src/stories/examples/miro/example.tsx +0 -1573
- package/src/stories/examples/miro/miro.stories.mdx +0 -31
- package/src/stories/examples/padding/example.tsx +0 -147
- package/src/stories/examples/padding/padding.stories.mdx +0 -35
- package/src/stories/examples/product-card/example.tsx +0 -594
- package/src/stories/examples/product-card/product-card.stories.mdx +0 -29
- package/src/stories/examples/stadium/example.tsx +0 -1040
- package/src/stories/examples/stadium/stadium-data.ts +0 -224
- package/src/stories/examples/stadium/stadium.stories.mdx +0 -32
- package/src/stories/examples/stress/example.tsx +0 -59
- package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
- package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
- package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -95
- package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
- package/src/stories/examples/text-selection/example.tsx +0 -221
- package/src/stories/examples/text-selection/text-selection.stories.mdx +0 -31
- package/src/stories/examples/velocity/example.tsx +0 -908
- package/src/stories/examples/velocity/velocity.stories.mdx +0 -35
- package/src/stories/examples/virtualize/example.tsx +0 -239
- package/src/stories/examples/virtualize/virtualize.stories.mdx +0 -84
- package/src/stories/examples/zoom-to-element/example.tsx +0 -219
- package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -31
- package/src/stories/hooks/use-controls.stories.mdx +0 -86
- package/src/stories/hooks/use-transform-component.stories.mdx +0 -108
- package/src/stories/hooks/use-transform-context.stories.mdx +0 -92
- package/src/stories/hooks/use-transform-effect.stories.mdx +0 -114
- package/src/stories/hooks/use-transform-init.stories.mdx +0 -105
- package/src/stories/types/args.types.ts +0 -192
- package/src/stories/utils/args.utils.ts +0 -35
- package/src/stories/utils/bounds-overlay.tsx +0 -168
- package/src/stories/utils/code.utils.tsx +0 -22
- package/src/stories/utils/controls.utils.tsx +0 -347
- package/src/stories/utils/index.ts +0 -5
- package/src/stories/utils/styles.module.css +0 -223
- package/src/stories/utils/viewer.styles.ts +0 -34
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { TransformComponent, TransformWrapper } from "components";
|
|
4
|
-
import { Controls, normalizeArgs } from "../../utils";
|
|
5
|
-
import { viewerFrame } from "../../utils/viewer.styles";
|
|
6
|
-
|
|
7
|
-
const BLOCKS = [
|
|
8
|
-
{ interval: 1000, label: "Block A", color: "#667eea", desc: "1 s cycle" },
|
|
9
|
-
{ interval: 3000, label: "Block B", color: "#f093fb", desc: "3 s cycle" },
|
|
10
|
-
{ interval: 12000, label: "Block C", color: "#43e97b", desc: "12 s cycle" },
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
function StatusDot({ active, color }: { active: boolean; color: string }) {
|
|
14
|
-
return (
|
|
15
|
-
<span
|
|
16
|
-
style={{
|
|
17
|
-
display: "inline-block",
|
|
18
|
-
width: 6,
|
|
19
|
-
height: 6,
|
|
20
|
-
borderRadius: "50%",
|
|
21
|
-
background: active ? color : "rgba(255,255,255,0.15)",
|
|
22
|
-
boxShadow: active ? `0 0 8px ${color}88` : "none",
|
|
23
|
-
transition: "all 0.3s ease",
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Block A: compact list ↔ wide 3-column dashboard with different card heights */
|
|
30
|
-
function BlockA({ expanded }: { expanded: boolean }) {
|
|
31
|
-
if (!expanded) {
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
style={{
|
|
35
|
-
padding: "14px 18px",
|
|
36
|
-
borderRadius: 12,
|
|
37
|
-
background: "rgba(255,255,255,0.03)",
|
|
38
|
-
borderLeft: `3px solid ${BLOCKS[0].color}`,
|
|
39
|
-
transition: "min-height 0.35s ease",
|
|
40
|
-
minHeight: 72,
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<span
|
|
44
|
-
style={{
|
|
45
|
-
fontSize: 11,
|
|
46
|
-
fontWeight: 700,
|
|
47
|
-
color: BLOCKS[0].color,
|
|
48
|
-
letterSpacing: "0.08em",
|
|
49
|
-
textTransform: "uppercase",
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{BLOCKS[0].label} — compact
|
|
53
|
-
</span>
|
|
54
|
-
<p
|
|
55
|
-
style={{
|
|
56
|
-
margin: "8px 0 0",
|
|
57
|
-
fontSize: 12,
|
|
58
|
-
color: "rgba(255,255,255,0.5)",
|
|
59
|
-
lineHeight: 1.5,
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
Single column. Low vertical footprint.
|
|
63
|
-
</p>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div
|
|
70
|
-
style={{
|
|
71
|
-
padding: 16,
|
|
72
|
-
borderRadius: 12,
|
|
73
|
-
background: "rgba(102, 126, 234, 0.06)",
|
|
74
|
-
border: `1px solid ${BLOCKS[0].color}33`,
|
|
75
|
-
transition: "min-height 0.35s ease",
|
|
76
|
-
minHeight: 200,
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<div
|
|
80
|
-
style={{
|
|
81
|
-
fontSize: 11,
|
|
82
|
-
fontWeight: 700,
|
|
83
|
-
color: BLOCKS[0].color,
|
|
84
|
-
letterSpacing: "0.08em",
|
|
85
|
-
textTransform: "uppercase",
|
|
86
|
-
marginBottom: 12,
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
89
|
-
{BLOCKS[0].label} — grid layout
|
|
90
|
-
</div>
|
|
91
|
-
<div
|
|
92
|
-
style={{
|
|
93
|
-
display: "grid",
|
|
94
|
-
gridTemplateColumns: "repeat(3, 1fr)",
|
|
95
|
-
gap: 10,
|
|
96
|
-
alignItems: "start",
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
<div
|
|
100
|
-
style={{
|
|
101
|
-
padding: 12,
|
|
102
|
-
borderRadius: 8,
|
|
103
|
-
background: "rgba(0,0,0,0.25)",
|
|
104
|
-
minHeight: 100,
|
|
105
|
-
border: "1px solid rgba(255,255,255,0.06)",
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
<div
|
|
109
|
-
style={{
|
|
110
|
-
height: 40,
|
|
111
|
-
borderRadius: 6,
|
|
112
|
-
background: `linear-gradient(90deg, ${BLOCKS[0].color}44, transparent)`,
|
|
113
|
-
marginBottom: 8,
|
|
114
|
-
}}
|
|
115
|
-
/>
|
|
116
|
-
<div style={{ fontSize: 10, color: "rgba(255,255,255,0.45)" }}>
|
|
117
|
-
Tall card
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
<div
|
|
121
|
-
style={{
|
|
122
|
-
padding: 12,
|
|
123
|
-
borderRadius: 8,
|
|
124
|
-
background: "rgba(0,0,0,0.25)",
|
|
125
|
-
minHeight: 52,
|
|
126
|
-
border: "1px solid rgba(255,255,255,0.06)",
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<div style={{ fontSize: 10, color: "rgba(255,255,255,0.45)" }}>
|
|
130
|
-
Short
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
<div
|
|
134
|
-
style={{
|
|
135
|
-
padding: 12,
|
|
136
|
-
borderRadius: 8,
|
|
137
|
-
background: "rgba(0,0,0,0.25)",
|
|
138
|
-
minHeight: 140,
|
|
139
|
-
border: "1px solid rgba(255,255,255,0.06)",
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
<div
|
|
143
|
-
style={{
|
|
144
|
-
display: "flex",
|
|
145
|
-
flexDirection: "column",
|
|
146
|
-
gap: 6,
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
{[1, 2, 3].map((n) => (
|
|
150
|
-
<div
|
|
151
|
-
key={n}
|
|
152
|
-
style={{
|
|
153
|
-
height: 8,
|
|
154
|
-
borderRadius: 4,
|
|
155
|
-
background: "rgba(255,255,255,0.08)",
|
|
156
|
-
width: `${60 + n * 12}%`,
|
|
157
|
-
}}
|
|
158
|
-
/>
|
|
159
|
-
))}
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/** Block B: sidebar + main ↔ stacked hero + stat strip + two columns */
|
|
168
|
-
function BlockB({ expanded }: { expanded: boolean }) {
|
|
169
|
-
if (!expanded) {
|
|
170
|
-
return (
|
|
171
|
-
<div
|
|
172
|
-
style={{
|
|
173
|
-
display: "flex",
|
|
174
|
-
gap: 14,
|
|
175
|
-
padding: 16,
|
|
176
|
-
borderRadius: 12,
|
|
177
|
-
background: "rgba(255,255,255,0.03)",
|
|
178
|
-
borderLeft: `3px solid ${BLOCKS[1].color}`,
|
|
179
|
-
minHeight: 120,
|
|
180
|
-
transition: "all 0.35s ease",
|
|
181
|
-
}}
|
|
182
|
-
>
|
|
183
|
-
<aside
|
|
184
|
-
style={{
|
|
185
|
-
width: 88,
|
|
186
|
-
flexShrink: 0,
|
|
187
|
-
borderRadius: 8,
|
|
188
|
-
background: "rgba(240, 147, 251, 0.12)",
|
|
189
|
-
border: "1px solid rgba(240, 147, 251, 0.25)",
|
|
190
|
-
}}
|
|
191
|
-
/>
|
|
192
|
-
<div style={{ flex: 1, minWidth: 0 }}>
|
|
193
|
-
<span
|
|
194
|
-
style={{
|
|
195
|
-
fontSize: 11,
|
|
196
|
-
fontWeight: 700,
|
|
197
|
-
color: BLOCKS[1].color,
|
|
198
|
-
letterSpacing: "0.08em",
|
|
199
|
-
textTransform: "uppercase",
|
|
200
|
-
}}
|
|
201
|
-
>
|
|
202
|
-
{BLOCKS[1].label} — sidebar
|
|
203
|
-
</span>
|
|
204
|
-
<p
|
|
205
|
-
style={{
|
|
206
|
-
margin: "8px 0 0",
|
|
207
|
-
fontSize: 12,
|
|
208
|
-
color: "rgba(255,255,255,0.5)",
|
|
209
|
-
lineHeight: 1.55,
|
|
210
|
-
}}
|
|
211
|
-
>
|
|
212
|
-
Horizontal split: narrow rail + fluid main. Pan/zoom should stay put
|
|
213
|
-
when this flips to a tall stacked layout.
|
|
214
|
-
</p>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<div
|
|
222
|
-
style={{
|
|
223
|
-
padding: 16,
|
|
224
|
-
borderRadius: 12,
|
|
225
|
-
background: "rgba(240, 147, 251, 0.07)",
|
|
226
|
-
border: `1px solid ${BLOCKS[1].color}33`,
|
|
227
|
-
minHeight: 320,
|
|
228
|
-
transition: "all 0.35s ease",
|
|
229
|
-
}}
|
|
230
|
-
>
|
|
231
|
-
<div
|
|
232
|
-
style={{
|
|
233
|
-
height: 72,
|
|
234
|
-
borderRadius: 10,
|
|
235
|
-
marginBottom: 12,
|
|
236
|
-
background: `linear-gradient(135deg, ${BLOCKS[1].color}55, rgba(15,15,26,0.9))`,
|
|
237
|
-
display: "flex",
|
|
238
|
-
alignItems: "center",
|
|
239
|
-
padding: "0 16px",
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
<span
|
|
243
|
-
style={{
|
|
244
|
-
fontSize: 14,
|
|
245
|
-
fontWeight: 800,
|
|
246
|
-
color: "#fff",
|
|
247
|
-
letterSpacing: "-0.02em",
|
|
248
|
-
}}
|
|
249
|
-
>
|
|
250
|
-
{BLOCKS[1].label} — hero band
|
|
251
|
-
</span>
|
|
252
|
-
</div>
|
|
253
|
-
<div
|
|
254
|
-
style={{
|
|
255
|
-
display: "flex",
|
|
256
|
-
gap: 8,
|
|
257
|
-
marginBottom: 14,
|
|
258
|
-
}}
|
|
259
|
-
>
|
|
260
|
-
{["24%", "1.2k", "98"].map((v, i) => (
|
|
261
|
-
<div
|
|
262
|
-
key={v}
|
|
263
|
-
style={{
|
|
264
|
-
flex: 1,
|
|
265
|
-
padding: "10px 8px",
|
|
266
|
-
borderRadius: 8,
|
|
267
|
-
background: "rgba(0,0,0,0.28)",
|
|
268
|
-
textAlign: "center",
|
|
269
|
-
border: "1px solid rgba(255,255,255,0.06)",
|
|
270
|
-
}}
|
|
271
|
-
>
|
|
272
|
-
<div
|
|
273
|
-
style={{
|
|
274
|
-
fontSize: 16,
|
|
275
|
-
fontWeight: 800,
|
|
276
|
-
color: BLOCKS[1].color,
|
|
277
|
-
}}
|
|
278
|
-
>
|
|
279
|
-
{v}
|
|
280
|
-
</div>
|
|
281
|
-
<div
|
|
282
|
-
style={{
|
|
283
|
-
fontSize: 9,
|
|
284
|
-
color: "rgba(255,255,255,0.35)",
|
|
285
|
-
textTransform: "uppercase",
|
|
286
|
-
letterSpacing: "0.06em",
|
|
287
|
-
}}
|
|
288
|
-
>
|
|
289
|
-
{["Load", "Views", "Score"][i]}
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
))}
|
|
293
|
-
</div>
|
|
294
|
-
<div
|
|
295
|
-
style={{
|
|
296
|
-
display: "grid",
|
|
297
|
-
gridTemplateColumns: "1fr 1fr",
|
|
298
|
-
gap: 10,
|
|
299
|
-
}}
|
|
300
|
-
>
|
|
301
|
-
<div
|
|
302
|
-
style={{
|
|
303
|
-
padding: 12,
|
|
304
|
-
borderRadius: 8,
|
|
305
|
-
background: "rgba(0,0,0,0.22)",
|
|
306
|
-
minHeight: 110,
|
|
307
|
-
border: "1px solid rgba(255,255,255,0.05)",
|
|
308
|
-
}}
|
|
309
|
-
>
|
|
310
|
-
<div
|
|
311
|
-
style={{
|
|
312
|
-
fontSize: 10,
|
|
313
|
-
color: "rgba(255,255,255,0.35)",
|
|
314
|
-
marginBottom: 8,
|
|
315
|
-
}}
|
|
316
|
-
>
|
|
317
|
-
Left column
|
|
318
|
-
</div>
|
|
319
|
-
<div
|
|
320
|
-
style={{
|
|
321
|
-
height: 64,
|
|
322
|
-
borderRadius: 6,
|
|
323
|
-
background:
|
|
324
|
-
"repeating-linear-gradient(-45deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04) 4px, transparent 4px, transparent 8px)",
|
|
325
|
-
}}
|
|
326
|
-
/>
|
|
327
|
-
</div>
|
|
328
|
-
<div
|
|
329
|
-
style={{
|
|
330
|
-
padding: 12,
|
|
331
|
-
borderRadius: 8,
|
|
332
|
-
background: "rgba(0,0,0,0.22)",
|
|
333
|
-
minHeight: 110,
|
|
334
|
-
border: "1px solid rgba(255,255,255,0.05)",
|
|
335
|
-
}}
|
|
336
|
-
>
|
|
337
|
-
<div
|
|
338
|
-
style={{
|
|
339
|
-
fontSize: 10,
|
|
340
|
-
color: "rgba(255,255,255,0.35)",
|
|
341
|
-
marginBottom: 8,
|
|
342
|
-
}}
|
|
343
|
-
>
|
|
344
|
-
Right column
|
|
345
|
-
</div>
|
|
346
|
-
{[40, 55, 35, 70].map((w) => (
|
|
347
|
-
<div
|
|
348
|
-
key={w}
|
|
349
|
-
style={{
|
|
350
|
-
height: 10,
|
|
351
|
-
marginBottom: 6,
|
|
352
|
-
borderRadius: 4,
|
|
353
|
-
background: "rgba(255,255,255,0.07)",
|
|
354
|
-
width: `${w}%`,
|
|
355
|
-
}}
|
|
356
|
-
/>
|
|
357
|
-
))}
|
|
358
|
-
</div>
|
|
359
|
-
</div>
|
|
360
|
-
</div>
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/** Block C: minimal ↔ long scrollable-style stack (gallery + list + footer) */
|
|
365
|
-
function BlockC({ expanded }: { expanded: boolean }) {
|
|
366
|
-
if (!expanded) {
|
|
367
|
-
return (
|
|
368
|
-
<div
|
|
369
|
-
style={{
|
|
370
|
-
padding: "12px 16px",
|
|
371
|
-
borderRadius: 12,
|
|
372
|
-
background: "rgba(255,255,255,0.03)",
|
|
373
|
-
borderLeft: `3px solid ${BLOCKS[2].color}`,
|
|
374
|
-
minHeight: 56,
|
|
375
|
-
transition: "all 0.35s ease",
|
|
376
|
-
}}
|
|
377
|
-
>
|
|
378
|
-
<span
|
|
379
|
-
style={{
|
|
380
|
-
fontSize: 11,
|
|
381
|
-
fontWeight: 700,
|
|
382
|
-
color: BLOCKS[2].color,
|
|
383
|
-
letterSpacing: "0.08em",
|
|
384
|
-
textTransform: "uppercase",
|
|
385
|
-
}}
|
|
386
|
-
>
|
|
387
|
-
{BLOCKS[2].label} — minimal
|
|
388
|
-
</span>
|
|
389
|
-
</div>
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
return (
|
|
394
|
-
<div
|
|
395
|
-
style={{
|
|
396
|
-
padding: 16,
|
|
397
|
-
borderRadius: 12,
|
|
398
|
-
background: "rgba(67, 233, 123, 0.06)",
|
|
399
|
-
border: `1px solid ${BLOCKS[2].color}33`,
|
|
400
|
-
minHeight: 380,
|
|
401
|
-
transition: "all 0.35s ease",
|
|
402
|
-
}}
|
|
403
|
-
>
|
|
404
|
-
<div
|
|
405
|
-
style={{
|
|
406
|
-
fontSize: 11,
|
|
407
|
-
fontWeight: 700,
|
|
408
|
-
color: BLOCKS[2].color,
|
|
409
|
-
letterSpacing: "0.08em",
|
|
410
|
-
textTransform: "uppercase",
|
|
411
|
-
marginBottom: 12,
|
|
412
|
-
}}
|
|
413
|
-
>
|
|
414
|
-
{BLOCKS[2].label} — expanded stack
|
|
415
|
-
</div>
|
|
416
|
-
<div
|
|
417
|
-
style={{
|
|
418
|
-
display: "flex",
|
|
419
|
-
gap: 8,
|
|
420
|
-
marginBottom: 14,
|
|
421
|
-
overflow: "hidden",
|
|
422
|
-
}}
|
|
423
|
-
>
|
|
424
|
-
{[0, 1, 2, 3, 4].map((i) => (
|
|
425
|
-
<div
|
|
426
|
-
key={i}
|
|
427
|
-
style={{
|
|
428
|
-
width: 56,
|
|
429
|
-
height: 56,
|
|
430
|
-
flexShrink: 0,
|
|
431
|
-
borderRadius: 8,
|
|
432
|
-
background: `linear-gradient(135deg, ${BLOCKS[2].color}${i % 2 ? "66" : "33"}, rgba(0,0,0,0.4))`,
|
|
433
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
434
|
-
}}
|
|
435
|
-
/>
|
|
436
|
-
))}
|
|
437
|
-
</div>
|
|
438
|
-
<div
|
|
439
|
-
style={{
|
|
440
|
-
display: "flex",
|
|
441
|
-
flexDirection: "column",
|
|
442
|
-
gap: 8,
|
|
443
|
-
marginBottom: 14,
|
|
444
|
-
}}
|
|
445
|
-
>
|
|
446
|
-
{["Item alpha", "Item beta", "Item gamma", "Item delta"].map(
|
|
447
|
-
(label, i) => (
|
|
448
|
-
<div
|
|
449
|
-
key={label}
|
|
450
|
-
style={{
|
|
451
|
-
display: "flex",
|
|
452
|
-
alignItems: "center",
|
|
453
|
-
gap: 10,
|
|
454
|
-
padding: "10px 12px",
|
|
455
|
-
borderRadius: 8,
|
|
456
|
-
background: "rgba(0,0,0,0.22)",
|
|
457
|
-
border: "1px solid rgba(255,255,255,0.05)",
|
|
458
|
-
}}
|
|
459
|
-
>
|
|
460
|
-
<div
|
|
461
|
-
style={{
|
|
462
|
-
width: 28,
|
|
463
|
-
height: 28,
|
|
464
|
-
borderRadius: 6,
|
|
465
|
-
background: `rgba(67, 233, 123, ${0.15 + i * 0.08})`,
|
|
466
|
-
}}
|
|
467
|
-
/>
|
|
468
|
-
<div style={{ flex: 1 }}>
|
|
469
|
-
<div
|
|
470
|
-
style={{
|
|
471
|
-
fontSize: 12,
|
|
472
|
-
fontWeight: 600,
|
|
473
|
-
color: "rgba(255,255,255,0.75)",
|
|
474
|
-
}}
|
|
475
|
-
>
|
|
476
|
-
{label}
|
|
477
|
-
</div>
|
|
478
|
-
<div
|
|
479
|
-
style={{
|
|
480
|
-
fontSize: 10,
|
|
481
|
-
color: "rgba(255,255,255,0.35)",
|
|
482
|
-
marginTop: 2,
|
|
483
|
-
}}
|
|
484
|
-
>
|
|
485
|
-
Extra rows push total content height way up — good stress for
|
|
486
|
-
layout reflow under zoom.
|
|
487
|
-
</div>
|
|
488
|
-
</div>
|
|
489
|
-
</div>
|
|
490
|
-
),
|
|
491
|
-
)}
|
|
492
|
-
</div>
|
|
493
|
-
<div
|
|
494
|
-
style={{
|
|
495
|
-
padding: "12px 14px",
|
|
496
|
-
borderRadius: 8,
|
|
497
|
-
background: "rgba(0,0,0,0.35)",
|
|
498
|
-
borderTop: `2px solid ${BLOCKS[2].color}44`,
|
|
499
|
-
fontSize: 11,
|
|
500
|
-
color: "rgba(255,255,255,0.45)",
|
|
501
|
-
lineHeight: 1.5,
|
|
502
|
-
}}
|
|
503
|
-
>
|
|
504
|
-
Footer strip appears only in expanded mode, adding another vertical
|
|
505
|
-
block. Together, A/B/C expansions reshape the canvas dramatically while
|
|
506
|
-
the transform state should remain stable.
|
|
507
|
-
</div>
|
|
508
|
-
</div>
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
export const Example: React.FC<any> = (args: any) => {
|
|
513
|
-
const [toggles, setToggles] = useState([false, false, false]);
|
|
514
|
-
|
|
515
|
-
useEffect(() => {
|
|
516
|
-
const timers = BLOCKS.map((block, i) =>
|
|
517
|
-
setInterval(() => {
|
|
518
|
-
setToggles((prev) => {
|
|
519
|
-
const next = [...prev];
|
|
520
|
-
next[i] = !next[i];
|
|
521
|
-
return next;
|
|
522
|
-
});
|
|
523
|
-
}, block.interval),
|
|
524
|
-
);
|
|
525
|
-
return () => timers.forEach(clearInterval);
|
|
526
|
-
}, []);
|
|
527
|
-
|
|
528
|
-
const [a, b, c] = toggles;
|
|
529
|
-
|
|
530
|
-
return (
|
|
531
|
-
<div style={{ fontFamily: "system-ui, -apple-system, sans-serif" }}>
|
|
532
|
-
<TransformWrapper {...normalizeArgs(args)} centerOnInit>
|
|
533
|
-
{(utils) => (
|
|
534
|
-
<div style={{ position: "relative" }}>
|
|
535
|
-
<Controls {...utils} position="bottom-left" />
|
|
536
|
-
<TransformComponent
|
|
537
|
-
wrapperStyle={{
|
|
538
|
-
...viewerFrame,
|
|
539
|
-
background:
|
|
540
|
-
"linear-gradient(145deg, #0c1029 0%, #111827 40%, #0a0f1e 100%)",
|
|
541
|
-
width: "500px",
|
|
542
|
-
height: "500px",
|
|
543
|
-
maxWidth: "80vw",
|
|
544
|
-
maxHeight: "75vh",
|
|
545
|
-
}}
|
|
546
|
-
contentStyle={{
|
|
547
|
-
width: "500px",
|
|
548
|
-
minHeight: 500,
|
|
549
|
-
}}
|
|
550
|
-
>
|
|
551
|
-
<div style={{ padding: 24 }}>
|
|
552
|
-
<div
|
|
553
|
-
style={{
|
|
554
|
-
display: "flex",
|
|
555
|
-
alignItems: "center",
|
|
556
|
-
gap: 16,
|
|
557
|
-
marginBottom: 20,
|
|
558
|
-
flexWrap: "wrap",
|
|
559
|
-
}}
|
|
560
|
-
>
|
|
561
|
-
<h2
|
|
562
|
-
style={{
|
|
563
|
-
margin: 0,
|
|
564
|
-
fontSize: 18,
|
|
565
|
-
fontWeight: 700,
|
|
566
|
-
color: "rgba(255,255,255,0.9)",
|
|
567
|
-
}}
|
|
568
|
-
>
|
|
569
|
-
Layout reflow
|
|
570
|
-
</h2>
|
|
571
|
-
<div
|
|
572
|
-
style={{ display: "flex", alignItems: "center", gap: 10 }}
|
|
573
|
-
>
|
|
574
|
-
{BLOCKS.map((block, i) => (
|
|
575
|
-
<div
|
|
576
|
-
key={block.label}
|
|
577
|
-
style={{
|
|
578
|
-
display: "flex",
|
|
579
|
-
alignItems: "center",
|
|
580
|
-
gap: 5,
|
|
581
|
-
}}
|
|
582
|
-
>
|
|
583
|
-
<StatusDot active={toggles[i]} color={block.color} />
|
|
584
|
-
<span
|
|
585
|
-
style={{
|
|
586
|
-
fontSize: 10,
|
|
587
|
-
color: "rgba(255,255,255,0.4)",
|
|
588
|
-
fontWeight: 600,
|
|
589
|
-
letterSpacing: "0.04em",
|
|
590
|
-
}}
|
|
591
|
-
>
|
|
592
|
-
{block.desc}
|
|
593
|
-
</span>
|
|
594
|
-
</div>
|
|
595
|
-
))}
|
|
596
|
-
</div>
|
|
597
|
-
</div>
|
|
598
|
-
|
|
599
|
-
<p
|
|
600
|
-
style={{
|
|
601
|
-
margin: "0 0 20px",
|
|
602
|
-
fontSize: 12,
|
|
603
|
-
lineHeight: 1.55,
|
|
604
|
-
color: "rgba(255,255,255,0.45)",
|
|
605
|
-
}}
|
|
606
|
-
>
|
|
607
|
-
Each block alternates between a <strong>compact</strong> and a{" "}
|
|
608
|
-
<strong>large</strong> layout: different grids, columns,
|
|
609
|
-
heights, and extra sections. This is a stronger test than text
|
|
610
|
-
swaps alone — pan and zoom should stay stable.
|
|
611
|
-
</p>
|
|
612
|
-
|
|
613
|
-
<div
|
|
614
|
-
style={{
|
|
615
|
-
display: "flex",
|
|
616
|
-
flexDirection: "column",
|
|
617
|
-
gap: 14,
|
|
618
|
-
}}
|
|
619
|
-
>
|
|
620
|
-
<BlockA expanded={a} />
|
|
621
|
-
<BlockB expanded={b} />
|
|
622
|
-
<BlockC expanded={c} />
|
|
623
|
-
</div>
|
|
624
|
-
</div>
|
|
625
|
-
</TransformComponent>
|
|
626
|
-
</div>
|
|
627
|
-
)}
|
|
628
|
-
</TransformWrapper>
|
|
629
|
-
</div>
|
|
630
|
-
);
|
|
631
|
-
};
|