react-zoom-pan-pinch 3.2.0 → 3.4.0

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.
Files changed (186) hide show
  1. package/dist/index.cjs.js +54 -33
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +6 -0
  4. package/dist/index.esm.js +54 -33
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +4 -1
  7. package/.eslintignore +0 -6
  8. package/.github/CODEOWNERS +0 -36
  9. package/.github/FUNDING.yml +0 -13
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  12. package/.github/workflows/docs.yml +0 -34
  13. package/.github/workflows/release.yml +0 -46
  14. package/.github/workflows/tests.yml +0 -42
  15. package/.prettierrc +0 -10
  16. package/.releaserc.json +0 -63
  17. package/.storybook/main.js +0 -23
  18. package/.storybook/preview-head.html +0 -5
  19. package/.storybook/preview.js +0 -11
  20. package/.storybook/theme-overrides.css +0 -49
  21. package/CHANGELOG.md +0 -26
  22. package/Code_of_Conduct.md +0 -61
  23. package/Contributing.md +0 -236
  24. package/__tests__/features/props.spec.tsx +0 -11
  25. package/__tests__/features/rendering.spec.tsx +0 -36
  26. package/__tests__/shared/render.shared.tsx +0 -41
  27. package/__tests__/utils/controls.utils.tsx +0 -25
  28. package/__tests__/utils/example.tsx +0 -81
  29. package/commitlint.config.js +0 -1
  30. package/dist/__tests__/features/props.spec.d.ts +0 -1
  31. package/dist/__tests__/features/rendering.spec.d.ts +0 -1
  32. package/dist/__tests__/shared/render.shared.d.ts +0 -11
  33. package/dist/__tests__/utils/controls.utils.d.ts +0 -3
  34. package/dist/__tests__/utils/example.d.ts +0 -6
  35. package/dist/src/components/index.d.ts +0 -4
  36. package/dist/src/components/keep-scale/keep-scale.d.ts +0 -2
  37. package/dist/src/components/mini-map/mini-map.d.ts +0 -8
  38. package/dist/src/components/mini-map/use-resize.hook.d.ts +0 -8
  39. package/dist/src/components/transform-component/transform-component.d.ts +0 -12
  40. package/dist/src/components/transform-wrapper/transform-wrapper.d.ts +0 -5
  41. package/dist/src/constants/state.constants.d.ts +0 -3
  42. package/dist/src/core/animations/animations.constants.d.ts +0 -16
  43. package/dist/src/core/animations/animations.utils.d.ts +0 -4
  44. package/dist/src/core/bounds/bounds.types.d.ts +0 -8
  45. package/dist/src/core/bounds/bounds.utils.d.ts +0 -17
  46. package/dist/src/core/double-click/double-click.logic.d.ts +0 -5
  47. package/dist/src/core/handlers/handlers.logic.d.ts +0 -8
  48. package/dist/src/core/handlers/handlers.utils.d.ts +0 -14
  49. package/dist/src/core/instance.core.d.ts +0 -77
  50. package/dist/src/core/pan/panning.logic.d.ts +0 -5
  51. package/dist/src/core/pan/panning.utils.d.ts +0 -10
  52. package/dist/src/core/pan/velocity.logic.d.ts +0 -5
  53. package/dist/src/core/pan/velocity.utils.d.ts +0 -5
  54. package/dist/src/core/pinch/pinch.logic.d.ts +0 -4
  55. package/dist/src/core/pinch/pinch.utils.d.ts +0 -6
  56. package/dist/src/core/wheel/wheel.logic.d.ts +0 -4
  57. package/dist/src/core/wheel/wheel.utils.d.ts +0 -7
  58. package/dist/src/core/zoom/zoom.logic.d.ts +0 -3
  59. package/dist/src/core/zoom/zoom.utils.d.ts +0 -3
  60. package/dist/src/hooks/index.d.ts +0 -4
  61. package/dist/src/hooks/use-controls.d.ts +0 -2
  62. package/dist/src/hooks/use-transform-context.d.ts +0 -1
  63. package/dist/src/hooks/use-transform-effect.d.ts +0 -2
  64. package/dist/src/hooks/use-transform-init.d.ts +0 -2
  65. package/dist/src/index.d.ts +0 -5
  66. package/dist/src/models/calculations.model.d.ts +0 -25
  67. package/dist/src/models/context.model.d.ts +0 -124
  68. package/dist/src/models/helpers.model.d.ts +0 -5
  69. package/dist/src/models/index.d.ts +0 -3
  70. package/dist/src/stories/docs/handlers.d.ts +0 -12
  71. package/dist/src/stories/docs/props.d.ts +0 -14
  72. package/dist/src/stories/examples/content-rerendering/example.d.ts +0 -2
  73. package/dist/src/stories/examples/image-responsive/example.d.ts +0 -2
  74. package/dist/src/stories/examples/keep-scale/example.d.ts +0 -2
  75. package/dist/src/stories/examples/mini-map/example.d.ts +0 -1
  76. package/dist/src/stories/examples/stress/example.d.ts +0 -2
  77. package/dist/src/stories/examples/svg-zoom-to-element/example.d.ts +0 -2
  78. package/dist/src/stories/examples/zoom-to-element/example.d.ts +0 -2
  79. package/dist/src/stories/types/args.types.d.ts +0 -280
  80. package/dist/src/stories/utils/args.utils.d.ts +0 -3
  81. package/dist/src/stories/utils/code.utils.d.ts +0 -6
  82. package/dist/src/stories/utils/controls.utils.d.ts +0 -3
  83. package/dist/src/stories/utils/index.d.ts +0 -3
  84. package/dist/src/utils/calculations.utils.d.ts +0 -11
  85. package/dist/src/utils/callback.utils.d.ts +0 -2
  86. package/dist/src/utils/context.utils.d.ts +0 -4
  87. package/dist/src/utils/event.utils.d.ts +0 -1
  88. package/dist/src/utils/helpers.utils.d.ts +0 -2
  89. package/dist/src/utils/index.d.ts +0 -8
  90. package/dist/src/utils/ref.utils.d.ts +0 -2
  91. package/dist/src/utils/state.utils.d.ts +0 -3
  92. package/dist/src/utils/styles.utils.d.ts +0 -4
  93. package/jest.config.ts +0 -45
  94. package/rollup.config.js +0 -51
  95. package/src/.eslintrc.json +0 -90
  96. package/src/components/index.ts +0 -4
  97. package/src/components/keep-scale/keep-scale.tsx +0 -28
  98. package/src/components/mini-map/mini-map.tsx +0 -188
  99. package/src/components/mini-map/use-resize.hook.ts +0 -69
  100. package/src/components/transform-component/transform-component.module.css +0 -30
  101. package/src/components/transform-component/transform-component.tsx +0 -58
  102. package/src/components/transform-wrapper/transform-wrapper.tsx +0 -42
  103. package/src/constants/state.constants.ts +0 -74
  104. package/src/core/animations/animations.constants.ts +0 -78
  105. package/src/core/animations/animations.utils.ts +0 -114
  106. package/src/core/bounds/bounds.types.ts +0 -8
  107. package/src/core/bounds/bounds.utils.ts +0 -198
  108. package/src/core/double-click/double-click.logic.ts +0 -116
  109. package/src/core/handlers/handlers.logic.ts +0 -115
  110. package/src/core/handlers/handlers.utils.ts +0 -195
  111. package/src/core/instance.core.ts +0 -499
  112. package/src/core/pan/panning.logic.ts +0 -100
  113. package/src/core/pan/panning.utils.ts +0 -196
  114. package/src/core/pan/velocity.logic.ts +0 -149
  115. package/src/core/pan/velocity.utils.ts +0 -79
  116. package/src/core/pinch/pinch.logic.ts +0 -81
  117. package/src/core/pinch/pinch.utils.ts +0 -88
  118. package/src/core/wheel/wheel.logic.ts +0 -121
  119. package/src/core/wheel/wheel.utils.ts +0 -122
  120. package/src/core/zoom/zoom.logic.ts +0 -69
  121. package/src/core/zoom/zoom.utils.ts +0 -58
  122. package/src/hooks/index.ts +0 -4
  123. package/src/hooks/use-controls.tsx +0 -9
  124. package/src/hooks/use-transform-context.tsx +0 -13
  125. package/src/hooks/use-transform-effect.tsx +0 -22
  126. package/src/hooks/use-transform-init.tsx +0 -27
  127. package/src/index.ts +0 -6
  128. package/src/models/calculations.model.ts +0 -26
  129. package/src/models/context.model.ts +0 -196
  130. package/src/models/helpers.model.ts +0 -15
  131. package/src/models/index.ts +0 -3
  132. package/src/react-app-env.d.ts +0 -1
  133. package/src/stories/assets/big-image.jpeg +0 -0
  134. package/src/stories/assets/map.jpg +0 -0
  135. package/src/stories/assets/medium-image.jpg +0 -0
  136. package/src/stories/assets/pin.svg +0 -1
  137. package/src/stories/assets/small-image.jpg +0 -0
  138. package/src/stories/assets/svg-example.svg +0 -14
  139. package/src/stories/docs/Introduction.stories.mdx +0 -174
  140. package/src/stories/docs/handlers.stories.mdx +0 -48
  141. package/src/stories/docs/handlers.tsx +0 -107
  142. package/src/stories/docs/props.stories.mdx +0 -92
  143. package/src/stories/docs/props.tsx +0 -508
  144. package/src/stories/examples/content/content.stories.mdx +0 -121
  145. package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -45
  146. package/src/stories/examples/content-rerendering/example.tsx +0 -73
  147. package/src/stories/examples/controls/controls.stories.mdx +0 -71
  148. package/src/stories/examples/image-big/image-big.stories.mdx +0 -43
  149. package/src/stories/examples/image-medium/image-medium.stories.mdx +0 -41
  150. package/src/stories/examples/image-responsive/example.tsx +0 -103
  151. package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -32
  152. package/src/stories/examples/image-small/image-small.stories.mdx +0 -41
  153. package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -46
  154. package/src/stories/examples/keep-scale/example.tsx +0 -92
  155. package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -45
  156. package/src/stories/examples/mini-map/example.tsx +0 -54
  157. package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -33
  158. package/src/stories/examples/stress/example.tsx +0 -23
  159. package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
  160. package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
  161. package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -57
  162. package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
  163. package/src/stories/examples/zoom-to-element/example.tsx +0 -94
  164. package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -28
  165. package/src/stories/hooks/use-controls.stories.mdx +0 -24
  166. package/src/stories/hooks/use-transform-context.stories.mdx +0 -15
  167. package/src/stories/hooks/use-transform-effect.stories.mdx +0 -29
  168. package/src/stories/hooks/use-transform-init.stories.mdx +0 -25
  169. package/src/stories/types/args.types.ts +0 -211
  170. package/src/stories/utils/args.utils.ts +0 -34
  171. package/src/stories/utils/code.utils.tsx +0 -24
  172. package/src/stories/utils/controls.utils.tsx +0 -43
  173. package/src/stories/utils/index.ts +0 -3
  174. package/src/stories/utils/styles.module.css +0 -34
  175. package/src/styles.css +0 -8
  176. package/src/typings.d.ts +0 -10
  177. package/src/utils/calculations.utils.ts +0 -16
  178. package/src/utils/callback.utils.ts +0 -11
  179. package/src/utils/context.utils.ts +0 -48
  180. package/src/utils/event.utils.ts +0 -22
  181. package/src/utils/helpers.utils.ts +0 -27
  182. package/src/utils/index.ts +0 -8
  183. package/src/utils/ref.utils.ts +0 -16
  184. package/src/utils/state.utils.ts +0 -40
  185. package/src/utils/styles.utils.ts +0 -44
  186. package/tsconfig.json +0 -33
