react-zoom-pan-pinch 4.0.0 → 4.0.1
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 +3 -2
- 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,370 +0,0 @@
|
|
|
1
|
-
/* ── Shared doc-page styles ── */
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
max-width: 880px;
|
|
5
|
-
font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
6
|
-
-webkit-font-smoothing: antialiased;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/* ── Section title ── */
|
|
10
|
-
|
|
11
|
-
.sectionTitle {
|
|
12
|
-
font-size: 24px;
|
|
13
|
-
font-weight: 800;
|
|
14
|
-
color: #0f172a;
|
|
15
|
-
letter-spacing: -0.03em;
|
|
16
|
-
margin: 0 0 20px;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: 12px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.sectionTitleAccent {
|
|
23
|
-
display: inline-block;
|
|
24
|
-
width: 4px;
|
|
25
|
-
height: 24px;
|
|
26
|
-
border-radius: 2px;
|
|
27
|
-
background: linear-gradient(180deg, #6366f1, #a78bfa);
|
|
28
|
-
flex-shrink: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* ── Props table ── */
|
|
32
|
-
|
|
33
|
-
.columnHeader {
|
|
34
|
-
display: grid;
|
|
35
|
-
grid-template-columns: 180px 150px 90px 1fr;
|
|
36
|
-
gap: 0 20px;
|
|
37
|
-
padding: 0 16px 8px;
|
|
38
|
-
margin-top: 4px;
|
|
39
|
-
font-size: 10px;
|
|
40
|
-
font-weight: 800;
|
|
41
|
-
letter-spacing: 0.12em;
|
|
42
|
-
text-transform: uppercase;
|
|
43
|
-
color: #94a3b8;
|
|
44
|
-
border-bottom: 2px solid #e2e8f0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.groupHeader {
|
|
48
|
-
margin-top: 8px;
|
|
49
|
-
padding: 10px 16px;
|
|
50
|
-
background: linear-gradient(135deg, #4f46e5, #7c3aed);
|
|
51
|
-
display: flex;
|
|
52
|
-
align-items: center;
|
|
53
|
-
gap: 12px;
|
|
54
|
-
border-radius: 8px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.groupName {
|
|
58
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
59
|
-
font-size: 13px;
|
|
60
|
-
font-weight: 700;
|
|
61
|
-
color: #ffffff;
|
|
62
|
-
letter-spacing: 0.01em;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.groupCount {
|
|
66
|
-
font-size: 10px;
|
|
67
|
-
font-weight: 700;
|
|
68
|
-
color: rgba(255, 255, 255, 0.7);
|
|
69
|
-
background: rgba(255, 255, 255, 0.15);
|
|
70
|
-
padding: 2px 9px;
|
|
71
|
-
border-radius: 99px;
|
|
72
|
-
letter-spacing: 0.04em;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.propRow {
|
|
76
|
-
display: grid;
|
|
77
|
-
grid-template-columns: 180px 150px 90px 1fr;
|
|
78
|
-
gap: 0 20px;
|
|
79
|
-
padding: 8px 16px;
|
|
80
|
-
border-bottom: 1px solid #f1f5f9;
|
|
81
|
-
align-items: baseline;
|
|
82
|
-
transition: background 0.1s ease;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.propRowAlt {
|
|
86
|
-
composes: propRow;
|
|
87
|
-
background: #fafbfd;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.propRow:hover,
|
|
91
|
-
.propRowAlt:hover {
|
|
92
|
-
background: #f5f3ff;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.propRowNested {
|
|
96
|
-
composes: propRow;
|
|
97
|
-
padding-left: 32px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.propRowNestedAlt {
|
|
101
|
-
composes: propRowNested;
|
|
102
|
-
background: #fafbfd;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.propRowNested:hover,
|
|
106
|
-
.propRowNestedAlt:hover {
|
|
107
|
-
background: #f5f3ff;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.propName {
|
|
111
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
112
|
-
font-size: 12.5px;
|
|
113
|
-
font-weight: 600;
|
|
114
|
-
color: #0f172a;
|
|
115
|
-
word-break: break-word;
|
|
116
|
-
line-height: 1.5;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.nestDot {
|
|
120
|
-
color: #a78bfa;
|
|
121
|
-
margin-right: 1px;
|
|
122
|
-
font-weight: 400;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.typeText {
|
|
126
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
127
|
-
font-size: 12px;
|
|
128
|
-
font-weight: 500;
|
|
129
|
-
color: #6366f1;
|
|
130
|
-
line-height: 1.5;
|
|
131
|
-
word-break: break-all;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.defaultText {
|
|
135
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
136
|
-
font-size: 12px;
|
|
137
|
-
font-weight: 500;
|
|
138
|
-
color: #475569;
|
|
139
|
-
line-height: 1.5;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.defaultEmpty {
|
|
143
|
-
font-size: 12px;
|
|
144
|
-
color: #d1d5db;
|
|
145
|
-
user-select: none;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.description {
|
|
149
|
-
font-size: 12.5px;
|
|
150
|
-
line-height: 1.55;
|
|
151
|
-
color: #64748b;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* ── Handler cards ── */
|
|
155
|
-
|
|
156
|
-
.handlersIntro {
|
|
157
|
-
font-size: 14px;
|
|
158
|
-
line-height: 1.7;
|
|
159
|
-
color: #475569;
|
|
160
|
-
margin: 0 0 24px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.handlersIntroHook {
|
|
164
|
-
display: inline-block;
|
|
165
|
-
padding: 1px 7px;
|
|
166
|
-
border-radius: 4px;
|
|
167
|
-
background: #f1f5f9;
|
|
168
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
169
|
-
font-size: 12px;
|
|
170
|
-
font-weight: 600;
|
|
171
|
-
color: #6366f1;
|
|
172
|
-
vertical-align: baseline;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.handlerGrid {
|
|
176
|
-
display: flex;
|
|
177
|
-
flex-direction: column;
|
|
178
|
-
gap: 16px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.handlerCard {
|
|
182
|
-
border-radius: 12px;
|
|
183
|
-
background: #ffffff;
|
|
184
|
-
border: 1px solid #e2e8f0;
|
|
185
|
-
overflow: hidden;
|
|
186
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
|
187
|
-
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.handlerCard:hover {
|
|
191
|
-
box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1), 0 1px 4px rgba(0, 0, 0, 0.04);
|
|
192
|
-
transform: translateY(-1px);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.handlerCardHeader {
|
|
196
|
-
background: linear-gradient(135deg, #4f46e5, #7c3aed);
|
|
197
|
-
padding: 12px 20px;
|
|
198
|
-
display: flex;
|
|
199
|
-
align-items: center;
|
|
200
|
-
justify-content: space-between;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.handlerName {
|
|
204
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
205
|
-
font-size: 15px;
|
|
206
|
-
font-weight: 700;
|
|
207
|
-
color: #ffffff;
|
|
208
|
-
letter-spacing: -0.01em;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.handlerNameParams {
|
|
212
|
-
color: rgba(255, 255, 255, 0.55);
|
|
213
|
-
font-weight: 400;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.handlerBadge {
|
|
217
|
-
font-size: 9px;
|
|
218
|
-
font-weight: 700;
|
|
219
|
-
color: rgba(255, 255, 255, 0.6);
|
|
220
|
-
background: rgba(255, 255, 255, 0.12);
|
|
221
|
-
padding: 2px 8px;
|
|
222
|
-
border-radius: 99px;
|
|
223
|
-
text-transform: uppercase;
|
|
224
|
-
letter-spacing: 0.08em;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.handlerCardBody {
|
|
228
|
-
padding: 16px 20px;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.paramsTable {
|
|
232
|
-
width: 100%;
|
|
233
|
-
border-collapse: collapse;
|
|
234
|
-
margin-bottom: 12px;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.paramsTableHeader {
|
|
238
|
-
font-size: 10px;
|
|
239
|
-
font-weight: 700;
|
|
240
|
-
letter-spacing: 0.1em;
|
|
241
|
-
text-transform: uppercase;
|
|
242
|
-
color: #94a3b8;
|
|
243
|
-
text-align: left;
|
|
244
|
-
padding: 0 0 6px;
|
|
245
|
-
border-bottom: 1px solid #f1f5f9;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.paramsTableCell {
|
|
249
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
250
|
-
font-size: 12px;
|
|
251
|
-
font-weight: 500;
|
|
252
|
-
color: #334155;
|
|
253
|
-
padding: 5px 12px 5px 0;
|
|
254
|
-
line-height: 1.5;
|
|
255
|
-
border-bottom: 1px solid #f8fafc;
|
|
256
|
-
vertical-align: baseline;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.paramsTableCellName {
|
|
260
|
-
composes: paramsTableCell;
|
|
261
|
-
font-weight: 600;
|
|
262
|
-
color: #0f172a;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.paramsTableCellType {
|
|
266
|
-
composes: paramsTableCell;
|
|
267
|
-
color: #6366f1;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.paramsTableCellDefault {
|
|
271
|
-
composes: paramsTableCell;
|
|
272
|
-
color: #64748b;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.handlerDescription {
|
|
276
|
-
margin: 0 0 12px;
|
|
277
|
-
font-size: 13px;
|
|
278
|
-
line-height: 1.6;
|
|
279
|
-
color: #475569;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.signatureBlock {
|
|
283
|
-
padding: 10px 14px;
|
|
284
|
-
border-radius: 6px;
|
|
285
|
-
background: #f8fafc;
|
|
286
|
-
border: 1px solid #f1f5f9;
|
|
287
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
288
|
-
font-size: 11.5px;
|
|
289
|
-
font-weight: 400;
|
|
290
|
-
color: #94a3b8;
|
|
291
|
-
line-height: 1.6;
|
|
292
|
-
overflow-x: auto;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/* ── Reusable doc table ── */
|
|
296
|
-
|
|
297
|
-
.docTable {
|
|
298
|
-
width: 100%;
|
|
299
|
-
border-collapse: collapse;
|
|
300
|
-
font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
301
|
-
font-size: 13px;
|
|
302
|
-
border: 1px solid #e2e8f0;
|
|
303
|
-
border-radius: 8px;
|
|
304
|
-
overflow: hidden;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.docTableHeadRow {
|
|
308
|
-
background: #f8fafc;
|
|
309
|
-
border-bottom: 2px solid #e2e8f0;
|
|
310
|
-
text-align: left;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.docTableTh {
|
|
314
|
-
padding: 10px 16px;
|
|
315
|
-
color: #64748b;
|
|
316
|
-
font-size: 11px;
|
|
317
|
-
font-weight: 700;
|
|
318
|
-
letter-spacing: 0.06em;
|
|
319
|
-
text-transform: uppercase;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.docTableRow {
|
|
323
|
-
border-bottom: 1px solid #f1f5f9;
|
|
324
|
-
transition: background 0.1s ease;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.docTableRowAlt {
|
|
328
|
-
composes: docTableRow;
|
|
329
|
-
background: #fafbfd;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.docTableRow:hover,
|
|
333
|
-
.docTableRowAlt:hover {
|
|
334
|
-
background: #f5f3ff;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.docTableCellName {
|
|
338
|
-
padding: 10px 16px;
|
|
339
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
340
|
-
font-size: 12.5px;
|
|
341
|
-
font-weight: 600;
|
|
342
|
-
color: #0f172a;
|
|
343
|
-
vertical-align: baseline;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.docTableCellType {
|
|
347
|
-
padding: 10px 16px;
|
|
348
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
349
|
-
font-size: 12px;
|
|
350
|
-
font-weight: 500;
|
|
351
|
-
color: #6366f1;
|
|
352
|
-
vertical-align: baseline;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
.docTableCellDefault {
|
|
356
|
-
padding: 10px 16px;
|
|
357
|
-
font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
|
|
358
|
-
font-size: 12px;
|
|
359
|
-
font-weight: 500;
|
|
360
|
-
color: #475569;
|
|
361
|
-
vertical-align: baseline;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.docTableCellText {
|
|
365
|
-
padding: 10px 16px;
|
|
366
|
-
font-size: 12.5px;
|
|
367
|
-
color: #475569;
|
|
368
|
-
line-height: 1.55;
|
|
369
|
-
vertical-align: baseline;
|
|
370
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { ReactZoomPanPinchHandlers } from "../../models/context.model";
|
|
4
|
-
|
|
5
|
-
export type ControlsFnOptionsType = {
|
|
6
|
-
name: React.ReactNode;
|
|
7
|
-
type: string[];
|
|
8
|
-
parameters: string[];
|
|
9
|
-
description: string;
|
|
10
|
-
isObjectRow?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type ComponentProps = Record<
|
|
14
|
-
keyof ReactZoomPanPinchHandlers,
|
|
15
|
-
| Omit<ControlsFnOptionsType, "name" | "isObjectRow">
|
|
16
|
-
| Record<string, Omit<ControlsFnOptionsType, "name" | "isObjectRow">>
|
|
17
|
-
>;
|
|
18
|
-
|
|
19
|
-
export const handlersTable: ComponentProps = {
|
|
20
|
-
zoomIn: {
|
|
21
|
-
type: ["function(step, animationTime, animationName)"],
|
|
22
|
-
parameters: [
|
|
23
|
-
"step: number = 0.5",
|
|
24
|
-
"animationTime: number = 300",
|
|
25
|
-
"animationName: string = easeOut",
|
|
26
|
-
],
|
|
27
|
-
description: "Function used for zoom in button",
|
|
28
|
-
},
|
|
29
|
-
zoomOut: {
|
|
30
|
-
type: ["function(step, animationTime, animationName)"],
|
|
31
|
-
parameters: [
|
|
32
|
-
"step: number = 0.5",
|
|
33
|
-
"animationTime: number = 300",
|
|
34
|
-
"animationName: string = easeOut",
|
|
35
|
-
],
|
|
36
|
-
description: "Function used for zoom out button",
|
|
37
|
-
},
|
|
38
|
-
setTransform: {
|
|
39
|
-
type: ["function(x, y, scale, animationTime, animationName)"],
|
|
40
|
-
parameters: [
|
|
41
|
-
"x: number",
|
|
42
|
-
"y: number",
|
|
43
|
-
"scale: number",
|
|
44
|
-
"animationTime: number = 300",
|
|
45
|
-
"animationName: string = easeOut",
|
|
46
|
-
],
|
|
47
|
-
description: "Function used for custom transformation animation",
|
|
48
|
-
},
|
|
49
|
-
resetTransform: {
|
|
50
|
-
type: ["function(animationTime, animationName)"],
|
|
51
|
-
parameters: [
|
|
52
|
-
"animationTime: number = 300",
|
|
53
|
-
"animationName: string = easeOut",
|
|
54
|
-
],
|
|
55
|
-
description: "Function used for reset button",
|
|
56
|
-
},
|
|
57
|
-
centerView: {
|
|
58
|
-
type: ["function(scale, animationTime, animationName)"],
|
|
59
|
-
parameters: [
|
|
60
|
-
"scale: number = undefined",
|
|
61
|
-
"animationTime: number = 300",
|
|
62
|
-
"animationName: string = easeOut",
|
|
63
|
-
],
|
|
64
|
-
description: "Function used for centering the content component",
|
|
65
|
-
},
|
|
66
|
-
zoomToElement: {
|
|
67
|
-
type: ["function(node, customZoom, animationTime, animationName)"],
|
|
68
|
-
parameters: [
|
|
69
|
-
"node: HTMLElement | string",
|
|
70
|
-
"customScale: number = undefined",
|
|
71
|
-
"animationTime: number = 300",
|
|
72
|
-
"animationName: string = easeOut",
|
|
73
|
-
],
|
|
74
|
-
description:
|
|
75
|
-
"This function make a transition for certain node provided to the function(as node element or it's id string). It allows only to zoom elements with offsetWidth and offsetHeight properties - since SVG's doesn't have those, it is impossible to perform it on such elements.",
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const getHandlersTable = (): ControlsFnOptionsType[] => {
|
|
80
|
-
return (Object.keys(handlersTable) as (keyof ComponentProps)[]).reduce<
|
|
81
|
-
ControlsFnOptionsType[]
|
|
82
|
-
>((acc, key) => {
|
|
83
|
-
const entry = handlersTable[key];
|
|
84
|
-
if ("type" in entry && Array.isArray(entry.type)) {
|
|
85
|
-
acc.push({
|
|
86
|
-
...(entry as Omit<ControlsFnOptionsType, "name" | "isObjectRow">),
|
|
87
|
-
name: key,
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
const nested = entry as Record<
|
|
91
|
-
string,
|
|
92
|
-
Omit<ControlsFnOptionsType, "name" | "isObjectRow">
|
|
93
|
-
>;
|
|
94
|
-
Object.keys(nested).forEach((prop) => {
|
|
95
|
-
acc.push({
|
|
96
|
-
...nested[prop],
|
|
97
|
-
isObjectRow: key === prop,
|
|
98
|
-
name:
|
|
99
|
-
key === prop ? (
|
|
100
|
-
<b>{prop}</b>
|
|
101
|
-
) : (
|
|
102
|
-
<>
|
|
103
|
-
{key}.<b>{prop}</b>
|
|
104
|
-
</>
|
|
105
|
-
),
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return acc;
|
|
110
|
-
}, []);
|
|
111
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
|
2
|
-
import { componentProps, wrapperProps } from "./props.tsx";
|
|
3
|
-
import { PropTable } from "./PropTable.tsx";
|
|
4
|
-
|
|
5
|
-
<Meta title="Docs/Props" />
|
|
6
|
-
|
|
7
|
-
<PropTable rows={componentProps} title="TransformComponent Props" />
|
|
8
|
-
|
|
9
|
-
<br />
|
|
10
|
-
|
|
11
|
-
<PropTable rows={wrapperProps} title="TransformWrapper Props" />
|