react-zoom-pan-pinch 3.3.0 → 3.4.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/dist/index.cjs.js +46 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +46 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -1
- package/.eslintignore +0 -6
- package/.github/CODEOWNERS +0 -36
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/docs.yml +0 -34
- package/.github/workflows/release.yml +0 -46
- package/.github/workflows/tests.yml +0 -42
- package/.prettierrc +0 -10
- package/.releaserc.json +0 -63
- package/.storybook/main.js +0 -23
- package/.storybook/preview-head.html +0 -5
- package/.storybook/preview.js +0 -11
- package/.storybook/theme-overrides.css +0 -49
- package/CHANGELOG.md +0 -26
- package/Code_of_Conduct.md +0 -61
- package/Contributing.md +0 -236
- package/__tests__/features/props.spec.tsx +0 -11
- package/__tests__/features/rendering.spec.tsx +0 -36
- package/__tests__/shared/render.shared.tsx +0 -41
- package/__tests__/utils/controls.utils.tsx +0 -25
- package/__tests__/utils/example.tsx +0 -81
- package/commitlint.config.js +0 -1
- package/dist/__tests__/features/props.spec.d.ts +0 -1
- package/dist/__tests__/features/rendering.spec.d.ts +0 -1
- package/dist/__tests__/shared/render.shared.d.ts +0 -11
- package/dist/__tests__/utils/controls.utils.d.ts +0 -3
- package/dist/__tests__/utils/example.d.ts +0 -6
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/components/keep-scale/keep-scale.d.ts +0 -2
- package/dist/src/components/mini-map/mini-map.d.ts +0 -8
- package/dist/src/components/mini-map/use-resize.hook.d.ts +0 -8
- package/dist/src/components/transform-component/transform-component.d.ts +0 -12
- package/dist/src/components/transform-wrapper/transform-wrapper.d.ts +0 -5
- package/dist/src/constants/state.constants.d.ts +0 -3
- package/dist/src/core/animations/animations.constants.d.ts +0 -16
- package/dist/src/core/animations/animations.utils.d.ts +0 -4
- package/dist/src/core/bounds/bounds.types.d.ts +0 -8
- package/dist/src/core/bounds/bounds.utils.d.ts +0 -17
- package/dist/src/core/double-click/double-click.logic.d.ts +0 -5
- package/dist/src/core/handlers/handlers.logic.d.ts +0 -8
- package/dist/src/core/handlers/handlers.utils.d.ts +0 -14
- package/dist/src/core/instance.core.d.ts +0 -77
- package/dist/src/core/pan/panning.logic.d.ts +0 -5
- package/dist/src/core/pan/panning.utils.d.ts +0 -10
- package/dist/src/core/pan/velocity.logic.d.ts +0 -5
- package/dist/src/core/pan/velocity.utils.d.ts +0 -5
- package/dist/src/core/pinch/pinch.logic.d.ts +0 -4
- package/dist/src/core/pinch/pinch.utils.d.ts +0 -6
- package/dist/src/core/wheel/wheel.logic.d.ts +0 -4
- package/dist/src/core/wheel/wheel.utils.d.ts +0 -7
- package/dist/src/core/zoom/zoom.logic.d.ts +0 -3
- package/dist/src/core/zoom/zoom.utils.d.ts +0 -3
- package/dist/src/hooks/index.d.ts +0 -4
- package/dist/src/hooks/use-controls.d.ts +0 -2
- package/dist/src/hooks/use-transform-context.d.ts +0 -1
- package/dist/src/hooks/use-transform-effect.d.ts +0 -2
- package/dist/src/hooks/use-transform-init.d.ts +0 -2
- package/dist/src/index.d.ts +0 -5
- package/dist/src/models/calculations.model.d.ts +0 -25
- package/dist/src/models/context.model.d.ts +0 -127
- package/dist/src/models/helpers.model.d.ts +0 -5
- package/dist/src/models/index.d.ts +0 -3
- package/dist/src/stories/docs/handlers.d.ts +0 -12
- package/dist/src/stories/docs/props.d.ts +0 -14
- package/dist/src/stories/examples/content-rerendering/example.d.ts +0 -2
- package/dist/src/stories/examples/image-responsive/example.d.ts +0 -2
- package/dist/src/stories/examples/keep-scale/example.d.ts +0 -2
- package/dist/src/stories/examples/mini-map/example.d.ts +0 -1
- package/dist/src/stories/examples/stress/example.d.ts +0 -2
- package/dist/src/stories/examples/svg-zoom-to-element/example.d.ts +0 -2
- package/dist/src/stories/examples/zoom-to-element/example.d.ts +0 -2
- package/dist/src/stories/types/args.types.d.ts +0 -280
- package/dist/src/stories/utils/args.utils.d.ts +0 -3
- package/dist/src/stories/utils/code.utils.d.ts +0 -6
- package/dist/src/stories/utils/controls.utils.d.ts +0 -3
- package/dist/src/stories/utils/index.d.ts +0 -3
- package/dist/src/utils/calculations.utils.d.ts +0 -11
- package/dist/src/utils/callback.utils.d.ts +0 -2
- package/dist/src/utils/context.utils.d.ts +0 -4
- package/dist/src/utils/event.utils.d.ts +0 -1
- package/dist/src/utils/helpers.utils.d.ts +0 -2
- package/dist/src/utils/index.d.ts +0 -8
- package/dist/src/utils/ref.utils.d.ts +0 -2
- package/dist/src/utils/state.utils.d.ts +0 -3
- package/dist/src/utils/styles.utils.d.ts +0 -4
- package/jest.config.ts +0 -45
- package/rollup.config.js +0 -51
- package/src/.eslintrc.json +0 -90
- package/src/components/index.ts +0 -4
- package/src/components/keep-scale/keep-scale.tsx +0 -28
- package/src/components/mini-map/mini-map.tsx +0 -188
- package/src/components/mini-map/use-resize.hook.ts +0 -69
- package/src/components/transform-component/transform-component.module.css +0 -30
- package/src/components/transform-component/transform-component.tsx +0 -61
- package/src/components/transform-wrapper/transform-wrapper.tsx +0 -39
- package/src/constants/state.constants.ts +0 -77
- package/src/core/animations/animations.constants.ts +0 -78
- package/src/core/animations/animations.utils.ts +0 -114
- package/src/core/bounds/bounds.types.ts +0 -8
- package/src/core/bounds/bounds.utils.ts +0 -187
- package/src/core/double-click/double-click.logic.ts +0 -116
- package/src/core/handlers/handlers.logic.ts +0 -115
- package/src/core/handlers/handlers.utils.ts +0 -195
- package/src/core/instance.core.ts +0 -503
- package/src/core/pan/panning.logic.ts +0 -100
- package/src/core/pan/panning.utils.ts +0 -196
- package/src/core/pan/velocity.logic.ts +0 -149
- package/src/core/pan/velocity.utils.ts +0 -79
- package/src/core/pinch/pinch.logic.ts +0 -81
- package/src/core/pinch/pinch.utils.ts +0 -88
- package/src/core/wheel/wheel.logic.ts +0 -121
- package/src/core/wheel/wheel.utils.ts +0 -122
- package/src/core/zoom/zoom.logic.ts +0 -69
- package/src/core/zoom/zoom.utils.ts +0 -58
- package/src/hooks/index.ts +0 -4
- package/src/hooks/use-controls.tsx +0 -9
- package/src/hooks/use-transform-context.tsx +0 -13
- package/src/hooks/use-transform-effect.tsx +0 -22
- package/src/hooks/use-transform-init.tsx +0 -27
- package/src/index.ts +0 -6
- package/src/models/calculations.model.ts +0 -26
- package/src/models/context.model.ts +0 -199
- package/src/models/helpers.model.ts +0 -15
- package/src/models/index.ts +0 -3
- package/src/react-app-env.d.ts +0 -1
- 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/Introduction.stories.mdx +0 -174
- package/src/stories/docs/handlers.stories.mdx +0 -48
- package/src/stories/docs/handlers.tsx +0 -107
- package/src/stories/docs/props.stories.mdx +0 -92
- package/src/stories/docs/props.tsx +0 -526
- package/src/stories/examples/content/content.stories.mdx +0 -121
- package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -45
- package/src/stories/examples/content-rerendering/example.tsx +0 -73
- package/src/stories/examples/controls/controls.stories.mdx +0 -71
- package/src/stories/examples/image-big/image-big.stories.mdx +0 -43
- package/src/stories/examples/image-medium/image-medium.stories.mdx +0 -41
- package/src/stories/examples/image-responsive/example.tsx +0 -103
- package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -32
- package/src/stories/examples/image-small/image-small.stories.mdx +0 -41
- package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -46
- package/src/stories/examples/keep-scale/example.tsx +0 -92
- package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -45
- package/src/stories/examples/mini-map/example.tsx +0 -54
- package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -33
- package/src/stories/examples/stress/example.tsx +0 -23
- 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 -57
- package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
- package/src/stories/examples/zoom-to-element/example.tsx +0 -94
- package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -28
- package/src/stories/hooks/use-controls.stories.mdx +0 -24
- package/src/stories/hooks/use-transform-context.stories.mdx +0 -15
- package/src/stories/hooks/use-transform-effect.stories.mdx +0 -29
- package/src/stories/hooks/use-transform-init.stories.mdx +0 -25
- package/src/stories/types/args.types.ts +0 -211
- package/src/stories/utils/args.utils.ts +0 -34
- package/src/stories/utils/code.utils.tsx +0 -24
- package/src/stories/utils/controls.utils.tsx +0 -43
- package/src/stories/utils/index.ts +0 -3
- package/src/stories/utils/styles.module.css +0 -34
- package/src/styles.css +0 -8
- package/src/typings.d.ts +0 -10
- package/src/utils/calculations.utils.ts +0 -16
- package/src/utils/callback.utils.ts +0 -11
- package/src/utils/context.utils.ts +0 -48
- package/src/utils/event.utils.ts +0 -22
- package/src/utils/helpers.utils.ts +0 -27
- package/src/utils/index.ts +0 -8
- package/src/utils/ref.utils.ts +0 -16
- package/src/utils/state.utils.ts +0 -40
- package/src/utils/styles.utils.ts +0 -44
- package/tsconfig.json +0 -33
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
export declare const argsTypes: {
|
|
2
|
-
wheel: {
|
|
3
|
-
table: {
|
|
4
|
-
disable: boolean;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
"wheel.step": {
|
|
8
|
-
defaultValue: number;
|
|
9
|
-
control: {
|
|
10
|
-
type: string;
|
|
11
|
-
min: number;
|
|
12
|
-
};
|
|
13
|
-
table: {
|
|
14
|
-
defaultValue: {
|
|
15
|
-
summary: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
"wheel.smoothStep": {
|
|
20
|
-
defaultValue: number;
|
|
21
|
-
control: {
|
|
22
|
-
type: string;
|
|
23
|
-
min: number;
|
|
24
|
-
};
|
|
25
|
-
table: {
|
|
26
|
-
defaultValue: {
|
|
27
|
-
summary: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
"wheel.disabled": {
|
|
32
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
33
|
-
control: {
|
|
34
|
-
type: string;
|
|
35
|
-
};
|
|
36
|
-
table: {
|
|
37
|
-
defaultValue: {
|
|
38
|
-
summary: string;
|
|
39
|
-
};
|
|
40
|
-
type: {
|
|
41
|
-
summary: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
"wheel.wheelDisabled": {
|
|
46
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
47
|
-
control: {
|
|
48
|
-
type: string;
|
|
49
|
-
};
|
|
50
|
-
table: {
|
|
51
|
-
defaultValue: {
|
|
52
|
-
summary: string;
|
|
53
|
-
};
|
|
54
|
-
type: {
|
|
55
|
-
summary: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
"wheel.touchPadDisabled": {
|
|
60
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
61
|
-
control: {
|
|
62
|
-
type: string;
|
|
63
|
-
};
|
|
64
|
-
table: {
|
|
65
|
-
defaultValue: {
|
|
66
|
-
summary: string;
|
|
67
|
-
};
|
|
68
|
-
type: {
|
|
69
|
-
summary: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
"wheel.activationKeys": {
|
|
74
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
75
|
-
control: {
|
|
76
|
-
type: string;
|
|
77
|
-
};
|
|
78
|
-
table: {
|
|
79
|
-
defaultValue: {
|
|
80
|
-
summary: string;
|
|
81
|
-
};
|
|
82
|
-
type: {
|
|
83
|
-
summary: string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
"wheel.excluded": {
|
|
88
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
89
|
-
control: {
|
|
90
|
-
type: string;
|
|
91
|
-
};
|
|
92
|
-
table: {
|
|
93
|
-
defaultValue: {
|
|
94
|
-
summary: string;
|
|
95
|
-
};
|
|
96
|
-
type: {
|
|
97
|
-
summary: string;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
panning: {
|
|
102
|
-
table: {
|
|
103
|
-
disable: boolean;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
"panning.disabled": {
|
|
107
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
108
|
-
control: {
|
|
109
|
-
type: string;
|
|
110
|
-
};
|
|
111
|
-
table: {
|
|
112
|
-
defaultValue: {
|
|
113
|
-
summary: string;
|
|
114
|
-
};
|
|
115
|
-
type: {
|
|
116
|
-
summary: string;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
"panning.velocityDisabled": {
|
|
121
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
122
|
-
control: {
|
|
123
|
-
type: string;
|
|
124
|
-
};
|
|
125
|
-
table: {
|
|
126
|
-
defaultValue: {
|
|
127
|
-
summary: string;
|
|
128
|
-
};
|
|
129
|
-
type: {
|
|
130
|
-
summary: string;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
"panning.lockAxisX": {
|
|
135
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
136
|
-
control: {
|
|
137
|
-
type: string;
|
|
138
|
-
};
|
|
139
|
-
table: {
|
|
140
|
-
defaultValue: {
|
|
141
|
-
summary: string;
|
|
142
|
-
};
|
|
143
|
-
type: {
|
|
144
|
-
summary: string;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
"panning.lockAxisY": {
|
|
149
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
150
|
-
control: {
|
|
151
|
-
type: string;
|
|
152
|
-
};
|
|
153
|
-
table: {
|
|
154
|
-
defaultValue: {
|
|
155
|
-
summary: string;
|
|
156
|
-
};
|
|
157
|
-
type: {
|
|
158
|
-
summary: string;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
"panning.activationKeys": {
|
|
163
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
164
|
-
control: {
|
|
165
|
-
type: string;
|
|
166
|
-
};
|
|
167
|
-
table: {
|
|
168
|
-
defaultValue: {
|
|
169
|
-
summary: string;
|
|
170
|
-
};
|
|
171
|
-
type: {
|
|
172
|
-
summary: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
"panning.excluded": {
|
|
177
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
178
|
-
control: {
|
|
179
|
-
type: string;
|
|
180
|
-
};
|
|
181
|
-
table: {
|
|
182
|
-
defaultValue: {
|
|
183
|
-
summary: string;
|
|
184
|
-
};
|
|
185
|
-
type: {
|
|
186
|
-
summary: string;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
pinch: {
|
|
191
|
-
table: {
|
|
192
|
-
disable: boolean;
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
"pinch.step": {
|
|
196
|
-
defaultValue: number;
|
|
197
|
-
control: {
|
|
198
|
-
type: string;
|
|
199
|
-
min: number;
|
|
200
|
-
};
|
|
201
|
-
table: {
|
|
202
|
-
defaultValue: {
|
|
203
|
-
summary: string;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
"pinch.disabled": {
|
|
208
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
209
|
-
control: {
|
|
210
|
-
type: string;
|
|
211
|
-
};
|
|
212
|
-
table: {
|
|
213
|
-
defaultValue: {
|
|
214
|
-
summary: string;
|
|
215
|
-
};
|
|
216
|
-
type: {
|
|
217
|
-
summary: string;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
"pinch.excluded": {
|
|
222
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
223
|
-
control: {
|
|
224
|
-
type: string;
|
|
225
|
-
};
|
|
226
|
-
table: {
|
|
227
|
-
defaultValue: {
|
|
228
|
-
summary: string;
|
|
229
|
-
};
|
|
230
|
-
type: {
|
|
231
|
-
summary: string;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
doubleClick: {
|
|
236
|
-
table: {
|
|
237
|
-
disable: boolean;
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
"doubleClick.step": {
|
|
241
|
-
defaultValue: number;
|
|
242
|
-
control: {
|
|
243
|
-
type: string;
|
|
244
|
-
min: number;
|
|
245
|
-
};
|
|
246
|
-
table: {
|
|
247
|
-
defaultValue: {
|
|
248
|
-
summary: string;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
"doubleClick.disabled": {
|
|
253
|
-
defaultValue: NonNullable<boolean | undefined>;
|
|
254
|
-
control: {
|
|
255
|
-
type: string;
|
|
256
|
-
};
|
|
257
|
-
table: {
|
|
258
|
-
defaultValue: {
|
|
259
|
-
summary: string;
|
|
260
|
-
};
|
|
261
|
-
type: {
|
|
262
|
-
summary: string;
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
"doubleClick.excluded": {
|
|
267
|
-
defaultValue: import("../../models").DeepNonNullableArray<string>;
|
|
268
|
-
control: {
|
|
269
|
-
type: string;
|
|
270
|
-
};
|
|
271
|
-
table: {
|
|
272
|
-
defaultValue: {
|
|
273
|
-
summary: string;
|
|
274
|
-
};
|
|
275
|
-
type: {
|
|
276
|
-
summary: string;
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
};
|
|
280
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rounds number to given decimal
|
|
3
|
-
* eg. roundNumber(2.34343, 1) => 2.3
|
|
4
|
-
*/
|
|
5
|
-
export declare const roundNumber: (num: number, decimal: number) => number;
|
|
6
|
-
/**
|
|
7
|
-
* Checks if value is number, if not it returns default value
|
|
8
|
-
* 1# eg. checkIsNumber(2, 30) => 2
|
|
9
|
-
* 2# eg. checkIsNumber(null, 30) => 30
|
|
10
|
-
*/
|
|
11
|
-
export declare const checkIsNumber: (num: any, defaultValue: number) => number;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ReactZoomPanPinchContentRef, ReactZoomPanPinchContext, ReactZoomPanPinchContextState, ReactZoomPanPinchRef } from "../models/context.model";
|
|
2
|
-
export declare const getControls: (contextInstance: ReactZoomPanPinchContext) => ReactZoomPanPinchContentRef;
|
|
3
|
-
export declare const getState: (contextInstance: ReactZoomPanPinchContext) => ReactZoomPanPinchContextState;
|
|
4
|
-
export declare const getContext: (contextInstance: ReactZoomPanPinchContext) => ReactZoomPanPinchRef;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function makePassiveEventOption(): any;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./calculations.utils";
|
|
2
|
-
export * from "./callback.utils";
|
|
3
|
-
export * from "./context.utils";
|
|
4
|
-
export * from "./event.utils";
|
|
5
|
-
export * from "./helpers.utils";
|
|
6
|
-
export * from "./state.utils";
|
|
7
|
-
export * from "./styles.utils";
|
|
8
|
-
export * from "./ref.utils";
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { LibrarySetup, ReactZoomPanPinchProps, ReactZoomPanPinchState } from "../models/context.model";
|
|
2
|
-
export declare const createState: (props: ReactZoomPanPinchProps) => ReactZoomPanPinchState;
|
|
3
|
-
export declare const createSetup: (props: ReactZoomPanPinchProps) => LibrarySetup;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { StateType } from "models";
|
|
2
|
-
export declare const getTransformStyles: (x: number, y: number, scale: number) => string;
|
|
3
|
-
export declare const getMatrixTransformStyles: (x: number, y: number, scale: number) => string;
|
|
4
|
-
export declare const getCenterPosition: (scale: number, wrapperComponent: HTMLDivElement, contentComponent: HTMLDivElement) => StateType;
|
package/jest.config.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Config } from "@jest/types";
|
|
2
|
-
|
|
3
|
-
const config: Config.InitialOptions = {
|
|
4
|
-
cacheDirectory: "../../node_modules/.cache/rhf/jest",
|
|
5
|
-
testEnvironment: "jsdom",
|
|
6
|
-
preset: "ts-jest",
|
|
7
|
-
testRegex: [".spec.ts"],
|
|
8
|
-
roots: ["<rootDir>/node_modules", "<rootDir>/src", "<rootDir>/__tests__"],
|
|
9
|
-
coverageProvider: "v8",
|
|
10
|
-
coverageReporters: [
|
|
11
|
-
["lcov", { projectRoot: "../.." }],
|
|
12
|
-
"clover",
|
|
13
|
-
"json",
|
|
14
|
-
"text",
|
|
15
|
-
],
|
|
16
|
-
collectCoverageFrom: ["<rootDir>/src/**/*.ts", "<rootDir>/src/**/*.tsx"],
|
|
17
|
-
coveragePathIgnorePatterns: [
|
|
18
|
-
".spec",
|
|
19
|
-
"test",
|
|
20
|
-
"tests",
|
|
21
|
-
"types",
|
|
22
|
-
"constants",
|
|
23
|
-
"index.ts",
|
|
24
|
-
".d.ts",
|
|
25
|
-
],
|
|
26
|
-
moduleDirectories: ["node_modules", "src"],
|
|
27
|
-
transform: {
|
|
28
|
-
"^.+\\.tsx?$": [
|
|
29
|
-
"ts-jest",
|
|
30
|
-
{
|
|
31
|
-
tsconfig: "./tsconfig.json",
|
|
32
|
-
isolatedModules: true,
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
moduleNameMapper: {
|
|
37
|
-
"\\.(css|less|scss|sss|styl)$": "<rootDir>/node_modules/jest-css-modules",
|
|
38
|
-
},
|
|
39
|
-
watchPlugins: [
|
|
40
|
-
"jest-watch-typeahead/filename",
|
|
41
|
-
"jest-watch-typeahead/testname",
|
|
42
|
-
],
|
|
43
|
-
setupFilesAfterEnv: ["jest-extended/all"],
|
|
44
|
-
};
|
|
45
|
-
export default config;
|
package/rollup.config.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import babel from "@rollup/plugin-babel";
|
|
2
|
-
import external from "rollup-plugin-peer-deps-external";
|
|
3
|
-
import del from "rollup-plugin-delete";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import postcss from "rollup-plugin-postcss";
|
|
6
|
-
import dts from "rollup-plugin-dts";
|
|
7
|
-
import pkg from "./package.json";
|
|
8
|
-
|
|
9
|
-
export default [
|
|
10
|
-
{
|
|
11
|
-
input: pkg.source,
|
|
12
|
-
output: [
|
|
13
|
-
{
|
|
14
|
-
file: pkg.main,
|
|
15
|
-
format: "cjs",
|
|
16
|
-
exports: "named",
|
|
17
|
-
sourcemap: true,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
file: pkg.module,
|
|
21
|
-
format: "es",
|
|
22
|
-
exports: "named",
|
|
23
|
-
sourcemap: true,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
plugins: [
|
|
27
|
-
external(),
|
|
28
|
-
babel({
|
|
29
|
-
exclude: "node_modules/**",
|
|
30
|
-
}),
|
|
31
|
-
del({ targets: ["dist/*"] }),
|
|
32
|
-
typescript({ sourceMap: false }),
|
|
33
|
-
postcss({
|
|
34
|
-
modules: true,
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
|
-
external: Object.keys(pkg.peerDependencies || {}),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
input: pkg.source,
|
|
41
|
-
output: [{ file: pkg.types, format: "es" }],
|
|
42
|
-
plugins: [
|
|
43
|
-
external(),
|
|
44
|
-
dts({
|
|
45
|
-
compilerOptions: {
|
|
46
|
-
baseUrl: "./src",
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
];
|
package/src/.eslintrc.json
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"ecmaVersion": 11,
|
|
6
|
-
"ecmaFeatures": {
|
|
7
|
-
"jsx": true
|
|
8
|
-
},
|
|
9
|
-
"project": "./tsconfig.json"
|
|
10
|
-
},
|
|
11
|
-
"settings": {
|
|
12
|
-
"import/resolver": {
|
|
13
|
-
"node": {
|
|
14
|
-
"moduleDirectory": ["node_modules", "src/"]
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"react": {
|
|
18
|
-
"pragma": "React",
|
|
19
|
-
"version": "detect"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"plugins": ["react", "react-hooks"],
|
|
23
|
-
"extends": [
|
|
24
|
-
"eslint:recommended",
|
|
25
|
-
"plugin:react-hooks/recommended",
|
|
26
|
-
"prettier",
|
|
27
|
-
"plugin:react/recommended",
|
|
28
|
-
"plugin:@typescript-eslint/recommended",
|
|
29
|
-
"plugin:import/typescript",
|
|
30
|
-
"airbnb",
|
|
31
|
-
"airbnb-typescript",
|
|
32
|
-
"plugin:prettier/recommended"
|
|
33
|
-
],
|
|
34
|
-
"rules": {
|
|
35
|
-
"react-hooks/rules-of-hooks": "error",
|
|
36
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
37
|
-
"react/prop-types": "off",
|
|
38
|
-
"react/jsx-uses-react": "error",
|
|
39
|
-
"react/jsx-uses-vars": "error",
|
|
40
|
-
"no-console": ["error", { "allow": ["warn", "error"] }],
|
|
41
|
-
"react/react-in-jsx-scope": "off",
|
|
42
|
-
"react/display-name": 0,
|
|
43
|
-
"import/no-extraneous-dependencies": 0,
|
|
44
|
-
"import/prefer-default-export": 0,
|
|
45
|
-
"import/no-cycle": 0,
|
|
46
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
47
|
-
"@typescript-eslint/lines-between-class-members": "off",
|
|
48
|
-
"prettier/prettier": ["error"],
|
|
49
|
-
"consistent-return": 0,
|
|
50
|
-
"@typescript-eslint/no-throw-literal": 0,
|
|
51
|
-
"no-underscore-dangle": 0,
|
|
52
|
-
"react/jsx-props-no-spreading": 0,
|
|
53
|
-
"react/function-component-definition": 0,
|
|
54
|
-
"testing-library/render-result-naming-convention": "off",
|
|
55
|
-
"import/order": [
|
|
56
|
-
"error",
|
|
57
|
-
{
|
|
58
|
-
"groups": [
|
|
59
|
-
["builtin", "external"],
|
|
60
|
-
["internal", "parent", "sibling", "index"]
|
|
61
|
-
],
|
|
62
|
-
"pathGroups": [
|
|
63
|
-
{ "pattern": "assets/**", "group": "sibling", "position": "after" },
|
|
64
|
-
{
|
|
65
|
-
"pattern": "@external/**/*.css",
|
|
66
|
-
"group": "sibling",
|
|
67
|
-
"position": "after"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"pattern": "*.css",
|
|
71
|
-
"group": "index",
|
|
72
|
-
"patternOptions": { "matchBase": true },
|
|
73
|
-
"position": "after"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"warnOnUnassignedImports": true,
|
|
77
|
-
"pathGroupsExcludedImportTypes": ["css"],
|
|
78
|
-
"newlines-between": "always"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
"overrides": [
|
|
83
|
-
{
|
|
84
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
85
|
-
"rules": {
|
|
86
|
-
"testing-library/render-result-naming-convention": "off"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
}
|
package/src/components/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useRef } from "react";
|
|
2
|
-
|
|
3
|
-
import { mergeRefs } from "utils/ref.utils";
|
|
4
|
-
import { Context } from "../transform-wrapper/transform-wrapper";
|
|
5
|
-
|
|
6
|
-
export const KeepScale = React.forwardRef<
|
|
7
|
-
HTMLDivElement,
|
|
8
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
9
|
-
>((props, ref) => {
|
|
10
|
-
const localRef = useRef<HTMLDivElement>(null);
|
|
11
|
-
const instance = useContext(Context);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
return instance.onChange((ctx) => {
|
|
15
|
-
if (localRef.current) {
|
|
16
|
-
const positionX = 0;
|
|
17
|
-
const positionY = 0;
|
|
18
|
-
localRef.current.style.transform = instance.handleTransformStyles(
|
|
19
|
-
positionX,
|
|
20
|
-
positionY,
|
|
21
|
-
1 / ctx.instance.transformState.scale,
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}, [instance]);
|
|
26
|
-
|
|
27
|
-
return <div {...props} ref={mergeRefs([localRef, ref])} />;
|
|
28
|
-
});
|