@@ -1,77 +0,0 @@
1
- import { BoundsType, LibrarySetup, PositionType, VelocityType, AnimationType, ReactZoomPanPinchProps, ReactZoomPanPinchState, ReactZoomPanPinchRef } from "../models";
2
- type StartCoordsType = {
3
- x: number;
4
- y: number;
5
- } | null;
6
- export declare class ZoomPanPinch {
7
- props: ReactZoomPanPinchProps;
8
- mounted: boolean;
9
- transformState: ReactZoomPanPinchState;
10
- setup: LibrarySetup;
11
- observer?: ResizeObserver;
12
- onChangeCallbacks: Set<(ctx: ReactZoomPanPinchRef) => void>;
13
- onInitCallbacks: Set<(ctx: ReactZoomPanPinchRef) => void>;
14
- wrapperComponent: HTMLDivElement | null;
15
- contentComponent: HTMLDivElement | null;
16
- isInitialized: boolean;
17
- bounds: BoundsType | null;
18
- previousWheelEvent: WheelEvent | null;
19
- wheelStopEventTimer: ReturnType<typeof setTimeout> | null;
20
- wheelAnimationTimer: ReturnType<typeof setTimeout> | null;
21
- isPanning: boolean;
22
- startCoords: StartCoordsType;
23
- lastTouch: number | null;
24
- distance: null | number;
25
- lastDistance: null | number;
26
- pinchStartDistance: null | number;
27
- pinchStartScale: null | number;
28
- pinchMidpoint: null | PositionType;
29
- doubleClickStopEventTimer: ReturnType<typeof setTimeout> | null;
30
- velocity: VelocityType | null;
31
- velocityTime: number | null;
32
- lastMousePosition: PositionType | null;
33
- animate: boolean;
34
- animation: AnimationType | null;
35
- maxBounds: BoundsType | null;
36
- pressedKeys: {
37
- [key: string]: boolean;
38
- };
39
- constructor(props: ReactZoomPanPinchProps);
40
- mount: () => void;
41
- unmount: () => void;
42
- update: (newProps: ReactZoomPanPinchProps) => void;
43
- initializeWindowEvents: () => void;
44
- cleanupWindowEvents: () => void;
45
- handleInitializeWrapperEvents: (wrapper: HTMLDivElement) => void;
46
- handleInitialize: (contentComponent: HTMLDivElement) => void;
47
- onWheelZoom: (event: WheelEvent) => void;
48
- onPanningStart: (event: MouseEvent) => void;
49
- onPanning: (event: MouseEvent) => void;
50
- onPanningStop: (event: MouseEvent | TouchEvent) => void;
51
- onPinchStart: (event: TouchEvent) => void;
52
- onPinch: (event: TouchEvent) => void;
53
- onPinchStop: (event: TouchEvent) => void;
54
- onTouchPanningStart: (event: TouchEvent) => void;
55
- onTouchPanning: (event: TouchEvent) => void;
56
- onTouchPanningStop: (event: TouchEvent) => void;
57
- onDoubleClick: (event: MouseEvent | TouchEvent) => void;
58
- clearPanning: (event: MouseEvent) => void;
59
- setKeyPressed: (e: KeyboardEvent) => void;
60
- setKeyUnPressed: (e: KeyboardEvent) => void;
61
- isPressingKeys: (keys: string[]) => boolean;
62
- setTransformState: (scale: number, positionX: number, positionY: number) => void;
63
- setCenter: () => void;
64
- handleTransformStyles: (x: number, y: number, scale: number) => string;
65
- applyTransformation: () => void;
66
- getContext: () => ReactZoomPanPinchRef;
67
- /**
68
- * Hooks
69
- */
70
- onChange: (callback: (ref: ReactZoomPanPinchRef) => void) => () => void;
71
- onInit: (callback: (ref: ReactZoomPanPinchRef) => void) => () => void;
72
- /**
73
- * Initialization
74
- */
75
- init: (wrapperComponent: HTMLDivElement, contentComponent: HTMLDivElement) => void;
76
- }
77
- export {};
@@ -1,5 +0,0 @@
1
- import { ReactZoomPanPinchContext } from "../../models/context.model";
2
- export declare function handlePanningStart(contextInstance: ReactZoomPanPinchContext, event: MouseEvent | TouchEvent): void;
3
- export declare function handleAlignToBounds(contextInstance: ReactZoomPanPinchContext): void;
4
- export declare function handlePanning(contextInstance: ReactZoomPanPinchContext, clientX: number, clientY: number): void;
5
- export declare function handlePanningEnd(contextInstance: ReactZoomPanPinchContext): void;
@@ -1,10 +0,0 @@
1
- import { PositionType, ReactZoomPanPinchContext, ReactZoomPanPinchState } from "../../models";
2
- export declare const isPanningStartAllowed: (contextInstance: ReactZoomPanPinchContext, event: MouseEvent | TouchEvent) => boolean;
3
- export declare const isPanningAllowed: (contextInstance: ReactZoomPanPinchContext) => boolean;
4
- export declare const handlePanningSetup: (contextInstance: ReactZoomPanPinchContext, event: MouseEvent) => void;
5
- export declare const handleTouchPanningSetup: (contextInstance: ReactZoomPanPinchContext, event: TouchEvent) => void;
6
- export declare function handlePanToBounds(contextInstance: ReactZoomPanPinchContext): Omit<ReactZoomPanPinchState, "previousScale"> | undefined;
7
- export declare function handlePaddingAnimation(contextInstance: ReactZoomPanPinchContext, positionX: number, positionY: number): void;
8
- export declare function handleNewPosition(contextInstance: ReactZoomPanPinchContext, newPositionX: number, newPositionY: number, paddingValueX: number, paddingValueY: number): void;
9
- export declare const getPanningClientPosition: (contextInstance: ReactZoomPanPinchContext, clientX: number, clientY: number) => PositionType;
10
- export declare const getPaddingValue: (contextInstance: ReactZoomPanPinchContext, size: number) => number;
@@ -1,5 +0,0 @@
1
- import { PositionType } from "../../models";
2
- import { ReactZoomPanPinchContext } from "../../models/context.model";
3
- export declare function getSizeMultiplier(wrapperComponent: HTMLDivElement, equalToMove: boolean): number;
4
- export declare function handleCalculateVelocity(contextInstance: ReactZoomPanPinchContext, position: PositionType): void;
5
- export declare function handleVelocityPanning(contextInstance: ReactZoomPanPinchContext): void;
@@ -1,5 +0,0 @@
1
- import { ReactZoomPanPinchContext } from "../../models/context.model";
2
- export declare const isVelocityCalculationAllowed: (contextInstance: ReactZoomPanPinchContext) => boolean;
3
- export declare const isVelocityAllowed: (contextInstance: ReactZoomPanPinchContext) => boolean;
4
- export declare function getVelocityMoveTime(contextInstance: ReactZoomPanPinchContext, velocity: number): number;
5
- export declare function getVelocityPosition(newPosition: number, startPosition: number, currentPosition: number, isLocked: boolean, limitToBounds: boolean, minPosition: number, maxPosition: number, minTarget: number, maxTarget: number, step: number): number;
@@ -1,4 +0,0 @@
1
- import { ReactZoomPanPinchContext } from "../../models";
2
- export declare const handlePinchStart: (contextInstance: ReactZoomPanPinchContext, event: TouchEvent) => void;
3
- export declare const handlePinchZoom: (contextInstance: ReactZoomPanPinchContext, event: TouchEvent) => void;
4
- export declare const handlePinchStop: (contextInstance: ReactZoomPanPinchContext) => void;
@@ -1,6 +0,0 @@
1
- import { PositionType, ReactZoomPanPinchContext } from "../../models";
2
- export declare const isPinchStartAllowed: (contextInstance: ReactZoomPanPinchContext, event: TouchEvent) => boolean;
3
- export declare const isPinchAllowed: (contextInstance: ReactZoomPanPinchContext) => boolean;
4
- export declare const calculateTouchMidPoint: (event: TouchEvent, scale: number, contentComponent: HTMLDivElement) => PositionType;
5
- export declare const getTouchDistance: (event: TouchEvent) => number;
6
- export declare const calculatePinchZoom: (contextInstance: ReactZoomPanPinchContext, currentDistance: number) => number;
@@ -1,4 +0,0 @@
1
- import { ReactZoomPanPinchContext } from "../../models";
2
- export declare const handleWheelStart: (contextInstance: ReactZoomPanPinchContext, event: WheelEvent) => void;
3
- export declare const handleWheelZoom: (contextInstance: ReactZoomPanPinchContext, event: WheelEvent) => void;
4
- export declare const handleWheelStop: (contextInstance: ReactZoomPanPinchContext, event: WheelEvent) => void;
@@ -1,7 +0,0 @@
1
- import { ReactZoomPanPinchContext, PositionType } from "../../models";
2
- export declare const isWheelAllowed: (contextInstance: ReactZoomPanPinchContext, event: WheelEvent) => boolean;
3
- export declare const getDeltaY: (event?: WheelEvent) => 1 | -1 | 0;
4
- export declare function getDelta(event: WheelEvent, customDelta?: number | null): number;
5
- export declare function getMousePosition(event: WheelEvent | MouseEvent | TouchEvent, contentComponent: HTMLDivElement, scale: number): PositionType;
6
- export declare const handleCalculateWheelZoom: (contextInstance: ReactZoomPanPinchContext, delta: number, step: number, disable: boolean, getTarget?: boolean) => number;
7
- export declare const handleWheelZoomStop: (contextInstance: ReactZoomPanPinchContext, event: WheelEvent) => boolean;
@@ -1,3 +0,0 @@
1
- import { ReactZoomPanPinchContext, ReactZoomPanPinchState } from "../../models";
2
- export declare function handleZoomToPoint(contextInstance: ReactZoomPanPinchContext, scale: number, mouseX: number, mouseY: number): Omit<ReactZoomPanPinchState, "previousScale"> | undefined;
3
- export declare function handleAlignToScaleBounds(contextInstance: ReactZoomPanPinchContext, mousePositionX?: number, mousePositionY?: number): void;
@@ -1,3 +0,0 @@
1
- import { BoundsType, PositionType, ReactZoomPanPinchContext } from "../../models";
2
- export declare function handleCalculateZoomPositions(contextInstance: ReactZoomPanPinchContext, mouseX: number, mouseY: number, newScale: number, bounds: BoundsType, limitToBounds: boolean): PositionType;
3
- export declare function checkZoomBounds(zoom: number, minScale: number, maxScale: number, zoomPadding: number, enablePadding: boolean): number;
@@ -1,4 +0,0 @@
1
- export * from "./use-controls";
2
- export * from "./use-transform-init";
3
- export * from "./use-transform-effect";
4
- export * from "./use-transform-context";
@@ -1,2 +0,0 @@
1
- import { ReactZoomPanPinchContentRef } from "models";
2
- export declare const useControls: () => ReactZoomPanPinchContentRef;
@@ -1 +0,0 @@
1
- export declare const useTransformContext: () => import("../core/instance.core").ZoomPanPinch;
@@ -1,2 +0,0 @@
1
- import { ReactZoomPanPinchContextState } from "../models";
2
- export declare const useTransformEffect: (callback: (ref: ReactZoomPanPinchContextState) => void | (() => void)) => void;
@@ -1,2 +0,0 @@
1
- import { ReactZoomPanPinchContextState } from "../models";
2
- export declare const useTransformInit: (callback: (ref: ReactZoomPanPinchContextState) => void | (() => void)) => void;
@@ -1,5 +0,0 @@
1
- export * from "./hooks";
2
- export * from "./components";
3
- export * from "./utils/styles.utils";
4
- export * from "./models/context.model";
5
- export * from "./models/calculations.model";
@@ -1,25 +0,0 @@
1
- export type SizeType = {
2
- width: number;
3
- height: number;
4
- };
5
- export type PositionType = {
6
- x: number;
7
- y: number;
8
- };
9
- export type StateType = {
10
- scale: number;
11
- positionX: number;
12
- positionY: number;
13
- };
14
- export type VelocityType = {
15
- velocityX: number;
16
- velocityY: number;
17
- total: number;
18
- };
19
- export type BoundsType = {
20
- minPositionX: number;
21
- maxPositionX: number;
22
- minPositionY: number;
23
- maxPositionY: number;
24
- };
25
- export type AnimationType = () => void | number;
@@ -1,124 +0,0 @@
1
- import React from "react";
2
- import { animations } from "../core/animations/animations.constants";
3
- import { DeepNonNullable } from "./helpers.model";
4
- import { zoomIn, zoomToElement, centerView, resetTransform, setTransform, zoomOut } from "../core/handlers/handlers.logic";
5
- import { ZoomPanPinch } from "../core/instance.core";
6
- export type ReactZoomPanPinchContext = typeof ZoomPanPinch.prototype;
7
- export type ReactZoomPanPinchContextState = {
8
- instance: ReactZoomPanPinchContext;
9
- state: ReactZoomPanPinchState;
10
- };
11
- export type ReactZoomPanPinchContentRef = {
12
- instance: ReactZoomPanPinchContext;
13
- } & ReactZoomPanPinchHandlers;
14
- export type ReactZoomPanPinchRef = ReactZoomPanPinchContextState & ReactZoomPanPinchHandlers;
15
- export type ReactZoomPanPinchState = {
16
- previousScale: number;
17
- scale: number;
18
- positionX: number;
19
- positionY: number;
20
- };
21
- export type ReactZoomPanPinchHandlers = {
22
- zoomIn: ReturnType<typeof zoomIn>;
23
- zoomOut: ReturnType<typeof zoomOut>;
24
- setTransform: ReturnType<typeof setTransform>;
25
- resetTransform: ReturnType<typeof resetTransform>;
26
- centerView: ReturnType<typeof centerView>;
27
- zoomToElement: ReturnType<typeof zoomToElement>;
28
- };
29
- export type ReactZoomPanPinchRefProps = {
30
- setRef: (context: ReactZoomPanPinchRef) => void;
31
- } & Omit<ReactZoomPanPinchProps, "ref">;
32
- export type ReactZoomPanPinchProps = {
33
- children?: React.ReactNode | ((ref: ReactZoomPanPinchContentRef) => React.ReactNode);
34
- ref?: React.Ref<ReactZoomPanPinchRef>;
35
- initialScale?: number;
36
- initialPositionX?: number;
37
- initialPositionY?: number;
38
- disabled?: boolean;
39
- minPositionX?: null | number;
40
- maxPositionX?: null | number;
41
- minPositionY?: null | number;
42
- maxPositionY?: null | number;
43
- minScale?: number;
44
- maxScale?: number;
45
- limitToBounds?: boolean;
46
- centerZoomedOut?: boolean;
47
- centerOnInit?: boolean;
48
- disablePadding?: boolean;
49
- customTransform?: (x: number, y: number, scale: number) => string;
50
- smooth?: boolean;
51
- wheel?: {
52
- step?: number;
53
- smoothStep?: number;
54
- disabled?: boolean;
55
- wheelDisabled?: boolean;
56
- touchPadDisabled?: boolean;
57
- activationKeys?: string[];
58
- excluded?: string[];
59
- };
60
- panning?: {
61
- disabled?: boolean;
62
- velocityDisabled?: boolean;
63
- lockAxisX?: boolean;
64
- lockAxisY?: boolean;
65
- activationKeys?: string[];
66
- excluded?: string[];
67
- };
68
- pinch?: {
69
- step?: number;
70
- disabled?: boolean;
71
- excluded?: string[];
72
- };
73
- doubleClick?: {
74
- disabled?: boolean;
75
- step?: number;
76
- mode?: "zoomIn" | "zoomOut" | "reset";
77
- animationTime?: number;
78
- animationType?: keyof typeof animations;
79
- excluded?: string[];
80
- };
81
- zoomAnimation?: {
82
- disabled?: boolean;
83
- size?: number;
84
- animationTime?: number;
85
- animationType?: keyof typeof animations;
86
- };
87
- alignmentAnimation?: {
88
- disabled?: boolean;
89
- sizeX?: number;
90
- sizeY?: number;
91
- animationTime?: number;
92
- velocityAlignmentTime?: number;
93
- animationType?: keyof typeof animations;
94
- };
95
- velocityAnimation?: {
96
- disabled?: boolean;
97
- sensitivity?: number;
98
- animationTime?: number;
99
- animationType?: keyof typeof animations;
100
- equalToMove?: boolean;
101
- };
102
- onWheelStart?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void;
103
- onWheel?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void;
104
- onWheelStop?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void;
105
- onPanningStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
106
- onPanning?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
107
- onPanningStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
108
- onPinchingStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
109
- onPinching?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
110
- onPinchingStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
111
- onZoomStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
112
- onZoom?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
113
- onZoomStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
114
- onTransformed?: (ref: ReactZoomPanPinchRef, state: {
115
- scale: number;
116
- positionX: number;
117
- positionY: number;
118
- }) => void;
119
- onInit?: (ref: ReactZoomPanPinchRef) => void;
120
- };
121
- export type ReactZoomPanPinchComponentHelpers = {
122
- setComponents: (wrapper: HTMLDivElement, content: HTMLDivElement) => void;
123
- };
124
- export type LibrarySetup = Pick<ReactZoomPanPinchProps, "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY"> & DeepNonNullable<Omit<ReactZoomPanPinchProps, "ref" | "initialScale" | "initialPositionX" | "initialPositionY" | "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY" | "children" | "defaultPositionX" | "defaultPositionY" | "defaultScale" | "wrapperClass" | "contentClass" | "onWheelStart" | "onWheel" | "onWheelStop" | "onPanningStart" | "onPanning" | "onPanningStop" | "onPinchingStart" | "onPinching" | "onPinchingStop" | "onZoomStart" | "onZoom" | "onZoomStop" | "onTransformed" | "onInit" | "customTransform">>;
@@ -1,5 +0,0 @@
1
- export type DeepNonNullable<T> = T extends (...args: any[]) => any ? T : T extends any[] ? DeepNonNullableArray<T[number]> : T extends object ? DeepNonNullableObject<T> : T;
2
- export type DeepNonNullableArray<T> = Array<DeepNonNullable<NonNullable<T>>>;
3
- export type DeepNonNullableObject<T> = {
4
- [P in keyof T]-?: DeepNonNullable<NonNullable<T[P]>>;
5
- };
@@ -1,3 +0,0 @@
1
- export * from "./context.model";
2
- export * from "./helpers.model";
3
- export * from "./calculations.model";
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import { ReactZoomPanPinchHandlers } from "../../models/context.model";
3
- export type ControlsFnOptionsType = {
4
- name: React.ReactNode;
5
- type: string[];
6
- parameters: string[];
7
- description: string;
8
- isObjectRow?: boolean;
9
- };
10
- export type ComponentProps = Record<keyof ReactZoomPanPinchHandlers, Omit<ControlsFnOptionsType, "name" | "isObjectRow"> | Record<string, Omit<ControlsFnOptionsType, "name" | "isObjectRow">>>;
11
- export declare const handlersTable: ComponentProps;
12
- export declare const getHandlersTable: () => ControlsFnOptionsType[];
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import { ReactZoomPanPinchProps } from "models";
3
- export type ControlsOptionsType = {
4
- name: React.ReactNode;
5
- type: string[];
6
- defaultValue: string;
7
- description: string;
8
- isObjectRow?: boolean;
9
- };
10
- export type ComponentProps = Record<keyof Omit<ReactZoomPanPinchProps, "children">, Omit<ControlsOptionsType, "name" | "isObjectRow"> | Record<string, Omit<ControlsOptionsType, "name" | "isObjectRow">>>;
11
- export declare const componentPropsTable: Record<string, Omit<ControlsOptionsType, "name">>;
12
- export declare const wrapperPropsTable: ComponentProps;
13
- export declare const componentProps: ControlsOptionsType[];
14
- export declare const wrapperProps: ControlsOptionsType[];
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;
@@ -1 +0,0 @@
1
- export declare const Template: (args: any) => JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Example: React.FC<any>;